2006/unicorn/org/w3c/unicorn/output OutputModule.java,1.1.1.1,1.2 EscapeXMLEntities.java,1.3,1.4 OutputFormater.java,1.1.1.1,1.2 EnumOutputModule.java,1.1.1.1,1.2 SimpleOutputModule.java,1.1.1.1,1.2 OutputFactory.java,1.2,1.3 SimpleOutputFormater.java,1.1.1.1,1.2 XHTMLize.java,1.4,1.5 XMLOutputFormater.java,1.2,1.3

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

Modified Files:
	OutputModule.java EscapeXMLEntities.java OutputFormater.java 
	EnumOutputModule.java SimpleOutputModule.java 
	OutputFactory.java SimpleOutputFormater.java XHTMLize.java 
	XMLOutputFormater.java 
Log Message:
Updating the javadoc for all the project

Index: OutputFactory.java
===================================================================
RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/output/OutputFactory.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- OutputFactory.java	29 Sep 2006 09:25:11 -0000	1.2
+++ OutputFactory.java	17 Jun 2008 13:41:11 -0000	1.3
@@ -15,52 +15,54 @@
 import org.apache.velocity.exception.ResourceNotFoundException;
 
 /**
- * This class allow to manage all output module and output formater.
- * It provide a way to share an instance of a output module or output formater
- * between different call of the framework UniCORN.
+ * This class allow to manage all output module and output formater. It provide
+ * a way to share an instance of a output module or output formater between
+ * different call of the framework UniCORN.
+ * 
  * @author Damien LEROY
  */
 public class OutputFactory {
 
-	protected static final Log logger = LogFactory.getLog("org.w3c.unicorn.output");
+	protected static final Log logger = LogFactory
+			.getLog("org.w3c.unicorn.output");
 
-	private static final Map<EnumOutputModule, OutputModule> mapOfOutputModule =
-		new LinkedHashMap<EnumOutputModule, OutputModule>();
+	private static final Map<EnumOutputModule, OutputModule> mapOfOutputModule = new LinkedHashMap<EnumOutputModule, OutputModule>();
 
-	private static final Map<String, OutputFormater> mapOfOutputFormater =
-		new LinkedHashMap<String, OutputFormater>();
+	private static final Map<String, OutputFormater> mapOfOutputFormater = new LinkedHashMap<String, OutputFormater>();
 
 	private static final Properties aPropertiesSpecialFormaters = new Properties();
-	
-	static {		
+
+	static {
 		try {
-			OutputFactory.aPropertiesSpecialFormaters.load(
-					OutputFactory.class.getResourceAsStream("specialFormaters.properties"));
-		}
-		catch (final IOException e) {
-			OutputFactory.logger.error("IOException : "+e.getMessage(), e);
+			OutputFactory.aPropertiesSpecialFormaters.load(OutputFactory.class
+					.getResourceAsStream("specialFormaters.properties"));
+		} catch (final IOException e) {
+			OutputFactory.logger.error("IOException : " + e.getMessage(), e);
 			e.printStackTrace();
 		}
 	}
 
 	/**
 	 * Create a new output module and add it to the map.
-	 * @param aEnumOutputModule To identify which type of output module will be created.
+	 * 
+	 * @param aEnumOutputModule
+	 *            To identify which type of output module will be created.
 	 * @return The new output module.
 	 */
-	private static OutputModule createOutputModule (
+	private static OutputModule createOutputModule(
 			final EnumOutputModule aEnumOutputModule) {
 		OutputFactory.logger.trace("createOutputModule");
 		if (OutputFactory.logger.isDebugEnabled()) {
-			OutputFactory.logger.debug("Output module : " + aEnumOutputModule + ".");
+			OutputFactory.logger.debug("Output module : " + aEnumOutputModule
+					+ ".");
 		}
 		final OutputModule aOutputModule;
 		switch (aEnumOutputModule) {
-			case SIMPLE :
-				aOutputModule = new SimpleOutputModule();
-				break;
-			default :
-				return null;
+		case SIMPLE:
+			aOutputModule = new SimpleOutputModule();
+			break;
+		default:
+			return null;
 		}
 		OutputFactory.mapOfOutputModule.put(aEnumOutputModule, aOutputModule);
 		return aOutputModule;
@@ -68,54 +70,63 @@
 
 	/**
 	 * Create a new output formater and add it to the map.
-	 * @param sOutputFormat The format who the output formater must produce.
+	 * 
+	 * @param sOutputFormat
+	 *            The format who the output formater must produce.
 	 * @return The new output formater.
 	 * @throws ResourceNotFoundException
 	 * @throws ParseErrorException
 	 * @throws Exception
 	 */
-	private static OutputFormater createOutputFormater (
-			final String sOutputFormat,
-			final String sLang,
-			final String sMimeType)
-	throws ResourceNotFoundException, ParseErrorException, Exception {
+	private static OutputFormater createOutputFormater(
+			final String sOutputFormat, final String sLang,
+			final String sMimeType) throws ResourceNotFoundException,
+			ParseErrorException, Exception {
 		OutputFactory.logger.trace("createOutputformater");
 		if (OutputFactory.logger.isDebugEnabled()) {
-			OutputFactory.logger.debug("Output format : " + sOutputFormat + ".");
+			OutputFactory.logger
+					.debug("Output format : " + sOutputFormat + ".");
 			OutputFactory.logger.debug("Language : " + sLang + ".");
 			OutputFactory.logger.debug("Mime type : " + sMimeType + ".");
 		}
-		
-		final String sFormaterName = OutputFactory.aPropertiesSpecialFormaters.getProperty(sMimeType);
+
+		final String sFormaterName = OutputFactory.aPropertiesSpecialFormaters
+				.getProperty(sMimeType);
 		if (null != sFormaterName) {
-			final Class aFormaterClass = Class.forName(
-					"org.w3c.unicorn.output."+
-					sFormaterName);
-			final Class[] tClassParamType = {String.class, String.class};
-			final Object[] tObjectParamValue = {sOutputFormat, sLang};
+			final Class aFormaterClass = Class
+					.forName("org.w3c.unicorn.output." + sFormaterName);
+			final Class[] tClassParamType = { String.class, String.class };
+			final Object[] tObjectParamValue = { sOutputFormat, sLang };
 			final OutputFormater aOutputFormater;
-			aOutputFormater = (OutputFormater) aFormaterClass.getConstructor(tClassParamType).newInstance(tObjectParamValue);
-			OutputFactory.mapOfOutputFormater.put(sMimeType + "_" + sLang + "_" + sOutputFormat, aOutputFormater);
+			aOutputFormater = (OutputFormater) aFormaterClass.getConstructor(
+					tClassParamType).newInstance(tObjectParamValue);
+			OutputFactory.mapOfOutputFormater.put(sMimeType + "_" + sLang + "_"
+					+ sOutputFormat, aOutputFormater);
 			return aOutputFormater;
 		}
 
 		final OutputFormater aOutputFormater;
 		aOutputFormater = new SimpleOutputFormater(sOutputFormat, sLang);
-		OutputFactory.mapOfOutputFormater.put(sLang + "_" + sOutputFormat, aOutputFormater);
+		OutputFactory.mapOfOutputFormater.put(sLang + "_" + sOutputFormat,
+				aOutputFormater);
 		return aOutputFormater;
 	}
 
 	/**
 	 * Return the output module asked.
-	 * @param sOutputModule The name of the output module to return.
+	 * 
+	 * @param sOutputModule
+	 *            The name of the output module to return.
 	 * @return The output module asked.
 	 */
-	public static OutputModule getOutputModule (final String sOutputModule) {
+	public static OutputModule getOutputModule(final String sOutputModule) {
 		OutputFactory.logger.trace("getOutputModule");
 		if (OutputFactory.logger.isDebugEnabled()) {
-			OutputFactory.logger.debug("Output module : " + sOutputModule + ".");
+			OutputFactory.logger
+					.debug("Output module : " + sOutputModule + ".");
 		}
-		final EnumOutputModule aEnumOutputModule = EnumOutputModule.fromValue(sOutputModule);
+		final EnumOutputModule aEnumOutputModule = EnumOutputModule
+				.fromValue(sOutputModule);
 		if (null == aEnumOutputModule) {
 			OutputFactory.logger.error("Unknow output module.");
 			return null;
@@ -125,16 +136,19 @@
 
 	/**
 	 * Retuern the output module asked.
+	 * 
 	 * @param aEnumOutputModule
 	 * @return The output module asked.
 	 */
-	public static OutputModule getOutputModule (
+	public static OutputModule getOutputModule(
 			final EnumOutputModule aEnumOutputModule) {
 		OutputFactory.logger.trace("getOutputModule");
 		if (OutputFactory.logger.isDebugEnabled()) {
-			OutputFactory.logger.debug("Output module : " + aEnumOutputModule + ".");
+			OutputFactory.logger.debug("Output module : " + aEnumOutputModule
+					+ ".");
 		}
-		final OutputModule aOutputModule = OutputFactory.mapOfOutputModule.get(aEnumOutputModule);
+		final OutputModule aOutputModule = OutputFactory.mapOfOutputModule
+				.get(aEnumOutputModule);
 		// if output module not already exist
 		if (null == aOutputModule) {
 			// create it
@@ -145,41 +159,38 @@
 
 	/**
 	 * Return the output formater asked.
-	 * @param sOutputFormat The output format who be puduce by the output formater.
+	 * 
+	 * @param sOutputFormat
+	 *            The output format who be puduce by the output formater.
 	 * @return The output formater asked.
 	 * @throws ResourceNotFoundException
 	 * @throws ParseErrorException
 	 * @throws Exception
 	 */
-	public static OutputFormater getOutputFormater (
-			final String sOutputFormat,
-			final String sLang,
-			final String sMimeType)
-	throws ResourceNotFoundException, ParseErrorException, Exception {
+	public static OutputFormater getOutputFormater(final String sOutputFormat,
+			final String sLang, final String sMimeType)
+			throws ResourceNotFoundException, ParseErrorException, Exception {
 		OutputFactory.logger.trace("getOutputformater");
 		if (OutputFactory.logger.isDebugEnabled()) {
-			OutputFactory.logger.debug("Output format : " + sOutputFormat + ".");
+			OutputFactory.logger
+					.debug("Output format : " + sOutputFormat + ".");
 			OutputFactory.logger.debug("Language : " + sLang + ".");
 		}
-		OutputFormater aOutputFormater = OutputFactory.mapOfOutputFormater.get(
-				sMimeType + "_" +
-				sLang + "_" +
-				sOutputFormat);
+		OutputFormater aOutputFormater = OutputFactory.mapOfOutputFormater
+				.get(sMimeType + "_" + sLang + "_" + sOutputFormat);
 		if (null != aOutputFormater) {
 			return aOutputFormater;
 		}
-		aOutputFormater = OutputFactory.mapOfOutputFormater.get(
-				sLang + "_" + sOutputFormat);
-		
+		aOutputFormater = OutputFactory.mapOfOutputFormater.get(sLang + "_"
+				+ sOutputFormat);
+
 		if (null != aOutputFormater) {
 			return aOutputFormater;
 		}
 		// if output formater not already exist create it
-		aOutputFormater = OutputFactory.createOutputFormater(
-				sOutputFormat,
-				sLang,
-				sMimeType);
-		
+		aOutputFormater = OutputFactory.createOutputFormater(sOutputFormat,
+				sLang, sMimeType);
+
 		return aOutputFormater;
 	}
 

Index: OutputModule.java
===================================================================
RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/output/OutputModule.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- OutputModule.java	31 Aug 2006 09:09:25 -0000	1.1.1.1
+++ OutputModule.java	17 Jun 2008 13:41:11 -0000	1.2
@@ -15,6 +15,7 @@
 
 /**
  * Interface for all output module.
+ * 
  * @author Damien LEROY
  */
 public interface OutputModule {
@@ -23,42 +24,32 @@
 
 	/**
 	 * Generate the output of all response.
-	 * @throws IOException 
-	 * @throws Exception 
-	 * @throws MethodInvocationException 
-	 * @throws ParseErrorException 
-	 * @throws ResourceNotFoundException 
+	 * 
+	 * @throws IOException
+	 * @throws Exception
+	 * @throws MethodInvocationException
+	 * @throws ParseErrorException
+	 * @throws ResourceNotFoundException
 	 */
-	public abstract void produceOutput (
-			final OutputFormater aOutputFormater,
+	public abstract void produceOutput(final OutputFormater aOutputFormater,
 			final Map<String, Object> mapOfStringObject,
-			final Map<String, String[]> mapOfParameter,
-			final Writer aWriter)
-	throws
-	IOException,
-	ResourceNotFoundException,
-	ParseErrorException,
-	MethodInvocationException,
-	Exception;
+			final Map<String, String[]> mapOfParameter, final Writer aWriter)
+			throws IOException, ResourceNotFoundException, ParseErrorException,
+			MethodInvocationException, Exception;
 
 	/**
 	 * Generates an error output
-	 * @throws IOException 
-	 * @throws Exception 
-	 * @throws MethodInvocationException 
-	 * @throws ParseErrorException 
-	 * @throws ResourceNotFoundException 
+	 * 
+	 * @throws IOException
+	 * @throws Exception
+	 * @throws MethodInvocationException
+	 * @throws ParseErrorException
+	 * @throws ResourceNotFoundException
 	 */
-	public abstract void produceError (
-			final OutputFormater aOutputFormater,
-			final Exception error,
-			final Map<String, String[]> mapOfParameter,
-			final Writer aWriter)
-	throws
-	IOException,
-	ResourceNotFoundException,
-	ParseErrorException,
-	MethodInvocationException,
-	Exception;
-	
+	public abstract void produceError(final OutputFormater aOutputFormater,
+			final Exception error, final Map<String, String[]> mapOfParameter,
+			final Writer aWriter) throws IOException,
+			ResourceNotFoundException, ParseErrorException,
+			MethodInvocationException, Exception;
+
 }

Index: SimpleOutputModule.java
===================================================================
RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/output/SimpleOutputModule.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- SimpleOutputModule.java	31 Aug 2006 09:09:25 -0000	1.1.1.1
+++ SimpleOutputModule.java	17 Jun 2008 13:41:11 -0000	1.2
@@ -13,32 +13,25 @@
 
 /**
  * This module allow to generate output in text format.
+ * 
  * @author Damien LEROY
  */
 public class SimpleOutputModule implements OutputModule {
 
-	public void produceOutput (
-			final OutputFormater aOutputFormater,
+	public void produceOutput(final OutputFormater aOutputFormater,
 			final Map<String, Object> mapOfStringObject,
-			final Map<String, String[]> mapOfParameter,
-			final Writer aWriter) throws
-			ResourceNotFoundException,
-			ParseErrorException,
-			MethodInvocationException,
-			Exception {
+			final Map<String, String[]> mapOfParameter, final Writer aWriter)
+			throws ResourceNotFoundException, ParseErrorException,
+			MethodInvocationException, Exception {
 		SimpleOutputModule.logger.trace("Constructor");
 		aOutputFormater.produceOutput(mapOfStringObject, aWriter);
 	}
-	
-	public void produceError (
-			final OutputFormater aOutputFormater,
+
+	public void produceError(final OutputFormater aOutputFormater,
 			final Exception aException,
-			final Map<String, String[]> mapOfParameter,
-			final Writer aWriter) throws
-			ResourceNotFoundException,
-			ParseErrorException,
-			MethodInvocationException,
-			Exception {
+			final Map<String, String[]> mapOfParameter, final Writer aWriter)
+			throws ResourceNotFoundException, ParseErrorException,
+			MethodInvocationException, Exception {
 		SimpleOutputModule.logger.trace("produceError");
 		aOutputFormater.produceError(aException, aWriter);
 	}

Index: EnumOutputModule.java
===================================================================
RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/output/EnumOutputModule.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- EnumOutputModule.java	31 Aug 2006 09:09:25 -0000	1.1.1.1
+++ EnumOutputModule.java	17 Jun 2008 13:41:11 -0000	1.2
@@ -6,25 +6,32 @@
 
 /**
  * @author Damien LEROY
- *
+ * 
  */
 public enum EnumOutputModule {
 
-	SIMPLE("simple"),
-	MAIL("mail");
+	SIMPLE("simple"), MAIL("mail");
 
 	private final String sValue;
 
-	private EnumOutputModule (final String sValue) {
+	private EnumOutputModule(final String sValue) {
 		this.sValue = sValue;
 	}
 
-	public final String value () {
+	public final String value() {
 		return this.sValue;
 	}
 
-	public static EnumOutputModule fromValue (final String sValue) {
-		for (final EnumOutputModule aEnumOutputMethod : EnumOutputModule.values()) {
+	/**
+	 * Returns if the string is an output method possible value
+	 * 
+	 * @param sValue
+	 *            string to compare
+	 * @return the output method if matches and null otherwise
+	 */
+	public static EnumOutputModule fromValue(final String sValue) {
+		for (final EnumOutputModule aEnumOutputMethod : EnumOutputModule
+				.values()) {
 			if (aEnumOutputMethod.sValue.equals(sValue)) {
 				return aEnumOutputMethod;
 			}

Index: OutputFormater.java
===================================================================
RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/output/OutputFormater.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- OutputFormater.java	31 Aug 2006 09:09:25 -0000	1.1.1.1
+++ OutputFormater.java	17 Jun 2008 13:41:11 -0000	1.2
@@ -14,17 +14,15 @@
 /**
  * SimpleOutputFormater<br />
  * Created: Jul 19, 2006 5:54:33 PM<br />
+ * 
  * @author Jean-Guilhem Rouel
  */
 public interface OutputFormater {
 
-	public abstract void produceOutput (
-			final Map<String, Object> mapOfStringObject,
-			final Writer aWriter) throws
-			ResourceNotFoundException,
-			ParseErrorException,
-			MethodInvocationException,
-			Exception;
+	public abstract void produceOutput(
+			final Map<String, Object> mapOfStringObject, final Writer aWriter)
+			throws ResourceNotFoundException, ParseErrorException,
+			MethodInvocationException, Exception;
 
 	/**
 	 * @param aException
@@ -34,12 +32,8 @@
 	 * @throws ParseErrorException
 	 * @throws ResourceNotFoundException
 	 */
-	public abstract void produceError (
-			final Exception aException,
-			final Writer aWriter) throws
-			ResourceNotFoundException,
-			ParseErrorException,
-			MethodInvocationException,
-			Exception;
+	public abstract void produceError(final Exception aException,
+			final Writer aWriter) throws ResourceNotFoundException,
+			ParseErrorException, MethodInvocationException, Exception;
 
 }
\ No newline at end of file

Index: EscapeXMLEntities.java
===================================================================
RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/output/EscapeXMLEntities.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- EscapeXMLEntities.java	29 Nov 2007 14:11:59 -0000	1.3
+++ EscapeXMLEntities.java	17 Jun 2008 13:41:11 -0000	1.4
@@ -3,33 +3,38 @@
 import org.apache.velocity.app.event.ReferenceInsertionEventHandler;
 
 /**
- * Escape all XML Entities in the reference insertion.
- * Specifically, the following conversions are performed:
+ * Escape all XML Entities in the reference insertion. Specifically, the
+ * following conversions are performed:
  * <DL>
- * <DT>&amp;</DT><DD>&amp;amp;</DD>
- * <DT>&lt;</DT><DD>&amp;lt;</DD>
- * <DT>&gt;</DT><DD>&amp;gt;</DD>
- * <DT>&quot;</DT><DD>&amp;quot;</DD>
+ * <DT>&amp;</DT>
+ * <DD>&amp;amp;</DD>
+ * <DT>&lt;</DT>
+ * <DD>&amp;lt;</DD>
+ * <DT>&gt;</DT>
+ * <DD>&amp;gt;</DD>
+ * <DT>&quot;</DT>
+ * <DD>&amp;quot;</DD>
  * </DL>
- *
+ * 
  * @author <a href="mailto:wglass@forio.com">Will Glass-Husain</a>
  */
 public class EscapeXMLEntities implements ReferenceInsertionEventHandler {
-	
+
 	/**
 	 * Escape the XML entities for all inserted references.
 	 */
-	public Object referenceInsert (final String sUnused, final Object oValue) {
+	public Object referenceInsert(final String sUnused, final Object oValue) {
 		final String sValue = oValue.toString();
 		return EscapeXMLEntities.escapeText(sValue);
 	}
 
 	/**
 	 * Escape the provided text.
+	 * 
 	 * @param sValue
 	 * @return
 	 */
-	public static String escapeText (final String sValue) {
+	public static String escapeText(final String sValue) {
 		final StringBuffer aStringBuffer = new StringBuffer(sValue.length());
 		final int iLength = sValue.length();
 		int iPosition = 0;
@@ -37,10 +42,12 @@
 
 		while (iNextPosition != -1) {
 			aStringBuffer.append(sValue.substring(iPosition, iNextPosition));
-			aStringBuffer.append(EscapeXMLEntities.escapeChar(sValue.charAt(iNextPosition)));
+			aStringBuffer.append(EscapeXMLEntities.escapeChar(sValue
+					.charAt(iNextPosition)));
 			iPosition = iNextPosition + 1;
 			if (iPosition < iLength) {
-				iNextPosition = EscapeXMLEntities.nextPosition(sValue, iPosition);
+				iNextPosition = EscapeXMLEntities.nextPosition(sValue,
+						iPosition);
 			} else {
 				iNextPosition = -1;
 			}
@@ -52,42 +59,56 @@
 
 		return aStringBuffer.toString();
 	}
-	
-	private static String escapeChar (final char c) {
+
+	/**
+	 * Transform the escape char into xml encoding
+	 * 
+	 * @param c
+	 *            char to transform
+	 * @return same character in xml form
+	 */
+	private static String escapeChar(final char c) {
 		switch (c) {
-			case '<' : return "&lt;";
-			case '>' : return "&gt;";
-			case '&' : return "&amp;";
-			case '"' : return "&quot;";
+		case '<':
+			return "&lt;";
+		case '>':
+			return "&gt;";
+		case '&':
+			return "&amp;";
+		case '"':
+			return "&quot;";
 		}
 		return null;
 	}
-	
-	private static int nextPosition (final String s, final int iCurrentPosition) {
+
+	/**
+	 * Returns the position of the next xml tag
+	 * 
+	 * @param s
+	 *            string to analyze
+	 * @param iCurrentPosition
+	 *            current position in the string
+	 * @return position of the next tag
+	 */
+	private static int nextPosition(final String s, final int iCurrentPosition) {
 		final int iLT = s.indexOf('<', iCurrentPosition);
 		final int iGT = s.indexOf('>', iCurrentPosition);
 		final int iAMP = s.indexOf('&', iCurrentPosition);
 		final int iQUOT = s.indexOf('"', iCurrentPosition);
-		
-		if (
-				(iLT != -1) &&
-				((iGT == -1) || (iLT < iGT)) &&
-				((iAMP == -1) || (iLT < iAMP)) &&
-				((iQUOT == -1) || (iLT < iQUOT))) {
+
+		if ((iLT != -1) && ((iGT == -1) || (iLT < iGT))
+				&& ((iAMP == -1) || (iLT < iAMP))
+				&& ((iQUOT == -1) || (iLT < iQUOT))) {
 			return iLT;
 		}
-		if (
-				(iGT != -1) &&
-				((iAMP == -1) || (iGT < iAMP)) &&
-				((iQUOT == -1) || (iGT < iQUOT))) {
+		if ((iGT != -1) && ((iAMP == -1) || (iGT < iAMP))
+				&& ((iQUOT == -1) || (iGT < iQUOT))) {
 			return iGT;
 		}
-		if (
-				(iAMP != -1) &&
-				((iQUOT == -1) || (iAMP < iQUOT))) {
+		if ((iAMP != -1) && ((iQUOT == -1) || (iAMP < iQUOT))) {
 			return iAMP;
 		}
 		return iQUOT;
 	}
-	
+
 }

Index: XHTMLize.java
===================================================================
RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/output/XHTMLize.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- XHTMLize.java	20 Feb 2008 15:09:59 -0000	1.4
+++ XHTMLize.java	17 Jun 2008 13:41:11 -0000	1.5
@@ -5,25 +5,28 @@
 import org.w3c.unicorn.response.A;
 import org.w3c.unicorn.response.Img;
 
-
 /**
- * Escape all XML Entities in the reference insertion.
- * Specifically, the following conversions are performed:
+ * Escape all XML Entities in the reference insertion. Specifically, the
+ * following conversions are performed:
  * <DL>
- * <DT>&amp;</DT><DD>&amp;amp;</DD>
- * <DT>&lt;</DT><DD>&amp;lt;</DD>
- * <DT>&gt;</DT><DD>&amp;gt;</DD>
- * <DT>&quot;</DT><DD>&amp;quot;</DD>
+ * <DT>&amp;</DT>
+ * <DD>&amp;amp;</DD>
+ * <DT>&lt;</DT>
+ * <DD>&amp;lt;</DD>
+ * <DT>&gt;</DT>
+ * <DD>&amp;gt;</DD>
+ * <DT>&quot;</DT>
+ * <DD>&amp;quot;</DD>
  * </DL>
- *
+ * 
  * @author <a href="mailto:wglass@forio.com">Will Glass-Husain</a>
  */
 public class XHTMLize implements ReferenceInsertionEventHandler {
-	
+
 	/**
 	 * Escape the XML entities for all inserted references.
 	 */
-	public Object referenceInsert (final String sUnused, final Object oValue) {
+	public Object referenceInsert(final String sUnused, final Object oValue) {
 		if (oValue instanceof A) {
 			A link = (A) oValue;
 			return insertA(link);
@@ -38,34 +41,43 @@
 		}
 		return EscapeXMLEntities.escapeText(oValue.toString());
 	}
-	
-	private Object insertA (final A aLink) {
-		String sResultat = "<a href=\"" + EscapeXMLEntities.escapeText(aLink.getHref()) + "\">";
+
+	/**
+	 * Insert a link
+	 * 
+	 * @param aLink
+	 *            link to insert
+	 * @return return the object containing the link
+	 */
+	private Object insertA(final A aLink) {
+		String sResultat = "<a href=\""
+				+ EscapeXMLEntities.escapeText(aLink.getHref()) + "\">";
 		for (final Object oElement : aLink.getContent()) {
 			if (oElement instanceof Img) {
 				sResultat += insertImg((Img) oElement);
-			}
-			//else if (oElement instanceof Code) {
-			//	sResultat += insertCode((Code) oElement);
-			//}
-			else {				
+			} else {
 				sResultat += EscapeXMLEntities.escapeText(oElement.toString());
 			}
 		}
 		sResultat += "</a>";
 		return sResultat;
 	}
-	
-	private Object insertCode (final Code aCode) {
+
+	/**
+	 * Insert code tag into the tags
+	 * 
+	 * @param aCode
+	 *            code to insert
+	 * @return object with code inserted
+	 */
+	private Object insertCode(final Code aCode) {
 		String sResultat = "<code>";
-		for (final Object oElement : aCode.getContent()) {			
+		for (final Object oElement : aCode.getContent()) {
 			if (oElement instanceof A) {
-				sResultat += insertA((A) oElement);			
-			}
-			else if(oElement instanceof Img) {
+				sResultat += insertA((A) oElement);
+			} else if (oElement instanceof Img) {
 				sResultat += insertImg((Img) oElement);
-			}
-			else {
+			} else {
 				sResultat += EscapeXMLEntities.escapeText(oElement.toString());
 			}
 		}
@@ -74,13 +86,16 @@
 	}
 
 	/**
+	 * Insert an img tag
+	 * 
 	 * @param img
-	 * @return
+	 *            image path to insert
+	 * @return the string containing the image tag
 	 */
-	private String insertImg (final Img aImage) {
+	private String insertImg(final Img aImage) {
 		return "<img src=\"" + EscapeXMLEntities.escapeText(aImage.getSrc())
-		+ "\" alt=\"" + EscapeXMLEntities.escapeText(aImage.getAlt())
-		+ "\"/>";
+				+ "\" alt=\"" + EscapeXMLEntities.escapeText(aImage.getAlt())
+				+ "\"/>";
 	}
 
 }

Index: SimpleOutputFormater.java
===================================================================
RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/output/SimpleOutputFormater.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- SimpleOutputFormater.java	31 Aug 2006 09:09:25 -0000	1.1.1.1
+++ SimpleOutputFormater.java	17 Jun 2008 13:41:11 -0000	1.2
@@ -21,6 +21,7 @@
 
 /**
  * Class for simple output formater.
+ * 
  * @author Jean-Guilhem ROUEL
  */
 public class SimpleOutputFormater implements OutputFormater {
@@ -28,61 +29,67 @@
 	private static final Log logger = OutputFactory.logger;
 
 	private Template aTemplateOutput = null;
+
 	private Template aTemplateError = null;
 
-	private static VelocityEngine aVelocityEngineOutput = new VelocityEngine();			
+	private static VelocityEngine aVelocityEngineOutput = new VelocityEngine();
+
 	private static VelocityEngine aVelocityEngineError = new VelocityEngine();
 
-	public SimpleOutputFormater (
-			final String sOutputFormat,
-			final String sLang) throws
-			ResourceNotFoundException,
-			ParseErrorException,
-			Exception {
+	public SimpleOutputFormater(final String sOutputFormat, final String sLang)
+			throws ResourceNotFoundException, ParseErrorException, Exception {
 		SimpleOutputFormater.logger.trace("Constructor");
 		if (SimpleOutputFormater.logger.isDebugEnabled()) {
-			SimpleOutputFormater.logger.debug("Output format : " + sOutputFormat + ".");
-			SimpleOutputFormater.logger.debug("Output language : " + sLang + ".");
+			SimpleOutputFormater.logger.debug("Output format : "
+					+ sOutputFormat + ".");
+			SimpleOutputFormater.logger.debug("Output language : " + sLang
+					+ ".");
 		}
 		final String sFileName;
-		sFileName = sLang + "_" +	sOutputFormat +	Property.get("TEMPLATE_FILE_EXTENSION");
-		this.aTemplateOutput = SimpleOutputFormater.aVelocityEngineOutput.getTemplate(sFileName);
-		this.aTemplateError = SimpleOutputFormater.aVelocityEngineError.getTemplate(sFileName);
+		sFileName = sLang + "_" + sOutputFormat
+				+ Property.get("TEMPLATE_FILE_EXTENSION");
+		this.aTemplateOutput = SimpleOutputFormater.aVelocityEngineOutput
+				.getTemplate(sFileName);
+		this.aTemplateError = SimpleOutputFormater.aVelocityEngineError
+				.getTemplate(sFileName);
 	}
 
-	/* (non-Javadoc)
-	 * @see org.w3c.unicorn.output.OutputFormater#produceOutput(java.util.Map, java.io.Writer)
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.w3c.unicorn.output.OutputFormater#produceOutput(java.util.Map,
+	 *      java.io.Writer)
 	 */
-	public void produceOutput (
-			final Map<String, Object> mapOfStringObject,
-			final Writer aWriter) 
-	throws ResourceNotFoundException, ParseErrorException, 
-			MethodInvocationException, Exception {
+	public void produceOutput(final Map<String, Object> mapOfStringObject,
+			final Writer aWriter) throws ResourceNotFoundException,
+			ParseErrorException, MethodInvocationException, Exception {
 		SimpleOutputFormater.logger.trace("produceOutput");
 		if (SimpleOutputFormater.logger.isDebugEnabled()) {
-			SimpleOutputFormater.logger.debug("Map of String -> Object : " + mapOfStringObject + ".");
+			SimpleOutputFormater.logger.debug("Map of String -> Object : "
+					+ mapOfStringObject + ".");
 			SimpleOutputFormater.logger.debug("Writer : " + aWriter + ".");
 		}
 		final VelocityContext aVelocityContext = new VelocityContext();
 		for (final String sObjectName : mapOfStringObject.keySet()) {
-			aVelocityContext.put(sObjectName, mapOfStringObject.get(sObjectName));
+			aVelocityContext.put(sObjectName, mapOfStringObject
+					.get(sObjectName));
 		}
 		this.aTemplateOutput.merge(aVelocityContext, aWriter);
 	}
 
-	/* (non-Javadoc)
-	 * @see org.w3c.unicorn.output.OutputFormater#produceError(java.lang.Exception, java.io.Writer)
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.w3c.unicorn.output.OutputFormater#produceError(java.lang.Exception,
+	 *      java.io.Writer)
 	 */
-	public void produceError (
-			final Exception aException,
-			final Writer aWriter) throws
-			ResourceNotFoundException,
-			ParseErrorException,
-			MethodInvocationException,
-			Exception {
+	public void produceError(final Exception aException, final Writer aWriter)
+			throws ResourceNotFoundException, ParseErrorException,
+			MethodInvocationException, Exception {
 		SimpleOutputFormater.logger.trace("produceError");
 		if (SimpleOutputFormater.logger.isDebugEnabled()) {
-			SimpleOutputFormater.logger.debug("Error : " + aException.getMessage() + ".");
+			SimpleOutputFormater.logger.debug("Error : "
+					+ aException.getMessage() + ".");
 			SimpleOutputFormater.logger.debug("Writer : " + aWriter + ".");
 		}
 		final VelocityContext aVelocityContext = new VelocityContext();
@@ -90,24 +97,23 @@
 		this.aTemplateError.merge(aVelocityContext, aWriter);
 	}
 
-	static {		
+	static {
 		try {
 			final Properties aProperties = new Properties();
-			aProperties.load(new URL("file:" + Property.get("VELOCITY_CONFIG_FILE")).openStream());
-			
-			aProperties.put(Velocity.FILE_RESOURCE_LOADER_PATH, 
-					Property.get("PATH_TO_OUTPUT_TEMPLATES")); 			
+			aProperties.load(new URL("file:"
+					+ Property.get("VELOCITY_CONFIG_FILE")).openStream());
+
+			aProperties.put(Velocity.FILE_RESOURCE_LOADER_PATH, Property
+					.get("PATH_TO_OUTPUT_TEMPLATES"));
 			SimpleOutputFormater.aVelocityEngineOutput.init(aProperties);
-			SimpleOutputFormater.logger.debug(
-					"OutputEngine " +
-					Velocity.FILE_RESOURCE_LOADER_PATH);
-			aProperties.put(
-					Velocity.FILE_RESOURCE_LOADER_PATH, 
-					Property.get("PATH_TO_OUTPUT_ERROR_TEMPLATES"));
+			SimpleOutputFormater.logger.debug("OutputEngine "
+					+ Velocity.FILE_RESOURCE_LOADER_PATH);
+			aProperties.put(Velocity.FILE_RESOURCE_LOADER_PATH, Property
+					.get("PATH_TO_OUTPUT_ERROR_TEMPLATES"));
 			SimpleOutputFormater.aVelocityEngineError.init(aProperties);
-		}
-		catch (final Exception e) {
-			SimpleOutputFormater.logger.error("Exception : "+e.getMessage(), e);
+		} catch (final Exception e) {
+			SimpleOutputFormater.logger.error("Exception : " + e.getMessage(),
+					e);
 			e.printStackTrace();
 		}
 	}

Index: XMLOutputFormater.java
===================================================================
RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/output/XMLOutputFormater.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- XMLOutputFormater.java	1 Sep 2006 14:30:17 -0000	1.2
+++ XMLOutputFormater.java	17 Jun 2008 13:41:11 -0000	1.3
@@ -22,86 +22,122 @@
 
 /**
  * Class for XML output formater.
+ * 
  * @author Jean-Guilhem ROUEL
  */
 public class XMLOutputFormater implements OutputFormater {
 
+	/**
+	 * Object used for complex logging purpose
+	 */
 	private static final Log logger = OutputFactory.logger;
 
+	/**
+	 * Template for the standard output
+	 */
 	private Template aTemplateOutput = null;
+
+	/**
+	 * Template used for the standard error
+	 */
 	private Template aTemplateError = null;
 
-	private static VelocityEngine aVelocityEngineOutput = new VelocityEngine();			
+	/**
+	 * Apache velocity engine for the output
+	 */
+	private static VelocityEngine aVelocityEngineOutput = new VelocityEngine();
+
+	/**
+	 * Apache velocity engine for the error
+	 */
 	private static VelocityEngine aVelocityEngineError = new VelocityEngine();
 
-	public XMLOutputFormater (
-			final String sOutputFormat,
-			final String sLang)
-	throws ResourceNotFoundException, ParseErrorException, Exception {
+	/**
+	 * Write the result of the XML in a file
+	 * @param sOutputFormat format of the output
+	 * @param sLang Language of the output
+	 * @throws ResourceNotFoundException exception when resources not found using the path
+	 * @throws ParseErrorException error in the parser
+	 * @throws Exception odd error occur
+	 */
+	public XMLOutputFormater(final String sOutputFormat, final String sLang)
+			throws ResourceNotFoundException, ParseErrorException, Exception {
 		XMLOutputFormater.logger.trace("Constructor");
 		if (XMLOutputFormater.logger.isDebugEnabled()) {
-			XMLOutputFormater.logger.debug("Output format : " + sOutputFormat + ".");
+			XMLOutputFormater.logger.debug("Output format : " + sOutputFormat
+					+ ".");
 			XMLOutputFormater.logger.debug("Output language : " + sLang + ".");
 		}
 		String sFileName;
-		sFileName = sLang + "_" + sOutputFormat + Property.get("TEMPLATE_FILE_EXTENSION");
-		// TODO check if sFileName exist
+		sFileName = sLang + "_" + sOutputFormat
+				+ Property.get("TEMPLATE_FILE_EXTENSION");
+		// check if sFileName exist
 		try {
-			this.aTemplateOutput = XMLOutputFormater.aVelocityEngineOutput.getTemplate(sFileName);
+			this.aTemplateOutput = XMLOutputFormater.aVelocityEngineOutput
+					.getTemplate(sFileName);
 		} catch (final ResourceNotFoundException aRNFE) {
-			XMLOutputFormater.logger.warn("Resource "+sFileName+" not found.", aRNFE);
-			sFileName = Property.get("DEFAULT_LANGUAGE") + "_" + sOutputFormat + Property.get("TEMPLATE_FILE_EXTENSION");
-			XMLOutputFormater.logger.warn("Redirect to resource : "+sFileName+".");
-			this.aTemplateOutput = XMLOutputFormater.aVelocityEngineOutput.getTemplate(sFileName);
+			XMLOutputFormater.logger.warn("Resource " + sFileName
+					+ " not found.", aRNFE);
+			sFileName = Property.get("DEFAULT_LANGUAGE") + "_" + sOutputFormat
+					+ Property.get("TEMPLATE_FILE_EXTENSION");
+			XMLOutputFormater.logger.warn("Redirect to resource : " + sFileName
+					+ ".");
+			this.aTemplateOutput = XMLOutputFormater.aVelocityEngineOutput
+					.getTemplate(sFileName);
 		}
 		try {
-			this.aTemplateError = XMLOutputFormater.aVelocityEngineError.getTemplate(sFileName);
+			this.aTemplateError = XMLOutputFormater.aVelocityEngineError
+					.getTemplate(sFileName);
 		} catch (final ResourceNotFoundException aRNFE) {
-			XMLOutputFormater.logger.warn("Resource "+sFileName+" not found.", aRNFE);
-			sFileName = Property.get("DEFAULT_LANGUAGE") + "_" + sOutputFormat + Property.get("TEMPLATE_FILE_EXTENSION");
-			XMLOutputFormater.logger.warn("Redirect to resource : "+sFileName+".");
-			this.aTemplateError = XMLOutputFormater.aVelocityEngineError.getTemplate(sFileName);
+			XMLOutputFormater.logger.warn("Resource " + sFileName
+					+ " not found.", aRNFE);
+			sFileName = Property.get("DEFAULT_LANGUAGE") + "_" + sOutputFormat
+					+ Property.get("TEMPLATE_FILE_EXTENSION");
+			XMLOutputFormater.logger.warn("Redirect to resource : " + sFileName
+					+ ".");
+			this.aTemplateError = XMLOutputFormater.aVelocityEngineError
+					.getTemplate(sFileName);
 		}
 	}
 
-	/* (non-Javadoc)
-	 * @see org.w3c.unicorn.output.OutputFormater#produceOutput(java.util.Map, java.io.Writer)
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.w3c.unicorn.output.OutputFormater#produceOutput(java.util.Map,
+	 *      java.io.Writer)
 	 */
-	public void produceOutput (
-			final Map<String, Object> mapOfStringObject,
-			final Writer aWriter) throws
-			ResourceNotFoundException,
-			ParseErrorException, 
-			MethodInvocationException,
-			Exception {
+	public void produceOutput(final Map<String, Object> mapOfStringObject,
+			final Writer aWriter) throws ResourceNotFoundException,
+			ParseErrorException, MethodInvocationException, Exception {
 		XMLOutputFormater.logger.trace("produceOutput");
 		if (XMLOutputFormater.logger.isDebugEnabled()) {
-			XMLOutputFormater.logger.debug("Map of String -> Object : " + mapOfStringObject + ".");
+			XMLOutputFormater.logger.debug("Map of String -> Object : "
+					+ mapOfStringObject + ".");
 			XMLOutputFormater.logger.debug("Writer : " + aWriter + ".");
 		}
 
 		final VelocityContext aVelocityContext = new VelocityContext();
 		final EventCartridge aEventCartridge = new EventCartridge();
 		aEventCartridge.addEventHandler(new XHTMLize());
-        //aEventCartridge.addEventHandler(new EscapeXMLEntities());                         
-        aEventCartridge.attachToContext(aVelocityContext);
-		
+		// aEventCartridge.addEventHandler(new EscapeXMLEntities());
+		aEventCartridge.attachToContext(aVelocityContext);
+
 		for (final String sObjectName : mapOfStringObject.keySet()) {
-			aVelocityContext.put(sObjectName, mapOfStringObject.get(sObjectName));
+			aVelocityContext.put(sObjectName, mapOfStringObject
+					.get(sObjectName));
 		}
 		this.aTemplateOutput.merge(aVelocityContext, aWriter);
 	}
 
-	/* (non-Javadoc)
-	 * @see org.w3c.unicorn.output.OutputFormater#produceError(java.lang.Exception, java.io.Writer)
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.w3c.unicorn.output.OutputFormater#produceError(java.lang.Exception,
+	 *      java.io.Writer)
 	 */
-	public void produceError (
-			final Exception aException,
-			final Writer aWriter) throws
-			ResourceNotFoundException,
-			ParseErrorException, 
-			MethodInvocationException,
-			Exception {
+	public void produceError(final Exception aException, final Writer aWriter)
+			throws ResourceNotFoundException, ParseErrorException,
+			MethodInvocationException, Exception {
 		XMLOutputFormater.logger.trace("produceError");
 		if (XMLOutputFormater.logger.isDebugEnabled()) {
 			XMLOutputFormater.logger.debug("Error : " + aException + ".");
@@ -109,31 +145,29 @@
 		}
 		final VelocityContext aVelocityContext = new VelocityContext();
 		final EventCartridge aEventCartridge = new EventCartridge();
-        aEventCartridge.addEventHandler(new EscapeXMLEntities());
-        aEventCartridge.attachToContext(aVelocityContext);
-		
-		aVelocityContext.put("error", aException);		
+		aEventCartridge.addEventHandler(new EscapeXMLEntities());
+		aEventCartridge.attachToContext(aVelocityContext);
+
+		aVelocityContext.put("error", aException);
 		this.aTemplateError.merge(aVelocityContext, aWriter);
 	}
 
-	static {		
+	static {
 		try {
 			final Properties aProperties = new Properties();
-			aProperties.load(new URL("file:" + Property.get("VELOCITY_CONFIG_FILE")).openStream());
-			
-			aProperties.put(Velocity.FILE_RESOURCE_LOADER_PATH, 
-					Property.get("PATH_TO_OUTPUT_TEMPLATES")); 			
+			aProperties.load(new URL("file:"
+					+ Property.get("VELOCITY_CONFIG_FILE")).openStream());
+
+			aProperties.put(Velocity.FILE_RESOURCE_LOADER_PATH, Property
+					.get("PATH_TO_OUTPUT_TEMPLATES"));
 			XMLOutputFormater.aVelocityEngineOutput.init(aProperties);
-			XMLOutputFormater.logger.debug(
-					"OutputEngine " +
-					Velocity.FILE_RESOURCE_LOADER_PATH);
-			aProperties.put(
-					Velocity.FILE_RESOURCE_LOADER_PATH, 
-					Property.get("PATH_TO_OUTPUT_ERROR_TEMPLATES"));
+			XMLOutputFormater.logger.debug("OutputEngine "
+					+ Velocity.FILE_RESOURCE_LOADER_PATH);
+			aProperties.put(Velocity.FILE_RESOURCE_LOADER_PATH, Property
+					.get("PATH_TO_OUTPUT_ERROR_TEMPLATES"));
 			XMLOutputFormater.aVelocityEngineError.init(aProperties);
-		}
-		catch (final Exception e) {
-			XMLOutputFormater.logger.error("Exception : "+e.getMessage(), e);
+		} catch (final Exception e) {
+			XMLOutputFormater.logger.error("Exception : " + e.getMessage(), e);
 			e.printStackTrace();
 		}
 	}

Received on Tuesday, 17 June 2008 13:41:53 UTC