1 |
+ |
//---PACKAGE DECLARATION--- |
2 |
+ |
package uk.ac.ukc.iscream.xml; |
3 |
+ |
|
4 |
+ |
//---IMPORTS--- |
5 |
|
import java.util.HashMap; |
6 |
|
|
7 |
< |
// Paul Mutton, pjm2@ukc.ac.uk |
8 |
< |
|
9 |
< |
// Object in which to store incoming XML data |
10 |
< |
// to be passed around the CORBA system. |
7 |
> |
/** |
8 |
> |
* Object in which to store incoming XML data |
9 |
> |
* to be passed around the CORBA system. |
10 |
> |
* |
11 |
> |
* @author $Author$ |
12 |
> |
* @version $Id$ |
13 |
> |
*/ |
14 |
|
public class XMLPacket { |
15 |
|
|
16 |
+ |
//---FINAL ATTRIBUTES--- |
17 |
+ |
|
18 |
+ |
/** |
19 |
+ |
* The current CVS revision of this class |
20 |
+ |
*/ |
21 |
+ |
public final String REVISION = "$Revision$"; |
22 |
+ |
|
23 |
+ |
//---STATIC METHODS--- |
24 |
+ |
|
25 |
+ |
//---CONSTRUCTORS--- |
26 |
+ |
|
27 |
+ |
//---PUBLIC METHODS--- |
28 |
+ |
|
29 |
|
// Add a key and value pair to the HashMap. |
30 |
|
public synchronized void addParam (String key, String value) { |
31 |
< |
params.put(key, value); |
31 |
> |
_params.put(key, value); |
32 |
|
// debug by println ;-) |
33 |
|
// System.out.println("Adding to hash: " + key + " = " + value); |
34 |
|
// end debug code |
39 |
|
// this should not necessarily indicate that the key |
40 |
|
// does not exist. |
41 |
|
public synchronized String getParam (String key) { |
42 |
< |
return (String)params.get(key); |
42 |
> |
return (String) _params.get(key); |
43 |
|
} |
44 |
|
|
45 |
|
// Print out the entire HashMap. |
46 |
|
// (Mainly for assisting debugging.) |
47 |
< |
public synchronized void printAll () { |
48 |
< |
System.out.println(params); |
47 |
> |
public synchronized String printAll () { |
48 |
> |
return _params.toString(); |
49 |
|
} |
50 |
|
|
51 |
< |
private HashMap params = new HashMap(); |
52 |
< |
|
53 |
< |
} |
51 |
> |
/** |
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 |
> |
private HashMap _params = new HashMap(); |
68 |
> |
|
69 |
> |
//---STATIC ATTRIBUTES--- |
70 |
> |
|
71 |
> |
} |