You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by sz...@apache.org on 2009/01/22 17:12:54 UTC

svn commit: r736687 - /directory/sandbox/szoerner/groovyldap/src/main/java/org/apache/directory/groovyldap/LDAP.java

Author: szoerner
Date: Thu Jan 22 08:12:54 2009
New Revision: 736687

URL: http://svn.apache.org/viewvc?rev=736687&view=rev
Log:
Applied patch from Michal Szklanowski

Modified:
    directory/sandbox/szoerner/groovyldap/src/main/java/org/apache/directory/groovyldap/LDAP.java

Modified: directory/sandbox/szoerner/groovyldap/src/main/java/org/apache/directory/groovyldap/LDAP.java
URL: http://svn.apache.org/viewvc/directory/sandbox/szoerner/groovyldap/src/main/java/org/apache/directory/groovyldap/LDAP.java?rev=736687&r1=736686&r2=736687&view=diff
==============================================================================
--- directory/sandbox/szoerner/groovyldap/src/main/java/org/apache/directory/groovyldap/LDAP.java (original)
+++ directory/sandbox/szoerner/groovyldap/src/main/java/org/apache/directory/groovyldap/LDAP.java Thu Jan 22 08:12:54 2009
@@ -63,6 +63,7 @@
     private String bindUser;
 
     private String bindPassword;
+    private String baseDn;
 
 
     protected Properties createEnvironment()
@@ -93,6 +94,13 @@
     }
 
 
+    protected LDAP( String url, String baseDn )
+    {
+        this.url = url;
+        this.anonymousBind = true;
+        this.baseDn = baseDn;
+    }
+
     protected LDAP( String url, String bindUser, String bindPassword )
     {
         this.url = url;
@@ -101,6 +109,14 @@
         this.bindPassword = bindPassword;
     }
 
+    protected LDAP( String url, String baseDn, String bindUser, String bindPassword )
+    {
+        this.url = url;
+        this.anonymousBind = false;
+        this.baseDn = baseDn;
+        this.bindUser = bindUser;
+        this.bindPassword = bindPassword;
+    }
 
     /**
      * Creates a new LDAP object with default parameters. It will anonymously connect to localhost on port 389. 
@@ -400,7 +416,7 @@
 
     public void eachEntry( String filter, Closure closure ) throws NamingException
     {
-        eachEntry( filter, "", SearchScope.SUB, closure );
+        eachEntry( filter, baseDn, SearchScope.SUB, closure );
     }
 
 
@@ -500,6 +516,12 @@
         return this.search( search );
     }
 
+    public List<Object> search( String filter ) throws NamingException
+    {
+        return search( filter, baseDn, SearchScope.SUB );
+    }
+
+
 
     public List<Object> search( Search search ) throws NamingException
     {
@@ -557,6 +579,21 @@
         return this.searchUnique( search );
     }
 
+    public Object searchUnique( String filter, String base, SearchScope scope) throws NamingException
+    {
+
+        Search search = new Search();
+        search.setFilter( filter );
+        search.setBase( base );
+        search.setScope( scope );
+
+        return searchUnique( search );
+    }
+
+    public Object searchUnique( String filter) throws NamingException
+    {
+        return searchUnique( filter, baseDn, SearchScope.SUB);
+    }
 
 
     public List<Object> search( String filter, String base, SearchScope scope ) throws NamingException