[Jukebox-cvs] CVS update: J4/src/java/gnu/j4/config XmlConfiguration.java Configuration.java Makefil
Brought to you by:
vtt
From: CVS B. <vt...@fr...> - 2000-08-24 20:35:33
|
User: vt Date: 00/08/24 13:35:50 Modified: src/java/gnu/j4/config Configuration.java Makefile.am Added: src/java/gnu/j4/config XmlConfiguration.java Log: Patchlevel bump. - Incorporated changes made in the JAXP branch - Added the local configuration options support Revision Changes Path 1.31 +33 -20 J4/src/java/gnu/j4/config/Configuration.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/config/Configuration.java?annotate=1.31&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/config/Configuration.java?rev=1.31&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/config/Configuration.java.diff?r1=1.31&r2=1.30&cvsroot=jukebox4 ----------------------------------- Index: Configuration.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/config/Configuration.java,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- Configuration.java 2000/07/25 17:42:28 1.30 +++ Configuration.java 2000/08/24 20:35:49 1.31 @@ -25,7 +25,7 @@ * target=_top>Java-Apache Project</a> in general and code written by <a * href="mailto:st...@ap...">Stefano Mazzocchi</a> in particular. * - * @version $Id: Configuration.java,v 1.30 2000/07/25 17:42:28 vt Exp $ + * @version $Id: Configuration.java,v 1.31 2000/08/24 20:35:49 vt Exp $ */ public class Configuration extends Hashtable { @@ -519,45 +519,58 @@ * If there's already existing value[s], the value is added into the * sequence of values. * + * <p> + * + * <strong>NOTE:</strong> it is not possible to distinguish between the + * <code>Vector</code> that is a value itself and the + * <code>Vector</code> that is a collection of other values. Caveat + * emptor. + * * @param key The key. * * @param value The value. - * - * @exception IllegalArgumentException if the argument is neither - * <code>String</code> nor <code>Vector</code>. */ - public void put(String key, String value) { + public void put(String key, Object value) { + Object found = super.get(key); if ( found == null ) { + + // OK, we don't have to fiddle with the sequence + super.put(key, value); return; + } if ( found instanceof Vector ) { + + // OK, there's existing sequence already. + Vector vFound = (Vector)found; if ( vFound.indexOf(value) == -1 ) { + vFound.addElement(value); + return; + + } else { + + // Oh well, it's already there, I'm not going to add a + // duplicate } - return; - } - - if ( found instanceof String ) { - String first = (String)found; - super.remove(key); - Vector set = new Vector(); - set.addElement(first); - set.addElement(value); - super.put(key, set); - return; } - throw new IllegalArgumentException(key - + " maps to " - + found.getClass().getName() - + ", String/Vector expected"); + // Now, we know for sure that some object is already set to be the + // configuration value, and it's not a collection (well, Vector), so + // we have to create a collection and add new value to it. + + super.remove(key); + Vector set = new Vector(); + set.addElement(found); + set.addElement(value); + super.put(key, set); } /** 1.9 +12 -7 J4/src/java/gnu/j4/config/Makefile.am CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/config/Makefile.am?annotate=1.9&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/config/Makefile.am?rev=1.9&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/config/Makefile.am.diff?r1=1.9&r2=1.8&cvsroot=jukebox4 ----------------------------------- Index: Makefile.am =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/config/Makefile.am,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- Makefile.am 2000/07/06 10:47:03 1.8 +++ Makefile.am 2000/08/24 20:35:49 1.9 @@ -1,23 +1,28 @@ -# $Id: Makefile.am,v 1.8 2000/07/06 10:47:03 vt Exp $ +# $Id: Makefile.am,v 1.9 2000/08/24 20:35:49 vt Exp $ BASE_FILES = ConfigReader.java \ Configuration.java \ PropertiesReader.java -if JSDK - JSDK_FILES = ServletConfigReader.java +XERCES_FILES = XmlConfiguration.java +if JSDK +JSDK_SUBSET = ${JSDK_FILES} else - -JSDK_FILES = +JSDK_SUBSET = +endif +if XERCES +XERCES_SUBSET = ${XERCES_FILES} +else +XERCES_SUBSET = endif -EXTRA_DIST = package.html ServletConfigReader.java +EXTRA_DIST = package.html ${JSDK_FILES} ${XERCES_FILES} noinst_PROGRAMS = package -package_SOURCES = ${BASE_FILES} ${JSDK_FILES} +package_SOURCES = ${BASE_FILES} ${JSDK_FILES} ${XERCES_SUBSET} ECHO = @ECHO@ JAVACX = @JAVACX@ 1.2 +287 -0 J4/src/java/gnu/j4/config/XmlConfiguration.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/config/XmlConfiguration.java?annotate=1.2&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/config/XmlConfiguration.java?rev=1.2&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/config/XmlConfiguration.java.diff?r1=1.2&r2=1.1&cvsroot=jukebox4 ----------------------------------- |