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