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