<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%
/*******************************************************************************
 * Copyright (c) 2007 IBM Corporation.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
%>      
<%@page import="org.eclipse.cosmos.internal.dr.ps.common.Configuration"%>
<%@page import="java.net.URL"%>
<%@page import="org.eclipse.core.runtime.FileLocator"%>


<jsp:useBean id="template" scope="request" class="org.eclipse.cosmos.dr.internal.web.ui.viewer.WorkBenchTemplate" > 
<jsp:setProperty name="template" property="*"/>
</jsp:useBean> 
<% 
template.setLocale(request.getLocale());
//check installation
Configuration configuration = new Configuration();
//InputStream propFile = getServletContext().getResourceAsStream(getServletContext().getInitParameter("COSMOSUI_CONFIGURATION_PATH")+"/configuration.properties");
URL propFile = getServletContext().getResource("/META-INF");
String propFileStr= FileLocator.toFileURL(propFile).getPath().substring(1)+"../COSMOSUI/config/configuration.properties";

boolean exists = configuration.load(propFileStr);
	
template.initialize(configuration);

if (request.getParameter("page") != null)
	template.setPage(request.getParameter("page"));

%>
<%
	String pageDirect = "install/index.jsp"; 
	if (exists)
		pageDirect = template.getPage()+"/index.jsp";
		
%>
<jsp:include page="<%=pageDirect %>" flush="true"/>