2006/unicorn/src/org/w3c/unicorn Framework.java,1.1.2.15,1.1.2.16

Update of /sources/public/2006/unicorn/src/org/w3c/unicorn
In directory hutz:/tmp/cvs-serv32542/src/org/w3c/unicorn

Modified Files:
      Tag: dev2
	Framework.java 
Log Message:
removed template caching which is already supported by velocity

Index: Framework.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/Attic/Framework.java,v
retrieving revision 1.1.2.15
retrieving revision 1.1.2.16
diff -u -d -r1.1.2.15 -r1.1.2.16
--- Framework.java	20 Aug 2009 14:42:12 -0000	1.1.2.15
+++ Framework.java	24 Aug 2009 09:16:10 -0000	1.1.2.16
@@ -27,12 +27,9 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.log4j.PropertyConfigurator;
-import org.apache.velocity.Template;
 import org.apache.velocity.VelocityContext;
 import org.apache.velocity.app.Velocity;
 import org.apache.velocity.app.VelocityEngine;
-import org.apache.velocity.exception.ParseErrorException;
-import org.apache.velocity.exception.ResourceNotFoundException;
 import org.w3c.unicorn.contract.Observer;
 import org.w3c.unicorn.contract.WADLUnmarshaller;
 import org.w3c.unicorn.contract.WADLUnmarshallerXPath;
@@ -67,7 +64,6 @@
 	/**
 	 * Data structure for the tasks
 	 */
-	//public static Map<String, Task> mapOfTask;
 	public static Tasklist mapOfTask;
 
 	/**
@@ -99,7 +95,6 @@
 	private static Hashtable<String, Properties> languageProperties;
 	private static Hashtable<String, String> languages;
 	private static VelocityEngine velocityEngine;
-	private static Hashtable<String, Template> velocityTemplates;
 	private static String[] configFiles = {
 		"extensions.properties",
 		"responseParsers.properties",
@@ -111,7 +106,6 @@
 		languageContexts = new Hashtable<String, VelocityContext>();
 		languageProperties = new Hashtable<String, Properties>();
 		languages = new Hashtable<String, String>();
-		velocityTemplates = new Hashtable<String, Template>();
 		mapOfObserver = new LinkedHashMap<String, Observer>();
 		mapOfReponseParser = new LinkedHashMap<String, ResponseParser>();
 	}
@@ -525,8 +519,9 @@
 		// Creating velocity engine
 		velocityEngine = new VelocityEngine();
 		Properties bProperties = Property.getProps("velocity.properties");
-		bProperties.put(Velocity.FILE_RESOURCE_LOADER_PATH, Property
-				.get("PATH_TO_TEMPLATES"));
+		bProperties.put(Velocity.FILE_RESOURCE_LOADER_PATH,
+				Property.get("PATH_TO_TEMPLATES") + "," + 
+				Property.get("PATH_TO_TEMPLATES")+"includes/");
 		logger.debug("> Initializing velocity engine with FILE_RESOURCE_LOADER_PATH: " + Property.get("PATH_TO_TEMPLATES"));
 		try {
 			velocityEngine.init(bProperties);
@@ -536,24 +531,6 @@
 			return;
 		}
 		
-		// TODO load all templates in the template directory
-		// Loading velocity templates
-		try {
-			velocityTemplates.put("index", velocityEngine.getTemplate("index.vm", "UTF-8"));
-			velocityTemplates.put("parameters", velocityEngine.getTemplate("includes/parameters.vm", "UTF-8"));
-		} catch (ResourceNotFoundException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		} catch (ParseErrorException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		} catch (Exception e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-		logger.debug("> "+velocityTemplates.size()+" velocity template(s) loaded");
-		// TODO add debug information on the loaded templates
-		
 		logger.info("OK - Velocity successfully initialized");
 		
 		TemplateHelper.init();
@@ -585,9 +562,6 @@
 	public static VelocityEngine getVelocityEngine() {
 		return velocityEngine;
 	}
-	public static Template getTemplate(String name) {
-		return velocityTemplates.get(name);
-	}
 	public static Hashtable<String, Properties> getLanguageProperties() {
 		return languageProperties;
 	}

Received on Monday, 24 August 2009 09:16:23 UTC