Thread: [Aglets-commits] aglets/src/com/ibm/awb/misc Encoding.java, 1.2, 1.3 PortPattern.java, 1.2, 1.3 URI
Status: Beta
Brought to you by:
cat4hire
From: Luca F. <cat...@us...> - 2009-07-28 07:05:02
|
Update of /cvsroot/aglets/aglets/src/com/ibm/awb/misc In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv18746/src/com/ibm/awb/misc Modified Files: Encoding.java PortPattern.java URIPattern.java FileUtils.java MalformedURIPatternException.java Version.java Resource.java Hexadecimal.java Log Message: Merge of experimental branch. Index: URIPattern.java =================================================================== RCS file: /cvsroot/aglets/aglets/src/com/ibm/awb/misc/URIPattern.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- URIPattern.java 27 Jul 2009 10:31:40 -0000 1.3 +++ URIPattern.java 28 Jul 2009 07:04:53 -0000 1.4 @@ -383,11 +383,19 @@ } } public String toString() { - String hostpart = HOSTNAME_LEADER + _host; + String hostpart = ""; + + // initialize hostpart only if the host is not empty + // (for the "file" URI scheme the host is parsed as empty) + if (_host != "") { + hostpart = HOSTNAME_LEADER + _host; + + // since there is a host part, add a port, too, if there is one + if (_port != null) { + hostpart = hostpart + PORT_LEADER + _port; + } + } - if (_port != null) { - hostpart = hostpart + PORT_LEADER + _port; - } return _protocol + PROTOCOL_TERMINATOR + hostpart + _file; } } Index: FileUtils.java =================================================================== RCS file: /cvsroot/aglets/aglets/src/com/ibm/awb/misc/FileUtils.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- FileUtils.java 28 Jul 2001 06:33:27 -0000 1.1.1.1 +++ FileUtils.java 28 Jul 2009 07:04:53 -0000 1.2 @@ -271,7 +271,7 @@ return (abs.toUpperCase().startsWith(path) || // - // the file is like /e:/test/bar.. + // the file is like /e:/test/memoryBar.. // (abs.charAt(0) == '/' && abs.length() > 2 && abs.charAt(2) == ':' && abs.toUpperCase().startsWith('/' + path))); Index: Version.java =================================================================== RCS file: /cvsroot/aglets/aglets/src/com/ibm/awb/misc/Version.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Version.java 27 Jul 2009 10:31:40 -0000 1.4 +++ Version.java 28 Jul 2009 07:04:53 -0000 1.5 @@ -33,17 +33,18 @@ public final class Version { - // ------------------------------------------------------------------- - // -- Instance variables. - - // -- Product information. - private String _kind = ""; + /** + * The description of the product. + */ + private String product = ""; - // -- Release information. - //-- Release information. - private int _majorVersion; - private int _minorVersion; - private int _microVersion; + /** + * Release information. + */ + private int majorVersion; + private int minorVersion; + private int microVersion; + private boolean isStable = true; /** * Creates a version object which will never expire. @@ -54,25 +55,95 @@ * @param date date of this version. */ public Version(String kind, int major, int minor, int micro) { - _kind = (kind != null) ? kind : ""; - _majorVersion = major; - _minorVersion = minor; - _microVersion = micro; + product = (kind != null) ? kind : ""; + majorVersion = major; + minorVersion = minor; + microVersion = micro; + } + + /** + * Builds a version identifier. + * @param kind the description of the product. + * @param major the major versione number M.x.x + * @param minor the minor version number x.M.x + * @param micro the micro version number x.x.M + * @param isStable true if this product is stable, false otherwise + */ + public Version(String kind, int major, int minor, int micro, boolean isStable){ + this(kind, major, minor, micro); + this.isStable = isStable; } /** * Gets the string that describes what is versioned. + * @deprecated see getProduct() */ + @Deprecated public String getKind() { - return _kind; + return this.getProduct(); } /** - * Returns a long text representation of the version numbers: - * e.g., Alpha2b, Beta1, V2.0. + * Provides a representation of the Version. The string returned is composed + * with the product kind, the major.minor.micro version and a string + * that provides information about the stable/unstable version. */ public String toString() { - return _kind + " " + - _majorVersion + "." + _minorVersion + "." + _microVersion; + StringBuffer buffer = new StringBuffer(50); + buffer.append( this.product ); + buffer.append( " - "); + buffer.append( this.majorVersion ); + buffer.append( "." ); + buffer.append( this.minorVersion ); + buffer.append( "." ); + buffer.append( this.microVersion ); + + if( this.isStable ) + buffer.append( " (stable)" ); + else + buffer.append( " (unstable)" ); + + return buffer.toString(); + + } + + /** + * Gets back the isStable. + * @return the isStable + */ + public boolean isStable() { + return isStable; + } + + /** + * Gets back the majorVersion. + * @return the majorVersion + */ + public int getMajorVersion() { + return majorVersion; + } + + /** + * Gets back the microVersion. + * @return the microVersion + */ + public int getMicroVersion() { + return microVersion; + } + + /** + * Gets back the minorVersion. + * @return the minorVersion + */ + public int getMinorVersion() { + return minorVersion; + } + + /** + * Gets back the product. + * @return the product + */ + public String getProduct() { + return product; } } Index: Resource.java =================================================================== RCS file: /cvsroot/aglets/aglets/src/com/ibm/awb/misc/Resource.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- Resource.java 27 Jul 2009 10:31:40 -0000 1.8 +++ Resource.java 28 Jul 2009 07:04:53 -0000 1.9 @@ -38,9 +38,7 @@ public class Resource { private static Hashtable resourceTable = new Hashtable(); private static Properties options = null; - private static LogCategory log - = LogInitializer.getCategory(Resource.class.getName() ); - + private static AgletsLogger logger = AgletsLogger.getLogger(Resource.class.getName()); static { /* @@ -111,7 +109,7 @@ return; } if (load(url) == false) { - log.error("Could not load resource from [" + url + "]"); + logger.error("Could not load resource from [" + url + "]"); } } /** @@ -148,7 +146,7 @@ if (resourceTable.contains(name)) { throw new SecurityException("cannot re-create existing resource"); } - log.debug("Creating resource: "+name+" url: "+file); + logger.debug("Creating resource: "+name+" url: "+file); Resource res = new Resource(file, defaults); resourceTable.put(name, res); @@ -191,7 +189,7 @@ if (value == null) { return defaultFont; } - String fontName = "Dialog"; + String fontName = "Dialogger"; int fontSize = 12; int fontStyle = Font.PLAIN; @@ -299,7 +297,7 @@ try { return v == null ? defaultValue : new URL(v); } catch (java.net.MalformedURLException ex) { - log.error("fail to convert '" + v + "' to URL", ex); + logger.error("fail to convert '" + v + "' to URL", ex); return defaultValue; } } @@ -332,12 +330,12 @@ public boolean load(URL loadFrom) { if ("file".equalsIgnoreCase(loadFrom.getProtocol())) { if (FileUtils.ensureDirectory(loadFrom.getFile()) == false) { - log.error("Could not create directory [" + loadFrom + logger.error("Could not create directory [" + loadFrom + "]"); return false; } if (FileUtils.ensureFile(loadFrom.getFile()) == false) { - log.error("Could not create file [" + loadFrom + logger.error("Could not create file [" + loadFrom + "]"); return false; } @@ -427,7 +425,7 @@ return false; } try { - log.info("saving properties into [" + saveTo + " ]"); + logger.info("saving properties into [" + saveTo + " ]"); // System.out.println(_propertyURL.getFile()); File file = new File(saveTo.getFile()); |