2006/unicorn/src/org/w3c/unicorn/output OutputFactory.java,1.7,1.8

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

Modified Files:
	OutputFactory.java 
Log Message:
ucn_output parameter defines the OutputModule class again

Index: OutputFactory.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/output/OutputFactory.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- OutputFactory.java	23 Sep 2009 09:26:05 -0000	1.7
+++ OutputFactory.java	23 Sep 2009 13:14:34 -0000	1.8
@@ -33,27 +33,26 @@
 		logger.trace("createOutputModule");
 		logger.debug("Output module : " + mapOfOutputParameter);
 		
-		String format = mapOfOutputParameter.get("format");
-		String lang = mapOfOutputParameter.get("lang"); 
-		String mimeType = mapOfOutputParameter.get("mimetype");
+		String module = mapOfOutputParameter.get("output");
 		
 		/* Commented out for now as this is unnecessary and that doesn't seem quite safe */		
-//		if(null == module || "".equals(module)) {
-//			module = "simple";
-//		}
-//		
-//		module = module.substring(0, 1).toUpperCase() + module.substring(1);
-//		
-//		Class<?> moduleClass;
-//		try {
-//			moduleClass = Class.forName("org.w3c.unicorn.output." + module + "OutputModule");
-//			return (OutputModule) moduleClass.getConstructor().newInstance();
-//		} catch (Exception e) {
-//			logger.error("Couldn't create output module " + module + ". Will use SimpleOutputModule", e);
-//		}
+		if(null == module || "".equals(module)) {
+			module = "simple";
+		}
+		
+		module = module.substring(0, 1).toUpperCase() + module.substring(1);
+		
+		Class<?> moduleClass;
+		try {
+			logger.debug("Trying to instantiate OutputModule: org.w3c.unicorn.output." + module + "OutputModule");
+			moduleClass = Class.forName("org.w3c.unicorn.output." + module + "OutputModule");
+			Class<?>[] parameters = {Map.class, Map.class};
+			return (OutputModule) moduleClass.getConstructor(parameters).newInstance(mapOfOutputParameter, mapOfSpecificParameter);
+		} catch (Exception e) {
+			logger.error("Couldn't create output module " + module + ". Will use SimpleOutputModule", e);
+		}
 
 		return new SimpleOutputModule(mapOfOutputParameter, mapOfSpecificParameter);
-		//return new MailOutputModule(mapOfOutputParameter, mapOfSpecificParameter);
 	}
 
 	/**

Received on Wednesday, 23 September 2009 13:14:46 UTC