| 1 |
tdb |
1.3 |
//---PACKAGE DECLARATION--- |
| 2 |
ajm |
1.5 |
package uk.ac.ukc.iscream.util; |
| 3 |
tdb |
1.3 |
|
| 4 |
|
|
//---IMPORTS--- |
| 5 |
pjm2 |
1.1 |
import java.util.HashMap; |
| 6 |
|
|
|
| 7 |
tdb |
1.3 |
/** |
| 8 |
|
|
* Object in which to store incoming XML data |
| 9 |
|
|
* to be passed around the CORBA system. |
| 10 |
|
|
* |
| 11 |
tdb |
1.4 |
* @author $Author: tdb1 $ |
| 12 |
ajm |
1.5 |
* @version $Id: XMLPacket.java,v 1.4 2000/11/30 02:04:18 tdb1 Exp $ |
| 13 |
tdb |
1.3 |
*/ |
| 14 |
|
|
public class XMLPacket { |
| 15 |
|
|
|
| 16 |
|
|
//---FINAL ATTRIBUTES--- |
| 17 |
|
|
|
| 18 |
|
|
/** |
| 19 |
|
|
* The current CVS revision of this class |
| 20 |
|
|
*/ |
| 21 |
ajm |
1.5 |
public final String REVISION = "$Revision: 1.4 $"; |
| 22 |
tdb |
1.3 |
|
| 23 |
|
|
//---STATIC METHODS--- |
| 24 |
|
|
|
| 25 |
|
|
//---CONSTRUCTORS--- |
| 26 |
pjm2 |
1.1 |
|
| 27 |
tdb |
1.3 |
//---PUBLIC METHODS--- |
| 28 |
pjm2 |
1.1 |
|
| 29 |
|
|
// Add a key and value pair to the HashMap. |
| 30 |
|
|
public synchronized void addParam (String key, String value) { |
| 31 |
tdb |
1.4 |
_params.put(key, value); |
| 32 |
pjm2 |
1.1 |
// debug by println ;-) |
| 33 |
|
|
// System.out.println("Adding to hash: " + key + " = " + value); |
| 34 |
|
|
// end debug code |
| 35 |
|
|
} |
| 36 |
|
|
|
| 37 |
|
|
// Return the value associated with a particular key. |
| 38 |
|
|
// Returns null if the key does not exist, although |
| 39 |
|
|
// this should not necessarily indicate that the key |
| 40 |
|
|
// does not exist. |
| 41 |
|
|
public synchronized String getParam (String key) { |
| 42 |
tdb |
1.4 |
return (String) _params.get(key); |
| 43 |
pjm2 |
1.1 |
} |
| 44 |
|
|
|
| 45 |
|
|
// Print out the entire HashMap. |
| 46 |
|
|
// (Mainly for assisting debugging.) |
| 47 |
pjm2 |
1.2 |
public synchronized String printAll () { |
| 48 |
tdb |
1.4 |
return _params.toString(); |
| 49 |
pjm2 |
1.1 |
} |
| 50 |
|
|
|
| 51 |
tdb |
1.3 |
/** |
| 52 |
|
|
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
| 53 |
|
|
* method to provide clean logging (every class should have this). |
| 54 |
|
|
* |
| 55 |
|
|
* @return the name of this class and its CVS revision |
| 56 |
|
|
*/ |
| 57 |
|
|
public String toString() { |
| 58 |
|
|
return this.getClass().getName() + "(" + REVISION.substring(11, REVISION.length() - 2) + ")"; |
| 59 |
|
|
} |
| 60 |
|
|
|
| 61 |
|
|
//---PRIVATE METHODS--- |
| 62 |
|
|
|
| 63 |
|
|
//---ACCESSOR/MUTATOR METHODS--- |
| 64 |
|
|
|
| 65 |
|
|
//---ATTRIBUTES--- |
| 66 |
|
|
|
| 67 |
tdb |
1.4 |
private HashMap _params = new HashMap(); |
| 68 |
tdb |
1.3 |
|
| 69 |
|
|
//---STATIC ATTRIBUTES--- |
| 70 |
|
|
|
| 71 |
|
|
} |