--- projects/cms/source/util/uk/org/iscream/cms/util/XMLPacket.java 2000/12/05 13:19:19 1.8 +++ projects/cms/source/util/uk/org/iscream/cms/util/XMLPacket.java 2000/12/12 20:44:30 1.9 @@ -8,8 +8,8 @@ import java.util.*; * Object in which to store incoming XML data * to be passed around the CORBA system. * - * @author $Author: pjm2 $ - * @version $Id: XMLPacket.java,v 1.8 2000/12/05 13:19:19 pjm2 Exp $ + * @author $Author: ajm $ + * @version $Id: XMLPacket.java,v 1.9 2000/12/12 20:44:30 ajm Exp $ */ public class XMLPacket { @@ -18,7 +18,7 @@ public class XMLPacket { /** * The current CVS revision of this class */ - public final String REVISION = "$Revision: 1.8 $"; + public final String REVISION = "$Revision: 1.9 $"; //---STATIC METHODS--- @@ -26,31 +26,41 @@ public class XMLPacket { //---PUBLIC METHODS--- - // Add a key and value pair to the HashMap. + /** + * Add a key and value pair to the HashMap. + */ public synchronized void addParam (String key, String value) { _params.put(key, value); } - // Return the value associated with a particular key. - // Returns null if the key does not exist, although - // this should not necessarily indicate that the key - // does not exist. + /** + * Return the value associated with a particular key. + * Returns null if the key does not exist, although + * this should not necessarily indicate that the key + * does not exist. + */ public synchronized String getParam (String key) { return (String) _params.get(key); } - // Return a Set of the keys in the HashMap. + /** + * Return a Set of the keys in the HashMap. + */ public synchronized Set getSet () { return _params.keySet(); } - // Find if a particular key exists in the HashMap. + /** + * Find if a particular key exists in the HashMap. + */ public synchronized boolean containsKey(String key){ return _params.containsKey(key); } - // Print out the entire HashMap. - // (Mainly for assisting debugging.) + /** + * Print out the entire HashMap. + * (Mainly for assisting debugging.) + */ public synchronized String printAll () { return _params.toString(); } @@ -59,10 +69,16 @@ public class XMLPacket { * Overrides the {@link java.lang.Object#toString() Object.toString()} * method to provide clean logging (every class should have this). * + * This uses the uk.ac.ukc.iscream.util.NameFormat class + * to format the toString() + * * @return the name of this class and its CVS revision */ - public String toString () { - return this.getClass().getName() + "(" + REVISION.substring(11, REVISION.length() - 2) + ")"; + public String toString() { + return FormatName.getName( + _name, + getClass().getName(), + REVISION); } //---PRIVATE METHODS--- @@ -72,6 +88,17 @@ public class XMLPacket { //---ATTRIBUTES--- private HashMap _params = new HashMap(); + + /** + * This is the friendly identifier of the + * component this class is running in. + * eg, a Filter may be called "filter1", + * If this class does not have an owning + * component, a name from the configuration + * can be placed here. This name could also + * be changed to null for utility classes. + */ + private String _name = null; //---STATIC ATTRIBUTES---