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 2013/09/05 18:44:31 UTC

svn commit: r1520372 - in /directory/apacheds/trunk: core-api/src/main/java/org/apache/directory/server/core/api/interceptor/ interceptors/authn/src/main/java/org/apache/directory/server/core/authn/ interceptors/authz/src/main/java/org/apache/directory...

Author: elecharny
Date: Thu Sep  5 16:44:30 2013
New Revision: 1520372

URL: http://svn.apache.org/r1520372
Log:
o Added a reference to the dnFactory in the BaseInterceptor
o Used this reference in all the interceptors
o Removed a few commented code

Modified:
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/BaseInterceptor.java
    directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
    directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
    directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java
    directory/apacheds/trunk/interceptors/collective/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java
    directory/apacheds/trunk/interceptors/exception/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
    directory/apacheds/trunk/interceptors/operational/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
    directory/apacheds/trunk/interceptors/referral/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java
    directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
    directory/apacheds/trunk/interceptors/subtree/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/BaseInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/BaseInterceptor.java?rev=1520372&r1=1520371&r2=1520372&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/BaseInterceptor.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/BaseInterceptor.java Thu Sep  5 16:44:30 2013
@@ -29,6 +29,7 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.schema.AttributeType;
 import org.apache.directory.api.ldap.model.schema.SchemaManager;
 import org.apache.directory.server.core.api.DirectoryService;
+import org.apache.directory.server.core.api.DnFactory;
 import org.apache.directory.server.core.api.InterceptorEnum;
 import org.apache.directory.server.core.api.LdapPrincipal;
 import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
@@ -67,6 +68,9 @@ public abstract class BaseInterceptor im
     /** A reference to the SchemaManager instance */
     protected SchemaManager schemaManager;
 
+    /** The DN factory */
+    protected DnFactory dnFactory;
+
     /** set of operational attribute types used for representing the password policy state of a user entry */
     protected static final Set<AttributeType> PWD_POLICY_STATE_ATTRIBUTE_TYPES = new HashSet<AttributeType>();
 
@@ -331,8 +335,10 @@ public abstract class BaseInterceptor im
      */
     public void init( DirectoryService directoryService ) throws LdapException
     {
+        // Initialize the fields that will be used by all the interceptors
         this.directoryService = directoryService;
-        this.schemaManager = directoryService.getSchemaManager();
+        schemaManager = directoryService.getSchemaManager();
+        dnFactory = directoryService.getDnFactory();
 
         // Init the At we use locally
         ACCESS_CONTROL_SUBENTRIES_AT = schemaManager.getAttributeType( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT );

Modified: directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java?rev=1520372&r1=1520371&r2=1520372&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java Thu Sep  5 16:44:30 2013
@@ -1581,7 +1581,7 @@ public class AuthenticationInterceptor e
 
             if ( pwdPolicySubentry != null )
             {
-                Dn configDn = directoryService.getDnFactory().create( pwdPolicySubentry.getString() );
+                Dn configDn = dnFactory.create( pwdPolicySubentry.getString() );
 
                 return pwdPolicyContainer.getPolicyConfig( configDn );
             }

Modified: directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java?rev=1520372&r1=1520371&r2=1520372&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java Thu Sep  5 16:44:30 2013
@@ -291,7 +291,7 @@ public class AciAuthorizationInterceptor
 
         // stuff for dealing with subentries (garbage for now)
         Value<?> subschemaSubentry = directoryService.getPartitionNexus().getRootDseValue( SUBSCHEMA_SUBENTRY_AT );
-        Dn subschemaSubentryDnName = directoryService.getDnFactory().create( subschemaSubentry.getString() );
+        Dn subschemaSubentryDnName = dnFactory.create( subschemaSubentry.getString() );
         subschemaSubentryDn = subschemaSubentryDnName.getNormName();
 
         // Init the caches now

Modified: directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java?rev=1520372&r1=1520371&r2=1520372&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java Thu Sep  5 16:44:30 2013
@@ -122,13 +122,13 @@ public class DefaultAuthorizationInterce
 
         nexus = directoryService.getPartitionNexus();
 
-        ADMIN_SYSTEM_DN = directoryService.getDnFactory().create( ServerDNConstants.ADMIN_SYSTEM_DN );
+        ADMIN_SYSTEM_DN = dnFactory.create( ServerDNConstants.ADMIN_SYSTEM_DN );
 
-        GROUPS_BASE_DN = directoryService.getDnFactory().create( ServerDNConstants.GROUPS_SYSTEM_DN );
+        GROUPS_BASE_DN = dnFactory.create( ServerDNConstants.GROUPS_SYSTEM_DN );
 
-        USERS_BASE_DN = directoryService.getDnFactory().create( ServerDNConstants.USERS_SYSTEM_DN );
+        USERS_BASE_DN = dnFactory.create( ServerDNConstants.USERS_SYSTEM_DN );
 
-        ADMIN_GROUP_DN = directoryService.getDnFactory().create( ServerDNConstants.ADMINISTRATORS_GROUP_DN );
+        ADMIN_GROUP_DN = dnFactory.create( ServerDNConstants.ADMINISTRATORS_GROUP_DN );
 
         loadAdministrators( directoryService );
     }
@@ -151,7 +151,7 @@ public class DefaultAuthorizationInterce
 
         for ( Value<?> value : uniqueMember )
         {
-            Dn memberDn = directoryService.getDnFactory().create( value.getString() );
+            Dn memberDn = dnFactory.create( value.getString() );
             newAdministrators.add( memberDn.getNormName() );
         }
 
@@ -519,7 +519,7 @@ public class DefaultAuthorizationInterce
         Dn principalDn = opContext.getSession().getEffectivePrincipal().getDn();
         Dn dn = entry.getDn();
 
-        dn.apply( opContext.getSession().getDirectoryService().getSchemaManager() );
+        dn.apply( schemaManager );
 
         // Admin users gets full access to all entries
         if ( isAnAdministrator( principalDn ) )

Modified: directory/apacheds/trunk/interceptors/collective/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/collective/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java?rev=1520372&r1=1520371&r2=1520372&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/collective/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/collective/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java Thu Sep  5 16:44:30 2013
@@ -343,6 +343,7 @@ public class CollectiveAttributeIntercep
         }
 
         LOG.debug( "Filtering entry " + entry.getDn() );
+
         /*
          * Before we proceed we need to lookup the exclusions within the entry
          * and build a set of exclusions for rapid lookup.  We use OID values
@@ -365,6 +366,7 @@ public class CollectiveAttributeIntercep
                  * to be injected into itself.
                  */
                 LOG.debug( "The entry excludes all the collectiveAttributes" );
+
                 return;
             }
 
@@ -384,7 +386,7 @@ public class CollectiveAttributeIntercep
         for ( Value<?> value : collectiveAttributeSubentries )
         {
             String subentryDnStr = value.getString();
-            Dn subentryDn = session.getDirectoryService().getDnFactory().create( subentryDnStr );
+            Dn subentryDn = dnFactory.create( subentryDnStr );
 
             LOG.debug( "Applying subentries {}", subentryDn.getName() );
 
@@ -397,14 +399,13 @@ public class CollectiveAttributeIntercep
 
             LookupOperationContext lookupContext = new LookupOperationContext( session, subentryDn,
                 SchemaConstants.ALL_ATTRIBUTES_ARRAY );
-            Entry subentry = session.getDirectoryService().getPartitionNexus().lookup( lookupContext );
+            Entry subentry = directoryService.getPartitionNexus().lookup( lookupContext );
 
             //LOG.debug( "Fetched the subentry : {}", subentry.getDn().getName() );
 
             for ( Attribute attribute : subentry.getAttributes() )
             {
                 AttributeType attributeType = attribute.getAttributeType();
-                //String attrId = attributeType.getName();
 
                 // Skip the attributes which are not collective
                 if ( !attributeType.isCollective() )

Modified: directory/apacheds/trunk/interceptors/exception/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/exception/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java?rev=1520372&r1=1520371&r2=1520372&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/exception/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/exception/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java Thu Sep  5 16:44:30 2013
@@ -105,7 +105,7 @@ public class ExceptionInterceptor extend
         super.init( directoryService );
         nexus = directoryService.getPartitionNexus();
         Value<?> attr = nexus.getRootDseValue( SUBSCHEMA_SUBENTRY_AT );
-        subschemSubentryDn = directoryService.getDnFactory().create( attr.getString() );
+        subschemSubentryDn = dnFactory.create( attr.getString() );
     }
 
 

Modified: directory/apacheds/trunk/interceptors/operational/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/operational/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java?rev=1520372&r1=1520371&r2=1520372&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/operational/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/operational/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java Thu Sep  5 16:44:30 2013
@@ -130,10 +130,10 @@ public class OperationalAttributeInterce
 
         // stuff for dealing with subentries (garbage for now)
         Value<?> subschemaSubentry = directoryService.getPartitionNexus().getRootDseValue( SUBSCHEMA_SUBENTRY_AT );
-        subschemaSubentryDn = directoryService.getDnFactory().create( subschemaSubentry.getString() );
+        subschemaSubentryDn = dnFactory.create( subschemaSubentry.getString() );
 
         // Create the Admin Dn
-        adminDn = directoryService.getDnFactory().create( ServerDNConstants.ADMIN_SYSTEM_DN );
+        adminDn = dnFactory.create( ServerDNConstants.ADMIN_SYSTEM_DN );
     }
 
 
@@ -471,7 +471,7 @@ public class OperationalAttributeInterce
 
             if ( attr != null )
             {
-                Dn creatorsName = directoryService.getDnFactory().create( attr.getString() );
+                Dn creatorsName = dnFactory.create( attr.getString() );
 
                 attr.clear();
                 attr.add( denormalizeTypes( creatorsName ).getName() );
@@ -481,7 +481,7 @@ public class OperationalAttributeInterce
 
             if ( attr != null )
             {
-                Dn modifiersName = directoryService.getDnFactory().create( attr.getString() );
+                Dn modifiersName = dnFactory.create( attr.getString() );
 
                 attr.clear();
                 attr.add( denormalizeTypes( modifiersName ).getName() );
@@ -491,7 +491,7 @@ public class OperationalAttributeInterce
 
             if ( attr != null )
             {
-                Dn modifiersName = directoryService.getDnFactory().create( attr.getString() );
+                Dn modifiersName = dnFactory.create( attr.getString() );
 
                 attr.clear();
                 attr.add( denormalizeTypes( modifiersName ).getName() );

Modified: directory/apacheds/trunk/interceptors/referral/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/referral/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java?rev=1520372&r1=1520371&r2=1520372&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/referral/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/referral/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java Thu Sep  5 16:44:30 2013
@@ -214,7 +214,7 @@ public class ReferralInterceptor extends
         directoryService.setReferralManager( referralManager );
 
         Value<?> subschemaSubentry = nexus.getRootDseValue( SUBSCHEMA_SUBENTRY_AT );
-        subschemaSubentryDn = directoryService.getDnFactory().create( subschemaSubentry.getString() );
+        subschemaSubentryDn = dnFactory.create( subschemaSubentry.getString() );
     }
 
 

Modified: directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java?rev=1520372&r1=1520371&r2=1520372&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java Thu Sep  5 16:44:30 2013
@@ -177,21 +177,21 @@ public class SchemaInterceptor extends B
         topFilter = new TopFilter();
         filters.add( topFilter );
 
-        schemaBaseDn = directoryService.getDnFactory().create( SchemaConstants.OU_SCHEMA );
+        schemaBaseDn = dnFactory.create( SchemaConstants.OU_SCHEMA );
 
         // stuff for dealing with subentries (garbage for now)
         Value<?> subschemaSubentry = nexus.getRootDseValue( SUBSCHEMA_SUBENTRY_AT );
-        subschemaSubentryDn = directoryService.getDnFactory().create( subschemaSubentry.getString() );
+        subschemaSubentryDn = dnFactory.create( subschemaSubentry.getString() );
         subschemaSubentryDnNorm = subschemaSubentryDn.getNormName();
 
-        schemaModificationAttributesDn = directoryService.getDnFactory().create(
+        schemaModificationAttributesDn = dnFactory.create(
             SchemaConstants.SCHEMA_MODIFICATIONS_DN );
 
         computeSuperiors();
 
         // Initialize the schema manager
         SchemaLoader loader = directoryService.getSchemaManager().getLoader();
-        schemaSubEntryManager = new SchemaSubentryManager( schemaManager, loader, directoryService.getDnFactory() );
+        schemaSubEntryManager = new SchemaSubentryManager( schemaManager, loader, dnFactory );
 
         if ( IS_DEBUG )
         {
@@ -878,9 +878,7 @@ public class SchemaInterceptor extends B
          */
         public boolean accept( SearchOperationContext operationContext, Entry entry ) throws LdapException
         {
-            ServerEntryUtils.filterContents(
-                operationContext.getSession().getDirectoryService().getSchemaManager(),
-                operationContext, entry );
+            ServerEntryUtils.filterContents( schemaManager, operationContext, entry );
 
             return true;
         }

Modified: directory/apacheds/trunk/interceptors/subtree/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/subtree/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java?rev=1520372&r1=1520371&r2=1520372&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/subtree/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/subtree/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java Thu Sep  5 16:44:30 2013
@@ -99,6 +99,8 @@ public class SubentryInterceptor extends
     /** the subentry control OID */
     private static final String SUBENTRY_CONTROL = Subentries.OID;
 
+    private static Value<String> SUBENTRY_OC;
+
     /** The set of Subentry operational attributes */
     public static AttributeType[] SUBENTRY_OPATTRS;
 
@@ -145,7 +147,7 @@ public class SubentryInterceptor extends
             }
 
             // see if we can use objectclass if present
-            return !entry.contains( OBJECT_CLASS_AT, SchemaConstants.SUBENTRY_OC );
+            return !entry.contains( OBJECT_CLASS_AT, SUBENTRY_OC );
         }
 
 
@@ -223,12 +225,13 @@ public class SubentryInterceptor extends
         controls.setReturningAttributes( new String[]
             { SchemaConstants.SUBTREE_SPECIFICATION_AT, SchemaConstants.OBJECT_CLASS_AT } );
 
-        Dn adminDn = directoryService.getDnFactory().create( ServerDNConstants.ADMIN_SYSTEM_DN );
+        Dn adminDn = dnFactory.create( ServerDNConstants.ADMIN_SYSTEM_DN );
+        SUBENTRY_OC = new StringValue( OBJECT_CLASS_AT, SchemaConstants.SUBENTRY_OC );
 
         // search each namingContext for subentries
         for ( String suffix : suffixes )
         {
-            Dn suffixDn = directoryService.getDnFactory().create( suffix );
+            Dn suffixDn = dnFactory.create( suffix );
 
             CoreSession adminSession = directoryService.getAdminSession();