- From: Florent Batard via cvs-syncmail <cvsmail@w3.org>
- Date: Tue, 17 Jun 2008 13:41:14 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2006/unicorn/org/w3c/unicorn/input In directory hutz:/tmp/cvs-serv11946/org/w3c/unicorn/input Modified Files: FakeUploadInputModule.java InputModule.java FileItemInputModule.java InputFactory.java URIInputModule.java UploadInputModule.java DirectInputModule.java Log Message: Updating the javadoc for all the project Index: FakeUploadInputModule.java =================================================================== RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/input/FakeUploadInputModule.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- FakeUploadInputModule.java 31 Aug 2006 09:09:25 -0000 1.1.1.1 +++ FakeUploadInputModule.java 17 Jun 2008 13:41:12 -0000 1.2 @@ -14,32 +14,61 @@ import org.w3c.unicorn.contract.EnumInputMethod; /** - * @author Damien LEROY - * + * @author Damien LEROY Class used for the fake upload input method check It + * means make the observer believe it was a direct input whereas it + * wasn't */ public class FakeUploadInputModule implements UploadInputModule { + /** + * Set the Input method to UPLOAD + */ private final EnumInputMethod aEnumInputMethod = EnumInputMethod.UPLOAD; + /** + * Content of the input + */ private String sContent = null; + + /** + * Name of the file to input + */ private String sFileName = null; + + /** + * Mime type of the input + */ private MimeType aMimeType = null; - protected FakeUploadInputModule (final InputModule aInputModule) throws IOException { + /** + * Build the input Module by setting the properties + * + * @param aInputModule + * @throws IOException + */ + protected FakeUploadInputModule(final InputModule aInputModule) + throws IOException { FakeUploadInputModule.logger.trace("Constructor"); if (FakeUploadInputModule.logger.isDebugEnabled()) { - FakeUploadInputModule.logger.debug("Input module : " + aInputModule + "."); + FakeUploadInputModule.logger.debug("Input module : " + aInputModule + + "."); } this.aMimeType = aInputModule.getMimeType(); this.sContent = aInputModule.getStringContent(); } - public String getFileName () { + /** + * Get the filename of the input + */ + public String getFileName() { FakeUploadInputModule.logger.trace("getFileName"); return this.sFileName; } - public InputStream getInputStream () throws IOException { + /** + * Get the stream of the input using the content + */ + public InputStream getInputStream() throws IOException { FakeUploadInputModule.logger.trace("getInputStream"); final PipedOutputStream aPipedOutputStream = new PipedOutputStream(); aPipedOutputStream.write(this.sContent.getBytes()); @@ -49,17 +78,17 @@ return aPipedInputStream; } - public EnumInputMethod getEnumInputMethod () { + public EnumInputMethod getEnumInputMethod() { FakeUploadInputModule.logger.trace("getEnumInputMethod"); return this.aEnumInputMethod; } - public MimeType getMimeType () { + public MimeType getMimeType() { FakeUploadInputModule.logger.trace("getMimeType"); return this.aMimeType; } - public Object getParameterValue () { + public Object getParameterValue() { FakeUploadInputModule.logger.trace("getParameterValue"); return this.sContent; } @@ -69,11 +98,17 @@ return this.sContent; } - public void dispose () { + /** + * Dispose the object + */ + public void dispose() { FakeUploadInputModule.logger.trace("dispose"); } - public String toString () { + /** + * prints the object + */ + public String toString() { final int iStringBufferSize = 500; final StringBuffer aStringBuffer = new StringBuffer(iStringBufferSize); aStringBuffer.append("FakeUploadInputModule"); Index: DirectInputModule.java =================================================================== RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/input/DirectInputModule.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- DirectInputModule.java 31 Aug 2006 09:09:25 -0000 1.1.1.1 +++ DirectInputModule.java 17 Jun 2008 13:41:12 -0000 1.2 @@ -11,66 +11,99 @@ import org.w3c.unicorn.contract.EnumInputMethod; /** - * @author Damien LEROY - * + * @author Damien LEROY Class used for the direct input method check */ public class DirectInputModule implements InputModule { + /** + * Sets the input method to DIRECT + */ private final EnumInputMethod aEnumInputMethod = EnumInputMethod.DIRECT; + /** + * Parameter used for the direct call + */ private String sInput = null; + + /** + * Mime-type used for the call + */ private MimeType aMimeType = null; - protected DirectInputModule ( - final MimeType aMimeType, + /** + * Build the DirectInput Module by filling the properties + * + * @param aMimeType + * mime-type of the module + * @param oInputParameterValue + * input parameter for the module + */ + protected DirectInputModule(final MimeType aMimeType, final Object oInputParameterValue) { DirectInputModule.logger.trace("Constructor"); if (DirectInputModule.logger.isDebugEnabled()) { DirectInputModule.logger.debug("Mime type : " + aMimeType + "."); - DirectInputModule.logger.debug("Input parameter value : " + oInputParameterValue + "."); + DirectInputModule.logger.debug("Input parameter value : " + + oInputParameterValue + "."); } if (!(oInputParameterValue instanceof String)) { - throw new IllegalArgumentException("Object oInputParameterValue : " + oInputParameterValue.toString() + "."); + throw new IllegalArgumentException("Object oInputParameterValue : " + + oInputParameterValue.toString() + "."); } this.aMimeType = aMimeType; this.sInput = (String) oInputParameterValue; } - protected DirectInputModule ( - final InputModule aInputModule) throws IOException { + /** + * Constructor for the Direct Input Module + * + * @param aInputModule + * InputModule to nest into a direct input module + * @throws IOException + * for unknown error + */ + protected DirectInputModule(final InputModule aInputModule) + throws IOException { DirectInputModule.logger.trace("Constructor"); if (DirectInputModule.logger.isDebugEnabled()) { - DirectInputModule.logger.debug("Input module : " + aInputModule + "."); + DirectInputModule.logger.debug("Input module : " + aInputModule + + "."); } this.sInput = aInputModule.getStringContent(); this.aMimeType = aInputModule.getMimeType(); } - public EnumInputMethod getEnumInputMethod () { + public EnumInputMethod getEnumInputMethod() { DirectInputModule.logger.trace("getEnumInputMethod"); return this.aEnumInputMethod; } - public MimeType getMimeType () { + public MimeType getMimeType() { DirectInputModule.logger.trace("getMimeType"); return this.aMimeType; } - public Object getParameterValue () { + public Object getParameterValue() { DirectInputModule.logger.trace("getParameterValue"); return this.sInput; } - public String getStringContent () { + public String getStringContent() { DirectInputModule.logger.trace("getStringContent"); return this.sInput; } - public void dispose () { + /** + * Dispose the object + */ + public void dispose() { DirectInputModule.logger.trace("dispose"); } - public String toString () { + /** + * Prints the object + */ + public String toString() { final int iStringBufferSize = 500; final StringBuffer aStringBuffer = new StringBuffer(iStringBufferSize); aStringBuffer.append("DirectInputModule"); Index: URIInputModule.java =================================================================== RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/input/URIInputModule.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- URIInputModule.java 25 Sep 2006 15:42:55 -0000 1.2 +++ URIInputModule.java 17 Jun 2008 13:41:12 -0000 1.3 @@ -18,33 +18,63 @@ import org.w3c.unicorn.util.Property; /** - * @author Damien LEROY - * + * @author Damien LEROY Class used to deal with the URI method for inputs */ public class URIInputModule implements InputModule { + /** + * Sets the method of input to URI + */ private final EnumInputMethod aEnumInputMethod = EnumInputMethod.URI; + /** + * Mime-type of the input + */ private MimeType aMimeType = null; + + /** + * URI of the input + */ private String sURI = null; + + /** + * File found at the URI + */ private File aFile = null; - protected URIInputModule ( - final MimeType aMimeType, + /** + * Constructor of the URI input module + * + * @param aMimeType + * mime-type of the input + * @param oInputParameterValue + * parameter of the input + */ + protected URIInputModule(final MimeType aMimeType, final Object oInputParameterValue) { URIInputModule.logger.trace("Constructor."); if (URIInputModule.logger.isDebugEnabled()) { - URIInputModule.logger.debug("oInputParameterValue : " + oInputParameterValue + "."); + URIInputModule.logger.debug("oInputParameterValue : " + + oInputParameterValue + "."); } if (!(oInputParameterValue instanceof String)) { - throw new IllegalArgumentException("Object oInputParameterValue : " + oInputParameterValue.toString() + "."); + throw new IllegalArgumentException("Object oInputParameterValue : " + + oInputParameterValue.toString() + "."); } this.aMimeType = aMimeType; this.sURI = (String) oInputParameterValue; this.sURI = EscapeXMLEntities.escapeText(this.sURI); } - protected URIInputModule (final InputModule aInputModule) throws IOException { + /** + * Copy an input module into a URI method module + * + * @param aInputModule + * input to copy + * @throws IOException + * odd error occurs + */ + protected URIInputModule(final InputModule aInputModule) throws IOException { URIInputModule.logger.trace("Constructor."); if (URIInputModule.logger.isDebugEnabled()) { URIInputModule.logger.debug("InputModule : " + aInputModule + "."); @@ -52,10 +82,13 @@ this.aMimeType = aInputModule.getMimeType(); final Date aDate = new Date(); final String sFileName; - sFileName = "tmp_" + aDate.getTime() + "_." + Framework.aPropertiesExtension.getProperty(this.aMimeType.toString()); - this.aFile = new File( - Property.get("PATH_TO_TEMPORARY_FILES") + - sFileName); + sFileName = "tmp_" + + aDate.getTime() + + "_." + + Framework.aPropertiesExtension.getProperty(this.aMimeType + .toString()); + this.aFile = new File(Property.get("PATH_TO_TEMPORARY_FILES") + + sFileName); this.aFile.createNewFile(); final PrintWriter aPrintWriter = new PrintWriter(aFile); aPrintWriter.print(aInputModule.getStringContent()); @@ -63,22 +96,22 @@ this.sURI = Property.get("URL_TO_TEMPORARY_FILES") + sFileName; } - public EnumInputMethod getEnumInputMethod () { + public EnumInputMethod getEnumInputMethod() { URIInputModule.logger.trace("getEnumInputMethod"); return this.aEnumInputMethod; } - public MimeType getMimeType () { + public MimeType getMimeType() { URIInputModule.logger.trace("getMimeType"); return this.aMimeType; } - public Object getParameterValue () { + public Object getParameterValue() { URIInputModule.logger.trace("getParameterValue"); return this.sURI; } - public String getStringContent () throws IOException { + public String getStringContent() throws IOException { URIInputModule.logger.trace("getString."); final URL aURL = new URL(this.sURI); final String sResult = (String) aURL.openConnection().getContent(); @@ -88,12 +121,15 @@ return sResult; } - public String getURI () { + public String getURI() { URIInputModule.logger.trace("getURI"); return this.sURI; } - public void dispose () { + /** + * Dispose the object + */ + public void dispose() { URIInputModule.logger.trace("dispose"); if (null != this.aFile && this.aFile.delete()) { URIInputModule.logger.info("File deleted."); @@ -101,7 +137,10 @@ } } - public String toString () { + /** + * Prints the object + */ + public String toString() { final int iStringBufferSize = 500; final StringBuffer aStringBuffer = new StringBuffer(iStringBufferSize); aStringBuffer.append("URIInputModule"); Index: InputFactory.java =================================================================== RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/input/InputFactory.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- InputFactory.java 31 Aug 2006 09:09:25 -0000 1.1.1.1 +++ InputFactory.java 17 Jun 2008 13:41:12 -0000 1.2 @@ -14,104 +14,166 @@ import org.w3c.unicorn.contract.EnumInputMethod; /** - * @author Damien LEROY - * + * @author Damien LEROY Class which deals with the creation of input method */ public class InputFactory { + /** + * Object used for complex logging purpose + */ private static final Log logger = InputModule.logger; - public static InputModule createInputModule ( - final MimeType aMimeType, + /** + * Used to create an inputModule + * + * @param aMimeType + * the mime-type of the input + * @param aEnumInputMethod + * the method used for the input + * @param oInputParameterValue + * the parameter for the input + * @return an input Module ready to use + */ + public static InputModule createInputModule(final MimeType aMimeType, final EnumInputMethod aEnumInputMethod, final Object oInputParameterValue) { InputFactory.logger.trace("createInputModule"); if (InputFactory.logger.isDebugEnabled()) { InputFactory.logger.debug("Mime type : " + aMimeType + "."); - InputFactory.logger.debug("Input method : " + aEnumInputMethod + "."); - InputFactory.logger.debug("Input parameter value : " + oInputParameterValue + "."); + InputFactory.logger.debug("Input method : " + aEnumInputMethod + + "."); + InputFactory.logger.debug("Input parameter value : " + + oInputParameterValue + "."); } switch (aEnumInputMethod) { - case DIRECT : - return new DirectInputModule(aMimeType, oInputParameterValue); - case UPLOAD : - return new FileItemInputModule(aMimeType, oInputParameterValue); - case URI : - return new URIInputModule(aMimeType, oInputParameterValue); + case DIRECT: + return new DirectInputModule(aMimeType, oInputParameterValue); + case UPLOAD: + return new FileItemInputModule(aMimeType, oInputParameterValue); + case URI: + return new URIInputModule(aMimeType, oInputParameterValue); } return null; } + /** + * Data structure for all the input modules + */ private Map<EnumInputMethod, InputModule> mapOfInputModule = null; + + /** + * Default input module + */ private InputModule aInputModuleDefault = null; - public InputFactory ( - final MimeType aMimeType, + /** + * Constructor of the input factory + * + * @param aMimeType + * mime-type of the input + * @param aEnumInputMethod + * method used for the input + * @param oInputParameterValue + * parameter of the input + */ + public InputFactory(final MimeType aMimeType, final EnumInputMethod aEnumInputMethod, final Object oInputParameterValue) { InputFactory.logger.trace("Constructor"); if (InputFactory.logger.isDebugEnabled()) { InputFactory.logger.debug("Mime type : " + aMimeType + "."); - InputFactory.logger.debug("Input method : " + aEnumInputMethod + "."); - InputFactory.logger.debug("Input parameter value : " + oInputParameterValue + "."); + InputFactory.logger.debug("Input method : " + aEnumInputMethod + + "."); + InputFactory.logger.debug("Input parameter value : " + + oInputParameterValue + "."); } this.mapOfInputModule = new LinkedHashMap<EnumInputMethod, InputModule>(); - this.aInputModuleDefault = InputFactory.createInputModule(aMimeType, aEnumInputMethod, oInputParameterValue); + this.aInputModuleDefault = InputFactory.createInputModule(aMimeType, + aEnumInputMethod, oInputParameterValue); this.mapOfInputModule.put(aEnumInputMethod, this.aInputModuleDefault); } - public InputModule getInputModule ( - final EnumInputMethod aEnumInputMethod) throws IOException { + /** + * Get an input module depending on its method + * + * @param aEnumInputMethod + * method used for the input + * @return the input module found or created + * @throws IOException + * odd error occured + */ + public InputModule getInputModule(final EnumInputMethod aEnumInputMethod) + throws IOException { InputFactory.logger.trace("getInputModule"); if (InputFactory.logger.isDebugEnabled()) { - InputFactory.logger.debug("Input method : " + aEnumInputMethod + "."); + InputFactory.logger.debug("Input method : " + aEnumInputMethod + + "."); } - final InputModule aInputModule = this.mapOfInputModule.get(aEnumInputMethod); + final InputModule aInputModule = this.mapOfInputModule + .get(aEnumInputMethod); if (null != aInputModule) { return aInputModule; } return this.createInputModule(aEnumInputMethod); } - public InputModule createInputModule ( - final EnumInputMethod aEnumInputMethod) throws IOException { + /** + * Creation of an input module + * + * @param aEnumInputMethod + * method of the input module + * @return a new input module + * @throws IOException + * odd error occured + */ + public InputModule createInputModule(final EnumInputMethod aEnumInputMethod) + throws IOException { InputFactory.logger.trace("createInputModule"); if (InputFactory.logger.isDebugEnabled()) { - InputFactory.logger.debug("Input method : " + aEnumInputMethod + "."); + InputFactory.logger.debug("Input method : " + aEnumInputMethod + + "."); } switch (aEnumInputMethod) { - case DIRECT : - return new DirectInputModule(this.aInputModuleDefault); - case UPLOAD : - return new FakeUploadInputModule(this.aInputModuleDefault); - case URI : - return new URIInputModule(this.aInputModuleDefault); + case DIRECT: + return new DirectInputModule(this.aInputModuleDefault); + case UPLOAD: + return new FakeUploadInputModule(this.aInputModuleDefault); + case URI: + return new URIInputModule(this.aInputModuleDefault); } return null; } - public MimeType getMimeType () { + public MimeType getMimeType() { InputFactory.logger.trace("getMimetype"); return this.aInputModuleDefault.getMimeType(); } - public InputModule getDefaultInputModule () { + public InputModule getDefaultInputModule() { InputFactory.logger.trace("getDefaultInputModule"); return this.aInputModuleDefault; } - public void dispose () { + /** + * Dispose the object + * + */ + public void dispose() { InputFactory.logger.trace("dispose"); for (final InputModule aInputModule : this.mapOfInputModule.values()) { aInputModule.dispose(); } } - public String toString () { + /** + * Prints the object + */ + public String toString() { final int iStringBufferSize = 500; final StringBuffer aStringBuffer = new StringBuffer(iStringBufferSize); aStringBuffer.append("InputFactory").append("\n"); - aStringBuffer.append("Default : ").append(this.aInputModuleDefault.getEnumInputMethod()).append("\n"); + aStringBuffer.append("Default : ").append( + this.aInputModuleDefault.getEnumInputMethod()).append("\n"); for (final InputModule aInputModule : this.mapOfInputModule.values()) { aStringBuffer.append(aInputModule).append("\n"); } Index: FileItemInputModule.java =================================================================== RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/input/FileItemInputModule.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- FileItemInputModule.java 31 Aug 2006 09:09:25 -0000 1.1.1.1 +++ FileItemInputModule.java 17 Jun 2008 13:41:12 -0000 1.2 @@ -14,68 +14,83 @@ /** * @author Damien LEROY - * + * */ public class FileItemInputModule implements UploadInputModule { + /** + * Sets the input method to UPLOAD + */ private final EnumInputMethod aEnumInputMethod = EnumInputMethod.UPLOAD; + /** + * The file item + */ private FileItem aFileItem = null; + + /** + * The mime-type of the file + */ private MimeType aMimeType = null; - protected FileItemInputModule ( - final MimeType aMimeType, + /** + * Build the Input module + * + * @param aMimeType + * mime-type of the file for the input + * @param oInputParameterValue + * parameter of the input + */ + protected FileItemInputModule(final MimeType aMimeType, final Object oInputParameterValue) { FileItemInputModule.logger.trace("Constructor"); if (FileItemInputModule.logger.isDebugEnabled()) { FileItemInputModule.logger.debug("Mime type : " + aMimeType + "."); - FileItemInputModule.logger.debug("Input parameter value : " + oInputParameterValue + "."); + FileItemInputModule.logger.debug("Input parameter value : " + + oInputParameterValue + "."); } if (!(oInputParameterValue instanceof FileItem)) { - throw new IllegalArgumentException("Object oInputParameterValue : " + oInputParameterValue.toString() + "."); + throw new IllegalArgumentException("Object oInputParameterValue : " + + oInputParameterValue.toString() + "."); } this.aMimeType = aMimeType; this.aFileItem = (FileItem) oInputParameterValue; } -/* - protected FileItemInputModule ( - final InputModule aInputModule) { - FileItemInputModule.logger.trace("Constructor."); - // maybe use a FakeUploadInputModule - //this.aFileItem = DiskFileItemFactory.createItem(); - } -*/ - public EnumInputMethod getEnumInputMethod () { + + public EnumInputMethod getEnumInputMethod() { FileItemInputModule.logger.trace("getEnumInputMethod"); return this.aEnumInputMethod; } - public String getFileName () { + public String getFileName() { FileItemInputModule.logger.trace("getFileName"); return this.aFileItem.getName(); } - public InputStream getInputStream () throws IOException { + public InputStream getInputStream() throws IOException { FileItemInputModule.logger.trace("getInputStream"); return this.aFileItem.getInputStream(); } - public MimeType getMimeType () { + public MimeType getMimeType() { FileItemInputModule.logger.trace("getMimeType"); return this.aMimeType; } - public Object getParameterValue () { + public Object getParameterValue() { FileItemInputModule.logger.trace("getParameterValue"); return this.aFileItem; } - public String getStringContent () { + public String getStringContent() { FileItemInputModule.logger.trace("getStringContent"); return this.aFileItem.getString(); } - public void dispose () { + /** + * Dispose the object + */ + public void dispose() { FileItemInputModule.logger.trace("dispose"); if (null != this.aFileItem) { this.aFileItem.delete(); @@ -83,7 +98,10 @@ } } - public String toString () { + /** + * Prints the object + */ + public String toString() { final int iStringBufferSize = 500; final StringBuffer aStringBuffer = new StringBuffer(iStringBufferSize); aStringBuffer.append("FileItemInputModule"); Index: InputModule.java =================================================================== RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/input/InputModule.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- InputModule.java 31 Aug 2006 09:09:25 -0000 1.1.1.1 +++ InputModule.java 17 Jun 2008 13:41:12 -0000 1.2 @@ -13,21 +13,23 @@ import org.w3c.unicorn.contract.EnumInputMethod; /** - * @author Damien LEROY - * + * @author Damien LEROY Interface for an input module */ public interface InputModule { public static final Log logger = LogFactory.getLog("org.w3c.unicorn.input"); - public EnumInputMethod getEnumInputMethod (); - public MimeType getMimeType (); - public Object getParameterValue (); - public String getStringContent () throws IOException; + public EnumInputMethod getEnumInputMethod(); + + public MimeType getMimeType(); + + public Object getParameterValue(); + + public String getStringContent() throws IOException; /** * Make all action necessary to remove input module. */ - public void dispose (); + public void dispose(); } Index: UploadInputModule.java =================================================================== RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/input/UploadInputModule.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- UploadInputModule.java 31 Aug 2006 09:09:25 -0000 1.1.1.1 +++ UploadInputModule.java 17 Jun 2008 13:41:12 -0000 1.2 @@ -10,15 +10,14 @@ import org.w3c.unicorn.contract.EnumInputMethod; /** - * @author Damien LEROY - * + * @author Damien LEROY Interface for the UploadInputModule */ public interface UploadInputModule extends InputModule { public final EnumInputMethod aEnumInputMethod = EnumInputMethod.UPLOAD; - public String getFileName (); + public String getFileName(); - public InputStream getInputStream () throws IOException; + public InputStream getInputStream() throws IOException; }
Received on Tuesday, 17 June 2008 13:41:53 UTC