| 1 | 
 import java.util.HashMap; | 
 
 
 
 
 
 | 2 | 
  | 
 
 
 
 
 
 | 3 | 
 // Paul Mutton, pjm2@ukc.ac.uk | 
 
 
 
 
 
 | 4 | 
  | 
 
 
 
 
 
 | 5 | 
 // Object in which to store incoming XML data | 
 
 
 
 
 
 | 6 | 
 // to be passed around the CORBA system. | 
 
 
 
 
 
 | 7 | 
 public class XMLPacket { | 
 
 
 
 
 
 | 8 | 
  | 
 
 
 
 
 
 | 9 | 
     // Add a key and value pair to the HashMap. | 
 
 
 
 
 
 | 10 | 
     public synchronized void addParam (String key, String value) { | 
 
 
 
 
 
 | 11 | 
         params.put(key, value);         | 
 
 
 
 
 
 | 12 | 
         // debug by println ;-) | 
 
 
 
 
 
 | 13 | 
         // System.out.println("Adding to hash: " + key + " = " + value); | 
 
 
 
 
 
 | 14 | 
         // end debug code | 
 
 
 
 
 
 | 15 | 
     } | 
 
 
 
 
 
 | 16 | 
      | 
 
 
 
 
 
 | 17 | 
     // Return the value associated with a particular key. | 
 
 
 
 
 
 | 18 | 
     // Returns null if the key does not exist, although | 
 
 
 
 
 
 | 19 | 
     // this should not necessarily indicate that the key | 
 
 
 
 
 
 | 20 | 
     // does not exist. | 
 
 
 
 
 
 | 21 | 
     public synchronized String getParam (String key) { | 
 
 
 
 
 
 | 22 | 
         return (String)params.get(key); | 
 
 
 
 
 
 | 23 | 
     } | 
 
 
 
 
 
 | 24 | 
      | 
 
 
 
 
 
 | 25 | 
     // Print out the entire HashMap. | 
 
 
 
 
 
 | 26 | 
     // (Mainly for assisting debugging.) | 
 
 
 
 
 
 | 27 | 
     public synchronized void printAll () { | 
 
 
 
 
 
 | 28 | 
         System.out.println(params); | 
 
 
 
 
 
 | 29 | 
     } | 
 
 
 
 
 
 | 30 | 
  | 
 
 
 
 
 
 | 31 | 
     private HashMap params = new HashMap();   | 
 
 
 
 
 
 | 32 | 
      | 
 
 
 
 
 
 | 33 | 
 } |