ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/util/uk/org/iscream/cms/util/XMLPacket.java
Revision: 1.16
Committed: Sun Aug 1 10:41:08 2004 UTC (19 years, 9 months ago) by tdb
Branch: MAIN
CVS Tags: HEAD
Changes since 1.15: +3 -3 lines
Log Message:
Catch a lot of old URL's and update them. Also remove a couple of old files
that aren't used.

File Contents

# User Rev Content
1 tdb 1.13 /*
2     * i-scream central monitoring system
3 tdb 1.16 * http://www.i-scream.org
4 tdb 1.13 * 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 tdb 1.3 //---PACKAGE DECLARATION---
22 tdb 1.15 package uk.org.iscream.cms.util;
23 tdb 1.3
24     //---IMPORTS---
25 pjm2 1.7 import java.util.*;
26 pjm2 1.1
27 tdb 1.3 /**
28 tdb 1.10 * Object in which to store incoming XML data for processing
29     * by a component of the system.
30 tdb 1.3 *
31 tdb 1.13 * @author $Author: tdb $
32 tdb 1.16 * @version $Id: XMLPacket.java,v 1.15 2003/02/05 14:27:59 tdb Exp $
33 tdb 1.3 */
34     public class XMLPacket {
35    
36     //---FINAL ATTRIBUTES---
37    
38     /**
39     * The current CVS revision of this class
40     */
41 tdb 1.16 public final String REVISION = "$Revision: 1.15 $";
42 tdb 1.3
43     //---STATIC METHODS---
44    
45     //---CONSTRUCTORS---
46 pjm2 1.1
47 tdb 1.3 //---PUBLIC METHODS---
48 pjm2 1.1
49 ajm 1.9 /**
50     * Add a key and value pair to the HashMap.
51 tdb 1.10 *
52     * @param key The key value
53     * @param value The value associated with the key
54 ajm 1.9 */
55 pjm2 1.1 public synchronized void addParam (String key, String value) {
56 pjm2 1.6 _params.put(key, value);
57 pjm2 1.1 }
58    
59 ajm 1.9 /**
60     * Return the value associated with a particular key.
61     * Returns null if the key does not exist, although
62     * this should not necessarily indicate that the key
63     * does not exist.
64 tdb 1.10 *
65     * @param key The key to retrieve
66     * @return The value associated with the key, if one exists, otherwise null.
67 ajm 1.9 */
68 pjm2 1.1 public synchronized String getParam (String key) {
69 tdb 1.4 return (String) _params.get(key);
70 pjm2 1.1 }
71    
72 ajm 1.9 /**
73     * Return a Set of the keys in the HashMap.
74 tdb 1.10 *
75     * @return a Set of the values in this Packet.
76 ajm 1.9 */
77 pjm2 1.7 public synchronized Set getSet () {
78     return _params.keySet();
79 pjm2 1.8 }
80    
81 ajm 1.9 /**
82     * Find if a particular key exists in the HashMap.
83 tdb 1.10 *
84     * @param key The key to check for
85     * @return whether the key exists
86 ajm 1.9 */
87 pjm2 1.8 public synchronized boolean containsKey(String key){
88     return _params.containsKey(key);
89 pjm2 1.7 }
90    
91 ajm 1.9 /**
92     * Print out the entire HashMap.
93     * (Mainly for assisting debugging.)
94 tdb 1.10 *
95     * @return A String representation of the data in this Packet
96 ajm 1.9 */
97 pjm2 1.2 public synchronized String printAll () {
98 tdb 1.4 return _params.toString();
99 pjm2 1.1 }
100    
101 tdb 1.3 /**
102     * Overrides the {@link java.lang.Object#toString() Object.toString()}
103     * method to provide clean logging (every class should have this).
104     *
105 tdb 1.12 * This uses the uk.org.iscream.cms.server.util.NameFormat class
106 ajm 1.9 * to format the toString()
107     *
108 tdb 1.3 * @return the name of this class and its CVS revision
109     */
110 ajm 1.9 public String toString() {
111     return FormatName.getName(
112     _name,
113     getClass().getName(),
114     REVISION);
115 tdb 1.3 }
116    
117     //---PRIVATE METHODS---
118    
119     //---ACCESSOR/MUTATOR METHODS---
120    
121     //---ATTRIBUTES---
122    
123 tdb 1.10 /**
124     * A HashMap of parameters
125     */
126 tdb 1.4 private HashMap _params = new HashMap();
127 ajm 1.9
128     /**
129     * This is the friendly identifier of the
130     * component this class is running in.
131     * eg, a Filter may be called "filter1",
132     * If this class does not have an owning
133     * component, a name from the configuration
134     * can be placed here. This name could also
135     * be changed to null for utility classes.
136     */
137     private String _name = null;
138 tdb 1.3
139     //---STATIC ATTRIBUTES---
140    
141 pjm2 1.6 }