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.harmony.jndi.tests.javax.naming.spi.mock;
018:
019: import java.util.Hashtable;
020:
021: import javax.naming.Name;
022: import javax.naming.NamingEnumeration;
023: import javax.naming.NamingException;
024: import javax.naming.directory.Attributes;
025: import javax.naming.directory.DirContext;
026: import javax.naming.directory.ModificationItem;
027: import javax.naming.directory.SearchControls;
028: import javax.naming.directory.SearchResult;
029:
030: public class MockDirContext2 extends MockContext implements DirContext {
031:
032: public MockDirContext2(Hashtable<?, ?> h) {
033: super (h);
034: }
035:
036: /*
037: * (non-Javadoc)
038: *
039: * @see javax.naming.directory.DirContext#bind(javax.naming.Name,
040: * java.lang.Object, javax.naming.directory.Attributes)
041: */
042: public void bind(Name name, Object obj, Attributes attributes)
043: throws NamingException {
044: InvokeRecord.set((String) getEnvironment().get("url.schema"),
045: "bind", name, obj, attributes);
046: }
047:
048: /*
049: * (non-Javadoc)
050: *
051: * @see javax.naming.directory.DirContext#bind(java.lang.String,
052: * java.lang.Object, javax.naming.directory.Attributes)
053: */
054: public void bind(String s, Object obj, Attributes attributes)
055: throws NamingException {
056: InvokeRecord.set((String) getEnvironment().get("url.schema"),
057: "bind", s, obj, attributes);
058: }
059:
060: /*
061: * (non-Javadoc)
062: *
063: * @see javax.naming.directory.DirContext#createSubcontext(javax.naming.Name,
064: * javax.naming.directory.Attributes)
065: */
066: public DirContext createSubcontext(Name name, Attributes attributes)
067: throws NamingException {
068: InvokeRecord.set((String) getEnvironment().get("url.schema"),
069: "createSubcontext", name, attributes);
070: return null;
071: }
072:
073: /*
074: * (non-Javadoc)
075: *
076: * @see javax.naming.directory.DirContext#createSubcontext(java.lang.String,
077: * javax.naming.directory.Attributes)
078: */
079: public DirContext createSubcontext(String s, Attributes attributes)
080: throws NamingException {
081: InvokeRecord.set((String) getEnvironment().get("url.schema"),
082: "createSubcontext", s, attributes);
083: return null;
084: }
085:
086: /*
087: * (non-Javadoc)
088: *
089: * @see javax.naming.directory.DirContext#getAttributes(javax.naming.Name)
090: */
091: public Attributes getAttributes(Name name) throws NamingException {
092: InvokeRecord.set((String) getEnvironment().get("url.schema"),
093: "getAttributes", name);
094: return null;
095: }
096:
097: /*
098: * (non-Javadoc)
099: *
100: * @see javax.naming.directory.DirContext#getAttributes(javax.naming.Name,
101: * java.lang.String[])
102: */
103: public Attributes getAttributes(Name name, String[] as)
104: throws NamingException {
105: InvokeRecord.set((String) getEnvironment().get("url.schema"),
106: "getAttributes", name, as);
107: return null;
108: }
109:
110: /*
111: * (non-Javadoc)
112: *
113: * @see javax.naming.directory.DirContext#getAttributes(java.lang.String)
114: */
115: public Attributes getAttributes(String s) throws NamingException {
116: InvokeRecord.set((String) getEnvironment().get("url.schema"),
117: "getAttributes", s);
118: return null;
119: }
120:
121: /*
122: * (non-Javadoc)
123: *
124: * @see javax.naming.directory.DirContext#getAttributes(java.lang.String,
125: * java.lang.String[])
126: */
127: public Attributes getAttributes(String s, String[] as)
128: throws NamingException {
129: InvokeRecord.set((String) getEnvironment().get("url.schema"),
130: "getAttributes", s, as);
131: return null;
132: }
133:
134: /*
135: * (non-Javadoc)
136: *
137: * @see javax.naming.directory.DirContext#getSchema(javax.naming.Name)
138: */
139: public DirContext getSchema(Name name) throws NamingException {
140: InvokeRecord.set((String) getEnvironment().get("url.schema"),
141: "getSchema", name);
142: return null;
143: }
144:
145: /*
146: * (non-Javadoc)
147: *
148: * @see javax.naming.directory.DirContext#getSchema(java.lang.String)
149: */
150: public DirContext getSchema(String s) throws NamingException {
151: InvokeRecord.set((String) getEnvironment().get("url.schema"),
152: "getSchema", s);
153: return null;
154: }
155:
156: /*
157: * (non-Javadoc)
158: *
159: * @see javax.naming.directory.DirContext#getSchemaClassDefinition(javax.naming.Name)
160: */
161: public DirContext getSchemaClassDefinition(Name name)
162: throws NamingException {
163: InvokeRecord.set((String) getEnvironment().get("url.schema"),
164: "getSchemaClassDefinition", name);
165: return null;
166: }
167:
168: /*
169: * (non-Javadoc)
170: *
171: * @see javax.naming.directory.DirContext#getSchemaClassDefinition(java.lang.String)
172: */
173: public DirContext getSchemaClassDefinition(String s)
174: throws NamingException {
175: InvokeRecord.set((String) getEnvironment().get("url.schema"),
176: "getSchemaClassDefinition", s);
177: return null;
178: }
179:
180: /*
181: * (non-Javadoc)
182: *
183: * @see javax.naming.directory.DirContext#modifyAttributes(javax.naming.Name,
184: * int, javax.naming.directory.Attributes)
185: */
186: public void modifyAttributes(Name name, int i, Attributes attributes)
187: throws NamingException {
188: InvokeRecord.set((String) getEnvironment().get("url.schema"),
189: "modifyAttributes", name, new Integer(i), attributes);
190:
191: }
192:
193: /*
194: * (non-Javadoc)
195: *
196: * @see javax.naming.directory.DirContext#modifyAttributes(javax.naming.Name,
197: * javax.naming.directory.ModificationItem[])
198: */
199: public void modifyAttributes(Name name,
200: ModificationItem[] amodificationitem)
201: throws NamingException {
202: InvokeRecord.set((String) getEnvironment().get("url.schema"),
203: "modifyAttributes", name, amodificationitem);
204: }
205:
206: /*
207: * (non-Javadoc)
208: *
209: * @see javax.naming.directory.DirContext#modifyAttributes(java.lang.String,
210: * int, javax.naming.directory.Attributes)
211: */
212: public void modifyAttributes(String s, int i, Attributes attributes)
213: throws NamingException {
214: InvokeRecord.set((String) getEnvironment().get("url.schema"),
215: "modifyAttributes", s, new Integer(i), attributes);
216:
217: }
218:
219: /*
220: * (non-Javadoc)
221: *
222: * @see javax.naming.directory.DirContext#modifyAttributes(java.lang.String,
223: * javax.naming.directory.ModificationItem[])
224: */
225: public void modifyAttributes(String s,
226: ModificationItem[] amodificationitem)
227: throws NamingException {
228: InvokeRecord.set((String) getEnvironment().get("url.schema"),
229: "modifyAttributes", s, amodificationitem);
230:
231: }
232:
233: /*
234: * (non-Javadoc)
235: *
236: * @see javax.naming.directory.DirContext#rebind(javax.naming.Name,
237: * java.lang.Object, javax.naming.directory.Attributes)
238: */
239: public void rebind(Name name, Object obj, Attributes attributes)
240: throws NamingException {
241: InvokeRecord.set((String) getEnvironment().get("url.schema"),
242: "rebind", name, obj, attributes);
243: }
244:
245: /*
246: * (non-Javadoc)
247: *
248: * @see javax.naming.directory.DirContext#rebind(java.lang.String,
249: * java.lang.Object, javax.naming.directory.Attributes)
250: */
251: public void rebind(String s, Object obj, Attributes attributes)
252: throws NamingException {
253: InvokeRecord.set((String) getEnvironment().get("url.schema"),
254: "rebind", s, obj, attributes);
255: }
256:
257: /*
258: * (non-Javadoc)
259: *
260: * @see javax.naming.directory.DirContext#search(javax.naming.Name,
261: * javax.naming.directory.Attributes)
262: */
263: public NamingEnumeration<SearchResult> search(Name name,
264: Attributes attributes) throws NamingException {
265: InvokeRecord.set((String) getEnvironment().get("url.schema"),
266: "search", name, attributes);
267: return null;
268: }
269:
270: /*
271: * (non-Javadoc)
272: *
273: * @see javax.naming.directory.DirContext#search(javax.naming.Name,
274: * javax.naming.directory.Attributes, java.lang.String[])
275: */
276: public NamingEnumeration<SearchResult> search(Name name,
277: Attributes attributes, String[] as) throws NamingException {
278: InvokeRecord.set((String) getEnvironment().get("url.schema"),
279: "search", name, attributes, as);
280: return null;
281: }
282:
283: /*
284: * (non-Javadoc)
285: *
286: * @see javax.naming.directory.DirContext#search(javax.naming.Name,
287: * java.lang.String, java.lang.Object[],
288: * javax.naming.directory.SearchControls)
289: */
290: public NamingEnumeration<SearchResult> search(Name name, String s,
291: Object[] aobj, SearchControls searchcontrols)
292: throws NamingException {
293: InvokeRecord.set((String) getEnvironment().get("url.schema"),
294: "search", name, s, aobj, searchcontrols);
295: return null;
296: }
297:
298: /*
299: * (non-Javadoc)
300: *
301: * @see javax.naming.directory.DirContext#search(javax.naming.Name,
302: * java.lang.String, javax.naming.directory.SearchControls)
303: */
304: public NamingEnumeration<SearchResult> search(Name name, String s,
305: SearchControls searchcontrols) throws NamingException {
306: InvokeRecord.set((String) getEnvironment().get("url.schema"),
307: "search", name, s, searchcontrols);
308: return null;
309: }
310:
311: /*
312: * (non-Javadoc)
313: *
314: * @see javax.naming.directory.DirContext#search(java.lang.String,
315: * javax.naming.directory.Attributes)
316: */
317: public NamingEnumeration<SearchResult> search(String s,
318: Attributes attributes) throws NamingException {
319: InvokeRecord.set((String) getEnvironment().get("url.schema"),
320: "search", s, attributes);
321: return null;
322: }
323:
324: /*
325: * (non-Javadoc)
326: *
327: * @see javax.naming.directory.DirContext#search(java.lang.String,
328: * javax.naming.directory.Attributes, java.lang.String[])
329: */
330: public NamingEnumeration<SearchResult> search(String s,
331: Attributes attributes, String[] as) throws NamingException {
332: InvokeRecord.set((String) getEnvironment().get("url.schema"),
333: "search", s, attributes, as);
334: return null;
335: }
336:
337: /*
338: * (non-Javadoc)
339: *
340: * @see javax.naming.directory.DirContext#search(java.lang.String,
341: * java.lang.String, java.lang.Object[],
342: * javax.naming.directory.SearchControls)
343: */
344: public NamingEnumeration<SearchResult> search(String s, String s1,
345: Object[] aobj, SearchControls searchcontrols)
346: throws NamingException {
347: InvokeRecord.set((String) getEnvironment().get("url.schema"),
348: "search", s, s1, aobj, searchcontrols);
349: return null;
350: }
351:
352: /*
353: * (non-Javadoc)
354: *
355: * @see javax.naming.directory.DirContext#search(java.lang.String,
356: * java.lang.String, javax.naming.directory.SearchControls)
357: */
358: public NamingEnumeration<SearchResult> search(String s, String s1,
359: SearchControls searchcontrols) throws NamingException {
360: InvokeRecord.set((String) getEnvironment().get("url.schema"),
361: "search", s, s1, searchcontrols);
362: return null;
363: }
364:
365: /*
366: * (non-Javadoc)
367: *
368: * @see javax.naming.Context#close()
369: */
370: @Override
371: public void close() throws NamingException {
372: InvokeRecord.set((String) getEnvironment().get("url.schema"),
373: "close");
374: }
375:
376: }
|