directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r412791 - in /directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core: authz/ collective/ event/ normalization/ partition/impl/btree/ schema/ subtree/
Date Thu, 08 Jun 2006 16:22:27 GMT
Author: akarasulu
Date: Thu Jun  8 09:22:26 2006
New Revision: 412791

URL: http://svn.apache.org/viewvc?rev=412791&view=rev
Log:
made subtree specification normalized distinguished names - using new interfaces instead of
just a name component normalizer now

Modified:
    directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/authz/AuthorizationService.java
    directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java
    directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeService.java
    directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/event/EventService.java
    directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/event/LeafEvaluator.java
    directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java
    directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/LeafEvaluator.java
    directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/schema/ConcreteNameComponentNormalizer.java
    directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java

Modified: directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/authz/AuthorizationService.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/authz/AuthorizationService.java?rev=412791&r1=412790&r2=412791&view=diff
==============================================================================
--- directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/authz/AuthorizationService.java
(original)
+++ directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/authz/AuthorizationService.java
Thu Jun  8 09:22:26 2006
@@ -34,6 +34,7 @@
 import org.apache.directory.server.core.partition.DirectoryPartitionNexusProxy;
 import org.apache.directory.server.core.schema.AttributeTypeRegistry;
 import org.apache.directory.server.core.schema.ConcreteNameComponentNormalizer;
+import org.apache.directory.server.core.schema.OidRegistry;
 import org.apache.directory.server.core.subtree.SubentryService;
 import org.apache.directory.shared.ldap.aci.ACIItem;
 import org.apache.directory.shared.ldap.aci.ACIItemParser;
@@ -155,7 +156,8 @@
         tupleCache = new TupleCache( factoryCfg );
         groupCache = new GroupCache( factoryCfg );
         attrRegistry = factoryCfg.getGlobalRegistries().getAttributeTypeRegistry();
-        aciParser = new ACIItemParser( new ConcreteNameComponentNormalizer( attrRegistry
) );
+        OidRegistry oidRegistry = factoryCfg.getGlobalRegistries().getOidRegistry();
+        aciParser = new ACIItemParser( new ConcreteNameComponentNormalizer( attrRegistry,
oidRegistry ) );
         engine = new ACDFEngine( factoryCfg.getGlobalRegistries().getOidRegistry(), attrRegistry
);
         chain = factoryCfg.getInterceptorChain();
         enabled = factoryCfg.getStartupConfiguration().isAccessControlEnabled();

Modified: directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java?rev=412791&r1=412790&r2=412791&view=diff
==============================================================================
--- directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java
(original)
+++ directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java
Thu Jun  8 09:22:26 2006
@@ -33,6 +33,7 @@
 import org.apache.directory.server.core.partition.DirectoryPartitionNexus;
 import org.apache.directory.server.core.schema.AttributeTypeRegistry;
 import org.apache.directory.server.core.schema.ConcreteNameComponentNormalizer;
+import org.apache.directory.server.core.schema.OidRegistry;
 import org.apache.directory.shared.ldap.aci.ACIItem;
 import org.apache.directory.shared.ldap.aci.ACIItemParser;
 import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
@@ -83,8 +84,9 @@
     public TupleCache(DirectoryServiceConfiguration factoryCfg) throws NamingException
     {
         this.nexus = factoryCfg.getPartitionNexus();
-        AttributeTypeRegistry registry = factoryCfg.getGlobalRegistries().getAttributeTypeRegistry();
-        NameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( registry );
+        AttributeTypeRegistry attributeRegistry = factoryCfg.getGlobalRegistries().getAttributeTypeRegistry();
+        OidRegistry oidRegistry = factoryCfg.getGlobalRegistries().getOidRegistry();
+        NameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( attributeRegistry,
oidRegistry );
         aciParser = new ACIItemParser( ncn );
         env = ( Hashtable ) factoryCfg.getEnvironment().clone();
         initialize();

Modified: directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeService.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeService.java?rev=412791&r1=412790&r2=412791&view=diff
==============================================================================
--- directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeService.java
(original)
+++ directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeService.java
Thu Jun  8 09:22:26 2006
@@ -246,7 +246,7 @@
         filter( result );
         return result;
     }
-
+    
 
     public Attributes lookup( NextInterceptor nextInterceptor, LdapDN name, String[] attrIds
) throws NamingException
     {

Modified: directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/event/EventService.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/event/EventService.java?rev=412791&r1=412790&r2=412791&view=diff
==============================================================================
--- directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/event/EventService.java
(original)
+++ directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/event/EventService.java
Thu Jun  8 09:22:26 2006
@@ -27,6 +27,7 @@
 import org.apache.directory.server.core.partition.DirectoryPartitionNexus;
 import org.apache.directory.server.core.partition.DirectoryPartitionNexusProxy;
 import org.apache.directory.server.core.schema.AttributeTypeRegistry;
+import org.apache.directory.server.core.schema.ConcreteNameComponentNormalizer;
 import org.apache.directory.server.core.schema.OidRegistry;
 import org.apache.directory.shared.ldap.filter.BranchNode;
 import org.apache.directory.shared.ldap.filter.ExprNode;
@@ -35,7 +36,6 @@
 import org.apache.directory.shared.ldap.message.DerefAliasesEnum;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.name.NameComponentNormalizer;
-import org.apache.directory.shared.ldap.schema.AttributeType;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -65,7 +65,7 @@
     private DirectoryPartitionNexus nexus;
     private Map sources = new HashMap();
     private Evaluator evaluator = null;
-    private AttributeTypeRegistry registry;
+    private AttributeTypeRegistry attributeRegistry;
     private NormalizingVisitor visitor;
 
     
@@ -74,10 +74,10 @@
         super.init( factoryCfg, cfg );
 
         OidRegistry oidRegistry = factoryCfg.getGlobalRegistries().getOidRegistry();
-        registry = factoryCfg.getGlobalRegistries().getAttributeTypeRegistry();
-        evaluator = new ExpressionEvaluator( oidRegistry, registry );
+        attributeRegistry = factoryCfg.getGlobalRegistries().getAttributeTypeRegistry();
+        evaluator = new ExpressionEvaluator( oidRegistry, attributeRegistry );
         nexus = factoryCfg.getPartitionNexus();
-        NameComponentNormalizer ncn = new PerComponentNormalizer();
+        NameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( attributeRegistry,
oidRegistry );
         visitor = new NormalizingVisitor( ncn, factoryCfg.getGlobalRegistries().getOidRegistry()
);
     }
 
@@ -104,7 +104,7 @@
         if ( filter.isLeaf() )
         {
             LeafNode ln = ( LeafNode ) filter;
-            if ( !registry.hasAttributeType( ln.getAttribute() ) )
+            if ( !attributeRegistry.hasAttributeType( ln.getAttribute() ) )
             {
                 StringBuffer buf = new StringBuffer();
                 buf.append( "undefined filter based on undefined attributeType '" );
@@ -464,49 +464,6 @@
         public SearchControls getSearchControls()
         {
             return controls;
-        }
-    }
-    
-    
-    /**
-     * A normalizer that normalizes each name component specifically according to
-     * the attribute type of the name component.
-     */
-    private class PerComponentNormalizer implements NameComponentNormalizer
-    {
-        public String normalizeByName( String name, String value ) throws NamingException
-        {
-            AttributeType type = registry.lookup( name );
-            return ( String ) type.getEquality().getNormalizer().normalize( value );
-        }
-
-
-        public String normalizeByName( String name, byte[] value ) throws NamingException
-        {
-            AttributeType type = registry.lookup( name );
-
-            return ( String ) type.getEquality().getNormalizer().normalize( value );
-        }
-
-
-        public String normalizeByOid( String oid, String value ) throws NamingException
-        {
-            AttributeType type = registry.lookup( oid );
-            return ( String ) type.getEquality().getNormalizer().normalize( value );
-        }
-
-
-        public boolean isDefined( String id )
-        {
-            return registry.hasAttributeType( id );
-        }
-
-
-        public String normalizeByOid( String oid, byte[] value ) throws NamingException
-        {
-            AttributeType type = registry.lookup( oid );
-
-            return ( String ) type.getEquality().getNormalizer().normalize( value );
         }
     }
 }

Modified: directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/event/LeafEvaluator.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/event/LeafEvaluator.java?rev=412791&r1=412790&r2=412791&view=diff
==============================================================================
--- directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/event/LeafEvaluator.java
(original)
+++ directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/event/LeafEvaluator.java
Thu Jun  8 09:22:26 2006
@@ -222,11 +222,12 @@
      */
     private Attribute getAttributeByOid( String attributeOid, Attributes entry ) throws NamingException
     {
+        String matchForOid = this.oidRegistry.getOid( attributeOid );
         for ( NamingEnumeration ii = entry.getIDs(); ii.hasMore(); /**/ )
         {
             String id = ( String ) ii.next();
             String oid = oidRegistry.getOid( id );
-            if ( oid.equals( attributeOid ) )
+            if ( oid.equals( matchForOid     ) )
             {
                 return entry.get( id );
             }

Modified: directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java?rev=412791&r1=412790&r2=412791&view=diff
==============================================================================
--- directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java
(original)
+++ directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java
Thu Jun  8 09:22:26 2006
@@ -32,13 +32,14 @@
 import org.apache.directory.server.core.interceptor.NextInterceptor;
 import org.apache.directory.server.core.partition.DirectoryPartitionNexus;
 import org.apache.directory.server.core.schema.AttributeTypeRegistry;
+import org.apache.directory.server.core.schema.ConcreteNameComponentNormalizer;
+import org.apache.directory.server.core.schema.OidRegistry;
 
 import org.apache.directory.shared.ldap.filter.BranchNode;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.filter.LeafNode;
 import org.apache.directory.shared.ldap.name.NameComponentNormalizer;
 import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.util.EmptyEnumeration;
 
 import org.slf4j.LoggerFactory;
@@ -61,14 +62,15 @@
     /** a filter node value normalizer and undefined node remover */
     private NormalizingVisitor visitor;
     /** the attributeType registry used for normalization and determining if some filter
nodes are undefined */
-    private AttributeTypeRegistry registry;
+    private AttributeTypeRegistry attributeRegistry;
 
 
     public void init( DirectoryServiceConfiguration factoryCfg, InterceptorConfiguration
cfg ) throws NamingException
     {
-        registry = factoryCfg.getGlobalRegistries().getAttributeTypeRegistry();
-        NameComponentNormalizer ncn = new PerComponentNormalizer();
-        visitor = new NormalizingVisitor( ncn, factoryCfg.getGlobalRegistries().getOidRegistry()
);
+        OidRegistry oidRegistry = factoryCfg.getGlobalRegistries().getOidRegistry();
+        attributeRegistry = factoryCfg.getGlobalRegistries().getAttributeTypeRegistry();
+        NameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( attributeRegistry,
oidRegistry );
+        visitor = new NormalizingVisitor( ncn, oidRegistry );
     }
 
 
@@ -144,7 +146,7 @@
         if ( filter.isLeaf() )
         {
             LeafNode ln = ( LeafNode ) filter;
-            if ( !registry.hasAttributeType( ln.getAttribute() ) )
+            if ( !attributeRegistry.hasAttributeType( ln.getAttribute() ) )
             {
                 StringBuffer buf = new StringBuffer();
                 buf.append( "undefined filter based on undefined attributeType '" );
@@ -250,48 +252,5 @@
     {
         suffix = LdapDN.normalize( suffix );
         next.removeContextPartition( suffix );
-    }
-
-
-    /**
-     * A normalizer that normalizes each name component specifically according to
-     * the attribute type of the name component.
-     */
-    private class PerComponentNormalizer implements NameComponentNormalizer
-    {
-        public String normalizeByName( String name, String value ) throws NamingException
-        {
-            AttributeType type = registry.lookup( name );
-            return ( String ) type.getEquality().getNormalizer().normalize( value );
-        }
-
-
-        public String normalizeByName( String name, byte[] value ) throws NamingException
-        {
-            AttributeType type = registry.lookup( name );
-
-            return ( String ) type.getEquality().getNormalizer().normalize( value );
-        }
-
-
-        public String normalizeByOid( String oid, String value ) throws NamingException
-        {
-            AttributeType type = registry.lookup( oid );
-            return ( String ) type.getEquality().getNormalizer().normalize( value );
-        }
-
-
-        public boolean isDefined( String id )
-        {
-            return registry.hasAttributeType( id );
-        }
-
-
-        public String normalizeByOid( String oid, byte[] value ) throws NamingException
-        {
-            AttributeType type = registry.lookup( oid );
-
-            return ( String ) type.getEquality().getNormalizer().normalize( value );
-        }
     }
 }

Modified: directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/LeafEvaluator.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/LeafEvaluator.java?rev=412791&r1=412790&r2=412791&view=diff
==============================================================================
--- directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/LeafEvaluator.java
(original)
+++ directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/LeafEvaluator.java
Thu Jun  8 09:22:26 2006
@@ -254,11 +254,12 @@
     
     private Attribute getAttributeByOid( String attributeOid, Attributes entry ) throws NamingException
     {
+        String matchForOid = this.oidRegistry.getOid( attributeOid );
         for ( NamingEnumeration ii = entry.getIDs(); ii.hasMore(); /**/ )
         {
             String id = ( String ) ii.next();
             String oid = this.oidRegistry.getOid( id );
-            if ( attributeOid.equals( oid ) )
+            if ( matchForOid.equals( oid ) )
             {
                 return entry.get( id );
             }

Modified: directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/schema/ConcreteNameComponentNormalizer.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/schema/ConcreteNameComponentNormalizer.java?rev=412791&r1=412790&r2=412791&view=diff
==============================================================================
--- directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/schema/ConcreteNameComponentNormalizer.java
(original)
+++ directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/schema/ConcreteNameComponentNormalizer.java
Thu Jun  8 09:22:26 2006
@@ -35,7 +35,9 @@
 public class ConcreteNameComponentNormalizer implements NameComponentNormalizer
 {
     /** the at registry used to dynamically resolve Normalizers */
-    private final AttributeTypeRegistry registry;
+    private final AttributeTypeRegistry attributeRegistry;
+    /** the oid registry used to dynamically resolve aliases to OIDs */
+    private final OidRegistry oidRegistry;
 
 
     /**
@@ -45,9 +47,10 @@
      *
      * @param registry the at registry used to dynamically resolve Normalizers
      */
-    public ConcreteNameComponentNormalizer(AttributeTypeRegistry registry)
+    public ConcreteNameComponentNormalizer( AttributeTypeRegistry registry, OidRegistry oidRegistry
)
     {
-        this.registry = registry;
+        this.attributeRegistry = registry;
+        this.oidRegistry = oidRegistry;
     }
 
 
@@ -100,7 +103,7 @@
      */
     private Normalizer lookup( String id ) throws NamingException
     {
-        AttributeType type = registry.lookup( id );
+        AttributeType type = attributeRegistry.lookup( id );
         return type.getEquality().getNormalizer();
     }
 
@@ -110,6 +113,12 @@
      */
     public boolean isDefined( String id )
     {
-        return registry.hasAttributeType( id );
+        return attributeRegistry.hasAttributeType( id );
+    }
+
+
+    public String normalizeName( String attributeName ) throws NamingException
+    {
+        return oidRegistry.getOid( attributeName );
     }
 }

Modified: directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java?rev=412791&r1=412790&r2=412791&view=diff
==============================================================================
--- directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java
(original)
+++ directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java
Thu Jun  8 09:22:26 2006
@@ -26,7 +26,6 @@
 import org.apache.directory.server.core.invocation.Invocation;
 import org.apache.directory.server.core.invocation.InvocationStack;
 import org.apache.directory.server.core.partition.DirectoryPartitionNexus;
-import org.apache.directory.server.core.schema.ConcreteNameComponentNormalizer;
 import org.apache.directory.server.core.schema.AttributeTypeRegistry;
 
 import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeValueException;
@@ -41,6 +40,7 @@
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.message.SubentriesControl;
 import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.schema.NormalizerMappingResolver;
 import org.apache.directory.shared.ldap.subtree.SubtreeSpecification;
 import org.apache.directory.shared.ldap.subtree.SubtreeSpecificationParser;
 
@@ -107,8 +107,13 @@
         this.nexus = factoryCfg.getPartitionNexus();
         this.factoryCfg = factoryCfg;
         this.registry = factoryCfg.getGlobalRegistries().getAttributeTypeRegistry();
-        ConcreteNameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( registry
);
-        ssParser = new SubtreeSpecificationParser( ncn );
+        ssParser = new SubtreeSpecificationParser( new NormalizerMappingResolver()
+        {
+            public Map getNormalizerMapping() throws NamingException
+            {
+                return registry.getNormalizerMapping();
+            }
+        });
         evaluator = new SubtreeEvaluator( factoryCfg.getGlobalRegistries().getOidRegistry()
);
 
         // prepare to find all subentries in all namingContexts
@@ -383,7 +388,7 @@
             LdapDN baseDn = ( LdapDN ) apName.clone();
             baseDn.addAll( ss.getBase() );
 
-            ExprNode filter = new PresenceNode( "objectclass" );
+            ExprNode filter = new PresenceNode( "2.5.4.0" ); // (objectClass=*)
             SearchControls controls = new SearchControls();
             controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
             controls.setReturningAttributes( new String[]



Mime
View raw message