directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r658835 - in /directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core: subtree/SubentryInterceptor.java trigger/TriggerInterceptor.java trigger/TriggerSpecCache.java
Date Wed, 21 May 2008 19:58:06 GMT
Author: elecharny
Date: Wed May 21 12:58:06 2008
New Revision: 658835

URL: http://svn.apache.org/viewvc?rev=658835&view=rev
Log:
fixing issues with Cursor verses NamingEnumeration usage in Interceptors

Modified:
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java?rev=658835&r1=658834&r2=658835&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
Wed May 21 12:58:06 2008
@@ -24,6 +24,7 @@
 
 import org.apache.directory.server.constants.ApacheSchemaConstants;
 import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.cursor.Cursor;
 import org.apache.directory.server.core.entry.DefaultServerAttribute;
 import org.apache.directory.server.core.entry.DefaultServerEntry;
 import org.apache.directory.server.core.entry.ServerAttribute;
@@ -31,7 +32,6 @@
 import org.apache.directory.server.core.entry.ServerModification;
 import org.apache.directory.server.core.entry.ServerSearchResult;
 import org.apache.directory.server.core.enumeration.SearchResultFilter;
-import org.apache.directory.server.core.enumeration.SearchResultFilteringEnumeration;
 import org.apache.directory.server.core.interceptor.NextInterceptor;
 import org.apache.directory.server.core.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
@@ -73,8 +73,6 @@
 import org.slf4j.LoggerFactory;
 
 import javax.naming.Name;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
 import javax.naming.directory.SearchControls;
 import javax.naming.ldap.Control;
 import javax.naming.ldap.LdapContext;
@@ -134,7 +132,7 @@
     private AttributeType objectClassType;
 
 
-    public void init( DirectoryService directoryService ) throws NamingException
+    public void init( DirectoryService directoryService ) throws Exception
     {
         super.init( directoryService );
         nexus = directoryService.getPartitionNexus();
@@ -147,7 +145,7 @@
 
         ssParser = new SubtreeSpecificationParser( new NormalizerMappingResolver()
         {
-            public Map<String, OidNormalizer> getNormalizerMapping() throws NamingException
+            public Map<String, OidNormalizer> getNormalizerMapping() throws Exception
             {
                 return atRegistry.getNormalizerMapping();
             }
@@ -170,15 +168,14 @@
             //suffix = LdapDN.normalize( suffix, registry.getNormalizerMapping() );
             suffix.normalize( atRegistry.getNormalizerMapping() );
 
-            NamingEnumeration<ServerSearchResult> subentries = nexus.search( new SearchOperationContext(
registries,
+            Cursor<ServerEntry> subentries = nexus.search( new SearchOperationContext(
registries,
                 suffix, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
 
-            while ( subentries.hasMore() )
+            while ( subentries.next() )
             {
-                ServerSearchResult result = subentries.next();
-                LdapDN dnName = new LdapDN( result.getDn() );
+                ServerEntry subentry = subentries.get();
+                LdapDN dnName = subentry.getDn();
 
-                ServerEntry subentry = result.getServerEntry();
                 String subtree = subentry.get( SchemaConstants.SUBTREE_SPECIFICATION_AT ).getString();
                 SubtreeSpecification ss;
 
@@ -199,7 +196,7 @@
     }
 
 
-    private int getSubentryTypes( ServerEntry subentry ) throws NamingException
+    private int getSubentryTypes( ServerEntry subentry ) throws Exception
     {
         int types = 0;
 
@@ -239,26 +236,27 @@
     // Methods/Code dealing with Subentry Visibility
     // -----------------------------------------------------------------------
 
-    public NamingEnumeration<ServerSearchResult> list( NextInterceptor nextInterceptor,
ListOperationContext opContext )
-        throws NamingException
+    public Cursor<ServerEntry> list( NextInterceptor nextInterceptor, ListOperationContext
opContext )
+        throws Exception
     {
-        NamingEnumeration<ServerSearchResult> result = nextInterceptor.list( opContext
);
+        Cursor<ServerEntry> result = nextInterceptor.list( opContext );
         Invocation invocation = InvocationStack.getInstance().peek();
 
         if ( !isSubentryVisible( invocation ) )
         {
-            return new SearchResultFilteringEnumeration( result, new SearchControls(), invocation,
-                new HideSubentriesFilter(), "List Subentry filter" );
+            // TODO FixMe
+            //return new SearchResultFilteringEnumeration( result, new SearchControls(),
invocation,
+            //    new HideSubentriesFilter(), "List Subentry filter" );
         }
 
         return result;
     }
 
 
-    public NamingEnumeration<ServerSearchResult> search( NextInterceptor nextInterceptor,
-        SearchOperationContext opContext ) throws NamingException
+    public Cursor<ServerEntry> search( NextInterceptor nextInterceptor,
+        SearchOperationContext opContext ) throws Exception
     {
-        NamingEnumeration<ServerSearchResult> result = nextInterceptor.search( opContext
);
+        Cursor<ServerEntry> result = nextInterceptor.search( opContext );
         Invocation invocation = InvocationStack.getInstance().peek();
         SearchControls searchCtls = opContext.getSearchControls();
 
@@ -271,13 +269,17 @@
         // for subtree and one level scope we filter
         if ( !isSubentryVisible( invocation ) )
         {
-            return new SearchResultFilteringEnumeration( result, searchCtls, invocation,
new HideSubentriesFilter(),
-                "Search Subentry filter hide subentries" );
+            // TODO FixMe
+            //return new SearchResultFilteringEnumeration( result, searchCtls, invocation,
new HideSubentriesFilter(),
+            //    "Search Subentry filter hide subentries" );
+            return null;
         }
         else
         {
-            return new SearchResultFilteringEnumeration( result, searchCtls, invocation,
new HideEntriesFilter(),
-                "Search Subentry filter hide entries" );
+            // TODO FixMe
+            //return new SearchResultFilteringEnumeration( result, searchCtls, invocation,
new HideEntriesFilter(),
+            //    "Search Subentry filter hide entries" );
+            return null;
         }
     }
 
@@ -288,9 +290,9 @@
      *
      * @param invocation the invocation object to use for determining subentry visibility
      * @return true if subentries should be visible, false otherwise
-     * @throws NamingException if there are problems accessing request controls
+     * @throws Exception if there are problems accessing request controls
      */
-    private boolean isSubentryVisible( Invocation invocation ) throws NamingException
+    private boolean isSubentryVisible( Invocation invocation ) throws Exception
     {
         Control[] reqControls = ( ( LdapContext ) invocation.getCaller() ).getRequestControls();
 
@@ -326,9 +328,9 @@
      * @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 NamingException if there are problems accessing entry information
+     * @throws Exception if there are problems accessing entry information
      */
-    public ServerEntry getSubentryAttributes( LdapDN dn, ServerEntry entryAttrs ) throws
NamingException
+    public ServerEntry getSubentryAttributes( LdapDN dn, ServerEntry entryAttrs ) throws
Exception
     {
         ServerEntry subentryAttrs = new DefaultServerEntry( registries, dn );
         Iterator<String> list = subentryCache.nameIterator();
@@ -405,7 +407,7 @@
     }
 
 
-    public void add( NextInterceptor next, AddOperationContext addContext ) throws NamingException
+    public void add( NextInterceptor next, AddOperationContext addContext ) throws Exception
     {
         LdapDN name = addContext.getDn();
         ServerEntry entry = addContext.getEntry();
@@ -483,15 +485,14 @@
             controls.setReturningAttributes( new String[]
                 { SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES
} );
 
-            NamingEnumeration<ServerSearchResult> subentries = nexus.search( new SearchOperationContext(
registries,
+            Cursor<ServerEntry> subentries = nexus.search( new SearchOperationContext(
registries,
                 baseDn, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
 
-            while ( subentries.hasMore() )
+            while ( subentries.next() )
             {
-                ServerSearchResult result = subentries.next();
-                LdapDN dn = result.getDn();
+                ServerEntry candidate = subentries.get();
+                LdapDN dn = candidate.getDn();
                 dn.normalize( atRegistry.getNormalizerMapping() );
-                ServerEntry candidate = result.getServerEntry();
 
                 if ( evaluator.evaluate( ss, apName, dn, candidate ) )
                 {
@@ -588,7 +589,7 @@
     // Methods dealing subentry deletion
     // -----------------------------------------------------------------------
 
-    public void delete( NextInterceptor next, DeleteOperationContext opContext ) throws NamingException
+    public void delete( NextInterceptor next, DeleteOperationContext opContext ) throws Exception
     {
         LdapDN name = opContext.getDn();
         ServerEntry entry = nexus.lookup( new LookupOperationContext( registries, name )
);
@@ -618,15 +619,14 @@
             controls.setReturningAttributes( new String[]
                 { SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES
} );
 
-            NamingEnumeration<ServerSearchResult> subentries = nexus.search( new SearchOperationContext(
registries,
+            Cursor<ServerEntry> subentries = nexus.search( new SearchOperationContext(
registries,
                 baseDn, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
 
-            while ( subentries.hasMore() )
+            while ( subentries.next() )
             {
-                ServerSearchResult result = subentries.next();
-                LdapDN dn = new LdapDN( result.getDn() );
+                ServerEntry candidate = subentries.get();
+                LdapDN dn = new LdapDN( candidate.getDn() );
                 dn.normalize( atRegistry.getNormalizerMapping() );
-                ServerEntry candidate = result.getServerEntry();
 
                 if ( evaluator.evaluate( ss, apName, dn, candidate ) )
                 {
@@ -653,17 +653,17 @@
      * @param name the name of the entry which is used as the search base
      * @return true if name is an administrative point or one of its descendants
      * are, false otherwise
-     * @throws NamingException if there are errors while searching the directory
+     * @throws Exception if there are errors while searching the directory
      */
-    private boolean hasAdministrativeDescendant( LdapDN name ) throws NamingException
+    private boolean hasAdministrativeDescendant( LdapDN name ) throws Exception
     {
         ExprNode filter = new PresenceNode( "administrativeRole" );
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-        NamingEnumeration<ServerSearchResult> aps = nexus.search( new SearchOperationContext(
registries, name,
+        Cursor<ServerEntry> aps = nexus.search( new SearchOperationContext( registries,
name,
             AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
 
-        if ( aps.hasMore() )
+        if ( aps.next() )
         {
             aps.close();
             return true;
@@ -674,7 +674,7 @@
 
 
     private List<Modification> getModsOnEntryRdnChange( Name oldName, Name newName,
ServerEntry entry )
-        throws NamingException
+        throws Exception
     {
         List<Modification> modList = new ArrayList<Modification>();
 
@@ -747,7 +747,7 @@
     }
 
 
-    public void rename( NextInterceptor next, RenameOperationContext opContext ) throws NamingException
+    public void rename( NextInterceptor next, RenameOperationContext opContext ) throws Exception
     {
         LdapDN name = opContext.getDn();
 
@@ -778,16 +778,15 @@
             controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
             controls.setReturningAttributes( new String[]
                 { SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES
} );
-            NamingEnumeration<ServerSearchResult> subentries = nexus.search( new SearchOperationContext(
registries,
+            Cursor<ServerEntry> subentries = nexus.search( new SearchOperationContext(
registries,
                 baseDn, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
 
-            while ( subentries.hasMore() )
+            while ( subentries.next() )
             {
-                ServerSearchResult result = subentries.next();
-                LdapDN dn = result.getDn();
+                ServerEntry candidate = subentries.get();
+                LdapDN dn = candidate.getDn();
                 dn.normalize( atRegistry.getNormalizerMapping() );
 
-                ServerEntry candidate = result.getServerEntry();
 
                 if ( evaluator.evaluate( ss, apName, dn, candidate ) )
                 {
@@ -823,7 +822,7 @@
     }
 
 
-    public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext opContext
) throws NamingException
+    public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext opContext
) throws Exception
     {
         LdapDN oriChildName = opContext.getDn();
         LdapDN parent = opContext.getParent();
@@ -856,15 +855,14 @@
             controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
             controls.setReturningAttributes( new String[]
                 { SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES
} );
-            NamingEnumeration<ServerSearchResult> subentries = nexus.search( new SearchOperationContext(
registries,
+            Cursor<ServerEntry> subentries = nexus.search( new SearchOperationContext(
registries,
                 baseDn, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
 
-            while ( subentries.hasMore() )
+            while ( subentries.next() )
             {
-                ServerSearchResult result = subentries.next();
-                LdapDN dn = result.getDn();
+                ServerEntry candidate = subentries.get();
+                LdapDN dn = candidate.getDn();
                 dn.normalize( atRegistry.getNormalizerMapping() );
-                ServerEntry candidate = result.getServerEntry();
 
                 if ( evaluator.evaluate( ss, apName, dn, candidate ) )
                 {
@@ -899,7 +897,7 @@
     }
 
 
-    public void move( NextInterceptor next, MoveOperationContext opContext ) throws NamingException
+    public void move( NextInterceptor next, MoveOperationContext opContext ) throws Exception
     {
         LdapDN oriChildName = opContext.getDn();
         LdapDN newParentName = opContext.getParent();
@@ -931,15 +929,14 @@
             controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
             controls.setReturningAttributes( new String[]
                 { SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES
} );
-            NamingEnumeration<ServerSearchResult> subentries = nexus.search( new SearchOperationContext(
registries,
+            Cursor<ServerEntry> subentries = nexus.search( new SearchOperationContext(
registries,
                 baseDn, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
 
-            while ( subentries.hasMore() )
+            while ( subentries.next() )
             {
-                ServerSearchResult result = subentries.next();
-                LdapDN dn = result.getDn();
+                ServerEntry candidate = subentries.get();
+                LdapDN dn = candidate.getDn();
                 dn.normalize( atRegistry.getNormalizerMapping() );
-                ServerEntry candidate = result.getServerEntry();
 
                 if ( evaluator.evaluate( ss, apName, dn, candidate ) )
                 {
@@ -977,7 +974,7 @@
     // Methods dealing subentry modification
     // -----------------------------------------------------------------------
 
-    private int getSubentryTypes( ServerEntry entry, List<Modification> mods ) throws
NamingException
+    private int getSubentryTypes( ServerEntry entry, List<Modification> mods ) throws
Exception
     {
         ServerAttribute ocFinalState = ( ServerAttribute ) entry.get( SchemaConstants.OBJECT_CLASS_AT
).clone();
 
@@ -1016,7 +1013,7 @@
     }
 
 
-    public void modify( NextInterceptor next, ModifyOperationContext opContext ) throws NamingException
+    public void modify( NextInterceptor next, ModifyOperationContext opContext ) throws Exception
     {
         LdapDN name = opContext.getDn();
         List<Modification> mods = opContext.getModItems();
@@ -1066,15 +1063,14 @@
             controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
             controls.setReturningAttributes( new String[]
                 { SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES
} );
-            NamingEnumeration<ServerSearchResult> subentries = nexus.search( new SearchOperationContext(
registries,
+            Cursor<ServerEntry> subentries = nexus.search( new SearchOperationContext(
registries,
                 oldBaseDn, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
 
-            while ( subentries.hasMore() )
+            while ( subentries.next() )
             {
-                ServerSearchResult result = subentries.next();
-                LdapDN dn = result.getDn();
+                ServerEntry candidate = subentries.get();
+                LdapDN dn = candidate.getDn();
                 dn.normalize( atRegistry.getNormalizerMapping() );
-                ServerEntry candidate = result.getServerEntry();
 
                 if ( evaluator.evaluate( ssOld, apName, dn, candidate ) )
                 {
@@ -1090,12 +1086,12 @@
             newBaseDn.addAll( ssNew.getBase() );
             subentries = nexus.search( new SearchOperationContext( registries, newBaseDn,
                 AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
-            while ( subentries.hasMore() )
+            
+            while ( subentries.next() )
             {
-                ServerSearchResult result = subentries.next();
-                LdapDN dn = result.getDn();
+                ServerEntry candidate = subentries.get();
+                LdapDN dn = candidate.getDn();
                 dn.normalize( atRegistry.getNormalizerMapping() );
-                ServerEntry candidate = result.getServerEntry();
 
                 if ( evaluator.evaluate( ssNew, apName, dn, candidate ) )
                 {
@@ -1128,7 +1124,7 @@
     // -----------------------------------------------------------------------
 
     private List<Modification> getOperationalModsForReplace( Name oldName, Name newName,
Subentry subentry,
-        ServerEntry entry ) throws NamingException
+        ServerEntry entry ) throws Exception
     {
         List<Modification> modList = new ArrayList<Modification>();
 
@@ -1222,7 +1218,7 @@
      * @param subentry the subentry to get attributes from
      * @return the set of attributes to be added or removed from entries
      */
-    private ServerEntry getSubentryOperatationalAttributes( LdapDN name, Subentry subentry
) throws NamingException
+    private ServerEntry getSubentryOperatationalAttributes( LdapDN name, Subentry subentry
) throws Exception
     {
         ServerEntry operational = new DefaultServerEntry( registries, name );
 
@@ -1289,7 +1285,7 @@
      * a subentry
      */
     private List<Modification> getOperationalModsForRemove( LdapDN subentryDn, ServerEntry
candidate )
-        throws NamingException
+        throws Exception
     {
         List<Modification> modList = new ArrayList<Modification>();
         String dn = subentryDn.toNormName();
@@ -1323,10 +1319,10 @@
      * @param operational the set of operational attributes supported by the AP
      * of the subentry
      * @return the set of modifications needed to update the entry
-     * @throws NamingException if there are probelms accessing modification items
+     * @throws Exception if there are probelms accessing modification items
      */
     public List<Modification> getOperationalModsForAdd( ServerEntry entry, ServerEntry
operational )
-        throws NamingException
+        throws Exception
     {
         List<Modification> modList = new ArrayList<Modification>();
 
@@ -1366,7 +1362,7 @@
     public class HideSubentriesFilter implements SearchResultFilter
     {
         public boolean accept( Invocation invocation, ServerSearchResult result, SearchControls
controls )
-            throws NamingException
+            throws Exception
         {
             String dn = result.getDn().getNormName();
 
@@ -1409,7 +1405,7 @@
     public class HideEntriesFilter implements SearchResultFilter
     {
         public boolean accept( Invocation invocation, ServerSearchResult result, SearchControls
controls )
-            throws NamingException
+            throws Exception
         {
             String dn = result.getDn().getNormName();
 
@@ -1446,7 +1442,7 @@
 
 
     private List<Modification> getModsOnEntryModification( LdapDN name, ServerEntry
oldEntry, ServerEntry newEntry )
-        throws NamingException
+        throws Exception
     {
         List<Modification> modList = new ArrayList<Modification>();
 

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java?rev=658835&r1=658834&r2=658835&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java
Wed May 21 12:58:06 2008
@@ -61,7 +61,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.naming.NamingException;
 import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -117,11 +116,11 @@
      * @param triggerSpecs the collection of trigger specifications to add to
      * @param dn the normalized distinguished name of the entry
      * @param entry the target entry that is considered as the trigger source
-     * @throws NamingException if there are problems accessing attribute values
+     * @throws Exception if there are problems accessing attribute values
      * @param proxy the partition nexus proxy 
      */
     private void addPrescriptiveTriggerSpecs( List<TriggerSpecification> triggerSpecs,
PartitionNexusProxy proxy,
-        LdapDN dn, ServerEntry entry ) throws NamingException
+        LdapDN dn, ServerEntry entry ) throws Exception
     {
         
         /*
@@ -161,9 +160,9 @@
      *
      * @param triggerSpecs the collection of trigger specifications to add to
      * @param entry the target entry that is considered as the trigger source
-     * @throws NamingException if there are problems accessing attribute values
+     * @throws Exception if there are problems accessing attribute values
      */
-    private void addEntryTriggerSpecs( List<TriggerSpecification> triggerSpecs, ServerEntry
entry ) throws NamingException
+    private void addEntryTriggerSpecs( List<TriggerSpecification> triggerSpecs, ServerEntry
entry ) throws Exception
     {
         EntryAttribute entryTrigger = entry.get( ENTRY_TRIGGER_ATTR );
         
@@ -230,7 +229,7 @@
     // Interceptor Overrides
     ////////////////////////////////////////////////////////////////////////////
     
-    public void init( DirectoryService directoryService ) throws NamingException
+    public void init( DirectoryService directoryService ) throws Exception
     {
         super.init( directoryService );
         registries = directoryService.getRegistries();
@@ -240,7 +239,7 @@
         triggerParser = new TriggerSpecificationParser
             ( new NormalizerMappingResolver()
                 {
-                    public Map<String, OidNormalizer> getNormalizerMapping() throws
NamingException
+                    public Map<String, OidNormalizer> getNormalizerMapping() throws
Exception
                     {
                         return attrRegistry.getNormalizerMapping();
                     }
@@ -259,7 +258,7 @@
         this.enabled = true; // TODO: Get this from the configuration if needed.
     }
 
-    public void add( NextInterceptor next, AddOperationContext addContext ) throws NamingException
+    public void add( NextInterceptor next, AddOperationContext addContext ) throws Exception
     {
     	LdapDN name = addContext.getDn();
     	ServerEntry entry = addContext.getEntry();
@@ -295,7 +294,7 @@
         executeTriggers( afterTriggerSpecs, injector, callerRootCtx );
     }
 
-    public void delete( NextInterceptor next, DeleteOperationContext deleteContext ) throws
NamingException
+    public void delete( NextInterceptor next, DeleteOperationContext deleteContext ) throws
Exception
     {
     	LdapDN name = deleteContext.getDn();
     	
@@ -329,7 +328,7 @@
         executeTriggers( afterTriggerSpecs, injector, callerRootCtx );
     }
     
-    public void modify( NextInterceptor next, ModifyOperationContext opContext ) throws NamingException
+    public void modify( NextInterceptor next, ModifyOperationContext opContext ) throws Exception
     {
         // Bypass trigger handling if the service is disabled.
         if ( !enabled )
@@ -364,7 +363,7 @@
     }
     
 
-    public void rename( NextInterceptor next, RenameOperationContext renameContext ) throws
NamingException
+    public void rename( NextInterceptor next, RenameOperationContext renameContext ) throws
Exception
     {
         LdapDN name = renameContext.getDn();
         Rdn newRdn = renameContext.getNewRdn();
@@ -410,7 +409,7 @@
         executeTriggers( afterTriggerSpecs, injector, callerRootCtx );
     }
     
-    public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext moveAndRenameContext
) throws NamingException
+    public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext moveAndRenameContext
) throws Exception
     {
         LdapDN oriChildName = moveAndRenameContext.getDn();
         LdapDN parent = moveAndRenameContext.getParent();
@@ -487,7 +486,7 @@
     }
     
     
-    public void move( NextInterceptor next, MoveOperationContext moveContext ) throws NamingException
+    public void move( NextInterceptor next, MoveOperationContext moveContext ) throws Exception
     {
         // Bypass trigger handling if the service is disabled.
         if ( !enabled )
@@ -566,7 +565,7 @@
     // Utility Methods
     ////////////////////////////////////////////////////////////////////////////
     
-    private Object executeTriggers( List<TriggerSpecification> triggerSpecs, StoredProcedureParameterInjector
injector, ServerLdapContext callerRootCtx ) throws NamingException
+    private Object executeTriggers( List<TriggerSpecification> triggerSpecs, StoredProcedureParameterInjector
injector, ServerLdapContext callerRootCtx ) throws Exception
     {
         Object result = null;
 
@@ -590,7 +589,7 @@
         return result;
     }
 
-    private Object executeTrigger( TriggerSpecification tsec, StoredProcedureParameterInjector
injector, ServerLdapContext callerRootCtx ) throws NamingException
+    private Object executeTrigger( TriggerSpecification tsec, StoredProcedureParameterInjector
injector, ServerLdapContext callerRootCtx ) throws Exception
     {
     	List<Object> returnValues = new ArrayList<Object>();
     	List<SPSpec> spSpecs = tsec.getSPSpecs();
@@ -607,7 +606,7 @@
     }
 
     
-    private Object executeProcedure( ServerLdapContext ctx, String procedure, Object[] values
) throws NamingException
+    private Object executeProcedure( ServerLdapContext ctx, String procedure, Object[] values
) throws Exception
     {
         
         try
@@ -616,7 +615,7 @@
             StoredProcEngine engine = manager.getStoredProcEngineInstance( spUnit );
             return engine.invokeProcedure( ctx, procedure, values );
         }
-        catch ( NamingException e )
+        catch ( Exception e )
         {
             LdapNamingException lne = new LdapNamingException( ResultCodeEnum.OTHER );
             lne.setRootCause( e );

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java?rev=658835&r1=658834&r2=658835&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java
Wed May 21 12:58:06 2008
@@ -22,8 +22,8 @@
 
 import org.apache.directory.server.constants.ApacheSchemaConstants;
 import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.cursor.Cursor;
 import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.core.entry.ServerSearchResult;
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
@@ -45,8 +45,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
 import javax.naming.directory.SearchControls;
 import java.text.ParseException;
 import java.util.ArrayList;
@@ -87,13 +85,13 @@
      * @param directoryService the directory service core
      * @throws NamingException with problems initializing cache
      */
-    public TriggerSpecCache( DirectoryService directoryService ) throws NamingException
+    public TriggerSpecCache( DirectoryService directoryService ) throws Exception
     {
         this.nexus = directoryService.getPartitionNexus();
         final AttributeTypeRegistry registry = directoryService.getRegistries().getAttributeTypeRegistry();
         triggerSpecParser = new TriggerSpecificationParser( new NormalizerMappingResolver()
             {
-                public Map<String, OidNormalizer> getNormalizerMapping() throws NamingException
+                public Map<String, OidNormalizer> getNormalizerMapping() throws Exception
                 {
                     return registry.getNormalizerMapping();
                 }
@@ -102,7 +100,7 @@
     }
 
 
-    private void initialize( Registries registries ) throws NamingException
+    private void initialize( Registries registries ) throws Exception
     {
         // search all naming contexts for trigger subentenries
         // generate TriggerSpecification arrays for each subentry
@@ -117,14 +115,13 @@
                     new ClientStringValue( ApacheSchemaConstants.TRIGGER_EXECUTION_SUBENTRY_OC
) );
             SearchControls ctls = new SearchControls();
             ctls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-            NamingEnumeration<ServerSearchResult> results = 
+            Cursor<ServerEntry> results = 
                 nexus.search( new SearchOperationContext( registries, baseDn, AliasDerefMode.DEREF_ALWAYS,
filter, ctls ) );
             
-            while ( results.hasMore() )
+            while ( results.next() )
             {
-                ServerSearchResult result = results.next();
-                LdapDN subentryDn = result.getDn();
-                ServerEntry resultEntry = result.getServerEntry();
+                ServerEntry resultEntry = results.get();
+                LdapDN subentryDn = resultEntry.getDn();
                 EntryAttribute triggerSpec = resultEntry.get( PRESCRIPTIVE_TRIGGER_ATTR );
                 
                 if ( triggerSpec == null )
@@ -142,7 +139,7 @@
     }
 
 
-    private boolean hasPrescriptiveTrigger( ServerEntry entry ) throws NamingException
+    private boolean hasPrescriptiveTrigger( ServerEntry entry ) throws Exception
     {
         // only do something if the entry contains prescriptiveTrigger
         EntryAttribute triggerSpec = entry.get( PRESCRIPTIVE_TRIGGER_ATTR );
@@ -151,7 +148,7 @@
     }
 
 
-    public void subentryAdded( LdapDN normName, ServerEntry entry ) throws NamingException
+    public void subentryAdded( LdapDN normName, ServerEntry entry ) throws Exception
     {
         // only do something if the entry contains prescriptiveTrigger
         EntryAttribute triggerSpec = entry.get( PRESCRIPTIVE_TRIGGER_ATTR );
@@ -184,7 +181,7 @@
     }
 
 
-    public void subentryDeleted( LdapDN normName, ServerEntry entry ) throws NamingException
+    public void subentryDeleted( LdapDN normName, ServerEntry entry ) throws Exception
     {
         if ( !hasPrescriptiveTrigger( entry ) )
         {
@@ -195,7 +192,7 @@
     }
 
 
-    public void subentryModified( ModifyOperationContext opContext, ServerEntry entry ) throws
NamingException
+    public void subentryModified( ModifyOperationContext opContext, ServerEntry entry ) throws
Exception
     {
         if ( !hasPrescriptiveTrigger( entry ) )
         {



Mime
View raw message