directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r575783 [2/4] - in /directory: apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/ apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/ apacheds/trunk/core/src/main/java/org/apache/directory/server...
Date Fri, 14 Sep 2007 20:15:03 GMT
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java?rev=575783&r1=575782&r2=575783&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java Fri Sep 14 13:14:59 2007
@@ -45,11 +45,13 @@
 import org.apache.directory.server.schema.registries.OidRegistry;
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.filter.AndNode;
 import org.apache.directory.shared.ldap.filter.BranchNode;
+import org.apache.directory.shared.ldap.filter.EqualityNode;
 import org.apache.directory.shared.ldap.filter.ExprNode;
+import org.apache.directory.shared.ldap.filter.OrNode;
 import org.apache.directory.shared.ldap.filter.PresenceNode;
 import org.apache.directory.shared.ldap.filter.SimpleNode;
-import org.apache.directory.shared.ldap.filter.AssertionEnum;
 import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
@@ -187,7 +189,7 @@
     {
         LdapDN base = new LdapDN( "ou=schema" );
         base.normalize( attrRegistry.getNormalizerMapping() );
-        ExprNode filter = new SimpleNode( oidRegistry.getOid( SchemaConstants.OBJECT_CLASS_AT ), MetaSchemaConstants.META_SCHEMA_OC, AssertionEnum.EQUALITY );
+        ExprNode filter = new EqualityNode( oidRegistry.getOid( SchemaConstants.OBJECT_CLASS_AT ), MetaSchemaConstants.META_SCHEMA_OC );
         SearchControls searchControls = new SearchControls();
         searchControls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
         searchControls.setReturningAttributes( SCHEMA_ATTRIBUTES );
@@ -212,17 +214,16 @@
     
     public boolean hasMatchingRule( String oid ) throws NamingException
     {
-        BranchNode filter = new BranchNode( AssertionEnum.AND );
-        filter.addNode( new SimpleNode( OBJECTCLASS_OID, 
-            MetaSchemaConstants.META_MATCHING_RULE_OC, AssertionEnum.EQUALITY ) );
+        BranchNode filter = new AndNode();
+        filter.addNode( new EqualityNode( OBJECTCLASS_OID, MetaSchemaConstants.META_MATCHING_RULE_OC ) );
 
         if ( NUMERIC_OID_CHECKER.isValidSyntax( oid ) )
         {
-            filter.addNode( new SimpleNode( M_OID_OID, oid, AssertionEnum.EQUALITY ) );
+            filter.addNode( new EqualityNode( M_OID_OID, oid ) );
         }
         else
         {
-            filter.addNode( new SimpleNode( M_NAME_OID, oid.toLowerCase(), AssertionEnum.EQUALITY ) );
+            filter.addNode( new EqualityNode( M_NAME_OID, oid.toLowerCase() ) );
         }
         
         SearchControls searchControls = new SearchControls();
@@ -256,17 +257,16 @@
     
     public boolean hasAttributeType( String oid ) throws NamingException
     {
-        BranchNode filter = new BranchNode( AssertionEnum.AND );
-        filter.addNode( new SimpleNode( OBJECTCLASS_OID, 
-            MetaSchemaConstants.META_ATTRIBUTE_TYPE_OC, AssertionEnum.EQUALITY ) );
+        BranchNode filter = new AndNode();
+        filter.addNode( new EqualityNode( OBJECTCLASS_OID,  MetaSchemaConstants.META_ATTRIBUTE_TYPE_OC ) );
 
         if ( NUMERIC_OID_CHECKER.isValidSyntax( oid ) )
         {
-            filter.addNode( new SimpleNode( M_OID_OID, oid, AssertionEnum.EQUALITY ) );
+            filter.addNode( new EqualityNode( M_OID_OID, oid ) );
         }
         else
         {
-            filter.addNode( new SimpleNode( M_NAME_OID, oid.toLowerCase(), AssertionEnum.EQUALITY ) );
+            filter.addNode( new EqualityNode( M_NAME_OID, oid.toLowerCase() ) );
         }
         
         SearchControls searchControls = new SearchControls();
@@ -300,17 +300,16 @@
     
     public boolean hasObjectClass( String oid ) throws NamingException
     {
-        BranchNode filter = new BranchNode( AssertionEnum.AND );
-        filter.addNode( new SimpleNode( OBJECTCLASS_OID, 
-            MetaSchemaConstants.META_OBJECT_CLASS_OC, AssertionEnum.EQUALITY ) );
+        BranchNode filter = new AndNode();
+        filter.addNode( new EqualityNode( OBJECTCLASS_OID, MetaSchemaConstants.META_OBJECT_CLASS_OC ) );
 
         if ( NUMERIC_OID_CHECKER.isValidSyntax( oid ) )
         {
-            filter.addNode( new SimpleNode( M_OID_OID, oid, AssertionEnum.EQUALITY ) );
+            filter.addNode( new EqualityNode( M_OID_OID, oid ) );
         }
         else
         {
-            filter.addNode( new SimpleNode( M_NAME_OID, oid.toLowerCase(), AssertionEnum.EQUALITY ) );
+            filter.addNode( new EqualityNode( M_NAME_OID, oid.toLowerCase() ) );
         }
         
         SearchControls searchControls = new SearchControls();
@@ -344,17 +343,16 @@
     
     public boolean hasSyntax( String oid ) throws NamingException
     {
-        BranchNode filter = new BranchNode( AssertionEnum.AND );
-        filter.addNode( new SimpleNode( OBJECTCLASS_OID, 
-            MetaSchemaConstants.META_SYNTAX_OC, AssertionEnum.EQUALITY ) );
+        BranchNode filter = new AndNode();
+        filter.addNode( new EqualityNode( OBJECTCLASS_OID, MetaSchemaConstants.META_SYNTAX_OC ) );
 
         if ( NUMERIC_OID_CHECKER.isValidSyntax( oid ) )
         {
-            filter.addNode( new SimpleNode( M_OID_OID, oid, AssertionEnum.EQUALITY ) );
+            filter.addNode( new EqualityNode( M_OID_OID, oid ) );
         }
         else
         {
-            filter.addNode( new SimpleNode( M_NAME_OID, oid.toLowerCase(), AssertionEnum.EQUALITY ) );
+            filter.addNode( new EqualityNode( M_NAME_OID, oid.toLowerCase() ) );
         }
         
         SearchControls searchControls = new SearchControls();
@@ -388,17 +386,16 @@
     
     public boolean hasSyntaxChecker( String oid ) throws NamingException
     {
-        BranchNode filter = new BranchNode( AssertionEnum.AND );
-        filter.addNode( new SimpleNode( OBJECTCLASS_OID, 
-            MetaSchemaConstants.META_SYNTAX_CHECKER_OC, AssertionEnum.EQUALITY ) );
+        BranchNode filter = new AndNode();
+        filter.addNode( new EqualityNode( OBJECTCLASS_OID, MetaSchemaConstants.META_SYNTAX_CHECKER_OC ) );
 
         if ( NUMERIC_OID_CHECKER.isValidSyntax( oid ) )
         {
-            filter.addNode( new SimpleNode( M_OID_OID, oid, AssertionEnum.EQUALITY ) );
+            filter.addNode( new EqualityNode( M_OID_OID, oid ) );
         }
         else
         {
-            filter.addNode( new SimpleNode( M_NAME_OID, oid.toLowerCase(), AssertionEnum.EQUALITY ) );
+            filter.addNode( new EqualityNode( M_NAME_OID, oid.toLowerCase() ) );
         }
         
         SearchControls searchControls = new SearchControls();
@@ -488,9 +485,9 @@
      */
     public SearchResult find( String entityName ) throws NamingException
     {
-        BranchNode filter = new BranchNode( AssertionEnum.OR );
-        SimpleNode nameAVA = new SimpleNode( M_NAME_OID, entityName.toLowerCase(), AssertionEnum.EQUALITY );
-        SimpleNode oidAVA = new SimpleNode( M_OID_OID, entityName.toLowerCase(), AssertionEnum.EQUALITY );
+        BranchNode filter = new OrNode();
+        SimpleNode nameAVA = new EqualityNode( M_NAME_OID, entityName.toLowerCase() );
+        SimpleNode oidAVA = new EqualityNode( M_OID_OID, entityName.toLowerCase() );
         filter.addNode( nameAVA );
         filter.addNode( oidAVA );
         SearchControls searchControls = new SearchControls();
@@ -597,18 +594,17 @@
     public Set<SearchResult> listSyntaxDependents( String numericOid ) throws NamingException
     {
         Set<SearchResult> set = new HashSet<SearchResult>( );
-        BranchNode filter = new BranchNode( AssertionEnum.AND );
+        BranchNode filter = new AndNode();
         
         // subfilter for (| (objectClass=metaMatchingRule) (objectClass=metaAttributeType))  
-        BranchNode or = new BranchNode( AssertionEnum.OR );
-        or.addNode( new SimpleNode( OBJECTCLASS_OID, 
-            MetaSchemaConstants.META_MATCHING_RULE_OC.toLowerCase(), AssertionEnum.EQUALITY ) );
-        or.addNode( new SimpleNode( OBJECTCLASS_OID, 
-            MetaSchemaConstants.META_ATTRIBUTE_TYPE_OC.toLowerCase(), AssertionEnum.EQUALITY ) );
+        BranchNode or = new OrNode();
+        or.addNode( new EqualityNode( OBJECTCLASS_OID, 
+            MetaSchemaConstants.META_MATCHING_RULE_OC.toLowerCase() ) );
+        or.addNode( new EqualityNode( OBJECTCLASS_OID, 
+            MetaSchemaConstants.META_ATTRIBUTE_TYPE_OC.toLowerCase() ) );
         
         filter.addNode( or );
-        filter.addNode( new SimpleNode( M_SYNTAX_OID, 
-            numericOid.toLowerCase(), AssertionEnum.EQUALITY ) );
+        filter.addNode( new EqualityNode( M_SYNTAX_OID, numericOid.toLowerCase() ) );
 
         SearchControls searchControls = new SearchControls();
         searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
@@ -638,25 +634,24 @@
     public Set<SearchResult> listMatchingRuleDependents( MatchingRule mr ) throws NamingException
     {
         Set<SearchResult> set = new HashSet<SearchResult>( );
-        BranchNode filter = new BranchNode( AssertionEnum.AND );
+        BranchNode filter = new AndNode();
         
         // ( objectClass = metaAttributeType )
-        filter.addNode( new SimpleNode( OBJECTCLASS_OID, 
-            MetaSchemaConstants.META_ATTRIBUTE_TYPE_OC.toLowerCase(), AssertionEnum.EQUALITY ) );
+        filter.addNode( new EqualityNode( OBJECTCLASS_OID, MetaSchemaConstants.META_ATTRIBUTE_TYPE_OC.toLowerCase() ) );
         
-        BranchNode or = new BranchNode( AssertionEnum.OR );
-        or.addNode( new SimpleNode( M_ORDERING_OID, mr.getOid(), AssertionEnum.EQUALITY ) );
-        or.addNode( new SimpleNode( M_SUBSTRING_OID, mr.getOid(), AssertionEnum.EQUALITY ) );
-        or.addNode( new SimpleNode( M_EQUALITY_OID, mr.getOid(), AssertionEnum.EQUALITY ) );
+        BranchNode or = new OrNode();
+        or.addNode( new EqualityNode( M_ORDERING_OID, mr.getOid() ) );
+        or.addNode( new EqualityNode( M_SUBSTRING_OID, mr.getOid() ) );
+        or.addNode( new EqualityNode( M_EQUALITY_OID, mr.getOid() ) );
         filter.addNode( or );
 
         if ( mr.getNames() != null || mr.getNames().length > 0 )
         {
             for ( String name : mr.getNames() )
             {
-                or.addNode( new SimpleNode( M_ORDERING_OID, name.toLowerCase(), AssertionEnum.EQUALITY ) );
-                or.addNode( new SimpleNode( M_SUBSTRING_OID, name.toLowerCase(), AssertionEnum.EQUALITY ) );
-                or.addNode( new SimpleNode( M_EQUALITY_OID, name.toLowerCase(), AssertionEnum.EQUALITY ) );
+                or.addNode( new EqualityNode( M_ORDERING_OID, name.toLowerCase() ) );
+                or.addNode( new EqualityNode( M_SUBSTRING_OID, name.toLowerCase() ) );
+                or.addNode( new EqualityNode( M_EQUALITY_OID, name.toLowerCase() ) );
             }
         }
 
@@ -689,7 +684,7 @@
     {
         SearchControls searchControls = new SearchControls();
         searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-        BranchNode filter = new BranchNode( AssertionEnum.AND );
+        BranchNode filter = new AndNode();
         
         // (& (m-oid=*) (m-name=*) )
         filter.addNode( new PresenceNode( M_OID_OID ) );
@@ -720,21 +715,21 @@
          */
         
         Set<SearchResult> set = new HashSet<SearchResult>( );
-        BranchNode filter = new BranchNode( AssertionEnum.AND );
+        BranchNode filter = new AndNode();
         
         // ( objectClass = metaAttributeType )
-        BranchNode or = new BranchNode( AssertionEnum.OR );
-        or.addNode( new SimpleNode( OBJECTCLASS_OID, 
-            MetaSchemaConstants.META_ATTRIBUTE_TYPE_OC.toLowerCase(), AssertionEnum.EQUALITY ) );
-        or.addNode( new SimpleNode( OBJECTCLASS_OID, 
-            MetaSchemaConstants.META_OBJECT_CLASS_OC.toLowerCase(), AssertionEnum.EQUALITY ) );
+        BranchNode or = new OrNode();
+        or.addNode( new EqualityNode( OBJECTCLASS_OID, 
+            MetaSchemaConstants.META_ATTRIBUTE_TYPE_OC.toLowerCase() ) );
+        or.addNode( new EqualityNode( OBJECTCLASS_OID, 
+            MetaSchemaConstants.META_OBJECT_CLASS_OC.toLowerCase() ) );
         filter.addNode( or );
 
         
-        or = new BranchNode( AssertionEnum.OR );
-        or.addNode( new SimpleNode( M_MAY_OID, at.getOid(), AssertionEnum.EQUALITY ) );
-        or.addNode( new SimpleNode( M_MUST_OID, at.getOid(), AssertionEnum.EQUALITY ) );
-        or.addNode( new SimpleNode( M_SUP_ATTRIBUTE_TYPE_OID, at.getOid(), AssertionEnum.EQUALITY ) );
+        or = new OrNode();
+        or.addNode( new EqualityNode( M_MAY_OID, at.getOid() ) );
+        or.addNode( new EqualityNode( M_MUST_OID, at.getOid() ) );
+        or.addNode( new EqualityNode( M_SUP_ATTRIBUTE_TYPE_OID, at.getOid() ) );
         filter.addNode( or );
 
         SearchControls searchControls = new SearchControls();
@@ -778,12 +773,12 @@
          */
         
         Set<SearchResult> set = new HashSet<SearchResult>( );
-        BranchNode filter = new BranchNode( AssertionEnum.AND );
+        BranchNode filter = new AndNode();
         
-        filter.addNode( new SimpleNode( OBJECTCLASS_OID, 
-            MetaSchemaConstants.META_SCHEMA_OC.toLowerCase(), AssertionEnum.EQUALITY ) );
-        filter.addNode( new SimpleNode( M_DEPENDENCIES_OID, 
-            schemaName.toLowerCase(), AssertionEnum.EQUALITY ) );
+        filter.addNode( new EqualityNode( OBJECTCLASS_OID, 
+            MetaSchemaConstants.META_SCHEMA_OC.toLowerCase() ) );
+        filter.addNode( new EqualityNode( M_DEPENDENCIES_OID, 
+            schemaName.toLowerCase() ) );
 
         SearchControls searchControls = new SearchControls();
         searchControls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
@@ -820,12 +815,12 @@
     public Set<SearchResult> listEnabledSchemaDependents( String schemaName ) throws NamingException
     {
         Set<SearchResult> set = new HashSet<SearchResult>( );
-        BranchNode filter = new BranchNode( AssertionEnum.AND );
+        BranchNode filter = new AndNode();
         
-        filter.addNode( new SimpleNode( OBJECTCLASS_OID, 
-            MetaSchemaConstants.META_SCHEMA_OC.toLowerCase(), AssertionEnum.EQUALITY ) );
-        filter.addNode( new SimpleNode( M_DEPENDENCIES_OID, 
-            schemaName.toLowerCase(), AssertionEnum.EQUALITY ) );
+        filter.addNode( new EqualityNode( OBJECTCLASS_OID, 
+            MetaSchemaConstants.META_SCHEMA_OC.toLowerCase() ) );
+        filter.addNode( new EqualityNode( M_DEPENDENCIES_OID, 
+            schemaName.toLowerCase() ) );
         
         SearchControls searchControls = new SearchControls();
         searchControls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
@@ -889,22 +884,22 @@
          */
         
         Set<SearchResult> set = new HashSet<SearchResult>( );
-        BranchNode filter = new BranchNode( AssertionEnum.AND );
+        BranchNode filter = new AndNode();
         
-        BranchNode or = new BranchNode( AssertionEnum.OR );
-        or.addNode( new SimpleNode( OBJECTCLASS_OID, 
-            MetaSchemaConstants.META_NAME_FORM_OC.toLowerCase(), AssertionEnum.EQUALITY ) );
-        or.addNode( new SimpleNode( OBJECTCLASS_OID, 
-            MetaSchemaConstants.META_OBJECT_CLASS_OC.toLowerCase(), AssertionEnum.EQUALITY ) );
-        or.addNode( new SimpleNode( OBJECTCLASS_OID, 
-            MetaSchemaConstants.META_DIT_CONTENT_RULE_OC.toLowerCase(), AssertionEnum.EQUALITY ) );
+        BranchNode or = new OrNode();
+        or.addNode( new EqualityNode( OBJECTCLASS_OID, 
+            MetaSchemaConstants.META_NAME_FORM_OC.toLowerCase() ) );
+        or.addNode( new EqualityNode( OBJECTCLASS_OID, 
+            MetaSchemaConstants.META_OBJECT_CLASS_OC.toLowerCase() ) );
+        or.addNode( new EqualityNode( OBJECTCLASS_OID, 
+            MetaSchemaConstants.META_DIT_CONTENT_RULE_OC.toLowerCase() ) );
         filter.addNode( or );
 
         
-        or = new BranchNode( AssertionEnum.OR );
-        or.addNode( new SimpleNode( M_AUX_OID, oc.getOid(), AssertionEnum.EQUALITY ) );
-        or.addNode( new SimpleNode( M_OC_OID, oc.getOid(), AssertionEnum.EQUALITY ) );
-        or.addNode( new SimpleNode( M_SUP_OBJECT_CLASS_OID, oc.getOid(), AssertionEnum.EQUALITY ) );
+        or = new OrNode();
+        or.addNode( new EqualityNode( M_AUX_OID, oc.getOid() ) );
+        or.addNode( new EqualityNode( M_OC_OID, oc.getOid() ) );
+        or.addNode( new EqualityNode( M_SUP_OBJECT_CLASS_OID, oc.getOid() ) );
         filter.addNode( or );
 
         SearchControls searchControls = new SearchControls();

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java?rev=575783&r1=575782&r2=575783&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java Fri Sep 14 13:14:59 2007
@@ -71,7 +71,7 @@
 import org.apache.directory.shared.ldap.exception.LdapNameNotFoundException;
 import org.apache.directory.shared.ldap.exception.LdapNoSuchAttributeException;
 import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
-import org.apache.directory.shared.ldap.filter.AssertionEnum;
+import org.apache.directory.shared.ldap.filter.EqualityNode;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.filter.PresenceNode;
 import org.apache.directory.shared.ldap.filter.SimpleNode;
@@ -566,7 +566,7 @@
                 if ( nodeOid.equals( SchemaConstants.OBJECT_CLASS_AT_OID )
                     && ( objectClassOid.equals( SchemaConstants.TOP_OC_OID ) || 
                         objectClassOid.equals( SchemaConstants.SUBSCHEMA_OC_OID ) )
-                    && ( node.getAssertionType() == AssertionEnum.EQUALITY ) )
+                    && ( node instanceof EqualityNode ) )
                 {
                     // call.setBypass( true );
                     Attributes attrs = getSubschemaEntry( searchCtls.getReturningAttributes() );

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/sp/LdapClassLoader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/sp/LdapClassLoader.java?rev=575783&r1=575782&r2=575783&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/sp/LdapClassLoader.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/sp/LdapClassLoader.java Fri Sep 14 13:14:59 2007
@@ -31,9 +31,9 @@
 import org.apache.directory.server.constants.ApacheSchemaConstants;
 import org.apache.directory.server.core.jndi.ServerLdapContext;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.filter.AssertionEnum;
+import org.apache.directory.shared.ldap.filter.AndNode;
 import org.apache.directory.shared.ldap.filter.BranchNode;
-import org.apache.directory.shared.ldap.filter.SimpleNode;
+import org.apache.directory.shared.ldap.filter.EqualityNode;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
 import org.slf4j.Logger;
@@ -73,9 +73,9 @@
         NamingEnumeration javaClassEntries = null;
         byte[] classBytes = null;
         
-        BranchNode filter = new BranchNode( AssertionEnum.AND );
-        filter.addNode( new SimpleNode( "fullyQualifiedJavaClassName", name, AssertionEnum.EQUALITY ) );
-        filter.addNode( new SimpleNode( SchemaConstants.OBJECT_CLASS_AT, ApacheSchemaConstants.JAVA_CLASS_OC, AssertionEnum.EQUALITY ) );
+        BranchNode filter = new AndNode( );
+        filter.addNode( new EqualityNode( "fullyQualifiedJavaClassName", name ) );
+        filter.addNode( new EqualityNode( SchemaConstants.OBJECT_CLASS_AT, ApacheSchemaConstants.JAVA_CLASS_OC ) );
         
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/RefinementEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/RefinementEvaluator.java?rev=575783&r1=575782&r2=575783&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/RefinementEvaluator.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/RefinementEvaluator.java Fri Sep 14 13:14:59 2007
@@ -21,13 +21,15 @@
 
 
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.filter.AndNode;
 import org.apache.directory.shared.ldap.filter.BranchNode;
 import org.apache.directory.shared.ldap.filter.ExprNode;
+import org.apache.directory.shared.ldap.filter.NotNode;
+import org.apache.directory.shared.ldap.filter.OrNode;
 import org.apache.directory.shared.ldap.filter.SimpleNode;
 
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
-import java.util.Iterator;
 
 
 /**
@@ -73,46 +75,44 @@
 
         BranchNode bnode = ( BranchNode ) node;
 
-        switch ( bnode.getOperator() )
+        if ( node instanceof OrNode )
         {
-            case OR :
-                Iterator children = bnode.getChildren().iterator();
-
-                while ( children.hasNext() )
+            for ( ExprNode child:bnode.getChildren() )
+            {
+                if ( evaluate( child, objectClasses ) )
                 {
-                    ExprNode child = ( ExprNode ) children.next();
-
-                    if ( evaluate( child, objectClasses ) )
-                    {
-                        return true;
-                    }
+                    return true;
                 }
+            }
 
-                return false;
-                
-            case AND :
-                children = bnode.getChildren().iterator();
-                while ( children.hasNext() )
+            return false;
+        }
+        else if ( node instanceof AndNode )
+        {
+            for ( ExprNode child:bnode.getChildren() )
+            {
+                if ( !evaluate( child, objectClasses ) )
                 {
-                    ExprNode child = ( ExprNode ) children.next();
-
-                    if ( !evaluate( child, objectClasses ) )
-                    {
-                        return false;
-                    }
+                    return false;
                 }
+            }
 
-                return true;
-                
-            case NOT :
-                if ( null != bnode.getChild() )
-                {
-                    return !evaluate( bnode.getChild(), objectClasses );
-                }
+            return true;
+        	
+        }
+        else if ( node instanceof NotNode )
+        {
+            if ( null != bnode.getFirstChild() )
+            {
+                return !evaluate( bnode.getFirstChild(), objectClasses );
+            }
 
-                throw new IllegalArgumentException( "Negation has no child: " + node );
-            default:
-                throw new IllegalArgumentException( "Unrecognized branch node operator: " + bnode.getOperator() );
+            throw new IllegalArgumentException( "Negation has no child: " + node );
+        	
+        }
+        else
+        {
+            throw new IllegalArgumentException( "Unrecognized branch node operator: " + bnode );
         }
     }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluator.java?rev=575783&r1=575782&r2=575783&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluator.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluator.java Fri Sep 14 13:14:59 2007
@@ -22,7 +22,7 @@
 
 import org.apache.directory.server.schema.registries.OidRegistry;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.filter.AssertionEnum;
+import org.apache.directory.shared.ldap.filter.EqualityNode;
 import org.apache.directory.shared.ldap.filter.SimpleNode;
 import org.apache.directory.shared.ldap.util.StringTools;
 
@@ -72,9 +72,9 @@
         {
             throw new IllegalArgumentException( "node cannot be null" );
         }
-        if ( node.getAssertionType() != AssertionEnum.EQUALITY )
+        if ( !( node instanceof EqualityNode ) )
         {
-            throw new NamingException( "Unrecognized assertion type for refinement node: " + node.getAssertionType() );
+            throw new NamingException( "Unrecognized assertion type for refinement node: " + node );
         }
         if ( !node.getAttribute().equalsIgnoreCase( SchemaConstants.OBJECT_CLASS_AT ) )
         {

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java?rev=575783&r1=575782&r2=575783&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java Fri Sep 14 13:14:59 2007
@@ -61,10 +61,9 @@
 import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeValueException;
 import org.apache.directory.shared.ldap.exception.LdapNoSuchAttributeException;
 import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
-import org.apache.directory.shared.ldap.filter.AssertionEnum;
+import org.apache.directory.shared.ldap.filter.EqualityNode;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.filter.PresenceNode;
-import org.apache.directory.shared.ldap.filter.SimpleNode;
 import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.message.ModificationItemImpl;
@@ -149,7 +148,7 @@
 
         // prepare to find all subentries in all namingContexts
         Iterator suffixes = this.nexus.listSuffixes( null );
-        ExprNode filter = new SimpleNode( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.SUBENTRY_OC, AssertionEnum.EQUALITY );
+        ExprNode filter = new EqualityNode( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.SUBENTRY_OC );
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
         controls.setReturningAttributes( new String[] { SchemaConstants.SUBTREE_SPECIFICATION_AT, SchemaConstants.OBJECT_CLASS_AT } );

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java?rev=575783&r1=575782&r2=575783&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java Fri Sep 14 13:14:59 2007
@@ -44,9 +44,8 @@
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.filter.AssertionEnum;
+import org.apache.directory.shared.ldap.filter.EqualityNode;
 import org.apache.directory.shared.ldap.filter.ExprNode;
-import org.apache.directory.shared.ldap.filter.SimpleNode;
 import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.NormalizerMappingResolver;
@@ -117,7 +116,7 @@
         {
             String suffix = ( String ) suffixes.next();
             LdapDN baseDn = new LdapDN( suffix );
-            ExprNode filter = new SimpleNode( SchemaConstants.OBJECT_CLASS_AT, ApacheSchemaConstants.TRIGGER_EXECUTION_SUBENTRY_OC, AssertionEnum.EQUALITY );
+            ExprNode filter = new EqualityNode( SchemaConstants.OBJECT_CLASS_AT, ApacheSchemaConstants.TRIGGER_EXECUTION_SUBENTRY_OC );
             SearchControls ctls = new SearchControls();
             ctls.setSearchScope( SearchControls.SUBTREE_SCOPE );
             NamingEnumeration results = 

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/subtree/RefinementEvaluatorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/subtree/RefinementEvaluatorTest.java?rev=575783&r1=575782&r2=575783&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/subtree/RefinementEvaluatorTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/subtree/RefinementEvaluatorTest.java Fri Sep 14 13:14:59 2007
@@ -36,12 +36,11 @@
 import org.apache.directory.server.schema.registries.DefaultRegistries;
 import org.apache.directory.server.schema.registries.OidRegistry;
 import org.apache.directory.server.schema.registries.Registries;
-import org.apache.directory.shared.ldap.filter.BranchNode;
+import org.apache.directory.shared.ldap.filter.EqualityNode;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.filter.FilterParser;
 import org.apache.directory.shared.ldap.filter.FilterParserImpl;
-import org.apache.directory.shared.ldap.filter.SimpleNode;
-import org.apache.directory.shared.ldap.filter.AssertionEnum;
+import org.apache.directory.shared.ldap.filter.NotNode;
 import org.apache.directory.shared.ldap.message.AttributeImpl;
 
 import java.util.Set;
@@ -119,7 +118,7 @@
 
         try
         {
-            assertFalse( evaluator.evaluate( new SimpleNode( "", "", AssertionEnum.EQUALITY ), null ) );
+            assertFalse( evaluator.evaluate( new EqualityNode( "", "" ), null ) );
             fail( "should never get here due to an IAE" );
         }
         catch ( IllegalArgumentException iae )
@@ -128,7 +127,7 @@
 
         try
         {
-            assertFalse( evaluator.evaluate( new SimpleNode( "", "", AssertionEnum.EQUALITY ), new AttributeImpl( "blah" ) ) );
+            assertFalse( evaluator.evaluate( new EqualityNode( "", "" ), new AttributeImpl( "blah" ) ) );
             fail( "should never get here due to an IAE" );
         }
         catch ( IllegalArgumentException iae )
@@ -143,19 +142,19 @@
 
         // positive test
         objectClasses = new AttributeImpl( "objectClass", "person" );
-        assertTrue( evaluator.evaluate( new SimpleNode( "objectClass", "person", AssertionEnum.EQUALITY ), objectClasses ) );
+        assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", "person" ), objectClasses ) );
 
         objectClasses = new AttributeImpl( "objectClass" );
         objectClasses.add( "person" );
         objectClasses.add( "blah" );
-        assertTrue( evaluator.evaluate( new SimpleNode( "objectClass", "person", AssertionEnum.EQUALITY ), objectClasses ) );
+        assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", "person" ), objectClasses ) );
 
         // negative tests
         objectClasses = new AttributeImpl( "objectClass", "person" );
-        assertFalse( evaluator.evaluate( new SimpleNode( "objectClass", "blah", AssertionEnum.EQUALITY ), objectClasses ) );
+        assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", "blah" ), objectClasses ) );
 
         objectClasses = new AttributeImpl( "objectClass", "blah" );
-        assertFalse( evaluator.evaluate( new SimpleNode( "objectClass", "person", AssertionEnum.EQUALITY ), objectClasses ) );
+        assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", "person" ), objectClasses ) );
     }
 
 
@@ -165,19 +164,19 @@
 
         // positive test
         objectClasses = new AttributeImpl( "objectClass", "person" );
-        assertTrue( evaluator.evaluate( new SimpleNode( "objectClass", "2.5.6.6", AssertionEnum.EQUALITY ), objectClasses ) );
+        assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", "2.5.6.6" ), objectClasses ) );
 
         objectClasses = new AttributeImpl( "objectClass" );
         objectClasses.add( "person" );
         objectClasses.add( "blah" );
-        assertTrue( evaluator.evaluate( new SimpleNode( "objectClass", "2.5.6.6", AssertionEnum.EQUALITY ), objectClasses ) );
+        assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", "2.5.6.6" ), objectClasses ) );
 
         // negative tests
         objectClasses = new AttributeImpl( "objectClass", "person" );
-        assertFalse( evaluator.evaluate( new SimpleNode( "objectClass", "2.5.6.5", AssertionEnum.EQUALITY ), objectClasses ) );
+        assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", "2.5.6.5" ), objectClasses ) );
 
         objectClasses = new AttributeImpl( "objectClass", "blah" );
-        assertFalse( evaluator.evaluate( new SimpleNode( "objectClass", "2.5.6.5", AssertionEnum.EQUALITY ), objectClasses ) );
+        assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", "2.5.6.5" ), objectClasses ) );
     }
 
 
@@ -232,7 +231,7 @@
 
         try
         {
-            assertFalse( evaluator.evaluate( new BranchNode( AssertionEnum.NOT ), new AttributeImpl( "objectClass" ) ) );
+            assertFalse( evaluator.evaluate( new NotNode(), new AttributeImpl( "objectClass" ) ) );
             fail( "should never get here due to an IAE" );
         }
         catch ( IllegalArgumentException iae )

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java?rev=575783&r1=575782&r2=575783&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java Fri Sep 14 13:14:59 2007
@@ -35,8 +35,8 @@
 import org.apache.directory.server.schema.registries.DefaultRegistries;
 import org.apache.directory.server.schema.registries.OidRegistry;
 import org.apache.directory.server.schema.registries.Registries;
-import org.apache.directory.shared.ldap.filter.SimpleNode;
-import org.apache.directory.shared.ldap.filter.AssertionEnum;
+import org.apache.directory.shared.ldap.filter.EqualityNode;
+import org.apache.directory.shared.ldap.filter.GreaterEqNode;
 import org.apache.directory.shared.ldap.message.AttributeImpl;
 
 import java.util.Set;
@@ -115,7 +115,7 @@
 
         try
         {
-            assertFalse( evaluator.evaluate( new SimpleNode( "", "", AssertionEnum.GREATEREQ ), objectClasses ) );
+            assertFalse( evaluator.evaluate( new GreaterEqNode( "", "" ), objectClasses ) );
             fail( "should never get here due to an NE" );
         }
         catch ( NamingException ne )
@@ -124,7 +124,7 @@
 
         try
         {
-            assertFalse( evaluator.evaluate( new SimpleNode( "", "", AssertionEnum.EQUALITY ), objectClasses ) );
+            assertFalse( evaluator.evaluate( new EqualityNode( "", "" ), objectClasses ) );
             fail( "should never get here due to an NE" );
         }
         catch ( NamingException ne )
@@ -133,7 +133,7 @@
 
         try
         {
-            assertFalse( evaluator.evaluate( new SimpleNode( "objectClass", "", AssertionEnum.EQUALITY ), objectClasses ) );
+            assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", "" ), objectClasses ) );
             fail( "should never get here due to an IAE" );
         }
         catch ( IllegalArgumentException iae )
@@ -143,7 +143,7 @@
         try
         {
             objectClasses = new AttributeImpl( "incorrectAttrId" );
-            assertFalse( evaluator.evaluate( new SimpleNode( "objectClass", "", AssertionEnum.EQUALITY ), objectClasses ) );
+            assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", "" ), objectClasses ) );
             fail( "should never get here due to an IAE" );
         }
         catch ( IllegalArgumentException iae )
@@ -158,19 +158,19 @@
 
         // positive test
         objectClasses = new AttributeImpl( "objectClass", "person" );
-        assertTrue( evaluator.evaluate( new SimpleNode( "objectClass", "person", AssertionEnum.EQUALITY ), objectClasses ) );
+        assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", "person" ), objectClasses ) );
 
         objectClasses = new AttributeImpl( "objectClass" );
         objectClasses.add( "person" );
         objectClasses.add( "blah" );
-        assertTrue( evaluator.evaluate( new SimpleNode( "objectClass", "person", AssertionEnum.EQUALITY ), objectClasses ) );
+        assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", "person" ), objectClasses ) );
 
         // negative tests
         objectClasses = new AttributeImpl( "objectClass", "person" );
-        assertFalse( evaluator.evaluate( new SimpleNode( "objectClass", "blah", AssertionEnum.EQUALITY ), objectClasses ) );
+        assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", "blah" ), objectClasses ) );
 
         objectClasses = new AttributeImpl( "objectClass", "blah" );
-        assertFalse( evaluator.evaluate( new SimpleNode( "objectClass", "person", AssertionEnum.EQUALITY ), objectClasses ) );
+        assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", "person" ), objectClasses ) );
     }
 
 
@@ -180,18 +180,18 @@
 
         // positive test
         objectClasses = new AttributeImpl( "objectClass", "person" );
-        assertTrue( evaluator.evaluate( new SimpleNode( "objectClass", "2.5.6.6", AssertionEnum.EQUALITY ), objectClasses ) );
+        assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", "2.5.6.6" ), objectClasses ) );
 
         objectClasses = new AttributeImpl( "objectClass" );
         objectClasses.add( "person" );
         objectClasses.add( "blah" );
-        assertTrue( evaluator.evaluate( new SimpleNode( "objectClass", "2.5.6.6", AssertionEnum.EQUALITY ), objectClasses ) );
+        assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", "2.5.6.6" ), objectClasses ) );
 
         // negative tests
         objectClasses = new AttributeImpl( "objectClass", "person" );
-        assertFalse( evaluator.evaluate( new SimpleNode( "objectClass", "2.5.6.5", AssertionEnum.EQUALITY ), objectClasses ) );
+        assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", "2.5.6.5" ), objectClasses ) );
 
         objectClasses = new AttributeImpl( "objectClass", "blah" );
-        assertFalse( evaluator.evaluate( new SimpleNode( "objectClass", "2.5.6.5", AssertionEnum.EQUALITY ), objectClasses ) );
+        assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", "2.5.6.5" ), objectClasses ) );
     }
 }

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/SearchHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/SearchHandler.java?rev=575783&r1=575782&r2=575783&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/SearchHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/SearchHandler.java Fri Sep 14 13:14:59 2007
@@ -347,7 +347,7 @@
 
                 // now we process entries for ever as they change 
                 PersistentSearchListener handler = new PersistentSearchListener( ctx, session, req );
-                StringBuffer buf = new StringBuffer();
+                StringBuilder buf = new StringBuilder();
                 req.getFilter().printToBuffer( buf );
                 ctx.addNamingListener( req.getBase(), buf.toString(), controls, handler );
                 //TM long t1 = System.nanoTime();

Modified: directory/shared/trunk/ldap/src/main/antlr/ACIItem.g
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/antlr/ACIItem.g?rev=575783&r1=575782&r2=575783&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/antlr/ACIItem.g (original)
+++ directory/shared/trunk/ldap/src/main/antlr/ACIItem.g Fri Sep 14 13:14:59 2007
@@ -34,12 +34,14 @@
 import javax.naming.directory.Attribute;
 import javax.naming.Name;
 
-import org.apache.directory.shared.ldap.filter.AssertionEnum;
 import org.apache.directory.shared.ldap.filter.BranchNode;
+import org.apache.directory.shared.ldap.filter.AndNode;
+import org.apache.directory.shared.ldap.filter.OrNode;
+import org.apache.directory.shared.ldap.filter.NotNode;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.filter.FilterParserImpl;
 import org.apache.directory.shared.ldap.filter.LeafNode;
-import org.apache.directory.shared.ldap.filter.SimpleNode;
+import org.apache.directory.shared.ldap.filter.EqualityNode;
 import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.name.NameComponentNormalizer;
 import org.apache.directory.shared.ldap.subtree.SubtreeSpecification;
@@ -1224,7 +1226,7 @@
     :
     ID_item ( SP )* COLON ( SP )* oid=oid
     {
-        node = new SimpleNode( SchemaConstants.OBJECT_CLASS_AT , oid , AssertionEnum.EQUALITY );
+        node = new EqualityNode( SchemaConstants.OBJECT_CLASS_AT , oid );
     }
     ;
 
@@ -1237,7 +1239,7 @@
     :
     ID_and ( SP )* COLON ( SP )* children=refinements
     {
-        node = new BranchNode( AssertionEnum.AND , children );
+        node = new AndNode( children );
     }
     ;
 
@@ -1250,7 +1252,7 @@
     :
     ID_or ( SP )* COLON ( SP )* children=refinements
     {
-        node = new BranchNode( AssertionEnum.OR , children );
+        node = new OrNode( children );
     }
     ;
 
@@ -1263,7 +1265,7 @@
     :
     ID_not ( SP )* COLON ( SP )* children=refinements
     {
-        node = new BranchNode( AssertionEnum.NOT , children );
+        node = new NotNode( children );
     }
     ;
 

Modified: directory/shared/trunk/ldap/src/main/antlr/filter-parser.g
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/antlr/filter-parser.g?rev=575783&r1=575782&r2=575783&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/antlr/filter-parser.g (original)
+++ directory/shared/trunk/ldap/src/main/antlr/filter-parser.g Fri Sep 14 13:14:59 2007
@@ -66,10 +66,13 @@
 {
     /** the monitor used to track the activities of this parser */
     FilterParserMonitor monitor;
+    
     /** the token stream selector used for multiplexing the underlying stream */
     TokenStreamSelector selector;
+    
     /** the filter value encoding lexer */
     AntlrFilterValueLexer valueLexer;
+    
     /** the value parser pulling tokens from the value lexer */
     AntlrFilterValueParser valueParser;
 
@@ -173,7 +176,7 @@
       }
     )*
     {
-        node = new BranchNode( AssertionEnum.AND, children );
+        node = new AndNode( children );
     }
     ;
 
@@ -198,7 +201,7 @@
       }
     )*
     {
-        node = new BranchNode( AssertionEnum.OR, children );
+        node = new OrNode( children );
     }
     ;
 
@@ -213,7 +216,7 @@
 }
     : EXCLAMATION child=filter
     {
-        node = new BranchNode( AssertionEnum.NOT );
+        node = new NotNode();
         node.addNode( child );
     }
     ;
@@ -297,31 +300,53 @@
         switch( type )
         {
             case APPROXIMATE :
+                if ( value instanceof String )
+                {
+                    node = new ApproximateNode( attribute, ( String ) value );
+                }
+                else if ( value instanceof byte[] )
+                {
+                    node = new ApproximateNode( attribute, ( byte[] ) value );
+                }
+                break;
+
             case GREATEREQ :
+                if ( value instanceof String )
+                {
+                    node = new GreaterEqNode( attribute, ( String ) value );
+                }
+                else if ( value instanceof byte[] )
+                {
+                    node = new GreaterEqNode( attribute, ( byte[] ) value );
+                }
+                break;
+
             case LESSEQ :
                 if ( value instanceof String )
                 {
-                    node = new SimpleNode( attribute, ( String ) value, type );
+                    node = new LessEqNode( attribute, ( String ) value );
                 }
                 else if ( value instanceof byte[] )
                 {
-                    node = new SimpleNode( attribute, ( byte[] ) value, type );
+                    node = new LessEqNode( attribute, ( byte[] ) value );
                 }
+
                 break;
                 
             case EQUALITY :
                 if ( value instanceof String )
                 {
-                    node = new SimpleNode( attribute, ( String ) value, type );
+                    node = new EqualityNode( attribute, ( String ) value );
                 }
                 else if ( value instanceof byte[] )
                 {
-                    node = new SimpleNode( attribute, ( byte[] ) value, type );
+                    node = new EqualityNode( attribute, ( byte[] ) value );
                 }
                 else
                 {
                     node = ( LeafNode ) value;
                 }
+                
                 break;
                 
             default:

Modified: directory/shared/trunk/ldap/src/main/antlr/subtree-specification.g
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/antlr/subtree-specification.g?rev=575783&r1=575782&r2=575783&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/antlr/subtree-specification.g (original)
+++ directory/shared/trunk/ldap/src/main/antlr/subtree-specification.g Fri Sep 14 13:14:59 2007
@@ -32,9 +32,11 @@
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.filter.LeafNode;
-import org.apache.directory.shared.ldap.filter.SimpleNode;
 import org.apache.directory.shared.ldap.filter.BranchNode;
-import org.apache.directory.shared.ldap.filter.AssertionEnum;
+import org.apache.directory.shared.ldap.filter.AndNode;
+import org.apache.directory.shared.ldap.filter.OrNode;
+import org.apache.directory.shared.ldap.filter.NotNode;
+import org.apache.directory.shared.ldap.filter.EqualityNode;
 import org.apache.directory.shared.ldap.filter.FilterParserImpl;
 import org.apache.directory.shared.ldap.subtree.SubtreeSpecification;
 import org.apache.directory.shared.ldap.subtree.SubtreeSpecificationModifier;
@@ -399,7 +401,7 @@
     :
     ID_item ( SP )* COLON ( SP )* oid=oid
     {
-        node = new SimpleNode( SchemaConstants.OBJECT_CLASS_AT , oid , AssertionEnum.EQUALITY );
+        node = new EqualityNode( SchemaConstants.OBJECT_CLASS_AT, oid );
     }
     ;
 
@@ -412,7 +414,7 @@
     :
     ID_and ( SP )* COLON ( SP )* children=refinements
     {
-        node = new BranchNode( AssertionEnum.AND , children );
+        node = new AndNode( children );
     }
     ;
 
@@ -425,7 +427,7 @@
     :
     ID_or ( SP )* COLON ( SP )* children=refinements
     {
-        node = new BranchNode( AssertionEnum.OR , children );
+        node = new OrNode( children );
     }
     ;
 
@@ -438,7 +440,7 @@
     :
     ID_not ( SP )* COLON ( SP )* children=refinements
     {
-        node = new BranchNode( AssertionEnum.NOT , children );
+        node = new NotNode( children );
     }
     ;
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItem.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItem.java?rev=575783&r1=575782&r2=575783&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItem.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ACIItem.java Fri Sep 14 13:14:59 2007
@@ -115,7 +115,7 @@
      *
      * @param buffer the string buffer
      */
-    public abstract void printToBuffer( StringBuffer buffer );
+    public abstract void printToBuffer( StringBuilder buffer );
 
     
     /**

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/GrantAndDenial.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/GrantAndDenial.java?rev=575783&r1=575782&r2=575783&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/GrantAndDenial.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/GrantAndDenial.java Fri Sep 14 13:14:59 2007
@@ -180,7 +180,7 @@
      *
      * @param buffer the string buffer
      */
-    public void printToBuffer( StringBuffer buffer )
+    public void printToBuffer( StringBuilder buffer )
     {
         buffer.append( getName() );
     }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ItemFirstACIItem.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ItemFirstACIItem.java?rev=575783&r1=575782&r2=575783&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ItemFirstACIItem.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ItemFirstACIItem.java Fri Sep 14 13:14:59 2007
@@ -125,7 +125,7 @@
      *
      * @param buffer the string buffer
      */
-    public void printToBuffer( StringBuffer buffer )
+    public void printToBuffer( StringBuilder buffer )
     {
         // identificationTag
         buffer.append( "{ identificationTag \"" );

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ItemPermission.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ItemPermission.java?rev=575783&r1=575782&r2=575783&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ItemPermission.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ItemPermission.java Fri Sep 14 13:14:59 2007
@@ -79,7 +79,7 @@
      *
      * @param buffer the string buffer
      */
-    public void printToBuffer( StringBuffer buffer )
+    public void printToBuffer( StringBuilder buffer )
     {
         buffer.append( "{ " );
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ProtectedItem.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ProtectedItem.java?rev=575783&r1=575782&r2=575783&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ProtectedItem.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/ProtectedItem.java Fri Sep 14 13:14:59 2007
@@ -77,7 +77,7 @@
      *
      * @param buffer the string buffer
      */
-    public abstract void printToBuffer( StringBuffer buffer );
+    public abstract void printToBuffer( StringBuilder buffer );
 
     
     /**
@@ -130,10 +130,9 @@
         }
 
 
-        public void printToBuffer( StringBuffer buffer )
+        public void printToBuffer( StringBuilder buffer )
         {
-            buffer.append( "classes" );
-            buffer.append( ' ' );
+            buffer.append( "classes " );
             classes.printRefinementToBuffer( buffer );
         }
     }
@@ -162,7 +161,7 @@
         }
         
         
-        public void printToBuffer( StringBuffer buffer )
+        public void printToBuffer( StringBuilder buffer )
         {
             buffer.append( "entry" );
         }
@@ -188,7 +187,7 @@
         }
         
         
-        public void printToBuffer( StringBuffer buffer )
+        public void printToBuffer( StringBuilder buffer )
         {
             buffer.append( "allUserAttributeTypes" );
         }
@@ -214,7 +213,7 @@
         }
         
         
-        public void printToBuffer( StringBuffer buffer )
+        public void printToBuffer( StringBuilder buffer )
         {
             buffer.append( "allUserAttributeTypesAndValues" );
         }
@@ -255,11 +254,6 @@
                 return true;
             }
 
-            if ( o == null )
-            {
-                return false;
-            }
-
             if ( getClass().isAssignableFrom( o.getClass() ) )
             {
                 AttributeTypeProtectedItem that = ( AttributeTypeProtectedItem ) o;
@@ -270,7 +264,7 @@
         }
         
         
-        public void printToBuffer( StringBuffer buffer )
+        public void printToBuffer( StringBuilder buffer )
         {
             buffer.append( "{ " );
             boolean isFirst = true;
@@ -320,10 +314,9 @@
         }
         
         
-        public void printToBuffer( StringBuffer buffer )
+        public void printToBuffer( StringBuilder buffer )
         {
-            buffer.append( "attributeType" );
-            buffer.append( ' ' );
+            buffer.append( "attributeType " );
             super.printToBuffer( buffer );
         }
     }
@@ -354,10 +347,9 @@
         }
         
         
-        public void printToBuffer( StringBuffer buffer )
+        public void printToBuffer( StringBuilder buffer )
         {
-            buffer.append( "allAttributeValues" );
-            buffer.append( ' ' );
+            buffer.append( "allAttributeValues " );
             super.printToBuffer( buffer );
         }
     }
@@ -392,10 +384,9 @@
         }
         
         
-        public void printToBuffer( StringBuffer buffer )
+        public void printToBuffer( StringBuilder buffer )
         {
-            buffer.append( "selfValue" );
-            buffer.append( ' ' );
+            buffer.append( "selfValue " );
             super.printToBuffer( buffer );
         }
     }
@@ -453,19 +444,16 @@
         }
         
         
-        public void printToBuffer( StringBuffer buffer )
+        public void printToBuffer( StringBuilder buffer )
         {
-            buffer.append( "attributeValue" );
-            buffer.append( ' ' );
-           
-            buffer.append( '{' );
-            buffer.append( ' ' );
+            buffer.append( "attributeValue {" );
             
             for ( Iterator<Attribute> it = attributes.iterator(); it.hasNext(); )
             {
                 Attribute attribute = it.next();
                 buffer.append( attribute.getID() );
                 buffer.append( '=' );
+                
                 try
                 {
                     buffer.append( attribute.get( 0 ) );
@@ -475,14 +463,13 @@
                     // doesn't occur here, it is an Attribute
                 }
                 
-                if(it.hasNext()) {
-                    buffer.append( ',' );
-                    buffer.append( ' ' );
+                if ( it.hasNext() ) 
+                {
+                    buffer.append( ", " );
                 }
             }
             
-            buffer.append( ' ' );
-            buffer.append( '}' );
+            buffer.append( " }" );
         }
     }
 
@@ -510,14 +497,6 @@
          */
         public MaxValueCount( Collection<MaxValueCountItem> items )
         {
-            for ( Iterator<MaxValueCountItem> i = items.iterator(); i.hasNext(); )
-            {
-                if ( !MaxValueCountItem.class.isAssignableFrom( i.next().getClass() ) )
-                {
-                    throw new IllegalArgumentException( "Max value count contains a wrong element." );
-                }
-            }
-
             this.items = Collections.unmodifiableCollection( new ArrayList<MaxValueCountItem>( items ) );
         }
 
@@ -554,27 +533,22 @@
         }
         
         
-        public void printToBuffer( StringBuffer buffer )
+        public void printToBuffer( StringBuilder buffer )
         {
-            buffer.append( "maxValueCount" );
-            buffer.append( ' ' );
-           
-            buffer.append( '{' );
-            buffer.append( ' ' );
+            buffer.append( "maxValueCount {" );
             
             for ( Iterator<MaxValueCountItem> it = items.iterator(); it.hasNext(); )
             {
                 MaxValueCountItem item = it.next();
                 item.printToBuffer( buffer );
                 
-                if(it.hasNext()) {
-                    buffer.append( ',' );
-                    buffer.append( ' ' );
+                if ( it.hasNext() ) 
+                {
+                    buffer.append( ", " );
                 }
             }
             
-            buffer.append( ' ' );
-            buffer.append( '}' );
+            buffer.append( " }" );
         }
     }
 
@@ -634,17 +608,16 @@
 
         public String toString()
         {
-            StringBuffer buf = new StringBuffer();
+        	StringBuilder buf = new StringBuilder();
             buf.append( "rangeOfValues: " );
             filter.printToBuffer( buf );
             return buf.toString();
         }
         
         
-        public void printToBuffer( StringBuffer buffer )
+        public void printToBuffer( StringBuilder buffer )
         {
-            buffer.append( "rangeOfValues" );
-            buffer.append( ' ' );
+            buffer.append( "rangeOfValues " );
             filter.printToBuffer( buffer );
         }
     }
@@ -710,10 +683,9 @@
         }
         
         
-        public void printToBuffer( StringBuffer buffer )
+        public void printToBuffer( StringBuilder buffer )
         {
-            buffer.append( "maxImmSub" );
-            buffer.append( ' ' );
+            buffer.append( "maxImmSub " );
             buffer.append( value );
         }
     }
@@ -777,27 +749,22 @@
         }
         
         
-        public void printToBuffer( StringBuffer buffer )
+        public void printToBuffer( StringBuilder buffer )
         {
-            buffer.append( "restrictedBy" );
-            buffer.append( ' ' );
-            
-            buffer.append( '{' );
-            buffer.append( ' ' );
+            buffer.append( "restrictedBy {" );
             
             for ( Iterator<RestrictedByItem> it = items.iterator(); it.hasNext(); )
             {
                 RestrictedByItem item = it.next();
                 item.printToBuffer( buffer );
                 
-                if(it.hasNext()) {
-                    buffer.append( ',' );
-                    buffer.append( ' ' );
+                if ( it.hasNext() ) 
+                {
+                    buffer.append( ", " );
                 }
             }
             
-            buffer.append( ' ' );
-            buffer.append( '}' );
+            buffer.append( " }" );
         }
     }
 
@@ -853,24 +820,13 @@
         }
         
         
-        public void printToBuffer( StringBuffer buffer )
+        public void printToBuffer( StringBuilder buffer )
         {
-            buffer.append( '{' );
-            buffer.append( ' ' );
-            
-            buffer.append( "type" );
-            buffer.append( ' ' );
-            buffer.append( attributeType );
+            buffer.append( "{ type " ).append( attributeType );
 
-            buffer.append( ',' );
-            buffer.append( ' ' );
+            buffer.append( ", maxcount " ).append( maxCount );
             
-            buffer.append( "maxCount" );
-            buffer.append( ' ' );
-            buffer.append( maxCount );
-            
-            buffer.append( ' ' );
-            buffer.append( '}' );
+            buffer.append( " }" );
         }
     }
 
@@ -927,25 +883,13 @@
         }
         
         
-        public void printToBuffer( StringBuffer buffer )
+        public void printToBuffer( StringBuilder buffer )
         {
-            buffer.append( '{' );
-            buffer.append( ' ' );
-            
-            buffer.append( "type" );
-            buffer.append( ' ' );
-            buffer.append( attributeType );
+            buffer.append( "' type " ).append( attributeType );
 
-            buffer.append( ',' );
-            buffer.append( ' ' );
+            buffer.append( ", valuesIn " ).append( valuesIn );
             
-            buffer.append( "valuesIn" );
-            buffer.append( ' ' );
-            buffer.append( valuesIn );
-            
-            buffer.append( ' ' );
-            buffer.append( '}' );
+            buffer.append( " }" );
         }
     }
-    
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserClass.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserClass.java?rev=575783&r1=575782&r2=575783&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserClass.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserClass.java Fri Sep 14 13:14:59 2007
@@ -66,7 +66,7 @@
      *
      * @param buffer the string buffer
      */
-    public abstract void printToBuffer( StringBuffer buffer );
+    public abstract void printToBuffer( StringBuilder buffer );
     
 
     /**
@@ -89,7 +89,7 @@
         }
         
         
-        public void printToBuffer( StringBuffer buffer )
+        public void printToBuffer( StringBuilder buffer )
         {
             buffer.append( "allUsers" );
         }
@@ -116,7 +116,7 @@
         }
         
         
-        public void printToBuffer( StringBuffer buffer )
+        public void printToBuffer( StringBuilder buffer )
         {
             buffer.append( "thisEntry" );
         }
@@ -178,7 +178,7 @@
         }
         
         
-        public void printToBuffer( StringBuffer buffer )
+        public void printToBuffer( StringBuilder buffer )
         {
             boolean isFirst = true;
             buffer.append( "{ " );
@@ -229,7 +229,7 @@
         }
         
         
-        public void printToBuffer( StringBuffer buffer )
+        public void printToBuffer( StringBuilder buffer )
         {
             buffer.append( "name " );
             super.printToBuffer( buffer );
@@ -265,7 +265,7 @@
         }
         
         
-        public void printToBuffer( StringBuffer buffer )
+        public void printToBuffer( StringBuilder buffer )
         {
             buffer.append( "userGroup " );
             super.printToBuffer( buffer );
@@ -327,7 +327,7 @@
         }
         
         
-        public void printToBuffer( StringBuffer buffer )
+        public void printToBuffer( StringBuilder buffer )
         {
             boolean isFirst = true;
             buffer.append( "subtree { " );

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserFirstACIItem.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserFirstACIItem.java?rev=575783&r1=575782&r2=575783&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserFirstACIItem.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserFirstACIItem.java Fri Sep 14 13:14:59 2007
@@ -126,87 +126,56 @@
      *
      * @param buffer the string buffer
      */
-    public void printToBuffer( StringBuffer buffer )
+    public void printToBuffer( StringBuilder buffer )
     {
-        buffer.append( '{' );
-        buffer.append( ' ' );
-        
         // identificationTag
-        buffer.append( "identificationTag" );
-        buffer.append( ' ' );
-        buffer.append( '"' );
+        buffer.append( "{ identificationTag \"" );
         buffer.append( getIdentificationTag() );
-        buffer.append( '"' );
-        buffer.append( ',' );
-        buffer.append( ' ' );
+        buffer.append( "\", " );
         
         // precedence
-        buffer.append( "precedence" );
-        buffer.append( ' ' );
+        buffer.append( "precedence " );
         buffer.append( getPrecedence() );
-        buffer.append( ',' );
-        buffer.append( ' ' );
+        buffer.append( ", " );
         
         // authenticationLevel
-        buffer.append( "authenticationLevel" );
-        buffer.append( ' ' );
+        buffer.append( "authenticationLevel " );
         buffer.append( getAuthenticationLevel().getName() );
-        buffer.append( ',' );
-        buffer.append( ' ' );
+        buffer.append( ", " );
         
         // itemOrUserFirst
-        buffer.append( "itemOrUserFirst" );
-        buffer.append( ' ' );
-        buffer.append( "userFirst" );
-        buffer.append( ':' );
-        buffer.append( ' ' );
-        
-        buffer.append( '{' );
-        buffer.append( ' ' );
+        buffer.append( "itemOrUserFirst userFirst: { " );
         
         // protectedItems
-        buffer.append( "userClasses" );
-        buffer.append( ' ' );
-        buffer.append( '{' );
-        buffer.append( ' ' );
+        buffer.append( "userClasses { " );
+
         for ( Iterator it = userClasses.iterator(); it.hasNext(); )
         {
             UserClass userClass =  ( UserClass ) it.next();
             userClass.printToBuffer( buffer );
             
-            if(it.hasNext()) {
-                buffer.append( ',' );
-                buffer.append( ' ' );
+            if ( it.hasNext() ) 
+            {
+                buffer.append( ", " );
             }
         }
-        buffer.append( ' ' );
-        buffer.append( '}' );
-        
-        buffer.append( ',' );
-        buffer.append( ' ' );
+
+        buffer.append( " }, " );
         
         // itemPermissions
-        buffer.append( "userPermissions" );
-        buffer.append( ' ' );
-        buffer.append( '{' );
-        buffer.append( ' ' );
+        buffer.append( "userPermissions { " );
+
         for ( Iterator it = userPermissions.iterator(); it.hasNext(); )
         {
             UserPermission permission = ( UserPermission ) it.next();
             permission.printToBuffer( buffer );
             
-            if(it.hasNext()) {
-                buffer.append( ',' );
-                buffer.append( ' ' );
+            if ( it.hasNext() ) 
+            {
+                buffer.append( ", " );
             }
         }
-        buffer.append( ' ' );
-        buffer.append( '}' );
-        
-        buffer.append( ' ' );
-        buffer.append( '}' );
         
-        buffer.append( ' ' );
-        buffer.append( '}' );
+        buffer.append( " } } }" );
     }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserPermission.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserPermission.java?rev=575783&r1=575782&r2=575783&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserPermission.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/aci/UserPermission.java Fri Sep 14 13:14:59 2007
@@ -80,58 +80,43 @@
      *
      * @param buffer the string buffer
      */
-    public void printToBuffer( StringBuffer buffer )
+    public void printToBuffer( StringBuilder buffer )
     {
-        buffer.append( '{' );
-        buffer.append( ' ' );
+        buffer.append( "{ " );
 
         if ( getPrecedence() >= 0 && getPrecedence() <= 255 )
         {
-            buffer.append( "precedence" );
-            buffer.append( ' ' );
+            buffer.append( "precedence " );
             buffer.append( getPrecedence() );
-            buffer.append( ',' );
-            buffer.append( ' ' );
+            buffer.append( ", " );
         }
         
-        buffer.append( "protectedItems" );
-        buffer.append( ' ' );
-        buffer.append( '{' );
-        buffer.append( ' ' );
+        buffer.append( "protectedItems { " );
+        
         for ( Iterator it = protectedItems.iterator(); it.hasNext(); )
         {
             ProtectedItem item = ( ProtectedItem ) it.next();
             item.printToBuffer( buffer );
             
-            if(it.hasNext()) {
-                buffer.append( ',' );
-                buffer.append( ' ' );
+            if ( it.hasNext() ) 
+            {
+                buffer.append( ", " );
             }
         }
-        buffer.append( ' ' );
-        buffer.append( '}' );
-        
-        buffer.append( ',' );
-        buffer.append( ' ' );
         
-        buffer.append( "grantsAndDenials" );
-        buffer.append( ' ' );
-        buffer.append( '{' );
-        buffer.append( ' ' );
+        buffer.append( " }, grantsAndDenials { " );
+
         for ( Iterator it = getGrantsAndDenials().iterator(); it.hasNext(); )
         {
             GrantAndDenial grantAndDenial = ( GrantAndDenial ) it.next();
             grantAndDenial.printToBuffer( buffer );
             
-            if(it.hasNext()) {
-                buffer.append( ',' );
-                buffer.append( ' ' );
+            if ( it.hasNext() ) 
+            {
+                buffer.append( ", " );
             }
         }
-        buffer.append( ' ' );
-        buffer.append( '}' );
         
-        buffer.append( ' ' );
-        buffer.append( '}' );
+        buffer.append( " } }" );
     }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java?rev=575783&r1=575782&r2=575783&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java Fri Sep 14 13:14:59 2007
@@ -65,13 +65,18 @@
 import org.apache.directory.shared.ldap.codec.search.controls.SubEntryControl;
 import org.apache.directory.shared.ldap.codec.util.LdapURL;
 import org.apache.directory.shared.ldap.codec.util.LdapURLEncodingException;
-import org.apache.directory.shared.ldap.filter.AssertionEnum;
+import org.apache.directory.shared.ldap.filter.AndNode;
+import org.apache.directory.shared.ldap.filter.ApproximateNode;
 import org.apache.directory.shared.ldap.filter.BranchNode;
+import org.apache.directory.shared.ldap.filter.EqualityNode;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.filter.ExtensibleNode;
+import org.apache.directory.shared.ldap.filter.GreaterEqNode;
 import org.apache.directory.shared.ldap.filter.LeafNode;
+import org.apache.directory.shared.ldap.filter.LessEqNode;
+import org.apache.directory.shared.ldap.filter.NotNode;
+import org.apache.directory.shared.ldap.filter.OrNode;
 import org.apache.directory.shared.ldap.filter.PresenceNode;
-import org.apache.directory.shared.ldap.filter.SimpleNode;
 import org.apache.directory.shared.ldap.filter.SubstringNode;
 import org.apache.directory.shared.ldap.message.AbandonRequestImpl;
 import org.apache.directory.shared.ldap.message.AddRequestImpl;
@@ -395,15 +400,15 @@
 
                 if ( twixFilter instanceof AndFilter )
                 {
-                    branch = new BranchNode( AssertionEnum.AND );
+                    branch = new AndNode();
                 }
                 else if ( twixFilter instanceof OrFilter )
                 {
-                    branch = new BranchNode( AssertionEnum.OR );
+                    branch = new OrNode();
                 }
                 else if ( twixFilter instanceof NotFilter )
                 {
-                    branch = new BranchNode( AssertionEnum.NOT );
+                    branch = new NotNode();
                 }
 
                 List<Filter> filtersSet = ( ( ConnectorFilter ) twixFilter ).getFilterSet();
@@ -440,15 +445,13 @@
                         case LdapConstants.EQUALITY_MATCH_FILTER:
                             if ( ava.getAssertionValue() instanceof String )
                             {
-                                branch = new SimpleNode( ava.getAttributeDesc(), 
-                                    (String)ava.getAssertionValue(), 
-                                    AssertionEnum.EQUALITY );
+                                branch = new EqualityNode( ava.getAttributeDesc(), 
+                                    (String)ava.getAssertionValue() );
                             }
                             else
                             {
-                                branch = new SimpleNode( ava.getAttributeDesc(), 
-                                    (byte[])ava.getAssertionValue(), 
-                                    AssertionEnum.EQUALITY );
+                                branch = new EqualityNode( ava.getAttributeDesc(), 
+                                    (byte[])ava.getAssertionValue() );
                             }
                             
                             break;
@@ -456,15 +459,13 @@
                         case LdapConstants.GREATER_OR_EQUAL_FILTER:
                             if ( ava.getAssertionValue() instanceof String )
                             {
-                                branch = new SimpleNode( ava.getAttributeDesc(),
-                                    (String)ava.getAssertionValue(),
-                                    AssertionEnum.GREATEREQ );
+                                branch = new GreaterEqNode( ava.getAttributeDesc(),
+                                    (String)ava.getAssertionValue() );
                             }
                             else
                             {
-                                branch = new SimpleNode( ava.getAttributeDesc(),
-                                    (byte[])ava.getAssertionValue(),
-                                    AssertionEnum.GREATEREQ );
+                                branch = new GreaterEqNode( ava.getAttributeDesc(),
+                                    (byte[])ava.getAssertionValue() );
                             }
 
                             break;
@@ -472,15 +473,13 @@
                         case LdapConstants.LESS_OR_EQUAL_FILTER:
                             if ( ava.getAssertionValue() instanceof String )
                             {
-                                branch = new SimpleNode( ava.getAttributeDesc(), 
-                                    (String)ava.getAssertionValue(), 
-                                    AssertionEnum.LESSEQ );
+                                branch = new LessEqNode( ava.getAttributeDesc(), 
+                                    (String)ava.getAssertionValue() );
                             }
                             else
                             {
-                                branch = new SimpleNode( ava.getAttributeDesc(), 
-                                    (byte[])ava.getAssertionValue(), 
-                                    AssertionEnum.LESSEQ );
+                                branch = new LessEqNode( ava.getAttributeDesc(), 
+                                    (byte[])ava.getAssertionValue() );
                             }
 
                             break;
@@ -488,15 +487,13 @@
                         case LdapConstants.APPROX_MATCH_FILTER:
                             if ( ava.getAssertionValue() instanceof String )
                             {
-                                branch = new SimpleNode( ava.getAttributeDesc(), 
-                                    (String)ava.getAssertionValue(), 
-                                    AssertionEnum.APPROXIMATE );
+                                branch = new ApproximateNode( ava.getAttributeDesc(), 
+                                    (String)ava.getAssertionValue() );
                             }
                             else
                             {
-                                branch = new SimpleNode( ava.getAttributeDesc(), 
-                                    (byte[])ava.getAssertionValue(), 
-                                    AssertionEnum.APPROXIMATE );
+                                branch = new ApproximateNode( ava.getAttributeDesc(), 
+                                    (byte[])ava.getAssertionValue() );
                             }
 
                             break;

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AbstractExprNode.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AbstractExprNode.java?rev=575783&r1=575782&r2=575783&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AbstractExprNode.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/filter/AbstractExprNode.java Fri Sep 14 13:14:59 2007
@@ -33,21 +33,13 @@
 public abstract class AbstractExprNode implements ExprNode
 {
     /** The map of annotations */
-    private Map<String, Object> annotations;
-
-    /** node type set to enumation of constants */
-    private final AssertionEnum assertionType;
-
+    protected Map<String, Object> annotations;
 
     /**
-     * Creates an node by setting abstract node type.
-     * 
-     * @param type
-     *            the type of this leaf node
+     * Creates a node by setting abstract node type.
      */
-    protected AbstractExprNode( AssertionEnum type)
+    protected AbstractExprNode()
     {
-        assertionType = type;
     }
 
 
@@ -85,125 +77,8 @@
      * 
      * @return the annotation map.
      */
-    protected Map getAnnotations()
+    protected Map<String, Object> getAnnotations()
     {
         return annotations;
-    }
-
-
-    /**
-     * Gets the assertion type of this leaf node.
-     * 
-     * @return the assertion or node type
-     */
-    public AssertionEnum getAssertionType()
-    {
-        return assertionType;
-    }
-
-
-    /**
-     * Returns the filter operator string associated with an assertion type.
-     * 
-     * @param assertionType
-     *            the assertion type value
-     * @return the string representation
-     * TODO Refactor these classes to use an enumeration type
-     */
-    public static final String getOperationString( AssertionEnum assertionType )
-    {
-        String opstr = null;
-
-        switch ( assertionType )
-        {
-            case APPROXIMATE :
-                opstr = "~=";
-
-                break;
-
-            case EQUALITY :
-                opstr = "=";
-
-                break;
-
-            case EXTENSIBLE :
-                opstr = "extensible";
-
-                break;
-
-            case GREATEREQ :
-                opstr = ">=";
-
-                break;
-
-            case LESSEQ :
-                opstr = "<=";
-
-                break;
-
-            case PRESENCE :
-                opstr = "=*";
-
-                break;
-
-            case SUBSTRING :
-                opstr = "=";
-
-                break;
-
-            default:
-                throw new IllegalArgumentException( "Attribute value assertion type is undefined." );
-        }
-
-        return opstr;
-    }
-
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see java.lang.Object#equals(java.lang.Object)
-     */
-    public boolean equals( Object other )
-    {
-        if ( this == other )
-        {
-            return true;
-        }
-
-        if ( ( other == null ) || ( other.getClass() != this.getClass() ) )
-        {
-            return false;
-        }
-
-        AbstractExprNode otherExprNode = ( AbstractExprNode ) other;
-
-        if ( otherExprNode.getAssertionType() != assertionType )
-        {
-            return false;
-        }
-
-        Map otherAnnotations = otherExprNode.annotations;
-
-        if ( otherAnnotations == annotations )
-        {
-            return true;
-        }
-
-        // return true if both are non-null and equals() is true
-
-        return ( ( null != annotations ) && ( null != otherAnnotations ) && 
-        		annotations.equals( otherAnnotations ) );
-    }
-    
-    /**
-     * @see Object#hashCode()
-     */
-    public int hashCode()
-    {
-        int hash = 7;
-        hash = hash*31 + ( assertionType == null ? 0 : assertionType.hashCode() );
-        hash = hash*31 + ( annotations == null ? 0 : annotations.hashCode() );
-        return hash;
     }
 }



Mime
View raw message