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.7 |
import java.util.*; |
6 |
pjm2 |
1.1 |
|
7 |
tdb |
1.3 |
/** |
8 |
|
|
* Object in which to store incoming XML data |
9 |
|
|
* to be passed around the CORBA system. |
10 |
|
|
* |
11 |
pjm2 |
1.7 |
* @author $Author: pjm2 $ |
12 |
pjm2 |
1.8 |
* @version $Id: XMLPacket.java,v 1.7 2000/12/05 12:26:22 pjm2 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 |
pjm2 |
1.8 |
public final String REVISION = "$Revision: 1.7 $"; |
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 |
pjm2 |
1.6 |
_params.put(key, value); |
32 |
pjm2 |
1.1 |
} |
33 |
|
|
|
34 |
|
|
// Return the value associated with a particular key. |
35 |
|
|
// Returns null if the key does not exist, although |
36 |
|
|
// this should not necessarily indicate that the key |
37 |
|
|
// does not exist. |
38 |
|
|
public synchronized String getParam (String key) { |
39 |
tdb |
1.4 |
return (String) _params.get(key); |
40 |
pjm2 |
1.1 |
} |
41 |
|
|
|
42 |
pjm2 |
1.7 |
// Return a Set of the keys in the HashMap. |
43 |
|
|
public synchronized Set getSet () { |
44 |
|
|
return _params.keySet(); |
45 |
pjm2 |
1.8 |
} |
46 |
|
|
|
47 |
|
|
// Find if a particular key exists in the HashMap. |
48 |
|
|
public synchronized boolean containsKey(String key){ |
49 |
|
|
return _params.containsKey(key); |
50 |
pjm2 |
1.7 |
} |
51 |
|
|
|
52 |
pjm2 |
1.1 |
// Print out the entire HashMap. |
53 |
|
|
// (Mainly for assisting debugging.) |
54 |
pjm2 |
1.2 |
public synchronized String printAll () { |
55 |
tdb |
1.4 |
return _params.toString(); |
56 |
pjm2 |
1.1 |
} |
57 |
|
|
|
58 |
tdb |
1.3 |
/** |
59 |
|
|
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
60 |
|
|
* method to provide clean logging (every class should have this). |
61 |
|
|
* |
62 |
|
|
* @return the name of this class and its CVS revision |
63 |
|
|
*/ |
64 |
pjm2 |
1.7 |
public String toString () { |
65 |
tdb |
1.3 |
return this.getClass().getName() + "(" + REVISION.substring(11, REVISION.length() - 2) + ")"; |
66 |
|
|
} |
67 |
|
|
|
68 |
|
|
//---PRIVATE METHODS--- |
69 |
|
|
|
70 |
|
|
//---ACCESSOR/MUTATOR METHODS--- |
71 |
|
|
|
72 |
|
|
//---ATTRIBUTES--- |
73 |
|
|
|
74 |
tdb |
1.4 |
private HashMap _params = new HashMap(); |
75 |
tdb |
1.3 |
|
76 |
|
|
//---STATIC ATTRIBUTES--- |
77 |
|
|
|
78 |
pjm2 |
1.6 |
} |