1 |
+ |
/* |
2 |
+ |
* i-scream central monitoring system |
3 |
+ |
* http://www.i-scream.org.uk |
4 |
+ |
* 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 |
|
//---PACKAGE DECLARATION--- |
22 |
< |
package uk.ac.ukc.iscream.util; |
22 |
> |
package uk.org.iscream.cms.util; |
23 |
|
|
24 |
|
//---IMPORTS--- |
25 |
|
import java.util.*; |
26 |
|
|
27 |
|
/** |
28 |
< |
* Object in which to store incoming XML data |
29 |
< |
* to be passed around the CORBA system. |
28 |
> |
* Object in which to store incoming XML data for processing |
29 |
> |
* by a component of the system. |
30 |
|
* |
31 |
|
* @author $Author$ |
32 |
|
* @version $Id$ |
48 |
|
|
49 |
|
/** |
50 |
|
* Add a key and value pair to the HashMap. |
51 |
+ |
* |
52 |
+ |
* @param key The key value |
53 |
+ |
* @param value The value associated with the key |
54 |
|
*/ |
55 |
|
public synchronized void addParam (String key, String value) { |
56 |
|
_params.put(key, value); |
61 |
|
* Returns null if the key does not exist, although |
62 |
|
* this should not necessarily indicate that the key |
63 |
|
* does not exist. |
64 |
+ |
* |
65 |
+ |
* @param key The key to retrieve |
66 |
+ |
* @return The value associated with the key, if one exists, otherwise null. |
67 |
|
*/ |
68 |
|
public synchronized String getParam (String key) { |
69 |
|
return (String) _params.get(key); |
71 |
|
|
72 |
|
/** |
73 |
|
* Return a Set of the keys in the HashMap. |
74 |
+ |
* |
75 |
+ |
* @return a Set of the values in this Packet. |
76 |
|
*/ |
77 |
|
public synchronized Set getSet () { |
78 |
|
return _params.keySet(); |
80 |
|
|
81 |
|
/** |
82 |
|
* Find if a particular key exists in the HashMap. |
83 |
+ |
* |
84 |
+ |
* @param key The key to check for |
85 |
+ |
* @return whether the key exists |
86 |
|
*/ |
87 |
|
public synchronized boolean containsKey(String key){ |
88 |
|
return _params.containsKey(key); |
91 |
|
/** |
92 |
|
* Print out the entire HashMap. |
93 |
|
* (Mainly for assisting debugging.) |
94 |
+ |
* |
95 |
+ |
* @return A String representation of the data in this Packet |
96 |
|
*/ |
97 |
|
public synchronized String printAll () { |
98 |
|
return _params.toString(); |
102 |
|
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
103 |
|
* method to provide clean logging (every class should have this). |
104 |
|
* |
105 |
< |
* This uses the uk.ac.ukc.iscream.util.NameFormat class |
105 |
> |
* This uses the uk.org.iscream.cms.server.util.NameFormat class |
106 |
|
* to format the toString() |
107 |
|
* |
108 |
|
* @return the name of this class and its CVS revision |
120 |
|
|
121 |
|
//---ATTRIBUTES--- |
122 |
|
|
123 |
+ |
/** |
124 |
+ |
* A HashMap of parameters |
125 |
+ |
*/ |
126 |
|
private HashMap _params = new HashMap(); |
127 |
|
|
128 |
|
/** |