View Javadoc
1   /*
2    *  Licensed to the Apache Software Foundation (ASF) under one
3    *  or more contributor license agreements.  See the NOTICE file
4    *  distributed with this work for additional information
5    *  regarding copyright ownership.  The ASF licenses this file
6    *  to you under the Apache License, Version 2.0 (the
7    *  "License"); you may not use this file except in compliance
8    *  with the License.  You may obtain a copy of the License at
9    * 
10   *    http://www.apache.org/licenses/LICENSE-2.0
11   * 
12   *  Unless required by applicable law or agreed to in writing,
13   *  software distributed under the License is distributed on an
14   *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   *  KIND, either express or implied.  See the License for the
16   *  specific language governing permissions and limitations
17   *  under the License.
18   * 
19   */
20  package org.apache.directory.ldap.client.api;
21  
22  
23  import java.io.IOException;
24  import java.util.List;
25  
26  import org.apache.directory.api.asn1.util.Oid;
27  import org.apache.directory.api.ldap.codec.api.BinaryAttributeDetector;
28  import org.apache.directory.api.ldap.codec.api.LdapApiService;
29  import org.apache.directory.api.ldap.model.cursor.EntryCursor;
30  import org.apache.directory.api.ldap.model.cursor.SearchCursor;
31  import org.apache.directory.api.ldap.model.entry.Entry;
32  import org.apache.directory.api.ldap.model.entry.Modification;
33  import org.apache.directory.api.ldap.model.entry.ModificationOperation;
34  import org.apache.directory.api.ldap.model.entry.Value;
35  import org.apache.directory.api.ldap.model.exception.LdapException;
36  import org.apache.directory.api.ldap.model.message.AbandonRequest;
37  import org.apache.directory.api.ldap.model.message.AddRequest;
38  import org.apache.directory.api.ldap.model.message.AddResponse;
39  import org.apache.directory.api.ldap.model.message.BindRequest;
40  import org.apache.directory.api.ldap.model.message.BindResponse;
41  import org.apache.directory.api.ldap.model.message.CompareRequest;
42  import org.apache.directory.api.ldap.model.message.CompareResponse;
43  import org.apache.directory.api.ldap.model.message.Control;
44  import org.apache.directory.api.ldap.model.message.DeleteRequest;
45  import org.apache.directory.api.ldap.model.message.DeleteResponse;
46  import org.apache.directory.api.ldap.model.message.ExtendedRequest;
47  import org.apache.directory.api.ldap.model.message.ExtendedResponse;
48  import org.apache.directory.api.ldap.model.message.ModifyDnRequest;
49  import org.apache.directory.api.ldap.model.message.ModifyDnResponse;
50  import org.apache.directory.api.ldap.model.message.ModifyRequest;
51  import org.apache.directory.api.ldap.model.message.ModifyResponse;
52  import org.apache.directory.api.ldap.model.message.SearchRequest;
53  import org.apache.directory.api.ldap.model.message.SearchScope;
54  import org.apache.directory.api.ldap.model.name.Dn;
55  import org.apache.directory.api.ldap.model.name.Rdn;
56  import org.apache.directory.api.ldap.model.schema.SchemaManager;
57  
58  
59  /**
60   * Provides a base implementation of a {@link Wrapper} for {@link LdapConnection}
61   * objects.  All methods are passed through to the wrapped 
62   * <code>LdapConnection</code>.
63   *
64   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
65   */
66  public class LdapConnectionWrapper implements LdapConnection, Wrapper<LdapConnection>
67  {
68      protected LdapConnection connection;
69  
70  
71      protected LdapConnectionWrapper( LdapConnection connection )
72      {
73          this.connection = connection;
74      }
75  
76  
77      /**
78       * {@inheritDoc}
79       */
80      public LdapConnection wrapped()
81      {
82          return connection;
83      }
84  
85  
86      @Override
87      public boolean isConnected()
88      {
89          return connection.isConnected();
90      }
91  
92  
93      @Override
94      public boolean isAuthenticated()
95      {
96          return connection.isAuthenticated();
97      }
98  
99  
100     @Override
101     public boolean connect() throws LdapException
102     {
103         return connection.connect();
104     }
105 
106 
107     @Override
108     public void close() throws IOException
109     {
110         connection.close();
111     }
112 
113 
114     @Override
115     public void add( Entry entry ) throws LdapException
116     {
117         connection.add( entry );
118     }
119 
120 
121     @Override
122     public AddResponse add( AddRequest addRequest ) throws LdapException
123     {
124         return connection.add( addRequest );
125     }
126 
127 
128     @Override
129     public void abandon( int messageId )
130     {
131         connection.abandon( messageId );
132     }
133 
134 
135     @Override
136     public void abandon( AbandonRequest abandonRequest )
137     {
138         connection.abandon( abandonRequest );
139     }
140 
141 
142     @Override
143     public void bind() throws LdapException
144     {
145         connection.bind();
146     }
147 
148 
149     @Override
150     public void anonymousBind() throws LdapException
151     {
152         connection.anonymousBind();
153     }
154 
155 
156     @Override
157     public void bind( String name ) throws LdapException
158     {
159         connection.bind( name );
160     }
161 
162 
163     @Override
164     public void bind( String name, String credentials ) throws LdapException
165     {
166         connection.bind( name, credentials );
167     }
168 
169 
170     @Override
171     public void bind( Dn name ) throws LdapException
172     {
173         connection.bind( name );
174     }
175 
176 
177     @Override
178     public void bind( Dn name, String credentials ) throws LdapException
179     {
180         connection.bind( name, credentials );
181     }
182 
183 
184     @Override
185     public BindResponse bind( BindRequest bindRequest ) throws LdapException
186     {
187         return connection.bind( bindRequest );
188     }
189 
190 
191     @Override
192     public EntryCursor search( Dn baseDn, String filter, SearchScope scope, String... attributes )
193         throws LdapException
194     {
195         return connection.search( baseDn, filter, scope, attributes );
196     }
197 
198 
199     @Override
200     public EntryCursor search( String baseDn, String filter, SearchScope scope, String... attributes )
201         throws LdapException
202     {
203         return connection.search( baseDn, filter, scope, attributes );
204     }
205 
206 
207     @Override
208     public SearchCursor search( SearchRequest searchRequest ) throws LdapException
209     {
210         return connection.search( searchRequest );
211     }
212 
213 
214     @Override
215     public void unBind() throws LdapException
216     {
217         connection.unBind();
218     }
219 
220 
221     @Override
222     public void setTimeOut( long timeOut )
223     {
224         connection.setTimeOut( timeOut );
225     }
226 
227 
228     @Override
229     public void modify( Dn dn, Modification... modifications ) throws LdapException
230     {
231         connection.modify( dn, modifications );
232     }
233 
234 
235     @Override
236     public void modify( String dn, Modification... modifications ) throws LdapException
237     {
238         connection.modify( dn, modifications );
239     }
240 
241 
242     @Override
243     public void modify( Entry entry, ModificationOperation modOp ) throws LdapException
244     {
245         connection.modify( entry, modOp );
246     }
247 
248 
249     @Override
250     public ModifyResponse modify( ModifyRequest modRequest ) throws LdapException
251     {
252         return connection.modify( modRequest );
253     }
254 
255 
256     @Override
257     public void rename( String entryDn, String newRdn ) throws LdapException
258     {
259         connection.rename( entryDn, newRdn );
260     }
261 
262 
263     @Override
264     public void rename( Dn entryDn, Rdn newRdn ) throws LdapException
265     {
266         connection.rename( entryDn, newRdn );
267     }
268 
269 
270     @Override
271     public void rename( String entryDn, String newRdn, boolean deleteOldRdn ) throws LdapException
272     {
273         connection.rename( entryDn, newRdn, deleteOldRdn );
274     }
275 
276 
277     @Override
278     public void rename( Dn entryDn, Rdn newRdn, boolean deleteOldRdn ) throws LdapException
279     {
280         connection.rename( entryDn, newRdn, deleteOldRdn );
281     }
282 
283 
284     @Override
285     public void move( String entryDn, String newSuperiorDn ) throws LdapException
286     {
287         connection.move( entryDn, newSuperiorDn );
288     }
289 
290 
291     @Override
292     public void move( Dn entryDn, Dn newSuperiorDn ) throws LdapException
293     {
294         connection.move( entryDn, newSuperiorDn );
295     }
296 
297 
298     @Override
299     public void moveAndRename( Dn entryDn, Dn newDn ) throws LdapException
300     {
301         connection.moveAndRename( entryDn, newDn );
302     }
303 
304 
305     @Override
306     public void moveAndRename( String entryDn, String newDn ) throws LdapException
307     {
308         connection.moveAndRename( entryDn, newDn );
309     }
310 
311 
312     @Override
313     public void moveAndRename( Dn entryDn, Dn newDn, boolean deleteOldRdn ) throws LdapException
314     {
315         connection.moveAndRename( entryDn, newDn, deleteOldRdn );
316     }
317 
318 
319     @Override
320     public void moveAndRename( String entryDn, String newDn, boolean deleteOldRdn ) throws LdapException
321     {
322         connection.moveAndRename( entryDn, newDn, deleteOldRdn );
323     }
324 
325 
326     @Override
327     public ModifyDnResponse modifyDn( ModifyDnRequest modDnRequest ) throws LdapException
328     {
329         return connection.modifyDn( modDnRequest );
330     }
331 
332 
333     @Override
334     public void delete( String dn ) throws LdapException
335     {
336         connection.delete( dn );
337     }
338 
339 
340     @Override
341     public void delete( Dn dn ) throws LdapException
342     {
343         connection.delete( dn );
344     }
345 
346 
347     @Override
348     public DeleteResponse delete( DeleteRequest deleteRequest ) throws LdapException
349     {
350         return connection.delete( deleteRequest );
351     }
352 
353 
354     @Override
355     public boolean compare( String dn, String attributeName, String value ) throws LdapException
356     {
357         return connection.compare( dn, attributeName, value );
358     }
359 
360 
361     @Override
362     public boolean compare( String dn, String attributeName, byte[] value ) throws LdapException
363     {
364         return connection.compare( dn, attributeName, value );
365     }
366 
367 
368     @Override
369     public boolean compare( String dn, String attributeName, Value<?> value ) throws LdapException
370     {
371         return connection.compare( dn, attributeName, value );
372     }
373 
374 
375     @Override
376     public boolean compare( Dn dn, String attributeName, String value ) throws LdapException
377     {
378         return connection.compare( dn, attributeName, value );
379     }
380 
381 
382     @Override
383     public boolean compare( Dn dn, String attributeName, byte[] value ) throws LdapException
384     {
385         return connection.compare( dn, attributeName, value );
386     }
387 
388 
389     @Override
390     public boolean compare( Dn dn, String attributeName, Value<?> value ) throws LdapException
391     {
392         return connection.compare( dn, attributeName, value );
393     }
394 
395 
396     @Override
397     public CompareResponse compare( CompareRequest compareRequest ) throws LdapException
398     {
399         return connection.compare( compareRequest );
400     }
401 
402 
403     @Override
404     public ExtendedResponse extended( String oid ) throws LdapException
405     {
406         return connection.extended( oid );
407     }
408 
409 
410     @Override
411     public ExtendedResponse extended( String oid, byte[] value ) throws LdapException
412     {
413         return connection.extended( oid, value );
414     }
415 
416 
417     @Override
418     public ExtendedResponse extended( Oid oid ) throws LdapException
419     {
420         return connection.extended( oid );
421     }
422 
423 
424     @Override
425     public ExtendedResponse extended( Oid oid, byte[] value ) throws LdapException
426     {
427         return connection.extended( oid, value );
428     }
429 
430 
431     @Override
432     public ExtendedResponse extended( ExtendedRequest extendedRequest ) throws LdapException
433     {
434         return connection.extended( extendedRequest );
435     }
436 
437 
438     @Override
439     public boolean exists( String dn ) throws LdapException
440     {
441         return connection.exists( dn );
442     }
443 
444 
445     @Override
446     public boolean exists( Dn dn ) throws LdapException
447     {
448         return connection.exists( dn );
449     }
450 
451 
452     @Override
453     public Entry getRootDse() throws LdapException
454     {
455         return connection.getRootDse();
456     }
457 
458 
459     @Override
460     public Entry getRootDse( String... attributes ) throws LdapException
461     {
462         return connection.getRootDse( attributes );
463     }
464 
465 
466     @Override
467     public Entry lookup( Dn dn ) throws LdapException
468     {
469         return connection.lookup( dn );
470     }
471 
472 
473     @Override
474     public Entry lookup( String dn ) throws LdapException
475     {
476         return connection.lookup( dn );
477     }
478 
479 
480     @Override
481     public Entry lookup( Dn dn, String... attributes ) throws LdapException
482     {
483         return connection.lookup( dn, attributes );
484     }
485 
486 
487     @Override
488     public Entry lookup( Dn dn, Control[] controls, String... attributes ) throws LdapException
489     {
490         return connection.lookup( dn, controls, attributes );
491     }
492 
493 
494     @Override
495     public Entry lookup( String dn, String... attributes ) throws LdapException
496     {
497         return connection.lookup( dn, attributes );
498     }
499 
500 
501     @Override
502     public Entry lookup( String dn, Control[] controls, String... attributes ) throws LdapException
503     {
504         return connection.lookup( dn, controls, attributes );
505     }
506 
507 
508     @Override
509     public boolean isControlSupported( String controlOID ) throws LdapException
510     {
511         return connection.isControlSupported( controlOID );
512     }
513 
514 
515     @Override
516     public List<String> getSupportedControls() throws LdapException
517     {
518         return connection.getSupportedControls();
519     }
520 
521 
522     @Override
523     public void loadSchema() throws LdapException
524     {
525         connection.loadSchema();
526     }
527 
528 
529     @Override
530     public SchemaManager getSchemaManager()
531     {
532         return connection.getSchemaManager();
533     }
534 
535 
536     @Override
537     public LdapApiService getCodecService()
538     {
539         return connection.getCodecService();
540     }
541 
542 
543     @Override
544     public boolean doesFutureExistFor( int messageId )
545     {
546         return connection.doesFutureExistFor( messageId );
547     }
548 
549 
550     @Override
551     public BinaryAttributeDetector getBinaryAttributeDetector()
552     {
553         return connection.getBinaryAttributeDetector();
554     }
555 
556 
557     @Override
558     public void setBinaryAttributeDetector( BinaryAttributeDetector binaryAttributeDetecter )
559     {
560         connection.setBinaryAttributeDetector( binaryAttributeDetecter );
561     }
562 
563 
564     @Override
565     public void setSchemaManager( SchemaManager schemaManager )
566     {
567         connection.setSchemaManager( schemaManager );
568     }
569 }