- From: Jonathan Barouh via cvs-syncmail <cvsmail@w3.org>
- Date: Tue, 17 Jun 2008 13:45:33 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2006/unicorn/org/w3c/unicorn/util In directory hutz:/tmp/cvs-serv14031/org/w3c/unicorn/util Modified Files: LocaleFactory.java unicorn.properties Unmarshaller.java LocalizedString.java Property.java ClientHttpRequest.java Log Message: Updating Javadoc for the project. Index: LocalizedString.java =================================================================== RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/util/LocalizedString.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- LocalizedString.java 18 Apr 2008 12:35:22 -0000 1.4 +++ LocalizedString.java 17 Jun 2008 13:45:31 -0000 1.5 @@ -24,20 +24,42 @@ private Map<String, String> mapOfString = null; + /** + * Default constructor for LocalizedString. + * + */ public LocalizedString () { LocalizedString.logger.trace("Constructor"); this.mapOfString = new LinkedHashMap<String, String>(); } + /** + * Constructs a LocalizedString with an initial string paired with a language. + * @param s The string to be localized. + * @param lang The corresponding language. + */ public LocalizedString (String s, String lang) { this(); mapOfString.put(lang, s); } + /** + * Looks for the existence of a specified sLocale string in the map. + * @param sLocale The string to look for. + * @return True if the sLocale string is in the map, else false. + */ public boolean hasLocale (final String sLocale) { return null != this.mapOfString.get(sLocale); } + /** + * Adds a message and its corresponding localization + * to the mapOfString attribute. + * @param sLocale The localization. + * @param sMessage The message to be written. + * @return The previous value associated with + * specified key, or null if there was no mapping for key. + */ public String addLocalization ( final String sLocale, final String sMessage) { @@ -49,6 +71,13 @@ return this.mapOfString.put(sLocale, sMessage); } + /** + * Finds and returns the message corresponding to the specified + * localization in the mapOfString. + * @param sLocale The localization wanted. + * @return The message corresponding to the localization + * or if there's none, the one corresponding to the default language. + */ public String getLocalization (final String sLocale) { final String sMessage = this.mapOfString.get(sLocale); if (null != sMessage) { @@ -57,12 +86,18 @@ return this.mapOfString.get(LocalizedString.DEFAULT_LANGUAGE); } + /** + * Returns the keys available in the mapOfString. + * @return A set with all the keys. + */ public Set<String> getSetOfLocale () { return this.mapOfString.keySet(); } - // return the message in DEFAULT_LANGUAGE (en) or in the first language in - // the list + /** + * Returns the message in in DEFAULT_LANGUAGE (en) or in the first language + * in the list. + */ public String toString () { String res = this.mapOfString.get(LocalizedString.DEFAULT_LANGUAGE); if (res==null) { Index: Unmarshaller.java =================================================================== RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/util/Unmarshaller.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- Unmarshaller.java 31 Aug 2006 09:09:28 -0000 1.1.1.1 +++ Unmarshaller.java 17 Jun 2008 13:45:31 -0000 1.2 @@ -18,6 +18,7 @@ public interface Unmarshaller { public void addURL (final URL aURL) throws IOException, JAXBException, SAXException; + public void unmarshal () throws Exception; } Index: LocaleFactory.java =================================================================== RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/util/LocaleFactory.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- LocaleFactory.java 31 Aug 2006 09:09:28 -0000 1.1.1.1 +++ LocaleFactory.java 17 Jun 2008 13:45:31 -0000 1.2 @@ -17,10 +17,19 @@ private static final LinkedHashMap<String, Locale> mapOfLocale = new LinkedHashMap<String, Locale>(); + /** + * Finds a Locale object among the mapOfLocale entries, given its name. + * @param sLocale The name of the Locale. + * @return The corresponding Locale object. + */ public static Locale getLocale (final String sLocale) { return LocaleFactory.mapOfLocale.get(sLocale); } + /** + * Returns the values available in the mapOfLocale. + * @return The collection of values. + */ public static Collection<Locale> values () { return LocaleFactory.mapOfLocale.values(); } Index: ClientHttpRequest.java =================================================================== RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/util/ClientHttpRequest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ClientHttpRequest.java 29 Nov 2007 14:11:58 -0000 1.3 +++ ClientHttpRequest.java 17 Jun 2008 13:45:31 -0000 1.4 @@ -39,6 +39,11 @@ ClientHttpRequest.randomString() + ClientHttpRequest.randomString(); + + /** + * Connects to the output stream of the URLConnection. + * @throws IOException + */ private void connect () throws IOException { //ClientHttpRequest.logger.trace("connect"); if (null == this.aOutputStream) { @@ -46,33 +51,60 @@ } } + /** + * Writes a single character on the output stream. + * @param c The character to write. + * @throws IOException + */ private void write (final char c) throws IOException { this.connect(); ClientHttpRequest.logger.debug(c); this.aOutputStream.write(c); } + /** + * Writes a character string on the output stream. + * @param s The string to write. + * @throws IOException + */ protected void write (final String s) throws IOException { this.connect(); ClientHttpRequest.logger.debug(s); this.aOutputStream.write(s.getBytes()); } + /** + * Writes a new line on the output stream (carriage return). + * @throws IOException + */ protected void newline () throws IOException { this.connect(); this.write("\r\n"); } + /** + * Writes a string and a new line on the output stream. + * @param s The string to write before the new line. + * @throws IOException + */ protected void writeln (final String s) throws IOException { this.connect(); this.write(s); this.newline(); } + /** + * Computes a random string. + * @return A string containing a random long which radix is 36. + */ protected static String randomString () { return Long.toString(ClientHttpRequest.aRandom.nextLong(), 36); } + /** + * Writes the sBoundary on the output, composed of three random strings. + * @throws IOException + */ private void boundary () throws IOException { this.write("--"); this.write(this.sBoundary); @@ -159,11 +191,20 @@ } } + /** + * Sets a new language. + * @param sLang The new language chosen. + */ public void setLang (final String sLang) { ClientHttpRequest.logger.debug("setLang("+sLang+")"); this.aURLConnection.setRequestProperty("Accept-Language", sLang); } + /** + * Writes a name in the appropriate format on the output. + * @param sName The name to write. + * @throws IOException + */ private void writeName (final String sName) throws IOException { this.newline(); this.write("Content-Disposition: form-data; name=\""); @@ -192,6 +233,12 @@ this.writeln(sValue); } + /** + * + * @param aInputStream + * @param aOutputStream + * @throws IOException + */ private static void pipe ( final InputStream aInputStream, final OutputStream aOutputStream) throws IOException { Index: Property.java =================================================================== RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/util/Property.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Property.java 18 Apr 2008 12:35:22 -0000 1.2 +++ Property.java 17 Jun 2008 13:45:31 -0000 1.3 @@ -24,6 +24,10 @@ private static final Log logger = LogFactory.getLog(Property.class); private static final Map<String, Property> mapOfProperty = new Hashtable<String, Property>(); + /** + * Adds a Property object to the static mapOfProperty. + * @param aProperty The Property to be add. + */ private static void addProperty (final Property aProperty) { Property.logger.trace("addProperty"); if (Property.logger.isDebugEnabled()) { @@ -33,14 +37,30 @@ Property.mapOfProperty.put(aProperty.getID(), aProperty); } + /** + * Finds a Property in the map given its ID. + * @param sID The ID of the Property wanted. + * @return The corresponding Property object + * or null if there's none. + */ public static Property getProperty (final String sID) { return Property.mapOfProperty.get(sID); } + /** + * Gets the value of a Property in the map given its ID. + * @param sID The ID of the Property wanted. + * @return The value of the corresponding Property + * or null if there's none. + */ public static String get (final String sID) { return Property.mapOfProperty.get(sID).getValue(); } + /** + * Adds the given properties in the map. + * @param aProperties The properties to be loaded. + */ public static void load (final Properties aProperties) { Property.logger.trace("load"); for ( @@ -52,6 +72,11 @@ } } + /** + * Adds a Property in the map with the given name and value. + * @param sPropName The name of the Property. + * @param sPropValue The value of the Property. + */ private static void parseValue (final String sPropName, final String sPropValue) { Property.logger.trace("parseValue"); if (Property.logger.isDebugEnabled()) { @@ -100,27 +125,51 @@ private String sSpecificElement = ""; private String sID = null; + /** + * Gives the ID of the current Property. + * @return The ID of the Property. + */ private String getID () { return this.sID; } + /** + * Sets the ID of the Property. + * @param sID The ID to set. + */ private void setID (final String sID) { this.sID = sID; } + /** + * Adds a Property to the listOfElement. + * @param aProperty The property to add. + */ private void addElement (final Property aProperty) { this.listOfElement.add(aProperty); } + /** + * Erases the contents of listOfElement. + * + */ public void clear () { this.listOfElement.clear(); this.sSpecificElement = ""; } + /** + * Sets a specific element in the list. + * @param sSpecific The name of the specific element. + */ public void setSpecific (final String sSpecific) { this.sSpecificElement = sSpecific; } + /** + * Gives the value of the Property. + * @return The value of the Property. + */ public String getValue () { final int iStringBufferSize = 500; final StringBuffer aStringBuffer = new StringBuffer(iStringBufferSize); @@ -161,6 +210,10 @@ } } + /** + * For each Property in the map, prints its ID and value. + * @param tArgument + */ public static void main (final String[] tArgument) { System.out.println("Begin."); Index: unicorn.properties =================================================================== RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/util/unicorn.properties,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- unicorn.properties 18 Apr 2008 12:35:22 -0000 1.4 +++ unicorn.properties 17 Jun 2008 13:45:31 -0000 1.5 @@ -1,6 +1,6 @@ -UNICORN_URL = http://localhost:8180/unicorn/ -UNICORN_HOME = /var/lib/tomcat55/webapps/unicorn/ +UNICORN_URL = http://localhost:8080/unicorn/ +UNICORN_HOME = D:\barouh\Tomcat 6.0\webapps\unicorn UNICORN_ENCODING = UTF-8 UNICORN_PARAMETER_PREFIX = ucn_
Received on Tuesday, 17 June 2008 13:46:09 UTC