1 |
tdb |
1.2 |
/* |
2 |
tdb |
1.3 |
* i-scream central monitoring system |
3 |
|
|
* http://www.i-scream.org.uk |
4 |
tdb |
1.2 |
* Copyright (C) 2000-2002 i-scream |
5 |
|
|
* |
6 |
|
|
* This program is free software; you can redistribute it and/or |
7 |
|
|
* modify it under the terms of the GNU General Public License |
8 |
|
|
* as published by the Free Software Foundation; either version 2 |
9 |
|
|
* of the License, or (at your option) any later version. |
10 |
|
|
* |
11 |
|
|
* This program is distributed in the hope that it will be useful, |
12 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
|
|
* GNU General Public License for more details. |
15 |
|
|
* |
16 |
|
|
* You should have received a copy of the GNU General Public License |
17 |
|
|
* along with this program; if not, write to the Free Software |
18 |
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 |
|
|
*/ |
20 |
|
|
|
21 |
pjm2 |
1.1 |
//---PACKAGE DECLARATION--- |
22 |
|
|
|
23 |
|
|
//---IMPORTS--- |
24 |
|
|
import java.util.*; |
25 |
|
|
|
26 |
|
|
/** |
27 |
|
|
* Object in which to store incoming XML data |
28 |
|
|
* to be provided to the CLI CLient. |
29 |
|
|
* |
30 |
tdb |
1.3 |
* @author $Author: tdb $ |
31 |
tdb |
1.4 |
* @version $Id: XMLPacket.java,v 1.3 2002/05/21 16:47:11 tdb Exp $ |
32 |
pjm2 |
1.1 |
*/ |
33 |
|
|
public class XMLPacket { |
34 |
|
|
|
35 |
|
|
//---FINAL ATTRIBUTES--- |
36 |
|
|
|
37 |
|
|
/** |
38 |
|
|
* The current CVS revision of this class |
39 |
|
|
*/ |
40 |
tdb |
1.4 |
public final String REVISION = "$Revision: 1.3 $"; |
41 |
pjm2 |
1.1 |
|
42 |
|
|
//---STATIC METHODS--- |
43 |
|
|
|
44 |
|
|
//---CONSTRUCTORS--- |
45 |
|
|
|
46 |
|
|
//---PUBLIC METHODS--- |
47 |
|
|
|
48 |
|
|
/** |
49 |
|
|
* Add a key and value pair to the HashMap. |
50 |
|
|
*/ |
51 |
|
|
public synchronized void addParam (String key, String value) { |
52 |
|
|
_params.put(key, value); |
53 |
|
|
} |
54 |
|
|
|
55 |
|
|
/** |
56 |
|
|
* Return the value associated with a particular key. |
57 |
|
|
* Returns null if the key does not exist, although |
58 |
|
|
* this should not necessarily indicate that the key |
59 |
|
|
* does not exist. |
60 |
|
|
*/ |
61 |
|
|
public synchronized String getParam (String key) { |
62 |
|
|
return (String) _params.get(key); |
63 |
|
|
} |
64 |
|
|
|
65 |
|
|
/** |
66 |
|
|
* Return a Set of the keys in the HashMap. |
67 |
|
|
*/ |
68 |
|
|
public synchronized Set getSet () { |
69 |
|
|
return _params.keySet(); |
70 |
|
|
} |
71 |
|
|
|
72 |
|
|
/** |
73 |
|
|
* Find if a particular key exists in the HashMap. |
74 |
|
|
*/ |
75 |
|
|
public synchronized boolean containsKey(String key){ |
76 |
|
|
return _params.containsKey(key); |
77 |
|
|
} |
78 |
|
|
|
79 |
|
|
/** |
80 |
|
|
* Print out the entire HashMap. |
81 |
|
|
* (Mainly for assisting debugging.) |
82 |
|
|
*/ |
83 |
|
|
public synchronized String printAll () { |
84 |
|
|
return _params.toString(); |
85 |
|
|
} |
86 |
|
|
|
87 |
|
|
|
88 |
|
|
//---PRIVATE METHODS--- |
89 |
|
|
|
90 |
|
|
//---ACCESSOR/MUTATOR METHODS--- |
91 |
|
|
|
92 |
|
|
//---ATTRIBUTES--- |
93 |
|
|
|
94 |
|
|
private HashMap _params = new HashMap(); |
95 |
|
|
|
96 |
|
|
//---STATIC ATTRIBUTES--- |
97 |
|
|
|
98 |
|
|
} |