001    /**
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     *
009     *      http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    package org.apache.xbean.naming.context;
018    
019    import javax.naming.Context;
020    import javax.naming.NamingException;
021    import javax.naming.Name;
022    import javax.naming.NamingEnumeration;
023    import javax.naming.NameParser;
024    import java.util.Hashtable;
025    
026    /**
027     * @version $Rev$ $Date$
028     */
029    public abstract class ContextFlyweight implements Context {
030        protected abstract Context getContext() throws NamingException;
031    
032        public void close() throws NamingException {
033        }
034    
035        public String getNameInNamespace() throws NamingException {
036            return getContext().getNameInNamespace();
037        }
038    
039        public Object lookup(Name name) throws NamingException {
040            return getContext().lookup(name);
041        }
042    
043        public Object lookup(String name) throws NamingException {
044            return getContext().lookup(name);
045        }
046    
047        public void bind(Name name, Object obj) throws NamingException {
048            getContext().bind(name, obj);
049        }
050    
051        public void bind(String name, Object obj) throws NamingException {
052            getContext().bind(name, obj);
053        }
054    
055        public void rebind(Name name, Object obj) throws NamingException {
056            getContext().rebind(name, obj);
057        }
058    
059        public void rebind(String name, Object obj) throws NamingException {
060            getContext().rebind(name, obj);
061        }
062    
063        public void unbind(Name name) throws NamingException {
064            getContext().unbind(name);
065        }
066    
067        public void unbind(String name) throws NamingException {
068            getContext().unbind(name);
069        }
070    
071        public void rename(Name oldName, Name newName) throws NamingException {
072            getContext().rename(oldName, newName);
073        }
074    
075        public void rename(String oldName, String newName) throws NamingException {
076            getContext().rename(oldName, newName);
077        }
078    
079        public NamingEnumeration list(Name name) throws NamingException {
080            return getContext().list(name);
081        }
082    
083        public NamingEnumeration list(String name) throws NamingException {
084            return getContext().list(name);
085        }
086    
087        public NamingEnumeration listBindings(Name name) throws NamingException {
088            return getContext().listBindings(name);
089        }
090    
091        public NamingEnumeration listBindings(String name) throws NamingException {
092            return getContext().listBindings(name);
093        }
094    
095        public void destroySubcontext(Name name) throws NamingException {
096            getContext().destroySubcontext(name);
097        }
098    
099        public void destroySubcontext(String name) throws NamingException {
100            getContext().destroySubcontext(name);
101        }
102    
103        public Context createSubcontext(Name name) throws NamingException {
104            return getContext().createSubcontext(name);
105        }
106    
107        public Context createSubcontext(String name) throws NamingException {
108            return getContext().createSubcontext(name);
109        }
110    
111        public Object lookupLink(Name name) throws NamingException {
112            return getContext().lookupLink(name);
113        }
114    
115        public Object lookupLink(String name) throws NamingException {
116            return getContext().lookupLink(name);
117        }
118    
119        public NameParser getNameParser(Name name) throws NamingException {
120            return getContext().getNameParser(name);
121        }
122    
123        public NameParser getNameParser(String name) throws NamingException {
124            return getContext().getNameParser(name);
125        }
126    
127        public Name composeName(Name name, Name prefix) throws NamingException {
128            return getContext().composeName(name, prefix);
129        }
130    
131        public String composeName(String name, String prefix) throws NamingException {
132            return getContext().composeName(name, prefix);
133        }
134    
135        public Object addToEnvironment(String propName, Object propVal) throws NamingException {
136            return getContext().addToEnvironment(propName, propVal);
137        }
138    
139        public Object removeFromEnvironment(String propName) throws NamingException {
140            return getContext().removeFromEnvironment(propName);
141        }
142    
143        public Hashtable getEnvironment() throws NamingException {
144            return getContext().getEnvironment();
145        }
146    }