2006/unicorn/src/org/w3c/unicorn/output OutputModule.java,1.10,1.11

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

Modified Files:
	OutputModule.java 
Log Message:
implemented default behaviors of produceOutput, produceError, and produceFirstOutput

Index: OutputModule.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/output/OutputModule.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- OutputModule.java	24 Sep 2009 17:43:13 -0000	1.10
+++ OutputModule.java	29 Sep 2009 16:04:35 -0000	1.11
@@ -22,6 +22,8 @@
  */
 public abstract class OutputModule {
 	
+	protected OutputFormater defaultOutputFormater;
+	
 	protected Map<String, String> outputParameters;
 	
 	protected Map<String, String> specificParameters;
@@ -31,25 +33,32 @@
 	public OutputModule(Map<String, String> mapOfOutputParameters, Map<String, String> mapOfSpecificParameters) {
 		this.outputParameters = mapOfOutputParameters;
 		this.specificParameters = mapOfSpecificParameters;
+		this.defaultOutputFormater = OutputFactory.createOutputFormater(outputParameters.get("format"), outputParameters.get("lang"));
 	}
 	
 	/**
 	 * Generate a first output before the requests are launched.
 	 * 
 	 */
-	public abstract void produceFirstOutput(Map<String, Object> mapOfStringObject, final Writer aWriter) throws UnicornException;
+	public void produceFirstOutput(Map<String, Object> mapOfStringObject, final Writer aWriter) throws UnicornException {
+		return;
+	}
 	
 	/**
 	 * Generate the output of all response.
 	 * 
 	 */
-	public abstract void produceOutput(Map<String, Object> mapOfStringObject, final Writer aWriter) throws UnicornException;
+	public void produceOutput(Map<String, Object> mapOfStringObject, final Writer aWriter) throws UnicornException {
+		defaultOutputFormater.produceOutput(mapOfStringObject, aWriter);
+	}
 
 	/**
 	 * Generates an error output
 	 * 
 	 */
-	public abstract void produceError(Map<String, Object> mapOfStringObject, final Writer aWriter);
+	public void produceError(Map<String, Object> mapOfStringObject, final Writer aWriter) {
+		defaultOutputFormater.produceError(mapOfStringObject, aWriter);
+	}
 
 	protected void displayOnIndex(Map<String, Object> mapOfStringObject, Writer writer) {
 		VelocityContext context = new VelocityContext(Language.getContext(outputParameters.get("lang")));
@@ -77,4 +86,7 @@
 		this.outputParameters = mapOfOutputParameters;
 	}
 	
+	public String getMimeType() {
+		return defaultOutputFormater.getMimeType();
+	}
 }

Received on Tuesday, 29 September 2009 16:04:48 UTC