View Javadoc

1   /*
2    * Copyright (c) 2003-2005, 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  package org.osjava.sj.jndi;
33  
34  import java.util.Hashtable;
35  
36  import javax.naming.Context;
37  import javax.naming.Name;
38  import javax.naming.NameParser;
39  import javax.naming.NamingEnumeration;
40  import javax.naming.NamingException;
41  
42  
43  /***
44   * Standard delegating pattern for JNDI Contexts.
45   * Sub-classes of this may filter calls to the JNDI code. 
46   */
47  public abstract class DelegatingContext implements Context {
48  
49      private Context target;
50  
51      public DelegatingContext(Context ctxt) {
52          this.target = ctxt;
53      }
54  
55      public Object lookup(Name name) throws NamingException {
56          return this.target.lookup(name);
57      }
58  
59      public Object lookup(String name) throws NamingException {
60          return this.target.lookup(name);
61      }
62  
63      public void bind(Name name, Object value) throws NamingException {
64          this.target.bind(name, value);
65      }
66  
67      public void bind(String name, Object value) throws NamingException {
68          this.target.bind(name, value);
69      }
70  
71      public void rebind(Name name, Object value) throws NamingException {
72          this.target.rebind(name, value);
73      }
74  
75      public void rebind(String name, Object value) throws NamingException {
76          this.target.rebind(name, value);
77      }
78  
79      public void unbind(Name name) throws NamingException {
80          this.target.unbind(name);
81      }
82  
83      public void unbind(String name) throws NamingException {
84          this.target.unbind(name);
85      }
86  
87      public void rename(Name name, Name name2) throws NamingException {
88          this.target.rename(name, name2);
89      }
90  
91      public void rename(String name, String name2) throws NamingException {
92          this.target.rename(name, name2);
93      }
94  
95      public NamingEnumeration list(Name name) throws NamingException {
96          return this.target.list(name);
97      }
98  
99      public NamingEnumeration list(String name) throws NamingException {
100         return this.target.list(name);
101     }
102 
103     public NamingEnumeration listBindings(Name name) throws NamingException {
104         return this.target.listBindings(name);
105     }
106 
107     public NamingEnumeration listBindings(String name) throws NamingException {
108         return this.target.listBindings(name);
109     }
110 
111     public void destroySubcontext(Name name) throws NamingException {
112         this.target.destroySubcontext(name);
113     }
114 
115     public void destroySubcontext(String name) throws NamingException {
116         this.target.destroySubcontext(name);
117     }
118 
119     public Context createSubcontext(Name name) throws NamingException {
120         return this.target.createSubcontext(name);
121     }
122 
123     public Context createSubcontext(String name) throws NamingException {
124         return this.target.createSubcontext(name);
125     }
126 
127     public Object lookupLink(Name name) throws NamingException {
128         return this.target.lookupLink(name);
129     }
130 
131     public Object lookupLink(String name) throws NamingException {
132         return this.target.lookupLink(name);
133     }
134 
135     public NameParser getNameParser(Name name) throws NamingException {
136         return this.target.getNameParser(name);
137     }
138 
139     public NameParser getNameParser(String name) throws NamingException {
140         return this.target.getNameParser(name);
141     }
142 
143     public Name composeName(Name name, Name name2) throws NamingException {
144         return this.target.composeName(name, name2);
145     }
146 
147     public String composeName(String name, String name2) throws NamingException {
148         return this.target.composeName(name, name2);
149     }
150 
151     public Object addToEnvironment(String key, Object value) throws NamingException {
152         return this.target.addToEnvironment(key, value);
153     }
154 
155     public Object removeFromEnvironment(String key) throws NamingException {
156         return this.target.removeFromEnvironment(key);
157     }
158 
159     public Hashtable getEnvironment() throws NamingException {
160         return this.target.getEnvironment();
161     }
162 
163     public void close() throws NamingException {
164         this.target.close();
165     }
166 
167     public String getNameInNamespace() throws NamingException {
168         return this.target.getNameInNamespace();
169     }
170 
171     protected Context getTarget() {
172         return this.target;
173     }
174 
175 }
176