1 |
pjm2 |
1.1 |
//---PACKAGE DECLARATION--- |
2 |
|
|
|
3 |
|
|
//---IMPORTS--- |
4 |
|
|
import java.util.*; |
5 |
|
|
|
6 |
|
|
/** |
7 |
|
|
* Object in which to store incoming XML data |
8 |
|
|
* to be provided to the CLI CLient. |
9 |
|
|
* |
10 |
|
|
* @author $Author: $ |
11 |
|
|
* @version $Id: $ |
12 |
|
|
*/ |
13 |
|
|
public class XMLPacket { |
14 |
|
|
|
15 |
|
|
//---FINAL ATTRIBUTES--- |
16 |
|
|
|
17 |
|
|
/** |
18 |
|
|
* The current CVS revision of this class |
19 |
|
|
*/ |
20 |
|
|
public final String REVISION = "$Revision: $"; |
21 |
|
|
|
22 |
|
|
//---STATIC METHODS--- |
23 |
|
|
|
24 |
|
|
//---CONSTRUCTORS--- |
25 |
|
|
|
26 |
|
|
//---PUBLIC METHODS--- |
27 |
|
|
|
28 |
|
|
/** |
29 |
|
|
* Add a key and value pair to the HashMap. |
30 |
|
|
*/ |
31 |
|
|
public synchronized void addParam (String key, String value) { |
32 |
|
|
_params.put(key, value); |
33 |
|
|
} |
34 |
|
|
|
35 |
|
|
/** |
36 |
|
|
* Return the value associated with a particular key. |
37 |
|
|
* Returns null if the key does not exist, although |
38 |
|
|
* this should not necessarily indicate that the key |
39 |
|
|
* does not exist. |
40 |
|
|
*/ |
41 |
|
|
public synchronized String getParam (String key) { |
42 |
|
|
return (String) _params.get(key); |
43 |
|
|
} |
44 |
|
|
|
45 |
|
|
/** |
46 |
|
|
* Return a Set of the keys in the HashMap. |
47 |
|
|
*/ |
48 |
|
|
public synchronized Set getSet () { |
49 |
|
|
return _params.keySet(); |
50 |
|
|
} |
51 |
|
|
|
52 |
|
|
/** |
53 |
|
|
* Find if a particular key exists in the HashMap. |
54 |
|
|
*/ |
55 |
|
|
public synchronized boolean containsKey(String key){ |
56 |
|
|
return _params.containsKey(key); |
57 |
|
|
} |
58 |
|
|
|
59 |
|
|
/** |
60 |
|
|
* Print out the entire HashMap. |
61 |
|
|
* (Mainly for assisting debugging.) |
62 |
|
|
*/ |
63 |
|
|
public synchronized String printAll () { |
64 |
|
|
return _params.toString(); |
65 |
|
|
} |
66 |
|
|
|
67 |
|
|
|
68 |
|
|
//---PRIVATE METHODS--- |
69 |
|
|
|
70 |
|
|
//---ACCESSOR/MUTATOR METHODS--- |
71 |
|
|
|
72 |
|
|
//---ATTRIBUTES--- |
73 |
|
|
|
74 |
|
|
private HashMap _params = new HashMap(); |
75 |
|
|
|
76 |
|
|
//---STATIC ATTRIBUTES--- |
77 |
|
|
|
78 |
|
|
} |