View Javadoc

1   /*
2    * Copyright (c) 2003, Henri Yandell
3    * All rights reserved.
4    * 
5    * Redistribution and use in source and binary forms, with or 
6    * without modification, are permitted provided that the 
7    * following conditions are met:
8    * 
9    * + Redistributions of source code must retain the above copyright notice, 
10   *   this list of conditions and the following disclaimer.
11   * 
12   * + Redistributions in binary form must reproduce the above copyright notice, 
13   *   this list of conditions and the following disclaimer in the documentation 
14   *   and/or other materials provided with the distribution.
15   * 
16   * + Neither the name of Simple-JNDI nor the names of its contributors 
17   *   may be used to endorse or promote products derived from this software 
18   *   without specific prior written permission.
19   * 
20   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
21   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
22   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
23   * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
24   * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
25   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
26   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
27   * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
28   * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
29   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
30   * POSSIBILITY OF SUCH DAMAGE.
31   */
32  
33  package org.osjava.sj.jndi;
34  
35  import java.util.Hashtable;
36  import java.util.Set;
37  import java.util.Collection;
38  import java.util.Map;
39  
40  /***
41   * A hashtable that shares its space with any other instance of StaticHashtable.
42   */
43  class StaticHashtable extends Hashtable {
44  
45      private Hashtable self;
46  
47      public StaticHashtable(Hashtable h) {
48          self = h;
49      }
50  
51      public synchronized int size() {
52          return self.size();
53      }
54  
55      public synchronized boolean isEmpty() {
56          return self.isEmpty();
57      }
58  
59      public synchronized java.util.Enumeration keys() {
60          return self.keys();
61      }
62  
63      public synchronized java.util.Enumeration elements() {
64          return self.elements();
65      }
66  
67      public synchronized boolean contains(Object obj) {
68          return self.contains(obj);
69      }
70  
71      public boolean containsValue(Object obj) {
72          return self.containsValue(obj);
73      }
74  
75      public synchronized boolean containsKey(Object obj) {
76          return self.containsKey(obj);
77      }
78  
79      public synchronized Object get(Object obj) {
80          return self.get(obj);
81      }
82  
83      public synchronized Object put(Object key, Object value) {
84          return self.put(key, value);
85      }
86  
87      public synchronized Object remove(Object obj) {
88          return self.remove(obj);
89      }
90  
91      public synchronized void putAll(Map map) {
92          self.putAll(map);
93      }
94  
95      public synchronized void clear() {
96          self.clear();
97      }
98  
99  //    public synchronized Object clone()
100 
101     public synchronized String toString() {
102         return self.toString();
103     }
104 
105     public Set keySet() {
106         return self.keySet();
107     }
108 
109     public Set entrySet() {
110         return self.entrySet();
111     }
112 
113     public Collection values() {
114         return self.values();
115     }
116 
117     public synchronized boolean equals(Object obj) {
118         return self.equals(obj);
119     }
120 
121     public synchronized int hashCode() {
122         return self.hashCode();
123     }
124 
125 
126 }