1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.ws.security;
19
20 /***
21 * WSDocInfoStore store WSDocInfo structure in a static Hash.
22 *
23 * Also the access methods are static. Thus it is possible to exchange
24 * WSDocInfo between otherwise unrelated functions/methods.
25 * The main usage for this is (are) the transformation functions that
26 * are called during Signature/Verfication process.
27 *
28 * @author Werner Dittmann (Werner.Dittmann@siemens.com)
29 */
30
31 import java.util.Hashtable;
32
33 public class WSDocInfoStore {
34
35 static Hashtable storage = new Hashtable(10);
36
37 public static WSDocInfo lookup(int hash) {
38 Integer intObj = new Integer(hash);
39 return (WSDocInfo) storage.get(intObj);
40 }
41
42 public static void store(WSDocInfo info) {
43 Integer intObj = new Integer(info.getHash());
44 if (storage.containsKey(intObj)) {
45 return;
46 }
47 storage.put(intObj, info);
48 }
49
50 public static void delete(int hash) {
51 Integer intObj = new Integer(hash);
52 WSDocInfo wsInfo = (WSDocInfo) storage.get(intObj);
53 if (wsInfo != null) {
54 wsInfo.clear();
55 storage.remove(intObj);
56 }
57 }
58
59 public static void delete(WSDocInfo info) {
60 delete(info.getHash());
61 }
62 }