1   /* Copyright 2004 Acegi Technology Pty Limited
2    *
3    * Licensed under the Apache License, Version 2.0 (the "License");
4    * you may not use this file except in compliance with the License.
5    * You may obtain a copy of the License at
6    *
7    *     http://www.apache.org/licenses/LICENSE-2.0
8    *
9    * Unless required by applicable law or agreed to in writing, software
10   * distributed under the License is distributed on an "AS IS" BASIS,
11   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12   * See the License for the specific language governing permissions and
13   * limitations under the License.
14   */
15  
16  package org.acegisecurity.adapters.jboss;
17  
18  import java.util.Hashtable;
19  
20  import javax.naming.Context;
21  import javax.naming.Name;
22  import javax.naming.NameParser;
23  import javax.naming.NamingEnumeration;
24  import javax.naming.NamingException;
25  
26  
27  /***
28   * Mocks a <code>javax.naming.Context</code> and returns an <code>Object</code>
29   * when queried for address <code>java:comp/env/security/subject</code>.
30   *
31   * @author Ben Alex
32   * @version $Id: MockInitialContext.java,v 1.2 2005/11/17 00:56:10 benalex Exp $
33   */
34  public class MockInitialContext implements Context {
35      //~ Instance fields ========================================================
36  
37      private Object object;
38  
39      //~ Constructors ===========================================================
40  
41      public MockInitialContext(Object object) {
42          this.object = object;
43      }
44  
45      private MockInitialContext() {
46          super();
47      }
48  
49      //~ Methods ================================================================
50  
51      public Hashtable getEnvironment() throws NamingException {
52          throw new UnsupportedOperationException("mock method not implemented");
53      }
54  
55      public String getNameInNamespace() throws NamingException {
56          throw new UnsupportedOperationException("mock method not implemented");
57      }
58  
59      public NameParser getNameParser(String name) throws NamingException {
60          throw new UnsupportedOperationException("mock method not implemented");
61      }
62  
63      public NameParser getNameParser(Name name) throws NamingException {
64          throw new UnsupportedOperationException("mock method not implemented");
65      }
66  
67      public Object addToEnvironment(String propName, Object propVal)
68          throws NamingException {
69          throw new UnsupportedOperationException("mock method not implemented");
70      }
71  
72      public void bind(String name, Object obj) throws NamingException {
73          throw new UnsupportedOperationException("mock method not implemented");
74      }
75  
76      public void bind(Name name, Object obj) throws NamingException {
77          throw new UnsupportedOperationException("mock method not implemented");
78      }
79  
80      public void close() throws NamingException {
81          throw new UnsupportedOperationException("mock method not implemented");
82      }
83  
84      public String composeName(String name, String prefix)
85          throws NamingException {
86          throw new UnsupportedOperationException("mock method not implemented");
87      }
88  
89      public Name composeName(Name name, Name prefix) throws NamingException {
90          throw new UnsupportedOperationException("mock method not implemented");
91      }
92  
93      public Context createSubcontext(String name) throws NamingException {
94          throw new UnsupportedOperationException("mock method not implemented");
95      }
96  
97      public Context createSubcontext(Name name) throws NamingException {
98          throw new UnsupportedOperationException("mock method not implemented");
99      }
100 
101     public void destroySubcontext(String name) throws NamingException {
102         throw new UnsupportedOperationException("mock method not implemented");
103     }
104 
105     public void destroySubcontext(Name name) throws NamingException {
106         throw new UnsupportedOperationException("mock method not implemented");
107     }
108 
109     public NamingEnumeration list(String name) throws NamingException {
110         throw new UnsupportedOperationException("mock method not implemented");
111     }
112 
113     public NamingEnumeration list(Name name) throws NamingException {
114         throw new UnsupportedOperationException("mock method not implemented");
115     }
116 
117     public NamingEnumeration listBindings(String name)
118         throws NamingException {
119         throw new UnsupportedOperationException("mock method not implemented");
120     }
121 
122     public NamingEnumeration listBindings(Name name) throws NamingException {
123         throw new UnsupportedOperationException("mock method not implemented");
124     }
125 
126     public Object lookup(String name) throws NamingException {
127         return this.object;
128     }
129 
130     public Object lookup(Name name) throws NamingException {
131         throw new UnsupportedOperationException("mock method not implemented");
132     }
133 
134     public Object lookupLink(String name) throws NamingException {
135         throw new UnsupportedOperationException("mock method not implemented");
136     }
137 
138     public Object lookupLink(Name name) throws NamingException {
139         throw new UnsupportedOperationException("mock method not implemented");
140     }
141 
142     public void rebind(String name, Object obj) throws NamingException {
143         throw new UnsupportedOperationException("mock method not implemented");
144     }
145 
146     public void rebind(Name name, Object obj) throws NamingException {
147         throw new UnsupportedOperationException("mock method not implemented");
148     }
149 
150     public Object removeFromEnvironment(String propName)
151         throws NamingException {
152         throw new UnsupportedOperationException("mock method not implemented");
153     }
154 
155     public void rename(String oldName, String newName)
156         throws NamingException {
157         throw new UnsupportedOperationException("mock method not implemented");
158     }
159 
160     public void rename(Name oldName, Name newName) throws NamingException {
161         throw new UnsupportedOperationException("mock method not implemented");
162     }
163 
164     public void unbind(String name) throws NamingException {
165         throw new UnsupportedOperationException("mock method not implemented");
166     }
167 
168     public void unbind(Name name) throws NamingException {
169         throw new UnsupportedOperationException("mock method not implemented");
170     }
171 }