directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r291081 - /directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerDirContext.java
Date Fri, 23 Sep 2005 06:28:48 GMT
Author: akarasulu
Date: Thu Sep 22 23:28:45 2005
New Revision: 291081

URL: http://svn.apache.org/viewcvs?rev=291081&view=rev
Log:
added extra overload to search in ServerDirContext to facilitate use with the LDAP protocol
provider

Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerDirContext.java

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerDirContext.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerDirContext.java?rev=291081&r1=291080&r2=291081&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerDirContext.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerDirContext.java
Thu Sep 22 23:28:45 2005
@@ -59,8 +59,7 @@
  */
 public abstract class ServerDirContext extends ServerContext implements EventDirContext
 {
-    
-    
+
     // ------------------------------------------------------------------------
     // Constructors
     // ------------------------------------------------------------------------
@@ -564,6 +563,24 @@
 
 
     /**
+     * A search overload that is used for optimizing search handling in the
+     * LDAP protocol provider which deals with an ExprNode instance rather than
+     * a String for the filter.
+     *
+     * @param name the relative name of the object serving as the search base
+     * @param filter the search filter as an expression tree
+     * @param cons the search controls to use
+     * @return an enumeration over the SearchResults
+     * @throws NamingException if there are problems performing the search
+     */
+    public NamingEnumeration search( Name name, ExprNode filter, SearchControls cons ) throws
NamingException
+    {
+        LdapName target = buildTarget( name );
+        return getNexusProxy().search( target, getEnvironment(), filter, cons );
+    }
+
+
+    /**
      * @see javax.naming.directory.DirContext#search(javax.naming.Name,
      *      java.lang.String, javax.naming.directory.SearchControls)
      */
@@ -574,37 +591,28 @@
 
         LdapName target = buildTarget( name );
 
-        if ( filter == null && getEnvironment().containsKey( "__filter__" ) )
+        try
         {
-            filterNode = ( ExprNode ) getEnvironment().get( "__filter__" );
+            filterNode = filterParser.parse( filter );
         }
-        else
+        catch ( ParseException pe )
         {
-            try
-            {
-                FilterParser parser = new FilterParserImpl();
-
-                filterNode = parser.parse( filter );
-            }
-            catch ( ParseException pe )
-            {
-                InvalidSearchFilterException isfe =
-                    new InvalidSearchFilterException (
-                    "Encountered parse exception while parsing the filter: '"
-                    + filter + "'" );
+            InvalidSearchFilterException isfe =
+                new InvalidSearchFilterException (
+                "Encountered parse exception while parsing the filter: '"
+                + filter + "'" );
 
-                isfe.setRootCause( pe );
+            isfe.setRootCause( pe );
 
-                throw isfe;
-            }
-            catch ( IOException ioe )
-            {
-                NamingException ne = new NamingException(
-                    "Parser failed with IO exception on filter: '"
-                    + filter + "'" );
-                ne.setRootCause( ioe );
-                throw ne;
-            }
+            throw isfe;
+        }
+        catch ( IOException ioe )
+        {
+            NamingException ne = new NamingException(
+                "Parser failed with IO exception on filter: '"
+                + filter + "'" );
+            ne.setRootCause( ioe );
+            throw ne;
         }
 
         return getNexusProxy().search( target , getEnvironment(), filterNode, cons );



Mime
View raw message