view src/de/mpiwg/dwinter/fulltextSearchServer/Utils/ConfigurationManager.java @ 0:db87c1b7eb6d

initial
author dwinter
date Wed, 03 Nov 2010 12:18:46 +0100
parents
children
line wrap: on
line source

package de.mpiwg.dwinter.fulltextSearchServer.Utils;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import javax.servlet.ServletContext;

import org.restlet.Context;
import org.restlet.engine.component.ChildContext;
import org.restlet.resource.Directory;

public class ConfigurationManager {

	public static Properties getConfig()  {
		ChildContext context = (ChildContext)Context.getCurrent();
		String lineIndex = context.getParameters().getFirstValue("de.mpwig.dwinter.fulltextSearchServer.lineIndex");
		String docIndex = context.getParameters().getFirstValue("de.mpwig.dwinter.fulltextSearchServer.docIndex");
		String digiviewBasicString = context.getParameters().getFirstValue("de.mpwig.dwinter.digilibTools.digiviewBasicString");
		String ticketIdentifier = lineIndex+"|"+docIndex;
		//File sf = new File(context,"/WEB-INF/serverSettings.properties");
		//InputStream ps = ConfigurationManager.class.getResourceAsStream("/de/mpiwg/dwinter/fulltextSearchServer/DefaultSettings/serverSettings.properties");
		//InputStream ps= new FileInputStream(sf);
		
		Properties defaultProperties = new Properties();
		//defaultProperties.load(ps);
		defaultProperties.setProperty("lineIndex", lineIndex);
		defaultProperties.setProperty("docIndex", docIndex);
		digiviewBasicString=digiviewBasicString.replace("&", "&");
		defaultProperties.setProperty("digiviewBasicString", digiviewBasicString);
		defaultProperties.setProperty("ticketIdentifier", ticketIdentifier);
		
		
		return defaultProperties;
	}

}