You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2010/06/30 01:28:31 UTC

svn commit: r959143 - in /directory: apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/ shared/trunk/ldap-aci/src/main/antlr/ shared/trunk/ldap-aci/src/main/java/org/apache/directory/shared/ldap/aci/

Author: elecharny
Date: Tue Jun 29 23:28:31 2010
New Revision: 959143

URL: http://svn.apache.org/viewvc?rev=959143&view=rev
Log:
o Make the ACIParser Schema Aware
o Inject the schemaManager in the instance of AciParser in the code

Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java
    directory/shared/trunk/ldap-aci/src/main/antlr/ACIItem.g
    directory/shared/trunk/ldap-aci/src/main/java/org/apache/directory/shared/ldap/aci/ACIItemParser.java

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java?rev=959143&r1=959142&r2=959143&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java Tue Jun 29 23:28:31 2010
@@ -210,8 +210,7 @@ public class AciAuthorizationInterceptor
         entryAciType = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.ENTRY_ACI_AT_OID );
         subentryAciType = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.SUBENTRY_ACI_AT_OID );
 
-        aciParser = new ACIItemParser( new ConcreteNameComponentNormalizer( schemaManager ), schemaManager
-            .getNormalizerMapping() );
+        aciParser = new ACIItemParser( new ConcreteNameComponentNormalizer( schemaManager ), schemaManager );
         engine = new ACDFEngine( schemaManager.getGlobalOidRegistry(), schemaManager );
         chain = directoryService.getInterceptorChain();
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java?rev=959143&r1=959142&r2=959143&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java Tue Jun 29 23:28:31 2010
@@ -96,7 +96,7 @@ public class TupleCache
         SchemaManager schemaManager = session.getDirectoryService().getSchemaManager();
         this.nexus = session.getDirectoryService().getPartitionNexus();
         NameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( schemaManager );
-        aciParser = new ACIItemParser( ncn, schemaManager.getNormalizerMapping() );
+        aciParser = new ACIItemParser( ncn, schemaManager );
         prescriptiveAciAT = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.PRESCRIPTIVE_ACI_AT );
         initialize( session );
     }

Modified: directory/shared/trunk/ldap-aci/src/main/antlr/ACIItem.g
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-aci/src/main/antlr/ACIItem.g?rev=959143&r1=959142&r2=959143&view=diff
==============================================================================
--- directory/shared/trunk/ldap-aci/src/main/antlr/ACIItem.g (original)
+++ directory/shared/trunk/ldap-aci/src/main/antlr/ACIItem.g Tue Jun 29 23:28:31 2010
@@ -53,9 +53,9 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.util.OptionalComponentsMonitor;
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.name.RDN;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
-import org.apache.directory.shared.ldap.schema.normalizers.OidNormalizer;
 import org.apache.directory.shared.ldap.entry.StringValue;
 import org.apache.directory.shared.ldap.aci.protectedItem.AllAttributeValuesItem;
 import org.apache.directory.shared.ldap.aci.protectedItem.AttributeTypeItem;
@@ -129,7 +129,9 @@ tokens
     private Integer precedence = null;
     private Set<GrantAndDenial> grantsAndDenials;
     private Set<UserPermission> userPermissions;
-    private Map<String, OidNormalizer> oidsMap;
+    
+    /** The SchemaManager */
+    private SchemaManager schemaManager;
     
     private Set<DN> chopBeforeExclusions;
     private Set<DN> chopAfterExclusions;
@@ -148,9 +150,9 @@ tokens
      *
      * @return the DnParser to be used for parsing Names
      */
-    public void init( Map<String, OidNormalizer> oidsMap )
+    public void init( SchemaManager schemaManager )
     {
-        this.oidsMap = oidsMap;
+        this.schemaManager = schemaManager;
     }
 
     /**
@@ -488,9 +490,9 @@ attributeValue
         // So, parse the set as a Dn and extract each attributeTypeAndValue
         DN attributeTypeAndValueSetAsDn = new DN( token.getText() );
         
-        if ( oidsMap != null )
+        if ( schemaManager != null )
         {        
-            attributeTypeAndValueSetAsDn.normalize( oidsMap );
+          attributeTypeAndValueSetAsDn.normalize( schemaManager.getNormalizerMapping() );
         }
         
         for ( RDN rdn :attributeTypeAndValueSetAsDn.getRdns() )
@@ -1172,9 +1174,9 @@ distinguishedName returns [ DN name ] 
     token:SAFEUTF8STRING
     {
         name = new DN( token.getText() );
-        if ( oidsMap != null )
+        if ( schemaManager != null )
         {
-            name.normalize( oidsMap );
+            name.normalize( schemaManager.getNormalizerMapping() );
         }
         log.debug( "recognized a DistinguishedName: " + token.getText() );
     }

Modified: directory/shared/trunk/ldap-aci/src/main/java/org/apache/directory/shared/ldap/aci/ACIItemParser.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-aci/src/main/java/org/apache/directory/shared/ldap/aci/ACIItemParser.java?rev=959143&r1=959142&r2=959143&view=diff
==============================================================================
--- directory/shared/trunk/ldap-aci/src/main/java/org/apache/directory/shared/ldap/aci/ACIItemParser.java (original)
+++ directory/shared/trunk/ldap-aci/src/main/java/org/apache/directory/shared/ldap/aci/ACIItemParser.java Tue Jun 29 23:28:31 2010
@@ -23,11 +23,10 @@ package org.apache.directory.shared.ldap
 
 import java.io.StringReader;
 import java.text.ParseException;
-import java.util.Map;
 
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.name.NameComponentNormalizer;
-import org.apache.directory.shared.ldap.schema.normalizers.OidNormalizer;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
 
 import antlr.RecognitionException;
 import antlr.TokenStreamException;
@@ -54,12 +53,12 @@ public class ACIItemParser
     /**
      * Creates a ACIItem parser.
      */
-    public ACIItemParser( Map<String, OidNormalizer> oidsMap )
+    public ACIItemParser( SchemaManager schemaManager )
     {
         this.lexer = new ReusableAntlrACIItemLexer( new StringReader( "" ) );
         this.parser = new ReusableAntlrACIItemParser( lexer );
 
-        this.parser.init( oidsMap ); // this method MUST be called while we cannot do
+        this.parser.init( schemaManager ); // this method MUST be called while we cannot do
         // constructor overloading for antlr generated parser
         this.isNormalizing = false;
     }
@@ -68,13 +67,13 @@ public class ACIItemParser
     /**
      * Creates a normalizing ACIItem parser.
      */
-    public ACIItemParser( NameComponentNormalizer normalizer, Map<String, OidNormalizer> oidsMap )
+    public ACIItemParser( NameComponentNormalizer normalizer, SchemaManager schemaManager )
     {
         this.lexer = new ReusableAntlrACIItemLexer( new StringReader( "" ) );
         this.parser = new ReusableAntlrACIItemParser( lexer );
 
         this.parser.setNormalizer( normalizer );
-        this.parser.init( oidsMap ); // this method MUST be called while we cannot do
+        this.parser.init( schemaManager ); // this method MUST be called while we cannot do
         // constructor overloading for antlr generated parser
         this.isNormalizing = true;
     }