directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r963530 [2/3] - in /directory/apacheds/trunk: core-api/src/main/java/org/apache/directory/server/core/ core-api/src/main/java/org/apache/directory/server/core/event/ core-api/src/main/java/org/apache/directory/server/core/schema/ core-api/s...
Date Mon, 12 Jul 2010 23:37:40 GMT
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/FilterNormalizingVisitor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/FilterNormalizingVisitor.java?rev=963530&r1=963529&r2=963530&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/FilterNormalizingVisitor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/FilterNormalizingVisitor.java Mon Jul 12 23:37:38 2010
@@ -26,7 +26,6 @@ import java.util.List;
 import org.apache.directory.shared.ldap.entry.StringValue;
 import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.exception.LdapException;
-import org.apache.directory.shared.ldap.exception.LdapNoSuchAttributeException;
 import org.apache.directory.shared.ldap.filter.AndNode;
 import org.apache.directory.shared.ldap.filter.BranchNode;
 import org.apache.directory.shared.ldap.filter.ExprNode;
@@ -132,21 +131,19 @@ public class FilterNormalizingVisitor im
      * @param value The value to normalize
      * @return the normalized value
      */
-    private Value<?> normalizeValue( String attribute, Value<?> value )
+    private Value<?> normalizeValue( AttributeType attributeType, Value<?> value )
     {
         try
         {
             Value<?> normalized = null;
 
-            AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( attribute );
-
             if ( attributeType.getSyntax().isHumanReadable() )
             {
-                normalized = new StringValue( ( String ) ncn.normalizeByName( attribute, value.getString() ) );
+                normalized = new StringValue( ( String ) ncn.normalizeByName( attributeType.getOid(), value.getString() ) );
             }
             else
             {
-                normalized = ( Value<?> ) ncn.normalizeByName( attribute, value.getBytes() );
+                normalized = ( Value<?> ) ncn.normalizeByName( attributeType.getOid(), value.getBytes() );
             }
 
             return normalized;
@@ -168,15 +165,15 @@ public class FilterNormalizingVisitor im
      */
     private ExprNode visitPresenceNode( PresenceNode node ) throws LdapException
     {
-        try
-        {
-            node.setAttribute( schemaManager.getAttributeTypeRegistry().getOidByName( node.getAttribute() ) );
-        }
-        catch ( LdapNoSuchAttributeException lnsae )
+        // still need this check here in case the top level is a leaf node
+        // with an undefined attributeType for its attribute
+        if ( !ncn.isDefined( node.getAttribute() ) )
         {
             return null;
         }
 
+        node.setAttributeType( schemaManager.lookupAttributeTypeRegistry( node.getAttribute() ) );
+
         return node;
     }
 
@@ -194,7 +191,6 @@ public class FilterNormalizingVisitor im
      */
     private ExprNode visitSimpleNode( SimpleNode node ) throws LdapException
     {
-        
         // still need this check here in case the top level is a leaf node
         // with an undefined attributeType for its attribute
         if ( !ncn.isDefined( node.getAttribute() ) )
@@ -202,17 +198,9 @@ public class FilterNormalizingVisitor im
             return null;
         }
         
-        // Check that the AttributeType is valid
-        try
-        {
-            node.setAttribute( schemaManager.getAttributeTypeRegistry().getOidByName( node.getAttribute() ) );
-        }
-        catch ( LdapNoSuchAttributeException lnsae )
-        {
-            return null;
-        }
-
-        Value<?> normalized = normalizeValue( node.getAttribute(), node.getValue() );
+        node.setAttributeType( schemaManager.lookupAttributeTypeRegistry( node.getAttribute() ) );
+        
+        Value<?> normalized = normalizeValue( node.getAttributeType(), node.getValue() );
 
         if ( normalized == null )
         {
@@ -243,11 +231,13 @@ public class FilterNormalizingVisitor im
             return null;
         }
 
+        node.setAttributeType( schemaManager.lookupAttributeTypeRegistry( node.getAttribute() ) );
+
         Value<?> normInitial = null;
 
         if ( node.getInitial() != null )
         {
-            normInitial = normalizeValue( node.getAttribute(), new StringValue( node.getInitial() ) );
+            normInitial = normalizeValue( node.getAttributeType(), new StringValue( node.getInitial() ) );
 
             if ( normInitial == null )
             {
@@ -263,7 +253,7 @@ public class FilterNormalizingVisitor im
 
             for ( String any : node.getAny() )
             {
-                Value<?> normAny = normalizeValue( node.getAttribute(), new StringValue( any ) );
+                Value<?> normAny = normalizeValue( node.getAttributeType(), new StringValue( any ) );
 
                 if ( normAny != null )
                 {
@@ -281,7 +271,7 @@ public class FilterNormalizingVisitor im
 
         if ( node.getFinal() != null )
         {
-            normFinal = normalizeValue( node.getAttribute(), new StringValue( node.getFinal() ) );
+            normFinal = normalizeValue( node.getAttributeType(), new StringValue( node.getFinal() ) );
 
             if ( normFinal == null )
             {
@@ -289,8 +279,6 @@ public class FilterNormalizingVisitor im
             }
         }
 
-        node.setAttribute( schemaManager.getAttributeTypeRegistry().getOidByName( node.getAttribute() ) );
-
         if ( normInitial != null )
         {
             node.setInitial( normInitial.getString() );
@@ -326,16 +314,15 @@ public class FilterNormalizingVisitor im
      */
     private ExprNode visitExtensibleNode( ExtensibleNode node ) throws LdapException
     {
-        // Check that the AttributeType is valid
-        try
-        {
-            node.setAttribute( schemaManager.getAttributeTypeRegistry().getOidByName( node.getAttribute() ) );
-        }
-        catch ( LdapNoSuchAttributeException lnsae )
+        // still need this check here in case the top level is a leaf node
+        // with an undefined attributeType for its attribute
+        if ( !ncn.isDefined( node.getAttribute() ) )
         {
             return null;
         }
 
+        node.setAttributeType( schemaManager.lookupAttributeTypeRegistry( node.getAttribute() ) );
+
         return node;
     }
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java?rev=963530&r1=963529&r2=963530&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java Mon Jul 12 23:37:38 2010
@@ -253,18 +253,23 @@ public class NormalizationInterceptor ex
 
         ExprNode filter = searchContext.getFilter();
 
+        if ( filter == null )
+        {
+            LOG.warn( "undefined filter based on undefined attributeType not evaluted at all.  Returning empty enumeration." );
+            return new BaseEntryFilteringCursor( new EmptyCursor<Entry>(), searchContext );
+        }
+
         // Normalize the filter
-        ExprNode result = ( ExprNode ) filter.accept( normVisitor );
+        filter = ( ExprNode ) filter.accept( normVisitor );
 
-        if ( result == null )
+        if ( filter == null )
         {
-            LOG
-                .warn( "undefined filter based on undefined attributeType not evaluted at all.  Returning empty enumeration." );
+            LOG.warn( "undefined filter based on undefined attributeType not evaluted at all.  Returning empty enumeration." );
             return new BaseEntryFilteringCursor( new EmptyCursor<Entry>(), searchContext );
         }
         else
         {
-            searchContext.setFilter( result );
+            searchContext.setFilter( filter );
 
             // TODO Normalize the returned Attributes, storing the UP attributes to format the returned values.
             return nextInterceptor.search( searchContext );

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java?rev=963530&r1=963529&r2=963530&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java Mon Jul 12 23:37:38 2010
@@ -144,7 +144,11 @@ public class DefaultPartitionNexus exten
     /** the closed state of this partition */
     private boolean initialized;
 
-    private static AttributeType ENTRY_CSN_ATTRIBUTE_TYPE;
+    /** A reference to the EntryCSN attributeType */
+    private static AttributeType ENTRY_CSN_AT;
+
+    /** A reference to the ObjectClass attributeType */
+    private static AttributeType OBJECT_CLASS_AT;
 
     final List<Modification> mods = new ArrayList<Modification>( 2 );
 
@@ -214,7 +218,8 @@ public class DefaultPartitionNexus exten
 
         //this.directoryService = directoryService;
         schemaManager = directoryService.getSchemaManager();
-        ENTRY_CSN_ATTRIBUTE_TYPE = schemaManager.getAttributeType( SchemaConstants.ENTRY_CSN_AT );
+        ENTRY_CSN_AT = schemaManager.getAttributeType( SchemaConstants.ENTRY_CSN_AT );
+        OBJECT_CLASS_AT = schemaManager.getAttributeType( SchemaConstants.OBJECT_CLASS_AT );
 
         // Initialize and normalize the localy used DNs
         DN adminDn = new DN( ServerDNConstants.ADMIN_SYSTEM_DN );
@@ -672,7 +677,7 @@ public class DefaultPartitionNexus exten
         Partition backend = getPartition( modifyContext.getDn() );
 
         String csn = directoryService.getCSN().toString();
-        EntryAttribute attribute = new DefaultEntryAttribute( ENTRY_CSN_ATTRIBUTE_TYPE, csn );
+        EntryAttribute attribute = new DefaultEntryAttribute( ENTRY_CSN_AT, csn );
         Modification updatedCsn = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, attribute );
         modifyContext.getModItems().add( updatedCsn );
 
@@ -825,7 +830,7 @@ public class DefaultPartitionNexus exten
             // We have to be careful, as we may have a filter which is not a PresenceFilter
             if ( filter instanceof PresenceNode )
             {
-                isSearchAll = ( ( PresenceNode ) filter ).getAttribute().equals( SchemaConstants.OBJECT_CLASS_AT_OID );
+                isSearchAll = ( ( PresenceNode ) filter ).getAttributeType().equals( OBJECT_CLASS_AT );
             }
 
             /*

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java?rev=963530&r1=963529&r2=963530&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java Mon Jul 12 23:37:38 2010
@@ -529,17 +529,15 @@ public class SchemaInterceptor extends B
     }
 
 
-    private Value<?> convert( String id, Object value ) throws LdapException
+    private Value<?> convert( AttributeType attributeType, Value<?> value ) throws LdapException
     {
-        AttributeType at = schemaManager.lookupAttributeTypeRegistry( id );
-
-        if ( at.getSyntax().isHumanReadable() )
+        if ( attributeType.getSyntax().isHumanReadable() )
         {
-            if ( value instanceof byte[] )
+            if ( value instanceof BinaryValue )
             {
                 try
                 {
-                    return new StringValue( new String( ( byte[] ) value, "UTF-8" ) );
+                    return new StringValue( attributeType, new String( (( BinaryValue ) value).getBytes(), "UTF-8" ) );
                 }
                 catch ( UnsupportedEncodingException uee )
                 {
@@ -551,18 +549,9 @@ public class SchemaInterceptor extends B
         }
         else
         {
-            if ( value instanceof String )
+            if ( value instanceof StringValue )
             {
-                try
-                {
-                    return new BinaryValue( ( ( String ) value ).getBytes( "UTF-8" ) );
-                }
-                catch ( UnsupportedEncodingException uee )
-                {
-                    String message = I18n.err( I18n.ERR_48 );
-                    LOG.error( message );
-                    throw new LdapException( message );
-                }
+                return new BinaryValue( attributeType, ( ( StringValue ) value ).getBytes() );
             }
         }
 
@@ -589,9 +578,9 @@ public class SchemaInterceptor extends B
             if ( filter instanceof EqualityNode )
             {
                 EqualityNode node = ( ( EqualityNode ) filter );
-                Object value = node.getValue();
+                Value<?> value = node.getValue();
 
-                Value<?> newValue = convert( node.getAttribute(), value );
+                Value<?> newValue = convert( node.getAttributeType(), value );
 
                 if ( newValue != null )
                 {
@@ -608,9 +597,9 @@ public class SchemaInterceptor extends B
             else if ( filter instanceof GreaterEqNode )
             {
                 GreaterEqNode node = ( ( GreaterEqNode ) filter );
-                Object value = node.getValue();
+                Value<?> value = node.getValue();
 
-                Value<?> newValue = convert( node.getAttribute(), value );
+                Value<?> newValue = convert( node.getAttributeType(), value );
 
                 if ( newValue != null )
                 {
@@ -621,9 +610,9 @@ public class SchemaInterceptor extends B
             else if ( filter instanceof LessEqNode )
             {
                 LessEqNode node = ( ( LessEqNode ) filter );
-                Object value = node.getValue();
+                Value<?> value = node.getValue();
 
-                Value<?> newValue = convert( node.getAttribute(), value );
+                Value<?> newValue = convert( node.getAttributeType(), value );
 
                 if ( newValue != null )
                 {
@@ -633,20 +622,13 @@ public class SchemaInterceptor extends B
             else if ( filter instanceof ExtensibleNode )
             {
                 ExtensibleNode node = ( ( ExtensibleNode ) filter );
-
-                if ( !schemaManager.lookupAttributeTypeRegistry( node.getAttribute() ).getSyntax().isHumanReadable() )
-                {
-                    String message = I18n.err( I18n.ERR_51 );
-                    LOG.error( message );
-                    throw new LdapException( message );
-                }
             }
             else if ( filter instanceof ApproximateNode )
             {
                 ApproximateNode node = ( ( ApproximateNode ) filter );
-                Object value = node.getValue();
+                Value<?> value = node.getValue();
 
-                Value<?> newValue = convert( node.getAttribute(), value );
+                Value<?> newValue = convert( node.getAttributeType(), value );
 
                 if ( newValue != null )
                 {
@@ -730,10 +712,10 @@ public class SchemaInterceptor extends B
                     return new BaseEntryFilteringCursor( new EmptyCursor<Entry>(), searchContext );
                 }
 
-                String nodeOid = schemaManager.getAttributeTypeRegistry().getOidByName( node.getAttribute() );
+                AttributeType nodeAt = node.getAttributeType();
 
                 // see if node attribute is objectClass
-                if ( nodeOid.equals( SchemaConstants.OBJECT_CLASS_AT_OID )
+                if ( nodeAt.equals( OBJECT_CLASS_AT )
                     && ( objectClassOid.equals( SchemaConstants.TOP_OC_OID ) || objectClassOid
                         .equals( SchemaConstants.SUBSCHEMA_OC_OID ) ) && ( node instanceof EqualityNode ) )
                 {
@@ -752,7 +734,7 @@ public class SchemaInterceptor extends B
                 PresenceNode node = ( PresenceNode ) filter;
 
                 // see if node attribute is objectClass
-                if ( node.getAttribute().equals( SchemaConstants.OBJECT_CLASS_AT_OID ) )
+                if ( node.getAttributeType().equals( OBJECT_CLASS_AT ) )
                 {
                     // call.setBypass( true );
                     Entry serverEntry = schemaService.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=963530&r1=963529&r2=963530&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 Mon Jul 12 23:37:38 2010
@@ -40,6 +40,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.filter.SearchScope;
 import org.apache.directory.shared.ldap.message.AliasDerefMode;
 import org.apache.directory.shared.ldap.name.DN;
+import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -65,6 +66,9 @@ public class LdapClassLoader extends Cla
     private DN defaultSearchDn;
     private DirectoryService directoryService;
 
+    /** A storage for the ObjectClass attributeType */
+    private AttributeType OBJECT_CLASS_AT;
+
     
     public LdapClassLoader( DirectoryService directoryService ) throws LdapException
     {
@@ -72,6 +76,8 @@ public class LdapClassLoader extends Cla
         this.directoryService = directoryService;
         defaultSearchDn = new DN( DEFAULT_SEARCH_CONTEXTS_CONFIG );
         defaultSearchDn.normalize( directoryService.getSchemaManager().getNormalizerMapping() );
+        
+        OBJECT_CLASS_AT = directoryService.getSchemaManager().getAttributeType( SchemaConstants.OBJECT_CLASS_AT );
     }
 
     
@@ -79,9 +85,9 @@ public class LdapClassLoader extends Cla
     {
         // Set up the search filter
         BranchNode filter = new AndNode( );
-        filter.addNode( new EqualityNode<String>( "fullyQualifiedJavaClassName", 
-            new StringValue( name ) ) );
-        filter.addNode( new EqualityNode<String>( SchemaConstants.OBJECT_CLASS_AT, 
+        AttributeType fqjcnAt = directoryService.getSchemaManager().getAttributeType( "fullyQualifiedJavaClassName" );
+        filter.addNode( new EqualityNode<String>( fqjcnAt, new StringValue( name ) ) );
+        filter.addNode( new EqualityNode<String>( OBJECT_CLASS_AT, 
             new StringValue( ApacheSchemaConstants.JAVA_CLASS_OC ) ) );
         
         try

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/sp/StoredProcExecutionManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/sp/StoredProcExecutionManager.java?rev=963530&r1=963529&r2=963530&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/sp/StoredProcExecutionManager.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/sp/StoredProcExecutionManager.java Mon Jul 12 23:37:38 2010
@@ -31,8 +31,8 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.filtering.EntryFilteringCursor;
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.entry.StringValue;
 import org.apache.directory.shared.ldap.entry.Entry;
+import org.apache.directory.shared.ldap.entry.StringValue;
 import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.filter.EqualityNode;
 import org.apache.directory.shared.ldap.filter.ExprNode;
@@ -86,9 +86,9 @@ public class StoredProcExecutionManager
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
         String spUnitName = StoredProcUtils.extractStoredProcUnitName( fullSPName );
         
-        AttributeType at = session.getDirectoryService()
+        AttributeType storeProcUnitNamAT = session.getDirectoryService()
             .getSchemaManager().lookupAttributeTypeRegistry( "storedProcUnitName" );
-        ExprNode filter = new EqualityNode<String>( "storedProcUnitName", new StringValue( at, spUnitName ) );
+        ExprNode filter = new EqualityNode<String>( storeProcUnitNamAT, new StringValue( storeProcUnitNamAT, spUnitName ) );
         DN dn = new DN( storedProcContainer );
         EntryFilteringCursor results = session.search( dn, SearchScope.SUBTREE, filter, 
             AliasDerefMode.DEREF_ALWAYS, EMPTY_ATTRIBS );

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=963530&r1=963529&r2=963530&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 Mon Jul 12 23:37:38 2010
@@ -28,6 +28,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.filter.EqualityNode;
 import org.apache.directory.shared.ldap.filter.SimpleNode;
+import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.SchemaManager;
 
 
@@ -43,6 +44,9 @@ public class RefinementLeafEvaluator
     /** A SchemaManager instance */
     private final SchemaManager schemaManager;
 
+    /** A storage for the ObjectClass attributeType */
+    private AttributeType OBJECT_CLASS_AT;
+
 
     /**
      * Creates a refinement filter's leaf node evaluator.
@@ -52,6 +56,7 @@ public class RefinementLeafEvaluator
     public RefinementLeafEvaluator( SchemaManager schemaManager)
     {
         this.schemaManager = schemaManager;
+        OBJECT_CLASS_AT = schemaManager.getAttributeType( SchemaConstants.OBJECT_CLASS_AT );
     }
 
 
@@ -77,10 +82,19 @@ public class RefinementLeafEvaluator
             throw new LdapException( I18n.err( I18n.ERR_301, node ) );
         }
         
-        if ( !node.getAttribute().equalsIgnoreCase( SchemaConstants.OBJECT_CLASS_AT ) )
+        if ( node.isSchemaAware() )
+        {
+            if ( !node.getAttributeType().equals( OBJECT_CLASS_AT ) )
+            {
+                throw new IllegalArgumentException( I18n.err( I18n.ERR_302, node.getAttribute() ) );
+            }
+        }
+        else if ( !node.getAttribute().equalsIgnoreCase( SchemaConstants.OBJECT_CLASS_AT ) &&
+                  !node.getAttribute().equalsIgnoreCase( SchemaConstants.OBJECT_CLASS_AT_OID ) )
         {
-            throw new LdapException( I18n.err( I18n.ERR_302, node.getAttribute() ) );
+            throw new IllegalArgumentException( I18n.err( I18n.ERR_302, node.getAttribute() ) );
         }
+            
 
         if ( null == objectClasses )
         {

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java?rev=963530&r1=963529&r2=963530&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java Mon Jul 12 23:37:38 2010
@@ -126,6 +126,9 @@ public class SubentryInterceptor extends
 
     /** A reference to the ObjectClass AT */
     private static AttributeType OBJECT_CLASS_AT;
+    
+    /** A reference to the AdmiistrativeRole AT */
+    private static AttributeType ADMINISTRATIVE_ROLE_AT;
 
 
     /**
@@ -142,13 +145,14 @@ public class SubentryInterceptor extends
 
         // setup various attribute type values
         OBJECT_CLASS_AT = schemaManager.getAttributeType( SchemaConstants.OBJECT_CLASS_AT );
+        ADMINISTRATIVE_ROLE_AT = schemaManager.getAttributeType( SchemaConstants.ADMINISTRATIVE_ROLE_AT );
 
         ssParser = new SubtreeSpecificationParser( schemaManager );
         evaluator = new SubtreeEvaluator( schemaManager );
 
         // prepare to find all subentries in all namingContexts
         Set<String> suffixes = nexus.listSuffixes();
-        ExprNode filter = new EqualityNode<String>( SchemaConstants.OBJECT_CLASS_AT, new StringValue(
+        ExprNode filter = new EqualityNode<String>( OBJECT_CLASS_AT, new StringValue(
             SchemaConstants.SUBENTRY_OC ) );
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
@@ -478,7 +482,7 @@ public class SubentryInterceptor extends
             DN baseDn = ( DN ) apName.clone();
             baseDn.addAll( ss.getBase() );
 
-            ExprNode filter = new PresenceNode( SchemaConstants.OBJECT_CLASS_AT_OID ); // (objectClass=*)
+            ExprNode filter = new PresenceNode( OBJECT_CLASS_AT ); // (objectClass=*)
             SearchControls controls = new SearchControls();
             controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
             controls.setReturningAttributes( new String[]
@@ -625,7 +629,7 @@ public class SubentryInterceptor extends
             DN baseDn = ( DN ) apName.clone();
             baseDn.addAll( ss.getBase() );
 
-            ExprNode filter = new PresenceNode( OBJECT_CLASS_AT.getOid() );
+            ExprNode filter = new PresenceNode( OBJECT_CLASS_AT );
             SearchControls controls = new SearchControls();
             controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
             controls.setReturningAttributes( new String[]
@@ -681,7 +685,7 @@ public class SubentryInterceptor extends
      */
     private boolean hasAdministrativeDescendant( OperationContext opContext, DN name ) throws LdapException
     {
-        ExprNode filter = new PresenceNode( SchemaConstants.ADMINISTRATIVE_ROLE_AT );
+        ExprNode filter = new PresenceNode( ADMINISTRATIVE_ROLE_AT );
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
 
@@ -807,7 +811,7 @@ public class SubentryInterceptor extends
             next.rename( renameContext );
 
             subentry = subentryCache.getSubentry( newName );
-            ExprNode filter = new PresenceNode( OBJECT_CLASS_AT.getName() );
+            ExprNode filter = new PresenceNode( OBJECT_CLASS_AT );
             SearchControls controls = new SearchControls();
             controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
             controls.setReturningAttributes( new String[]
@@ -892,7 +896,7 @@ public class SubentryInterceptor extends
 
             subentry = subentryCache.getSubentry( newName );
 
-            ExprNode filter = new PresenceNode( OBJECT_CLASS_AT.getOid() );
+            ExprNode filter = new PresenceNode( OBJECT_CLASS_AT );
             SearchControls controls = new SearchControls();
             controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
             controls.setReturningAttributes( new String[]
@@ -978,7 +982,7 @@ public class SubentryInterceptor extends
 
             subentry = subentryCache.getSubentry( newName );
 
-            ExprNode filter = new PresenceNode( SchemaConstants.OBJECT_CLASS_AT );
+            ExprNode filter = new PresenceNode( OBJECT_CLASS_AT );
             SearchControls controls = new SearchControls();
             controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
             controls.setReturningAttributes( new String[]
@@ -1128,7 +1132,7 @@ public class SubentryInterceptor extends
             DN apName = dn.getParent();
             DN oldBaseDn = ( DN ) apName.clone();
             oldBaseDn.addAll( ssOld.getBase() );
-            ExprNode filter = new PresenceNode( OBJECT_CLASS_AT.getOid() );
+            ExprNode filter = new PresenceNode( OBJECT_CLASS_AT );
             SearchControls controls = new SearchControls();
             controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
             controls.setReturningAttributes( new String[]

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=963530&r1=963529&r2=963530&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 Mon Jul 12 23:37:38 2010
@@ -55,6 +55,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.message.AliasDerefMode;
 import org.apache.directory.shared.ldap.name.DN;
+import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.NormalizerMappingResolver;
 import org.apache.directory.shared.ldap.schema.SchemaManager;
 import org.apache.directory.shared.ldap.schema.normalizers.OidNormalizer;
@@ -117,10 +118,13 @@ public class TriggerSpecCache
         // add that subentry to the hash
         Set<String> suffixes = nexus.listSuffixes();
         
+        AttributeType objectClassAt = directoryService.getSchemaManager().
+            getAttributeType( SchemaConstants.OBJECT_CLASS_AT );
+        
         for ( String suffix:suffixes )
         {
             DN baseDn = new DN( suffix );
-            ExprNode filter = new EqualityNode<String>( SchemaConstants.OBJECT_CLASS_AT, 
+            ExprNode filter = new EqualityNode<String>( objectClassAt, 
                     new StringValue( ApacheSchemaConstants.TRIGGER_EXECUTION_SUBENTRY_OC ) );
             SearchControls ctls = new SearchControls();
             ctls.setSearchScope( SearchControls.SUBTREE_SCOPE );

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilterTest.java?rev=963530&r1=963529&r2=963530&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilterTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilterTest.java Mon Jul 12 23:37:38 2010
@@ -45,6 +45,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.filter.PresenceNode;
 import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -81,7 +82,9 @@ public class MostSpecificProtectedItemFi
     private static final List<ACITuple> TUPLES_D = new ArrayList<ACITuple>();
     private static final List<ACITuple> TUPLES_E = new ArrayList<ACITuple>();
 
-    static
+    
+    @BeforeClass
+    public static void init()
     {
         Collection<ProtectedItem> attributeType = new ArrayList<ProtectedItem>();
         Collection<ProtectedItem> allAttributeValues = new ArrayList<ProtectedItem>();
@@ -95,7 +98,7 @@ public class MostSpecificProtectedItemFi
         allAttributeValues.add( new AllAttributeValuesItem( EMPTY_STRING_COLLECTION ) );
         selfValue.add( new SelfValueItem( EMPTY_STRING_COLLECTION ) );
         attributeValue.add( new AttributeValueItem( EMPTY_ATTRIBUTE_COLLECTION ) );
-        rangeOfValues.add( new RangeOfValuesItem( new PresenceNode( "objectClass" ) ) );
+        rangeOfValues.add( new RangeOfValuesItem( new PresenceNode( (String)null ) ) );
         allUserAttributeTypes.add( ProtectedItem.ALL_USER_ATTRIBUTE_TYPES );
         allUserAttributeTypesAndValues.add( ProtectedItem.ALL_USER_ATTRIBUTE_TYPES_AND_VALUES );
 
@@ -150,7 +153,6 @@ public class MostSpecificProtectedItemFi
         TUPLES_E.add( allUserAttributeTypesAndValuesTuple );
     }
 
-
     @Test
     public void testZeroOrOneTuple() throws Exception
     {

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java?rev=963530&r1=963529&r2=963530&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java Mon Jul 12 23:37:38 2010
@@ -58,7 +58,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.schema.SchemaManager;
 import org.apache.directory.shared.ldap.schema.loader.ldif.JarLdifSchemaLoader;
 import org.apache.directory.shared.ldap.schema.manager.impl.DefaultSchemaManager;
-import org.apache.directory.shared.ldap.schema.registries.OidRegistry;
 import org.apache.directory.shared.ldap.util.LdapExceptionUtils;
 import org.junit.BeforeClass;
 import org.junit.Test;

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/normalization/NormalizationVisitorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/normalization/NormalizationVisitorTest.java?rev=963530&r1=963529&r2=963530&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/normalization/NormalizationVisitorTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/normalization/NormalizationVisitorTest.java Mon Jul 12 23:37:38 2010
@@ -81,7 +81,7 @@ public class NormalizationVisitorTest
     @Test
     public void testSimpleFilter() throws ParseException
     {
-        ExprNode filter = FilterParser.parse( "(ou=  test  1 )" );
+        ExprNode filter = FilterParser.parse( schemaManager, "(ou=  test  1 )" );
         ExprNode result = ( ExprNode ) filter.accept( normVisitor );
         
         assertNotNull( result );
@@ -89,14 +89,14 @@ public class NormalizationVisitorTest
         EqualityNode<?> equalityNode = (EqualityNode<?>)result;
         
         assertEquals( "test 1", equalityNode.getValue().getNormalizedValue() );
-        assertEquals( "2.5.4.11", equalityNode.getAttribute() );
+        assertEquals( "2.5.4.11", equalityNode.getAttributeType().getOid() );
     }
     
     
     @Test
     public void testBranchNormalizedVisitor() throws Exception
     {
-        ExprNode filter = FilterParser.parse( "(!(|(uniqueMember=cn=user1,ou=Test,dc=example,dc=com)(member=cn=user2,ou=Test,dc=example,dc=com)))" );
+        ExprNode filter = FilterParser.parse( schemaManager, "(!(|(uniqueMember=cn=user1,ou=Test,dc=example,dc=com)(member=cn=user2,ou=Test,dc=example,dc=com)))" );
         ExprNode result = ( ExprNode ) filter.accept( normVisitor );
 
         assertNotNull( result );

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=963530&r1=963529&r2=963530&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 Mon Jul 12 23:37:38 2010
@@ -36,7 +36,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.schema.SchemaManager;
 import org.apache.directory.shared.ldap.schema.loader.ldif.JarLdifSchemaLoader;
 import org.apache.directory.shared.ldap.schema.manager.impl.DefaultSchemaManager;
-import org.apache.directory.shared.ldap.schema.registries.Registries;
 import org.apache.directory.shared.ldap.util.LdapExceptionUtils;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
@@ -53,17 +52,17 @@ import org.junit.runner.RunWith;
 @Concurrent()
 public class RefinementEvaluatorTest
 {
-    /** the registries */
-    private static Registries registries;
+    /** the SchemaManager instance */
+    private static SchemaManager schemaManager;
     
     /** the refinement evaluator to test */
     private static RefinementEvaluator evaluator;
 
     /** The ObjectClass AttributeType */
-    private static AttributeType OBJECT_CLASS;
+    private static AttributeType OBJECT_CLASS_AT;
 
-    /** The CN AttributeType */
-    private static AttributeType CN;
+    /** The CN_AT AttributeType */
+    private static AttributeType CN_AT;
     
     
     /**
@@ -75,7 +74,7 @@ public class RefinementEvaluatorTest
     {
         JarLdifSchemaLoader loader = new JarLdifSchemaLoader();
 
-        SchemaManager schemaManager = new DefaultSchemaManager( loader );
+        schemaManager = new DefaultSchemaManager( loader );
 
         boolean loaded = schemaManager.loadAllEnabled();
 
@@ -84,13 +83,11 @@ public class RefinementEvaluatorTest
             fail( "Schema load failed : " + LdapExceptionUtils.printErrors( schemaManager.getErrors() ) );
         }
 
-        registries = schemaManager.getRegistries();
-
         RefinementLeafEvaluator leafEvaluator = new RefinementLeafEvaluator( schemaManager );
         evaluator = new RefinementEvaluator( leafEvaluator );
         
-        OBJECT_CLASS = registries.getAttributeTypeRegistry().lookup( "objectClass" );
-        CN = registries.getAttributeTypeRegistry().lookup( "cn" );
+        OBJECT_CLASS_AT = schemaManager.getAttributeType( "objectClass" );
+        CN_AT = schemaManager.getAttributeTypeRegistry().lookup( "cn" );
     }
 
 
@@ -113,7 +110,7 @@ public class RefinementEvaluatorTest
     {
         try
         {
-            assertFalse( evaluator.evaluate( null, new DefaultEntryAttribute( "objectClass", OBJECT_CLASS ) ) );
+            assertFalse( evaluator.evaluate( null, new DefaultEntryAttribute( OBJECT_CLASS_AT ) ) );
             fail( "should never get here due to an IAE" );
         }
         catch ( IllegalArgumentException iae )
@@ -122,7 +119,7 @@ public class RefinementEvaluatorTest
 
         try
         {
-            assertFalse( evaluator.evaluate( new EqualityNode( "", new StringValue( "" ) ), null ) );
+            assertFalse( evaluator.evaluate( new EqualityNode( (String)null, new StringValue( "" ) ), null ) );
             fail( "should never get here due to an IAE" );
         }
         catch ( IllegalArgumentException iae )
@@ -131,8 +128,8 @@ public class RefinementEvaluatorTest
 
         try
         {
-            assertFalse( evaluator.evaluate( new EqualityNode( "", new StringValue( "" ) ), 
-                new DefaultEntryAttribute( "cn", CN ) ) );
+            assertFalse( evaluator.evaluate( new EqualityNode( (String)null, new StringValue( "" ) ), 
+                new DefaultEntryAttribute( "cn", CN_AT ) ) );
             fail( "should never get here due to an IAE" );
         }
         catch ( IllegalArgumentException iae )
@@ -147,38 +144,38 @@ public class RefinementEvaluatorTest
         EntryAttribute objectClasses = null;
 
         // positive test
-        objectClasses = new DefaultEntryAttribute( "objectClass", OBJECT_CLASS, "person" );
-        assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", new StringValue( "person" ) ), objectClasses ) );
+        objectClasses = new DefaultEntryAttribute( OBJECT_CLASS_AT, "person" );
+        assertTrue( evaluator.evaluate( new EqualityNode( OBJECT_CLASS_AT, new StringValue( "person" ) ), objectClasses ) );
 
-        objectClasses = new DefaultEntryAttribute( "objectClass", OBJECT_CLASS, "person", "blah" );
-        assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", new StringValue( "person" ) ), objectClasses ) );
+        objectClasses = new DefaultEntryAttribute( OBJECT_CLASS_AT, "person", "blah" );
+        assertTrue( evaluator.evaluate( new EqualityNode( OBJECT_CLASS_AT, new StringValue( "person" ) ), objectClasses ) );
 
         // negative tests
-        objectClasses = new DefaultEntryAttribute( "objectClass", OBJECT_CLASS, "person" );
-        assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", new StringValue( "blah" ) ), objectClasses ) );
+        objectClasses = new DefaultEntryAttribute( OBJECT_CLASS_AT, "person" );
+        assertFalse( evaluator.evaluate( new EqualityNode( OBJECT_CLASS_AT, new StringValue( "blah" ) ), objectClasses ) );
 
-        objectClasses = new DefaultEntryAttribute( "objectClass", OBJECT_CLASS, "blah" );
-        assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", new StringValue( "person" ) ), objectClasses ) );
+        objectClasses = new DefaultEntryAttribute( OBJECT_CLASS_AT, "blah" );
+        assertFalse( evaluator.evaluate( new EqualityNode( OBJECT_CLASS_AT, new StringValue( "person" ) ), objectClasses ) );
     }
 
 
     @Test 
     public void testMatchByOID() throws Exception
     {
-        EntryAttribute objectClasses = new DefaultEntryAttribute( "objectClass", OBJECT_CLASS, "person" );
+        EntryAttribute objectClasses = new DefaultEntryAttribute( OBJECT_CLASS_AT, "person" );
         
         // positive test
-        assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", new StringValue( "2.5.6.6" ) ), objectClasses ) );
+        assertTrue( evaluator.evaluate( new EqualityNode( OBJECT_CLASS_AT, new StringValue( "2.5.6.6" ) ), objectClasses ) );
 
-        objectClasses = new DefaultEntryAttribute( "objectClass", OBJECT_CLASS, "person", "blah" );
-        assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", new StringValue( "2.5.6.6" ) ), objectClasses ) );
+        objectClasses = new DefaultEntryAttribute( OBJECT_CLASS_AT, "person", "blah" );
+        assertTrue( evaluator.evaluate( new EqualityNode( OBJECT_CLASS_AT, new StringValue( "2.5.6.6" ) ), objectClasses ) );
 
         // negative tests
-        objectClasses = new DefaultEntryAttribute( "objectClass", OBJECT_CLASS, "person" );
-        assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", new StringValue( "2.5.6.5" ) ), objectClasses ) );
+        objectClasses = new DefaultEntryAttribute( OBJECT_CLASS_AT, "person" );
+        assertFalse( evaluator.evaluate( new EqualityNode( OBJECT_CLASS_AT, new StringValue( "2.5.6.5" ) ), objectClasses ) );
 
-        objectClasses = new DefaultEntryAttribute( "objectClass", OBJECT_CLASS, "blah" );
-        assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", new StringValue( "2.5.6.5" ) ), objectClasses ) );
+        objectClasses = new DefaultEntryAttribute( OBJECT_CLASS_AT, "blah" );
+        assertFalse( evaluator.evaluate( new EqualityNode( OBJECT_CLASS_AT, new StringValue( "2.5.6.5" ) ), objectClasses ) );
     }
 
 
@@ -186,17 +183,17 @@ public class RefinementEvaluatorTest
     public void testComplexOrRefinement() throws Exception
     {
         ExprNode refinement = null;
-        EntryAttribute objectClasses = new DefaultEntryAttribute( "objectClass", OBJECT_CLASS, "person" );
+        EntryAttribute objectClasses = new DefaultEntryAttribute( OBJECT_CLASS_AT, "person" );
         String refStr = "(|(objectClass=person)(objectClass=organizationalUnit))";
         
-        refinement = FilterParser.parse( refStr );
+        refinement = FilterParser.parse( schemaManager, refStr );
 
         assertTrue( evaluator.evaluate( refinement, objectClasses ) );
         
-        objectClasses = new DefaultEntryAttribute( "objectClass", OBJECT_CLASS, "organizationalUnit" );
+        objectClasses = new DefaultEntryAttribute( OBJECT_CLASS_AT, "organizationalUnit" );
         assertTrue( evaluator.evaluate( refinement, objectClasses ) );
         
-        objectClasses = new DefaultEntryAttribute( "objectClass", OBJECT_CLASS, "domain" );
+        objectClasses = new DefaultEntryAttribute( OBJECT_CLASS_AT, "domain" );
         assertFalse( evaluator.evaluate( refinement, objectClasses ) );
     }
 
@@ -205,21 +202,21 @@ public class RefinementEvaluatorTest
     public void testComplexAndRefinement() throws Exception
     {
         ExprNode refinement = null;
-        EntryAttribute objectClasses = new DefaultEntryAttribute( "objectClass", OBJECT_CLASS, "person" );
+        EntryAttribute objectClasses = new DefaultEntryAttribute( OBJECT_CLASS_AT, "person" );
         objectClasses.add( "organizationalUnit" );
         String refStr = "(&(objectClass=person)(objectClass=organizationalUnit))";
         
-        refinement = FilterParser.parse( refStr );
+        refinement = FilterParser.parse( schemaManager,refStr );
 
         assertTrue( evaluator.evaluate( refinement, objectClasses ) );
         
-        objectClasses = new DefaultEntryAttribute( "objectClass", OBJECT_CLASS, "organizationalUnit" );
+        objectClasses = new DefaultEntryAttribute( OBJECT_CLASS_AT, "organizationalUnit" );
         assertFalse( evaluator.evaluate( refinement, objectClasses ) );
         
-        objectClasses = new DefaultEntryAttribute( "objectClass", OBJECT_CLASS, "person" );
+        objectClasses = new DefaultEntryAttribute( OBJECT_CLASS_AT, "person" );
         assertFalse( evaluator.evaluate( refinement, objectClasses ) );
         
-        objectClasses = new DefaultEntryAttribute( "objectClass", OBJECT_CLASS, "domain" );
+        objectClasses = new DefaultEntryAttribute( OBJECT_CLASS_AT, "domain" );
         assertFalse( evaluator.evaluate( refinement, objectClasses ) );
     }
 
@@ -228,22 +225,22 @@ public class RefinementEvaluatorTest
     public void testComplexNotRefinement() throws Exception
     {
         ExprNode refinement = null;
-        EntryAttribute objectClasses = new DefaultEntryAttribute( "objectClass", OBJECT_CLASS, "person" );
+        EntryAttribute objectClasses = new DefaultEntryAttribute( OBJECT_CLASS_AT, "person" );
         String refStr = "(!(objectClass=person))";
 
-        refinement = FilterParser.parse( refStr );
+        refinement = FilterParser.parse( schemaManager, refStr );
 
         assertFalse( evaluator.evaluate( refinement, objectClasses ) );
         
-        objectClasses = new DefaultEntryAttribute( "objectClass", OBJECT_CLASS, "organizationalUnit" );
+        objectClasses = new DefaultEntryAttribute( OBJECT_CLASS_AT, "organizationalUnit" );
         assertTrue( evaluator.evaluate( refinement, objectClasses ) );
         
-        objectClasses = new DefaultEntryAttribute( "objectClass", OBJECT_CLASS, "domain" );
+        objectClasses = new DefaultEntryAttribute( OBJECT_CLASS_AT, "domain" );
         assertTrue( evaluator.evaluate( refinement, objectClasses ) );
 
         try
         {
-            assertFalse( evaluator.evaluate( new NotNode(), new DefaultEntryAttribute( "objectClass", OBJECT_CLASS ) ) );
+            assertFalse( evaluator.evaluate( new NotNode(), new DefaultEntryAttribute( OBJECT_CLASS_AT ) ) );
             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=963530&r1=963529&r2=963530&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 Mon Jul 12 23:37:38 2010
@@ -37,7 +37,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.schema.SchemaManager;
 import org.apache.directory.shared.ldap.schema.loader.ldif.JarLdifSchemaLoader;
 import org.apache.directory.shared.ldap.schema.manager.impl.DefaultSchemaManager;
-import org.apache.directory.shared.ldap.schema.registries.Registries;
 import org.apache.directory.shared.ldap.util.LdapExceptionUtils;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
@@ -54,12 +53,15 @@ import org.junit.runner.RunWith;
 @Concurrent()
 public class RefinementLeafEvaluatorTest
 {
+    /** the SchemaManager instance */
+    private static SchemaManager schemaManager;
+
     /** The ObjectClass AttributeType */
-    private static AttributeType OBJECT_CLASS;
+    private static AttributeType OBJECT_CLASS_AT;
+    
+    /** The CN AttributeType */
+    private static AttributeType CN_AT;
     
-    /** the registries */
-    private static Registries registries;
-
     /** the refinement leaf evaluator to test */
     private static RefinementLeafEvaluator evaluator;
 
@@ -73,7 +75,7 @@ public class RefinementLeafEvaluatorTest
     {
         JarLdifSchemaLoader loader = new JarLdifSchemaLoader();
 
-        SchemaManager schemaManager = new DefaultSchemaManager( loader );
+        schemaManager = new DefaultSchemaManager( loader );
 
         boolean loaded = schemaManager.loadAllEnabled();
 
@@ -81,10 +83,9 @@ public class RefinementLeafEvaluatorTest
         {
             fail( "Schema load failed : " + LdapExceptionUtils.printErrors( schemaManager.getErrors() ) );
         }
-
-        registries = schemaManager.getRegistries();
         
-        OBJECT_CLASS = schemaManager.getAttributeType( SchemaConstants.OBJECT_CLASS_AT );
+        OBJECT_CLASS_AT = schemaManager.getAttributeType( SchemaConstants.OBJECT_CLASS_AT );
+        CN_AT = schemaManager.getAttributeType( SchemaConstants.CN_AT );
 
         evaluator = new RefinementLeafEvaluator( schemaManager );
     }
@@ -132,13 +133,13 @@ public class RefinementLeafEvaluatorTest
             assertFalse( evaluator.evaluate( new EqualityNode( "", new StringValue( "" ) ), objectClasses ) );
             fail( "should never get here due to an NE" );
         }
-        catch ( LdapException ne )
+        catch ( IllegalArgumentException iae )
         {
         }
 
         try
         {
-            assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", new StringValue( "" ) ), objectClasses ) );
+            assertFalse( evaluator.evaluate( new EqualityNode( OBJECT_CLASS_AT, new StringValue( "" ) ), objectClasses ) );
             fail( "should never get here due to an IAE" );
         }
         catch ( IllegalArgumentException iae )
@@ -147,8 +148,8 @@ public class RefinementLeafEvaluatorTest
 
         try
         {
-            objectClasses = new DefaultEntryAttribute( "cn", OBJECT_CLASS );
-            assertFalse( evaluator.evaluate( new EqualityNode( "cn", new StringValue( "" ) ), objectClasses ) );
+            objectClasses = new DefaultEntryAttribute( "cn", OBJECT_CLASS_AT.getName() );
+            assertFalse( evaluator.evaluate( new EqualityNode( CN_AT, new StringValue( "" ) ), objectClasses ) );
             fail( "should never get here due to an IAE" );
         }
         catch ( IllegalArgumentException iae )
@@ -162,41 +163,41 @@ public class RefinementLeafEvaluatorTest
     public void testMatchByName() throws Exception
     {
         // positive test
-        EntryAttribute objectClasses = new DefaultEntryAttribute( "objectClass", OBJECT_CLASS, "person" );
-        assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", new StringValue( "person" ) ), objectClasses ) );
+        EntryAttribute objectClasses = new DefaultEntryAttribute( OBJECT_CLASS_AT, "person" );
+        assertTrue( evaluator.evaluate( new EqualityNode( OBJECT_CLASS_AT, new StringValue( "person" ) ), objectClasses ) );
 
-        objectClasses = new DefaultEntryAttribute( "objectClass", OBJECT_CLASS );
+        objectClasses = new DefaultEntryAttribute( OBJECT_CLASS_AT );
         objectClasses.add( "person" );
         objectClasses.add( "blah" );
-        assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", new StringValue( "person" ) ), objectClasses ) );
+        assertTrue( evaluator.evaluate( new EqualityNode( OBJECT_CLASS_AT, new StringValue( "person" ) ), objectClasses ) );
 
         // negative tests
-        objectClasses = new DefaultEntryAttribute( "objectClass", OBJECT_CLASS, "person" );
-        assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", new StringValue( "blah" ) ), objectClasses ) );
+        objectClasses = new DefaultEntryAttribute( OBJECT_CLASS_AT, "person" );
+        assertFalse( evaluator.evaluate( new EqualityNode( OBJECT_CLASS_AT, new StringValue( "blah" ) ), objectClasses ) );
 
-        objectClasses = new DefaultEntryAttribute( "objectClass", OBJECT_CLASS, "blah" );
-        assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", new StringValue( "person" ) ), objectClasses ) );
+        objectClasses = new DefaultEntryAttribute( OBJECT_CLASS_AT, "blah" );
+        assertFalse( evaluator.evaluate( new EqualityNode( OBJECT_CLASS_AT, new StringValue( "person" ) ), objectClasses ) );
     }
 
 
     @Test 
     public void testMatchByOID() throws Exception
     {
-        EntryAttribute objectClasses = new DefaultEntryAttribute( "objectClass", OBJECT_CLASS, "person" );
+        EntryAttribute objectClasses = new DefaultEntryAttribute( OBJECT_CLASS_AT, "person" );
 
         // positive test
-        assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", new StringValue( "2.5.6.6" ) ), objectClasses ) );
+        assertTrue( evaluator.evaluate( new EqualityNode( OBJECT_CLASS_AT, new StringValue( "2.5.6.6" ) ), objectClasses ) );
 
-        objectClasses = new DefaultEntryAttribute( "objectClass", OBJECT_CLASS );
+        objectClasses = new DefaultEntryAttribute( OBJECT_CLASS_AT );
         objectClasses.add( "person" );
         objectClasses.add( "blah" );
-        assertTrue( evaluator.evaluate( new EqualityNode( "objectClass", new StringValue( "2.5.6.6" ) ), objectClasses ) );
+        assertTrue( evaluator.evaluate( new EqualityNode( OBJECT_CLASS_AT, new StringValue( "2.5.6.6" ) ), objectClasses ) );
 
         // negative tests
-        objectClasses = new DefaultEntryAttribute( "objectClass", OBJECT_CLASS, "person" );
-        assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", new StringValue( "2.5.6.5" ) ), objectClasses ) );
+        objectClasses = new DefaultEntryAttribute( OBJECT_CLASS_AT, "person" );
+        assertFalse( evaluator.evaluate( new EqualityNode( OBJECT_CLASS_AT, new StringValue( "2.5.6.5" ) ), objectClasses ) );
 
-        objectClasses = new DefaultEntryAttribute( "objectClass", OBJECT_CLASS, "blah" );
-        assertFalse( evaluator.evaluate( new EqualityNode( "objectClass", new StringValue( "2.5.6.5" ) ), objectClasses ) );
+        objectClasses = new DefaultEntryAttribute( OBJECT_CLASS_AT, "blah" );
+        assertFalse( evaluator.evaluate( new EqualityNode( OBJECT_CLASS_AT, new StringValue( "2.5.6.5" ) ), objectClasses ) );
     }
 }

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java?rev=963530&r1=963529&r2=963530&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java Mon Jul 12 23:37:38 2010
@@ -256,7 +256,7 @@ public class SubtreeEvaluatorTest
     @Test
     public void testWithMinMaxAndSimpleRefinement() throws Exception
     {
-        ExprNode refinement = FilterParser.parse( "(objectClass=person)" );
+        ExprNode refinement = FilterParser.parse( schemaManager, "(objectClass=person)" );
         refinement.accept( visitor );
 
         SubtreeSpecificationModifier modifier = new SubtreeSpecificationModifier();
@@ -314,7 +314,7 @@ public class SubtreeEvaluatorTest
     @Test
     public void testWithFilter() throws Exception
     {
-        ExprNode filter = FilterParser.parse( "(&(cn=Ersin)(objectClass=person))" );
+        ExprNode filter = FilterParser.parse( schemaManager, "(&(cn=Ersin)(objectClass=person))" );
         filter.accept( visitor );
 
         SubtreeSpecificationModifier modifier = new SubtreeSpecificationModifier();

Modified: directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/LdifPartitionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/LdifPartitionTest.java?rev=963530&r1=963529&r2=963530&view=diff
==============================================================================
--- directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/LdifPartitionTest.java (original)
+++ directory/apacheds/trunk/ldif-partition/src/test/java/org/apache/directory/server/core/partition/LdifPartitionTest.java Mon Jul 12 23:37:38 2010
@@ -396,7 +396,7 @@ public class LdifPartitionTest
         DN dn = new DN( "dc=test,ou=test,ou=system" );
         dn.normalize( schemaManager.getNormalizerMapping() );
         searchCtx.setDn( dn );
-        ExprNode filter = FilterParser.parse( "(ObjectClass=domain)" );
+        ExprNode filter = FilterParser.parse( schemaManager, "(ObjectClass=domain)" );
         NameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( schemaManager );
         FilterNormalizingVisitor visitor = new FilterNormalizingVisitor( ncn, schemaManager );
         filter.accept( visitor );

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java?rev=963530&r1=963529&r2=963530&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java Mon Jul 12 23:37:38 2010
@@ -53,6 +53,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.exception.LdapOperationException;
 import org.apache.directory.shared.ldap.exception.OperationAbandonedException;
 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.SearchScope;
@@ -89,7 +90,7 @@ public class SearchHandler extends LdapR
     private static final boolean IS_DEBUG = LOG.isDebugEnabled();
 
     /** cached to save redundant lookups into registries */ 
-    private AttributeType objectClassAttributeType;
+    private AttributeType OBJECT_CLASS_AT;
     
     protected ReplicationProvider replicationProvider;
     
@@ -103,14 +104,14 @@ public class SearchHandler extends LdapR
      */
     private EqualityNode<String> newIsReferralEqualityNode( LdapSession session ) throws Exception
     {
-        if ( objectClassAttributeType == null )
+        if ( OBJECT_CLASS_AT == null )
         {
-            objectClassAttributeType = session.getCoreSession().getDirectoryService().
-                getSchemaManager().lookupAttributeTypeRegistry( SchemaConstants.OBJECT_CLASS_AT );
+            OBJECT_CLASS_AT = session.getCoreSession().getDirectoryService().
+                getSchemaManager().getAttributeType( SchemaConstants.OBJECT_CLASS_AT );
         }
         
-        EqualityNode<String> ocIsReferral = new EqualityNode<String>( SchemaConstants.OBJECT_CLASS_AT,
-            new StringValue( objectClassAttributeType, SchemaConstants.REFERRAL_OC ) );
+        EqualityNode<String> ocIsReferral = new EqualityNode<String>( OBJECT_CLASS_AT,
+            new StringValue( OBJECT_CLASS_AT, SchemaConstants.REFERRAL_OC ) );
         
         return ocIsReferral;
     }
@@ -938,12 +939,24 @@ public class SearchHandler extends LdapR
         {
             PresenceNode presenceNode = ( PresenceNode ) req.getFilter();
             
-            AttributeType at = session.getCoreSession().getDirectoryService()
-                .getSchemaManager().lookupAttributeTypeRegistry( presenceNode.getAttribute() );
-            
-            if ( at.getOid().equals( SchemaConstants.OBJECT_CLASS_AT_OID ) )
+            if ( presenceNode.isSchemaAware() )
             {
-                return;
+                AttributeType attributeType = presenceNode.getAttributeType();
+                
+                if ( attributeType.equals( OBJECT_CLASS_AT ) )
+                {
+                    return;
+                }
+            }
+            else
+            {
+                String attribute = presenceNode.getAttribute();
+                
+                if ( attribute.equalsIgnoreCase( SchemaConstants.OBJECT_CLASS_AT ) ||
+                     attribute.equalsIgnoreCase( SchemaConstants.OBJECT_CLASS_AT_OID ) )
+                {
+                    return;
+                }
             }
         }
 
@@ -1281,9 +1294,18 @@ public class SearchHandler extends LdapR
         
         if ( req.getFilter() instanceof PresenceNode )
         {
-            String attribute = ( ( PresenceNode ) req.getFilter() ).getAttribute();
-            isRootDSEFilter = attribute.equalsIgnoreCase( SchemaConstants.OBJECT_CLASS_AT ) ||
-                                attribute.equals( SchemaConstants.OBJECT_CLASS_AT_OID );
+            ExprNode filter = req.getFilter();
+            
+            if ( filter.isSchemaAware() )
+            {
+                AttributeType attributeType = ( ( PresenceNode ) req.getFilter() ).getAttributeType();
+                isRootDSEFilter = attributeType.equals( OBJECT_CLASS_AT );
+            }
+            else
+            {
+                String attribute = ( ( PresenceNode ) req.getFilter() ).getAttribute();
+                isRootDSEFilter = attribute.equalsIgnoreCase( SchemaConstants.OBJECT_CLASS_AT ) || attribute.equals( SchemaConstants.OBJECT_CLASS_AT_OID );
+            }
         }
         
         return isBaseIsRoot && isBaseScope && isRootDSEFilter;

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/cramMD5/CramMd5CallbackHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/cramMD5/CramMd5CallbackHandler.java?rev=963530&r1=963529&r2=963530&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/cramMD5/CramMd5CallbackHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/cramMD5/CramMd5CallbackHandler.java Mon Jul 12 23:37:38 2010
@@ -44,6 +44,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.AttributeTypeOptions;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -56,7 +57,9 @@ public class CramMd5CallbackHandler exte
     private static final Logger LOG = LoggerFactory.getLogger( CramMd5CallbackHandler.class );
 
     private String bindDn;
-    //private String userPassword;
+    
+    /** A SchemaManager instance */
+    private SchemaManager schemaManager;
 
 
     /**
@@ -71,6 +74,7 @@ public class CramMd5CallbackHandler exte
         super( adminSession.getDirectoryService(), bindRequest );
         this.ldapSession = ldapSession;
         this.adminSession = adminSession;
+        schemaManager = adminSession.getDirectoryService().getSchemaManager();
     }
 
 
@@ -78,7 +82,7 @@ public class CramMd5CallbackHandler exte
     {
         try
         {
-            ExprNode filter = FilterParser.parse( "(uid=" + username + ")" );
+            ExprNode filter = FilterParser.parse( schemaManager, "(uid=" + username + ")" );
             Set<AttributeTypeOptions> returningAttributes = new HashSet<AttributeTypeOptions>();
             
             AttributeType passwordAT = adminSession.getDirectoryService().getSchemaManager().lookupAttributeTypeRegistry( SchemaConstants.USER_PASSWORD_AT );

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/digestMD5/DigestMd5CallbackHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/digestMD5/DigestMd5CallbackHandler.java?rev=963530&r1=963529&r2=963530&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/digestMD5/DigestMd5CallbackHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/digestMD5/DigestMd5CallbackHandler.java Mon Jul 12 23:37:38 2010
@@ -44,6 +44,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.AttributeTypeOptions;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -56,7 +57,10 @@ public class DigestMd5CallbackHandler ex
     private static final Logger LOG = LoggerFactory.getLogger( DigestMd5CallbackHandler.class );
 
     private String bindDn;
-    private String userPassword;
+    
+    /** A SchemaManager instance */
+    private SchemaManager schemaManager;
+
 
 
     /**
@@ -71,6 +75,7 @@ public class DigestMd5CallbackHandler ex
         super( adminSession.getDirectoryService(), bindRequest );
         this.ldapSession = ldapSession;
         this.adminSession = adminSession;
+        schemaManager = adminSession.getDirectoryService().getSchemaManager();
     }
 
 
@@ -79,7 +84,7 @@ public class DigestMd5CallbackHandler ex
     {
         try
         {
-            ExprNode filter = FilterParser.parse( "(uid=" + username + ")" );
+            ExprNode filter = FilterParser.parse( schemaManager, "(uid=" + username + ")" );
             Set<AttributeTypeOptions> returningAttributes = new HashSet<AttributeTypeOptions>();
             
             AttributeType passwordAT = adminSession.getDirectoryService().getSchemaManager().lookupAttributeTypeRegistry( SchemaConstants.USER_PASSWORD_AT );
@@ -122,7 +127,7 @@ public class DigestMd5CallbackHandler ex
     {
         if ( LOG.isDebugEnabled() )
         {
-            LOG.debug( "Converted username " + getUsername() + " to DN " + bindDn + " with password " + userPassword + "." );
+            LOG.debug( "Converted username " + getUsername() + " to DN " + bindDn );
         }
 
         ldapSession.putSaslProperty( Context.SECURITY_PRINCIPAL, bindDn );

Modified: directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/catalog/GetCatalog.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/catalog/GetCatalog.java?rev=963530&r1=963529&r2=963530&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/catalog/GetCatalog.java (original)
+++ directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/catalog/GetCatalog.java Mon Jul 12 23:37:38 2010
@@ -28,8 +28,8 @@ import org.apache.directory.server.const
 import org.apache.directory.server.core.CoreSession;
 import org.apache.directory.server.core.filtering.EntryFilteringCursor;
 import org.apache.directory.server.protocol.shared.store.DirectoryServiceOperation;
-import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Entry;
+import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.filter.FilterParser;
 import org.apache.directory.shared.ldap.filter.SearchScope;
 import org.apache.directory.shared.ldap.message.AliasDerefMode;
@@ -56,7 +56,7 @@ public class GetCatalog implements Direc
         EntryFilteringCursor list = session.search( 
             DN.EMPTY_DN, 
             SearchScope.SUBTREE, 
-            FilterParser.parse( filter ), 
+            FilterParser.parse( session.getDirectoryService().getSchemaManager(), filter ), 
             AliasDerefMode.DEREF_ALWAYS,
             null );
 

Modified: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java?rev=963530&r1=963529&r2=963530&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java (original)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java Mon Jul 12 23:37:38 2010
@@ -86,6 +86,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.ldif.LdifReader;
 import org.apache.directory.shared.ldap.message.AliasDerefMode;
 import org.apache.directory.shared.ldap.name.DN;
+import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.SchemaManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -110,6 +111,9 @@ public class ConfigPartitionReader
     /** the schema manager set in the config partition */
     private SchemaManager schemaManager;
 
+    /** A reference to the ObjectClass AT */
+    private static AttributeType OBJECT_CLASS_AT;
+
     /** the parent directory of the config partition's working directory */
     private File workDir;
 
@@ -150,6 +154,9 @@ public class ConfigPartitionReader
         se = configPartition.getSearchEngine();
         this.schemaManager = configPartition.getSchemaManager();
         workDir = configPartition.getPartitionDir().getParentFile();
+        
+        // setup ObjectClass attribute type value
+        OBJECT_CLASS_AT = schemaManager.getAttributeType( SchemaConstants.OBJECT_CLASS_AT );
     }
 
 
@@ -161,7 +168,7 @@ public class ConfigPartitionReader
      */
     public LdapServer getLdapServer() throws Exception
     {
-        EqualityNode<String> filter = new EqualityNode<String>( SchemaConstants.OBJECT_CLASS_AT, new StringValue(
+        EqualityNode<String> filter = new EqualityNode<String>( OBJECT_CLASS_AT, new StringValue(
             ConfigSchemaConstants.ADS_LDAP_SERVER_OC ) );
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
@@ -219,7 +226,7 @@ public class ConfigPartitionReader
         }
         
         // read the SASL mechanism handlers' configuration
-        filter = new EqualityNode<String>( SchemaConstants.OBJECT_CLASS_AT, new StringValue(
+        filter = new EqualityNode<String>( OBJECT_CLASS_AT, new StringValue(
             ConfigSchemaConstants.ADS_LDAP_SERVER_SASL_MECH_HANDLER_OC ) );
         cursor = se.cursor( ldapServerEntry.getDn(), AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls );
         
@@ -237,7 +244,7 @@ public class ConfigPartitionReader
         cursor.close();
         
         // read the extnded operation handlers' config
-        filter = new EqualityNode<String>( SchemaConstants.OBJECT_CLASS_AT, new StringValue(
+        filter = new EqualityNode<String>( OBJECT_CLASS_AT, new StringValue(
             ConfigSchemaConstants.ADS_LDAP_SERVER_EXT_OP_HANDLER_OC ) );
         cursor = se.cursor( ldapServerEntry.getDn(), AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls );
         
@@ -264,7 +271,7 @@ public class ConfigPartitionReader
 
     public KdcServer getKdcServer() throws Exception
     {
-        EqualityNode<String> filter = new EqualityNode<String>( SchemaConstants.OBJECT_CLASS_AT, new StringValue(
+        EqualityNode<String> filter = new EqualityNode<String>( OBJECT_CLASS_AT, new StringValue(
             ConfigSchemaConstants.ADS_KERBEROS_SERVER_OC ) );
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
@@ -411,7 +418,7 @@ public class ConfigPartitionReader
 
     public DnsServer getDnsServer() throws Exception
     {
-        EqualityNode<String> filter = new EqualityNode<String>( SchemaConstants.OBJECT_CLASS_AT, new StringValue(
+        EqualityNode<String> filter = new EqualityNode<String>( OBJECT_CLASS_AT, new StringValue(
             ConfigSchemaConstants.ADS_DNS_SERVER_OC ) );
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
@@ -451,7 +458,7 @@ public class ConfigPartitionReader
     //TODO making this method invisible cause there is no DhcpServer exists as of now
     private DhcpService getDhcpServer() throws Exception
     {
-        EqualityNode<String> filter = new EqualityNode<String>( SchemaConstants.OBJECT_CLASS_AT, new StringValue(
+        EqualityNode<String> filter = new EqualityNode<String>( OBJECT_CLASS_AT, new StringValue(
             ConfigSchemaConstants.ADS_DHCP_SERVER_OC ) );
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
@@ -486,7 +493,7 @@ public class ConfigPartitionReader
 
     public NtpServer getNtpServer() throws Exception
     {
-        EqualityNode<String> filter = new EqualityNode<String>( SchemaConstants.OBJECT_CLASS_AT, new StringValue(
+        EqualityNode<String> filter = new EqualityNode<String>( OBJECT_CLASS_AT, new StringValue(
             ConfigSchemaConstants.ADS_NTP_SERVER_OC ) );
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
@@ -525,7 +532,7 @@ public class ConfigPartitionReader
     
     public ChangePasswordServer getChangePwdServer() throws Exception
     {
-        EqualityNode<String> filter = new EqualityNode<String>( SchemaConstants.OBJECT_CLASS_AT, new StringValue(
+        EqualityNode<String> filter = new EqualityNode<String>( OBJECT_CLASS_AT, new StringValue(
             ConfigSchemaConstants.ADS_CHANGEPWD_SERVER_OC ) );
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
@@ -629,7 +636,7 @@ public class ConfigPartitionReader
     
     public HttpServer getHttpServer() throws Exception
     {
-        EqualityNode<String> filter = new EqualityNode<String>( SchemaConstants.OBJECT_CLASS_AT, new StringValue(
+        EqualityNode<String> filter = new EqualityNode<String>( OBJECT_CLASS_AT, new StringValue(
             ConfigSchemaConstants.ADS_HTTP_SERVER_OC ) );
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
@@ -694,8 +701,8 @@ public class ConfigPartitionReader
      */
     public DirectoryService getDirectoryService() throws Exception
     {
-
-        PresenceNode filter = new PresenceNode( ConfigSchemaConstants.ADS_DIRECTORYSERVICE_ID );
+        AttributeType adsDirectoryServiceidAt = schemaManager.getAttributeType( ConfigSchemaConstants.ADS_DIRECTORYSERVICE_ID );
+        PresenceNode filter = new PresenceNode( adsDirectoryServiceidAt );
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
 
@@ -827,7 +834,7 @@ public class ConfigPartitionReader
 
     private List<SyncreplConfiguration> getReplProviderConfigs() throws Exception
     {
-        EqualityNode<String> filter = new EqualityNode<String>( SchemaConstants.OBJECT_CLASS_AT, new StringValue(
+        EqualityNode<String> filter = new EqualityNode<String>( OBJECT_CLASS_AT, new StringValue(
             ConfigSchemaConstants.ADS_REPL_PROVIDER_OC ) );
 
         SearchControls controls = new SearchControls();
@@ -964,7 +971,8 @@ public class ConfigPartitionReader
      */
     private List<Interceptor> getInterceptors( DN dirServiceDN ) throws Exception
     {
-        PresenceNode filter = new PresenceNode( ConfigSchemaConstants.ADS_INTERCEPTOR_ID );
+        AttributeType adsInterceptorIdAt = schemaManager.getAttributeType( ConfigSchemaConstants.ADS_INTERCEPTOR_ID );
+        PresenceNode filter = new PresenceNode( adsInterceptorIdAt );
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
         IndexCursor<Long, Entry, Long> cursor = se.cursor( dirServiceDN, AliasDerefMode.NEVER_DEREF_ALIASES,
@@ -1015,7 +1023,8 @@ public class ConfigPartitionReader
 
     private Map<String, Partition> getPartitions( DN dirServiceDN ) throws Exception
     {
-        PresenceNode filter = new PresenceNode( ConfigSchemaConstants.ADS_PARTITION_ID );
+        AttributeType adsPartitionIdeAt = schemaManager.getAttributeType( ConfigSchemaConstants.ADS_PARTITION_ID );
+        PresenceNode filter = new PresenceNode( adsPartitionIdeAt );
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
         IndexCursor<Long, Entry, Long> cursor = se.cursor( dirServiceDN, AliasDerefMode.NEVER_DEREF_ALIASES,
@@ -1033,7 +1042,7 @@ public class ConfigPartitionReader
             {
                 continue;
             }
-            EntryAttribute ocAttr = partitionEntry.get( SchemaConstants.OBJECT_CLASS_AT );
+            EntryAttribute ocAttr = partitionEntry.get( OBJECT_CLASS_AT );
 
             if ( ocAttr.contains( ConfigSchemaConstants.ADS_JDBMPARTITION ) )
             {
@@ -1094,7 +1103,8 @@ public class ConfigPartitionReader
 
     private Set<Index<?, Entry, Long>> getIndexes( DN partitionDN ) throws Exception
     {
-        PresenceNode filter = new PresenceNode( ConfigSchemaConstants.ADS_INDEX_ATTRIBUTE_ID );
+        AttributeType adsIndexAttributeIdAt = schemaManager.getAttributeType( ConfigSchemaConstants.ADS_INDEX_ATTRIBUTE_ID );
+        PresenceNode filter = new PresenceNode( adsIndexAttributeIdAt );
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
         IndexCursor<Long, Entry, Long> cursor = se.cursor( partitionDN, AliasDerefMode.NEVER_DEREF_ALIASES, filter,
@@ -1113,7 +1123,7 @@ public class ConfigPartitionReader
                 continue;
             }
 
-            EntryAttribute ocAttr = indexEntry.get( SchemaConstants.OBJECT_CLASS_AT );
+            EntryAttribute ocAttr = indexEntry.get( OBJECT_CLASS_AT );
 
             if ( ocAttr.contains( ConfigSchemaConstants.ADS_JDBMINDEX ) )
             {
@@ -1153,7 +1163,8 @@ public class ConfigPartitionReader
 
     private Transport[] getTransports( DN adsServerDN ) throws Exception
     {
-        PresenceNode filter = new PresenceNode( ConfigSchemaConstants.ADS_TRANSPORT_ID );
+        AttributeType adsTransportIdAt = schemaManager.getAttributeType( ConfigSchemaConstants.ADS_TRANSPORT_ID );
+        PresenceNode filter = new PresenceNode( adsTransportIdAt );
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
         IndexCursor<Long, Entry, Long> cursor = se.cursor( adsServerDN, AliasDerefMode.NEVER_DEREF_ALIASES,
@@ -1186,7 +1197,7 @@ public class ConfigPartitionReader
     {
         Transport transport = null;
 
-        EntryAttribute ocAttr = transportEntry.get( SchemaConstants.OBJECT_CLASS_AT );
+        EntryAttribute ocAttr = transportEntry.get( OBJECT_CLASS_AT );
 
         if ( ocAttr.contains( ConfigSchemaConstants.ADS_TCP_TRANSPORT ) )
         {
@@ -1336,7 +1347,8 @@ public class ConfigPartitionReader
 
     private Set<WebApp> getWebApps( DN webAppsDN ) throws Exception
     {
-        PresenceNode filter = new PresenceNode( ConfigSchemaConstants.ADS_HTTP_WARFILE );
+        AttributeType adsHttpWarFileAt = schemaManager.getAttributeType( ConfigSchemaConstants.ADS_HTTP_WARFILE );
+        PresenceNode filter = new PresenceNode( adsHttpWarFileAt );
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
         IndexCursor<Long, Entry, Long> cursor = se.cursor( webAppsDN, AliasDerefMode.NEVER_DEREF_ALIASES, filter,

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateCursor.java?rev=963530&r1=963529&r2=963530&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateCursor.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateCursor.java Mon Jul 12 23:37:38 2010
@@ -20,12 +20,12 @@
 package org.apache.directory.server.xdbm.search.impl;
 
 
+import org.apache.directory.server.i18n.I18n;
+import org.apache.directory.server.xdbm.AbstractIndexCursor;
 import org.apache.directory.server.xdbm.Index;
+import org.apache.directory.server.xdbm.IndexCursor;
 import org.apache.directory.server.xdbm.IndexEntry;
 import org.apache.directory.server.xdbm.Store;
-import org.apache.directory.server.xdbm.AbstractIndexCursor;
-import org.apache.directory.server.xdbm.IndexCursor;
-import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.shared.ldap.cursor.InvalidCursorPositionException;
 import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.entry.Value;

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.java?rev=963530&r1=963529&r2=963530&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.java Mon Jul 12 23:37:38 2010
@@ -27,8 +27,8 @@ import org.apache.directory.server.xdbm.
 import org.apache.directory.server.xdbm.IndexEntry;
 import org.apache.directory.server.xdbm.Store;
 import org.apache.directory.server.xdbm.search.Evaluator;
-import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Entry;
+import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.filter.ApproximateNode;
 import org.apache.directory.shared.ldap.schema.AttributeType;
@@ -73,7 +73,7 @@ public class ApproximateEvaluator<T, ID 
         else
         {
             idx = null;
-            type = schemaManager.lookupAttributeTypeRegistry( node.getAttribute() );
+            type = node.getAttributeType();
 
             MatchingRule mr = type.getEquality();
 

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java?rev=963530&r1=963529&r2=963530&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java Mon Jul 12 23:37:38 2010
@@ -22,6 +22,10 @@ package org.apache.directory.server.xdbm
 
 import java.util.List;
 
+import org.apache.directory.server.i18n.I18n;
+import org.apache.directory.server.xdbm.Index;
+import org.apache.directory.server.xdbm.Store;
+import org.apache.directory.server.xdbm.search.Optimizer;
 import org.apache.directory.shared.ldap.filter.AndNode;
 import org.apache.directory.shared.ldap.filter.ApproximateNode;
 import org.apache.directory.shared.ldap.filter.AssertionNode;
@@ -38,10 +42,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.filter.ScopeNode;
 import org.apache.directory.shared.ldap.filter.SimpleNode;
 import org.apache.directory.shared.ldap.filter.SubstringNode;
-import org.apache.directory.server.i18n.I18n;
-import org.apache.directory.server.xdbm.Index;
-import org.apache.directory.server.xdbm.search.Optimizer;
-import org.apache.directory.server.xdbm.Store;
 
 
 /**



Mime
View raw message