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 |
ajm |
1.9 |
* @version $Id: XMLPacket.java,v 1.8 2000/12/05 13:19:19 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 |
ajm |
1.9 |
public final String REVISION = "$Revision: 1.8 $"; |
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 |
ajm |
1.9 |
/** |
30 |
|
|
* Add a key and value pair to the HashMap. |
31 |
|
|
*/ |
32 |
pjm2 |
1.1 |
public synchronized void addParam (String key, String value) { |
33 |
pjm2 |
1.6 |
_params.put(key, value); |
34 |
pjm2 |
1.1 |
} |
35 |
|
|
|
36 |
ajm |
1.9 |
/** |
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 |
|
|
*/ |
42 |
pjm2 |
1.1 |
public synchronized String getParam (String key) { |
43 |
tdb |
1.4 |
return (String) _params.get(key); |
44 |
pjm2 |
1.1 |
} |
45 |
|
|
|
46 |
ajm |
1.9 |
/** |
47 |
|
|
* Return a Set of the keys in the HashMap. |
48 |
|
|
*/ |
49 |
pjm2 |
1.7 |
public synchronized Set getSet () { |
50 |
|
|
return _params.keySet(); |
51 |
pjm2 |
1.8 |
} |
52 |
|
|
|
53 |
ajm |
1.9 |
/** |
54 |
|
|
* Find if a particular key exists in the HashMap. |
55 |
|
|
*/ |
56 |
pjm2 |
1.8 |
public synchronized boolean containsKey(String key){ |
57 |
|
|
return _params.containsKey(key); |
58 |
pjm2 |
1.7 |
} |
59 |
|
|
|
60 |
ajm |
1.9 |
/** |
61 |
|
|
* Print out the entire HashMap. |
62 |
|
|
* (Mainly for assisting debugging.) |
63 |
|
|
*/ |
64 |
pjm2 |
1.2 |
public synchronized String printAll () { |
65 |
tdb |
1.4 |
return _params.toString(); |
66 |
pjm2 |
1.1 |
} |
67 |
|
|
|
68 |
tdb |
1.3 |
/** |
69 |
|
|
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
70 |
|
|
* method to provide clean logging (every class should have this). |
71 |
|
|
* |
72 |
ajm |
1.9 |
* This uses the uk.ac.ukc.iscream.util.NameFormat class |
73 |
|
|
* to format the toString() |
74 |
|
|
* |
75 |
tdb |
1.3 |
* @return the name of this class and its CVS revision |
76 |
|
|
*/ |
77 |
ajm |
1.9 |
public String toString() { |
78 |
|
|
return FormatName.getName( |
79 |
|
|
_name, |
80 |
|
|
getClass().getName(), |
81 |
|
|
REVISION); |
82 |
tdb |
1.3 |
} |
83 |
|
|
|
84 |
|
|
//---PRIVATE METHODS--- |
85 |
|
|
|
86 |
|
|
//---ACCESSOR/MUTATOR METHODS--- |
87 |
|
|
|
88 |
|
|
//---ATTRIBUTES--- |
89 |
|
|
|
90 |
tdb |
1.4 |
private HashMap _params = new HashMap(); |
91 |
ajm |
1.9 |
|
92 |
|
|
/** |
93 |
|
|
* This is the friendly identifier of the |
94 |
|
|
* component this class is running in. |
95 |
|
|
* eg, a Filter may be called "filter1", |
96 |
|
|
* If this class does not have an owning |
97 |
|
|
* component, a name from the configuration |
98 |
|
|
* can be placed here. This name could also |
99 |
|
|
* be changed to null for utility classes. |
100 |
|
|
*/ |
101 |
|
|
private String _name = null; |
102 |
tdb |
1.3 |
|
103 |
|
|
//---STATIC ATTRIBUTES--- |
104 |
|
|
|
105 |
pjm2 |
1.6 |
} |