directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1185134 [2/2] - in /directory/apacheds/trunk: core-api/src/main/java/org/apache/directory/server/core/api/ core-api/src/main/java/org/apache/directory/server/core/api/event/ core-api/src/main/java/org/apache/directory/server/core/api/subtr...
Date Mon, 17 Oct 2011 12:51:02 GMT
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=1185134&r1=1185133&r2=1185134&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
Mon Oct 17 12:51:01 2011
@@ -30,6 +30,7 @@ import javax.naming.directory.SearchCont
 import org.apache.directory.server.constants.ApacheSchemaConstants;
 import org.apache.directory.server.constants.ServerDNConstants;
 import org.apache.directory.server.core.shared.DefaultCoreSession;
+import org.apache.directory.server.core.shared.subtree.SubentryUtils;
 import org.apache.directory.server.core.api.CoreSession;
 import org.apache.directory.server.core.api.DirectoryService;
 import org.apache.directory.server.core.api.LdapPrincipal;
@@ -50,6 +51,9 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.interceptor.context.SearchingOperationContext;
 import org.apache.directory.server.core.api.partition.ByPassConstants;
 import org.apache.directory.server.core.api.partition.PartitionNexus;
+import org.apache.directory.server.core.api.subtree.Subentry;
+import org.apache.directory.server.core.api.subtree.SubentryCache;
+import org.apache.directory.server.core.api.subtree.SubtreeEvaluator;
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.shared.ldap.codec.controls.search.subentries.SubentriesDecorator;
 import org.apache.directory.shared.ldap.model.constants.AuthenticationLevel;
@@ -103,18 +107,12 @@ public class SubentryInterceptor extends
     /** The set of Subentry operational attributes */
     public static AttributeType[] SUBENTRY_OPATTRS;
 
-    /** the hash mapping the Dn of a subentry to its SubtreeSpecification/types */
-    private final SubentryCache subentryCache = new SubentryCache();
-
     /** The SubTree specification parser instance */
     private SubtreeSpecificationParser ssParser;
 
-    /** The Subtree evaluator instance */
-    private SubtreeEvaluator evaluator;
-
     /** A reference to the nexus for direct backend operations */
     private PartitionNexus nexus;
-
+    
     /** An enum used for the entries update */
     private enum OperationEnum
     {
@@ -135,7 +133,7 @@ public class SubentryInterceptor extends
         public boolean accept( SearchingOperationContext searchContext, Entry entry ) throws
Exception
         {
             // See if the requested entry is a subentry
-            if ( subentryCache.hasSubentry( entry.getDn() ) )
+            if ( directoryService.getSubentryCache().hasSubentry( entry.getDn() ) )
             {
                 return false;
             }
@@ -155,7 +153,7 @@ public class SubentryInterceptor extends
         public boolean accept( SearchingOperationContext searchContext, Entry entry ) throws
Exception
         {
             // See if the requested entry is a subentry
-            if ( subentryCache.hasSubentry( entry.getDn() ) )
+            if ( directoryService.getSubentryCache().hasSubentry( entry.getDn() ) )
             {
                 return true;
             }
@@ -189,7 +187,6 @@ public class SubentryInterceptor extends
             };
 
         ssParser = new SubtreeSpecificationParser( schemaManager );
-        evaluator = new SubtreeEvaluator( schemaManager );
 
         // prepare to find all subentries in all namingContexts
         Set<String> suffixes = nexus.listSuffixes();
@@ -243,7 +240,7 @@ public class SubentryInterceptor extends
                     newSubentry.setAdministrativeRoles( getSubentryAdminRoles( subentry )
);
                     newSubentry.setSubtreeSpecification( ss );
 
-                    subentryCache.addSubentry( subentryDn, newSubentry );
+                    directoryService.getSubentryCache().addSubentry( subentryDn, newSubentry
);
                 }
             }
             catch ( Exception e )
@@ -355,7 +352,7 @@ public class SubentryInterceptor extends
                 Entry candidate = subentries.get();
                 Dn candidateDn = candidate.getDn();
 
-                if ( evaluator.evaluate( ss, apDn, candidateDn, candidate ) )
+                if ( directoryService.getEvaluator().evaluate( ss, apDn, candidateDn, candidate
) )
                 {
                     List<Modification> modifications = null;
 
@@ -518,6 +515,9 @@ public class SubentryInterceptor extends
          * would be caused by chop exclusions. In this case we must add subentry
          * operational attribute values with the dn of this subentry.
          */
+        SubentryCache subentryCache = directoryService.getSubentryCache();
+        SubtreeEvaluator evaluator = directoryService.getEvaluator();
+        
         for ( Dn subentryDn : subentryCache )
         {
             Dn apDn = subentryDn.getParent();
@@ -774,12 +774,12 @@ public class SubentryInterceptor extends
     {
         List<Modification> modList = new ArrayList<Modification>();
 
-        for ( Dn subentryDn : subentryCache )
+        for ( Dn subentryDn : directoryService.getSubentryCache() )
         {
             Dn apDn = subentryDn.getParent();
-            SubtreeSpecification ss = subentryCache.getSubentry( subentryDn ).getSubtreeSpecification();
-            boolean isOldEntrySelected = evaluator.evaluate( ss, apDn, name, oldEntry );
-            boolean isNewEntrySelected = evaluator.evaluate( ss, apDn, name, newEntry );
+            SubtreeSpecification ss = directoryService.getSubentryCache().getSubentry( subentryDn
).getSubtreeSpecification();
+            boolean isOldEntrySelected = directoryService.getEvaluator().evaluate( ss, apDn,
name, oldEntry );
+            boolean isNewEntrySelected = directoryService.getEvaluator().evaluate( ss, apDn,
name, newEntry );
 
             if ( isOldEntrySelected == isNewEntrySelected )
             {
@@ -890,7 +890,7 @@ public class SubentryInterceptor extends
              * ----------------------------------------------------------------
              */
             setSubtreeSpecification( subentry, entry );
-            subentryCache.addSubentry( dn, subentry );
+            directoryService.getSubentryCache().addSubentry( dn, subentry );
 
             // Now inject the subentry into the backend
             next.add( addContext );
@@ -920,19 +920,19 @@ public class SubentryInterceptor extends
             // We brutally check *all* the subentries, as we don't hold a hierarchy
             // of AP
             // TODO : add a hierarchy of subentries
-            for ( Dn subentryDn : subentryCache )
+            for ( Dn subentryDn : directoryService.getSubentryCache() )
             {
                 Dn apDn = subentryDn.getParent();
 
                 // No need to evaluate the entry if it's not below an AP.
                 if ( dn.isDescendantOf( apDn ) )
                 {
-                    Subentry subentry = subentryCache.getSubentry( subentryDn );
+                    Subentry subentry = directoryService.getSubentryCache().getSubentry(
subentryDn );
                     SubtreeSpecification ss = subentry.getSubtreeSpecification();
 
                     // Now, evaluate the entry wrt the subentry ss
                     // and inject a ref to the subentry if it evaluates to true
-                    if ( evaluator.evaluate( ss, apDn, dn, entry ) )
+                    if ( directoryService.getEvaluator().evaluate( ss, apDn, dn, entry )
)
                     {
 
                         if ( subentry.isAccessControlAdminRole() )
@@ -980,7 +980,7 @@ public class SubentryInterceptor extends
         // We first remove the re
         if ( entry.contains( OBJECT_CLASS_AT, SchemaConstants.SUBENTRY_OC ) )
         {
-            Subentry removedSubentry = subentryCache.getSubentry( dn );
+            Subentry removedSubentry = directoryService.getSubentryCache().getSubentry( dn
);
 
             /* ----------------------------------------------------------------
              * Find the baseDn for the subentry and use that to search the tree
@@ -998,7 +998,7 @@ public class SubentryInterceptor extends
             updateEntries( OperationEnum.REMOVE, deleteContext.getSession(), dn, apDn, removedSubentry.getSubtreeSpecification(),
baseDn, null );
 
             // Update the cache
-            subentryCache.removeSubentry( dn );
+            directoryService.getSubentryCache().removeSubentry( dn );
 
             // Now delete the subentry itself
             next.delete( deleteContext );
@@ -1064,7 +1064,7 @@ public class SubentryInterceptor extends
         // Check if we have a modified subentry attribute in a Subentry entry
         if ( containsSubentryOC && isSubtreeSpecificationModification )
         {
-            Subentry subentry = subentryCache.removeSubentry( dn );
+            Subentry subentry = directoryService.getSubentryCache().removeSubentry( dn );
             SubtreeSpecification ssOld = subentry.getSubtreeSpecification();
             SubtreeSpecification ssNew;
 
@@ -1081,7 +1081,7 @@ public class SubentryInterceptor extends
 
             subentry.setSubtreeSpecification( ssNew );
             subentry.setAdministrativeRoles( getSubentryTypes( entry, modifications ) );
-            subentryCache.addSubentry( dn, subentry );
+            directoryService.getSubentryCache().addSubentry( dn, subentry );
 
             next.modify( modifyContext );
 
@@ -1109,7 +1109,7 @@ public class SubentryInterceptor extends
                     Entry candidate = subentries.get();
                     Dn candidateDn = candidate.getDn();
 
-                    if ( evaluator.evaluate( ssOld, apName, candidateDn, candidate ) )
+                    if ( directoryService.getEvaluator().evaluate( ssOld, apName, candidateDn,
candidate ) )
                     {
                         nexus.modify( new ModifyOperationContext( modifyContext.getSession(),
candidateDn,
                             getOperationalModsForRemove( dn, candidate ) ) );
@@ -1135,7 +1135,7 @@ public class SubentryInterceptor extends
             }
 
             // search for all selected entries by the new SS and add references to subentry
-            subentry = subentryCache.getSubentry( dn );
+            subentry = directoryService.getSubentryCache().getSubentry( dn );
             List<Attribute> operationalAttributes = getSubentryOperationalAttributes(
dn, subentry );
             Dn newBaseDn = apName;
             newBaseDn = newBaseDn.add( ssNew.getBase() );
@@ -1152,7 +1152,7 @@ public class SubentryInterceptor extends
                     Entry candidate = subentries.get();
                     Dn candidateDn = candidate.getDn();
 
-                    if ( evaluator.evaluate( ssNew, apName, candidateDn, candidate ) )
+                    if ( directoryService.getEvaluator().evaluate( ssNew, apName, candidateDn,
candidate ) )
                     {
                         nexus.modify( new ModifyOperationContext( modifyContext.getSession(),
candidateDn,
                             getOperationalModsForAdd( candidate, operationalAttributes )
) );
@@ -1241,7 +1241,7 @@ public class SubentryInterceptor extends
             // the new parent is an AP
             checkAdministrativeRole( moveContext, newSuperiorDn );
 
-            Subentry subentry = subentryCache.removeSubentry( oldDn );
+            Subentry subentry = directoryService.getSubentryCache().removeSubentry( oldDn
);
             SubtreeSpecification ss = subentry.getSubtreeSpecification();
             Dn apName = oldDn.getParent();
             Dn baseDn = apName;
@@ -1250,11 +1250,11 @@ public class SubentryInterceptor extends
             newName = newName.add( oldDn.getRdn() );
             newName.apply( schemaManager );
 
-            subentryCache.addSubentry( newName, subentry );
+            directoryService.getSubentryCache().addSubentry( newName, subentry );
 
             next.move( moveContext );
 
-            subentry = subentryCache.getSubentry( newName );
+            subentry = directoryService.getSubentryCache().getSubentry( newName );
 
             ExprNode filter = new PresenceNode( OBJECT_CLASS_AT );
             SearchControls controls = new SearchControls();
@@ -1277,7 +1277,7 @@ public class SubentryInterceptor extends
                     Dn dn = candidate.getDn();
                     dn.apply( schemaManager );
 
-                    if ( evaluator.evaluate( ss, apName, dn, candidate ) )
+                    if ( directoryService.getEvaluator().evaluate( ss, apName, dn, candidate
) )
                     {
                         nexus.modify( new ModifyOperationContext( moveContext.getSession(),
dn, getOperationalModsForReplace(
                             oldDn, newName, subentry, candidate ) ) );
@@ -1341,7 +1341,7 @@ public class SubentryInterceptor extends
 
         if ( entry.contains( OBJECT_CLASS_AT, SchemaConstants.SUBENTRY_OC ) )
         {
-            Subentry subentry = subentryCache.removeSubentry( oldDn );
+            Subentry subentry = directoryService.getSubentryCache().removeSubentry( oldDn
);
             SubtreeSpecification ss = subentry.getSubtreeSpecification();
             Dn apName = oldDn.getParent();
             Dn baseDn = apName;
@@ -1351,11 +1351,11 @@ public class SubentryInterceptor extends
             newName = newName.add( moveAndRenameContext.getNewRdn() );
             newName.apply( schemaManager );
 
-            subentryCache.addSubentry( newName, subentry );
+            directoryService.getSubentryCache().addSubentry( newName, subentry );
 
             next.moveAndRename( moveAndRenameContext );
 
-            subentry = subentryCache.getSubentry( newName );
+            subentry = directoryService.getSubentryCache().getSubentry( newName );
 
             ExprNode filter = new PresenceNode( OBJECT_CLASS_AT );
             SearchControls controls = new SearchControls();
@@ -1377,7 +1377,7 @@ public class SubentryInterceptor extends
                     Dn dn = candidate.getDn();
                     dn.apply( schemaManager );
 
-                    if ( evaluator.evaluate( ss, apName, dn, candidate ) )
+                    if ( directoryService.getEvaluator().evaluate( ss, apName, dn, candidate
) )
                     {
                         nexus.modify( new ModifyOperationContext( moveAndRenameContext.getSession(),
dn, getOperationalModsForReplace(
                             oldDn, newName, subentry, candidate ) ) );
@@ -1433,7 +1433,7 @@ public class SubentryInterceptor extends
         if ( entry.contains( OBJECT_CLASS_AT, SchemaConstants.SUBENTRY_OC ) )
         {
             // @Todo To be reviewed !!!
-            Subentry subentry = subentryCache.removeSubentry( oldDn );
+            Subentry subentry = directoryService.getSubentryCache().removeSubentry( oldDn
);
             SubtreeSpecification ss = subentry.getSubtreeSpecification();
             Dn apName = oldDn.getParent();
             Dn baseDn = apName;
@@ -1443,10 +1443,10 @@ public class SubentryInterceptor extends
             newName = newName.add( renameContext.getNewRdn() );
             newName.apply( schemaManager );
 
-            subentryCache.addSubentry( newName, subentry );
+            directoryService.getSubentryCache().addSubentry( newName, subentry );
             next.rename( renameContext );
 
-            subentry = subentryCache.getSubentry( newName );
+            subentry = directoryService.getSubentryCache().getSubentry( newName );
             ExprNode filter = new PresenceNode( OBJECT_CLASS_AT );
             SearchControls controls = new SearchControls();
             controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
@@ -1467,7 +1467,7 @@ public class SubentryInterceptor extends
                     Dn dn = candidate.getDn();
                     dn.apply( schemaManager );
 
-                    if ( evaluator.evaluate( ss, apName, dn, candidate ) )
+                    if ( directoryService.getEvaluator().evaluate( ss, apName, dn, candidate
) )
                     {
                         nexus.modify( new ModifyOperationContext( renameContext.getSession(),
dn, getOperationalModsForReplace(
                             oldDn, newName, subentry, candidate ) ) );
@@ -1541,89 +1541,4 @@ public class SubentryInterceptor extends
 
         return cursor;
     }
-
-
-    //-------------------------------------------------------------------------------------------
-    // Shared method
-    //-------------------------------------------------------------------------------------------
-    /**
-     * Evaluates the set of subentry subtrees upon an entry and returns the
-     * operational subentry attributes that will be added to the entry if
-     * added at the dn specified.
-     *
-     * @param dn the normalized distinguished name of the entry
-     * @param entryAttrs the entry attributes are generated for
-     * @return the set of subentry op attrs for an entry
-     * @throws Exception if there are problems accessing entry information
-     */
-    public Entry getSubentryAttributes( Dn dn, Entry entryAttrs ) throws LdapException
-    {
-        Entry subentryAttrs = new DefaultEntry( schemaManager, dn );
-
-        for ( Dn subentryDn : subentryCache )
-        {
-            Dn apDn = subentryDn.getParent();
-            Subentry subentry = subentryCache.getSubentry( subentryDn );
-            SubtreeSpecification ss = subentry.getSubtreeSpecification();
-
-            if ( evaluator.evaluate( ss, apDn, dn, entryAttrs ) )
-            {
-                Attribute operational;
-
-                if ( subentry.isAccessControlAdminRole() )
-                {
-                    operational = subentryAttrs.get( ACCESS_CONTROL_SUBENTRIES_AT );
-
-                    if ( operational == null )
-                    {
-                        operational = new DefaultAttribute( ACCESS_CONTROL_SUBENTRIES_AT
);
-                        subentryAttrs.put( operational );
-                    }
-
-                    operational.add( subentryDn.getNormName() );
-                }
-
-                if ( subentry.isSchemaAdminRole() )
-                {
-                    operational = subentryAttrs.get( SUBSCHEMA_SUBENTRY_AT );
-
-                    if ( operational == null )
-                    {
-                        operational = new DefaultAttribute( SUBSCHEMA_SUBENTRY_AT );
-                        subentryAttrs.put( operational );
-                    }
-
-                    operational.add( subentryDn.getNormName() );
-                }
-
-                if ( subentry.isCollectiveAdminRole() )
-                {
-                    operational = subentryAttrs.get( COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT );
-
-                    if ( operational == null )
-                    {
-                        operational = new DefaultAttribute( COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT
);
-                        subentryAttrs.put( operational );
-                    }
-
-                    operational.add( subentryDn.getNormName() );
-                }
-
-                if ( subentry.isTriggersAdminRole() )
-                {
-                    operational = subentryAttrs.get( TRIGGER_EXECUTION_SUBENTRIES_AT );
-
-                    if ( operational == null )
-                    {
-                        operational = new DefaultAttribute( TRIGGER_EXECUTION_SUBENTRIES_AT
);
-                        subentryAttrs.put( operational );
-                    }
-
-                    operational.add( subentryDn.getNormName() );
-                }
-            }
-        }
-
-        return subentryAttrs;
-    }
 }

Modified: directory/apacheds/trunk/interceptors/subtree/src/test/java/org/apache/directory/server/core/subtree/RefinementEvaluatorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/subtree/src/test/java/org/apache/directory/server/core/subtree/RefinementEvaluatorTest.java?rev=1185134&r1=1185133&r2=1185134&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/subtree/src/test/java/org/apache/directory/server/core/subtree/RefinementEvaluatorTest.java
(original)
+++ directory/apacheds/trunk/interceptors/subtree/src/test/java/org/apache/directory/server/core/subtree/RefinementEvaluatorTest.java
Mon Oct 17 12:51:01 2011
@@ -23,6 +23,8 @@ import static org.junit.Assert.assertFal
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import org.apache.directory.server.core.shared.subtree.RefinementEvaluator;
+import org.apache.directory.server.core.shared.subtree.RefinementLeafEvaluator;
 import org.apache.directory.shared.ldap.model.entry.Attribute;
 import org.apache.directory.shared.ldap.model.entry.DefaultAttribute;
 import org.apache.directory.shared.ldap.model.entry.StringValue;

Modified: directory/apacheds/trunk/interceptors/subtree/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/subtree/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java?rev=1185134&r1=1185133&r2=1185134&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/subtree/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java
(original)
+++ directory/apacheds/trunk/interceptors/subtree/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java
Mon Oct 17 12:51:01 2011
@@ -26,6 +26,8 @@ import static org.junit.Assert.fail;
 
 import com.mycila.junit.concurrent.Concurrency;
 import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+
+import org.apache.directory.server.core.shared.subtree.RefinementLeafEvaluator;
 import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.model.entry.DefaultAttribute;
 import org.apache.directory.shared.ldap.model.entry.Attribute;

Modified: directory/apacheds/trunk/interceptors/subtree/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/subtree/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java?rev=1185134&r1=1185133&r2=1185134&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/subtree/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java
(original)
+++ directory/apacheds/trunk/interceptors/subtree/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java
Mon Oct 17 12:51:01 2011
@@ -33,6 +33,7 @@ import net.sf.ehcache.CacheManager;
 
 import org.apache.directory.server.core.shared.DefaultDnFactory;
 import org.apache.directory.server.core.api.DnFactory;
+import org.apache.directory.server.core.api.subtree.SubtreeEvaluator;
 import org.apache.directory.server.core.shared.normalization.FilterNormalizingVisitor;
 import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
 import org.apache.directory.shared.ldap.model.entry.Entry;

Modified: directory/apacheds/trunk/interceptors/trigger/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/trigger/pom.xml?rev=1185134&r1=1185133&r2=1185134&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/trigger/pom.xml (original)
+++ directory/apacheds/trunk/interceptors/trigger/pom.xml Mon Oct 17 12:51:01 2011
@@ -65,11 +65,6 @@
     </dependency>
     
     <dependency>
-      <groupId>${project.groupId}</groupId>
-      <artifactId>apacheds-interceptors-subtree</artifactId>
-    </dependency>
-    
-    <dependency>
       <groupId>commons-collections</groupId>
       <artifactId>commons-collections</artifactId>
     </dependency>

Modified: directory/apacheds/trunk/interceptors/trigger/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/trigger/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java?rev=1185134&r1=1185133&r2=1185134&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/trigger/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java
(original)
+++ directory/apacheds/trunk/interceptors/trigger/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java
Mon Oct 17 12:51:01 2011
@@ -44,7 +44,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.shared.sp.StoredProcEngineConfig;
 import org.apache.directory.server.core.shared.sp.StoredProcExecutionManager;
 import org.apache.directory.server.core.shared.sp.java.JavaStoredProcEngineConfig;
-import org.apache.directory.server.core.subtree.SubentryInterceptor;
+import org.apache.directory.server.core.shared.subtree.SubentryUtils;
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.model.entry.Attribute;
@@ -96,6 +96,9 @@ public class TriggerInterceptor extends 
 
     private StoredProcExecutionManager manager;
     
+    /** The SubentryUtils instance */
+    private static SubentryUtils subentryUtils;
+
     /**
      * Adds prescriptiveTrigger TriggerSpecificaitons to a collection of
      * TriggerSpeficaitions by accessing the triggerSpecCache.  The trigger
@@ -250,6 +253,9 @@ public class TriggerInterceptor extends 
         manager = new StoredProcExecutionManager( spContainer, spEngineConfigs );
 
         this.enabled = true; // TODO: Get this from the configuration if needed.
+        
+        // Init the SubentryUtils instance
+        subentryUtils = new SubentryUtils( directoryService );
     }
 
 
@@ -442,9 +448,7 @@ public class TriggerInterceptor extends 
         // we need to construct an entry to represent it
         // at least with minimal requirements which are object class
         // and access control subentry operational attributes.
-        SubentryInterceptor subentryInterceptor = ( SubentryInterceptor ) chain.get( SubentryInterceptor.class
-            .getSimpleName() );
-        Entry fakeImportedEntry = subentryInterceptor.getSubentryAttributes(newDn, importedEntry
);
+        Entry fakeImportedEntry = subentryUtils.getSubentryAttributes(newDn, importedEntry
);
 
         for ( Attribute attribute : importedEntry )
         {
@@ -516,9 +520,7 @@ public class TriggerInterceptor extends 
         // we need to construct an entry to represent it
         // at least with minimal requirements which are object class
         // and access control subentry operational attributes.
-        SubentryInterceptor subentryInterceptor = ( SubentryInterceptor ) chain.get( SubentryInterceptor.class
-            .getSimpleName() );
-        Entry fakeImportedEntry = subentryInterceptor.getSubentryAttributes( newDn, importedEntry
);
+        Entry fakeImportedEntry = subentryUtils.getSubentryAttributes( newDn, importedEntry
);
 
         for ( Attribute attribute : importedEntry )
         {



Mime
View raw message