You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2007/10/06 08:48:45 UTC

svn commit: r582462 [5/10] - in /directory: apacheds/branches/bigbang/ apacheds/branches/bigbang/core-unit/src/main/java/org/apache/directory/server/core/unit/ apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/ apacheds...

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java Fri Oct  5 23:48:35 2007
@@ -20,14 +20,14 @@
 package org.apache.directory.server.core.prefs;
 
 
-import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.prefs.AbstractPreferences;
-import java.util.prefs.BackingStoreException;
-import java.util.prefs.Preferences;
+import org.apache.directory.server.constants.ApacheSchemaConstants;
+import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.jndi.CoreContextFactory;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.message.AttributeImpl;
+import org.apache.directory.shared.ldap.message.AttributesImpl;
+import org.apache.directory.shared.ldap.message.ModificationItemImpl;
+import org.apache.directory.shared.ldap.util.PreferencesDictionary;
 
 import javax.naming.Context;
 import javax.naming.NameClassPair;
@@ -39,17 +39,10 @@
 import javax.naming.directory.ModificationItem;
 import javax.naming.ldap.InitialLdapContext;
 import javax.naming.ldap.LdapContext;
-
-import org.apache.directory.server.constants.ApacheSchemaConstants;
-import org.apache.directory.server.core.configuration.MutableStartupConfiguration;
-import org.apache.directory.server.core.configuration.ShutdownConfiguration;
-import org.apache.directory.server.core.jndi.CoreContextFactory;
-
-import org.apache.directory.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.message.AttributeImpl;
-import org.apache.directory.shared.ldap.message.AttributesImpl;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
-import org.apache.directory.shared.ldap.util.PreferencesDictionary;
+import java.util.*;
+import java.util.prefs.AbstractPreferences;
+import java.util.prefs.BackingStoreException;
+import java.util.prefs.Preferences;
 
 
 /**
@@ -80,17 +73,15 @@
 
     /**
      * Creates a preferences object for the system preferences root.
+     * @param service the directory service core
      */
-    public ServerSystemPreferences()
+    public ServerSystemPreferences( DirectoryService service )
     {
         super( null, "" );
-
         super.newNode = false;
 
-        MutableStartupConfiguration cfg = new MutableStartupConfiguration();
-        cfg.setAllowAnonymousAccess( true );
-
-        Hashtable<String, Object> env = new Hashtable<String, Object>( cfg.toJndiEnvironment() );
+        Hashtable<String, Object> env = new Hashtable<String, Object>();
+        env.put( DirectoryService.JNDI_KEY, service );
         env.put( Context.INITIAL_CONTEXT_FACTORY, CoreContextFactory.class.getName() );
         env.put( Context.PROVIDER_URL, PreferencesUtils.SYSPREF_BASE );
 
@@ -105,32 +96,24 @@
     }
 
 
-    public synchronized void close()
+    public synchronized void close() throws NamingException
     {
         if ( this.parent() != null )
         {
             throw new ServerSystemPreferenceException( "Cannot close child preferences." );
         }
 
-        Hashtable<String, Object> env = new Hashtable<String, Object>( new ShutdownConfiguration().toJndiEnvironment() );
-        env.put( Context.INITIAL_CONTEXT_FACTORY, CoreContextFactory.class.getName() );
-        env.put( Context.PROVIDER_URL, PreferencesUtils.SYSPREF_BASE );
-
-        try
-        {
-            ctx = new InitialLdapContext( env, null );
-        }
-        catch ( Exception e )
-        {
-            throw new ServerSystemPreferenceException( "Failed to close.", e );
-        }
+        this.ctx.close();
     }
 
 
     /**
      * Creates a preferences object using a relative name.
+     * 
+     * @param name the name of the preference node to create
+     * @param parent the parent of the preferences node to create
      */
-    public ServerSystemPreferences(ServerSystemPreferences parent, String name)
+    public ServerSystemPreferences( ServerSystemPreferences parent, String name )
     {
         super( parent, name );
         LdapContext parentCtx = parent.getLdapContext();
@@ -189,7 +172,8 @@
      * Sets up a new ServerPreferences node by injecting the required information
      * such as the node name attribute and the objectClass attribute.
      *
-     * @param name the name of the new ServerPreferences node.
+     * @param name the name of the new ServerPreferences node
+     * @throws NamingException if we fail to created the new node
      */
     private void setUpNode( String name ) throws NamingException
     {
@@ -228,7 +212,8 @@
 
         try
         {
-            ctx.modifyAttributes( "", ( ModificationItemImpl[] ) changes.toArray( EMPTY_MODS ) );
+            //noinspection SuspiciousToArrayCall
+            ctx.modifyAttributes( "", changes.toArray( EMPTY_MODS ) );
         }
         catch ( NamingException e )
         {
@@ -271,7 +256,8 @@
 
         try
         {
-            ctx.modifyAttributes( "", ( ModificationItemImpl[] ) changes.toArray( EMPTY_MODS ) );
+            //noinspection SuspiciousToArrayCall
+            ctx.modifyAttributes( "", changes.toArray( EMPTY_MODS ) );
         }
         catch ( NamingException e )
         {
@@ -286,7 +272,7 @@
     protected String[] childrenNamesSpi() throws BackingStoreException
     {
         List<String> children = new ArrayList<String>();
-        NamingEnumeration list = null;
+        NamingEnumeration list;
 
         try
         {
@@ -304,13 +290,13 @@
             throw new BackingStoreException( e );
         }
 
-        return ( String[] ) children.toArray( EMPTY_STRINGS );
+        return children.toArray( EMPTY_STRINGS );
     }
 
 
     protected String[] keysSpi() throws BackingStoreException
     {
-        Attributes attrs = null;
+        Attributes attrs;
         List<String> keys = new ArrayList<String>();
 
         try
@@ -335,7 +321,7 @@
             throw new BackingStoreException( e );
         }
 
-        return ( String[] ) keys.toArray( EMPTY_STRINGS );
+        return keys.toArray( EMPTY_STRINGS );
     }
 
 
@@ -350,12 +336,12 @@
     private void addDelta( ModificationItemImpl mi )
     {
         String key = mi.getAttribute().getID();
-        List<ModificationItem> deltas = null;
+        List<ModificationItem> deltas;
         changes.add( mi );
         
         if ( keyToChange.containsKey( key ) )
         {
-            deltas = ( List<ModificationItem> ) keyToChange.get( key );
+            deltas = keyToChange.get( key );
         }
         else
         {
@@ -369,24 +355,23 @@
 
     protected String getSpi( String key )
     {
-        String value = null;
+        String value;
 
         try
         {
             Attribute attr = ctx.getAttributes( "" ).get( key );
             if ( keyToChange.containsKey( key ) )
             {
-                List mods = ( List ) keyToChange.get( key );
-                for ( int ii = 0; ii < mods.size(); ii++ )
+                List<ModificationItem> mods = keyToChange.get( key );
+                for ( ModificationItem mod : mods )
                 {
-                    ModificationItemImpl mi = ( ModificationItemImpl ) mods.get( ii );
-                    if ( mi.getModificationOp() == DirContext.REMOVE_ATTRIBUTE )
+                    if ( mod.getModificationOp() == DirContext.REMOVE_ATTRIBUTE )
                     {
                         attr = null;
                     }
                     else
                     {
-                        attr = mi.getAttribute();
+                        attr = mod.getAttribute();
                     }
                 }
             }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java Fri Oct  5 23:48:35 2007
@@ -20,25 +20,7 @@
 package org.apache.directory.server.core.referral;
 
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.naming.Context;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.ModificationItem;
-import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
-
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
+import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.authn.AuthenticationService;
 import org.apache.directory.server.core.authz.AuthorizationService;
 import org.apache.directory.server.core.authz.DefaultAuthorizationService;
@@ -48,17 +30,7 @@
 import org.apache.directory.server.core.event.EventService;
 import org.apache.directory.server.core.interceptor.BaseInterceptor;
 import org.apache.directory.server.core.interceptor.NextInterceptor;
-import org.apache.directory.server.core.interceptor.context.AddContextPartitionOperationContext;
-import org.apache.directory.server.core.interceptor.context.AddOperationContext;
-import org.apache.directory.server.core.interceptor.context.CompareOperationContext;
-import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
-import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
-import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
-import org.apache.directory.server.core.interceptor.context.RemoveContextPartitionOperationContext;
-import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
+import org.apache.directory.server.core.interceptor.context.*;
 import org.apache.directory.server.core.invocation.Invocation;
 import org.apache.directory.server.core.invocation.InvocationStack;
 import org.apache.directory.server.core.jndi.ServerLdapContext;
@@ -80,6 +52,7 @@
 import org.apache.directory.shared.ldap.exception.LdapReferralException;
 import org.apache.directory.shared.ldap.filter.EqualityNode;
 import org.apache.directory.shared.ldap.filter.ExprNode;
+import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
@@ -88,10 +61,16 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.naming.Context;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.*;
+import java.util.*;
+
 
 /**
  * An service which is responsible referral handling behavoirs.  It manages 
- * referral handling behavoir when the {@link Context.REFERRAL} is implicitly
+ * referral handling behavoir when the {@link Context#REFERRAL} is implicitly
  * or explicitly set to "ignore", when set to "throw" and when set to "follow". 
  * 
  * @org.apache.xbean.XBean
@@ -101,7 +80,7 @@
  */
 public class ReferralService extends BaseInterceptor
 {
-    private static final Logger log = LoggerFactory.getLogger( ReferralService.class );
+    private static final Logger LOG = LoggerFactory.getLogger( ReferralService.class );
     private static final String IGNORE = "ignore";
     private static final String THROW_FINDING_BASE = "throw-finding-base";
     private static final String THROW = "throw";
@@ -167,7 +146,7 @@
         
         if ( oc == null )
         {
-            log.warn( "could not find objectClass attribute in entry: " + entry );
+            LOG.warn( "could not find objectClass attribute in entry: " + entry );
             return false;
         }
         
@@ -185,7 +164,7 @@
             	{
             		// very unlikely, as we have already checked the entry in SchemaService
             		String message = "An entry with a 'referral' ObjectClass must contains a 'ref' Attribute";
-            		log.error( message );
+            		LOG.error( message );
             		throw new NamingException( message );
             	}
             	
@@ -217,35 +196,35 @@
             					// Let's assume that it's incorrect if we get something
             					// else in the LdapURL
             					String message = "An LDAPURL should not contains a scope";
-            					log.error( message );
+            					LOG.error( message );
             					throw new NamingException( message );
             				}
             				
             				if ( !StringTools.isEmpty( ldapUrl.getFilter() ) )
             				{
             					String message = "An LDAPURL should not contains filters";
-            					log.error( message );
+            					LOG.error( message );
             					throw new NamingException( message );
             				}
             				
             				if ( ( ldapUrl.getAttributes() != null ) && ( ldapUrl.getAttributes().size() != 0 ) )
             				{
             					String message = "An LDAPURL should not contains any description attribute list";
-            					log.error( message );
+            					LOG.error( message );
             					throw new NamingException( message );
             				}
             				
             				if ( ( ldapUrl.getExtensions() != null ) && ( ldapUrl.getExtensions().size() != 0 ) )
             				{
             					String message = "An LDAPURL should not contains any extension";
-            					log.error( message );
+            					LOG.error( message );
             					throw new NamingException( message );
             				}
             				
             				if ( ( ldapUrl.getCriticalExtensions() != null ) && ( ldapUrl.getCriticalExtensions().size() != 0 ) )
             				{
             					String message = "An LDAPURL should not contains any critical extension";
-            					log.error( message );
+            					LOG.error( message );
             					throw new NamingException( message );
             				}
             				
@@ -254,7 +233,7 @@
             				if ( ( dn == null ) || dn.isEmpty() )
             				{
             					String message = "An LDAPURL should contains a non-empty DN";
-            					log.error( message );
+            					LOG.error( message );
             					throw new NamingException( message );
             				}
             			}
@@ -262,13 +241,12 @@
             			{
             				// Either the URL is invalid, or it's not a LDAP URL.
             				// we will just ignore this LdapURL.
-            				continue;
-            			}
+                        }
             		}
             		else
             		{
             			String message = "Invalid referral value, it should be a String";
-            			log.error( message );
+            			LOG.error( message );
             			throw new NamingException( message );
             		}
             	}
@@ -280,12 +258,12 @@
     }
 
 
-    public void init(DirectoryServiceConfiguration dsConfig) throws NamingException
+    public void init( DirectoryService directoryService ) throws NamingException
     {
-        nexus = dsConfig.getPartitionNexus();
-        attrRegistry = dsConfig.getRegistries().getAttributeTypeRegistry();
-        oidRegistry = dsConfig.getRegistries().getOidRegistry();
-        env = dsConfig.getEnvironment();
+        nexus = directoryService.getPartitionNexus();
+        attrRegistry = directoryService.getRegistries().getAttributeTypeRegistry();
+        oidRegistry = directoryService.getRegistries().getOidRegistry();
+        env = directoryService.getEnvironment();
 
         Iterator<String> suffixes = nexus.listSuffixes( null );
         
@@ -323,7 +301,7 @@
             }
             catch ( LdapURLEncodingException e )
             {
-                log.error( "Bad URL (" + val + ") for ref in " + farthest + ".  Reference will be ignored." );
+                LOG.error( "Bad URL (" + val + ") for ref in " + farthest + ".  Reference will be ignored." );
             }
 
             LdapDN urlDn = new LdapDN( ldapUrl.getDn().toNormName() );
@@ -375,9 +353,8 @@
             buf.append( LdapURL.urlEncode( urlDn.getUpName(), false ) );
             list.add( buf.toString() );
         }
-        
-        LdapReferralException lre = new LdapReferralException( list );
-        throw lre;
+
+        throw new LdapReferralException( list );
     }
 
 
@@ -398,8 +375,6 @@
             {
                 lut.referralAdded( name );
             }
-            
-            return;
         }
         else if ( refval.equals( THROW ) )
         {
@@ -766,7 +741,7 @@
     }
 
 
-    private void checkModify( LdapDN name, List<ModificationItem> mods ) throws NamingException
+    private void checkModify( LdapDN name, List<ModificationItemImpl> mods ) throws NamingException
     {
         boolean isTargetReferral = lut.isReferral( name );
 
@@ -774,7 +749,7 @@
         // Check and update lut if we change the objectClass 
         // -------------------------------------------------------------------
 
-        for ( ModificationItem mod:mods )
+        for ( ModificationItem mod : mods )
         {
             if ( mod.getAttribute().getID().equalsIgnoreCase( SchemaConstants.OBJECT_CLASS_AT ) )
             {
@@ -786,35 +761,35 @@
                      * if ADD op where refferal is added to objectClass of a
                      * non-referral entry then we add a new referral to lut
                      */
-                    case ( DirContext.ADD_ATTRIBUTE  ):
+                    case ( DirContext.ADD_ATTRIBUTE ):
                         if ( modsOcHasReferral && !isTargetReferral )
                         {
                             lut.referralAdded( name );
                         }
                     
                         break;
-                        
-                    /* 
-                     * if REMOVE op where refferal is removed from objectClass of a
-                     * referral entry then we remove the referral from lut
-                     */
-                    case ( DirContext.REMOVE_ATTRIBUTE  ):
+
+                        /*
+                        * if REMOVE op where refferal is removed from objectClass of a
+                        * referral entry then we remove the referral from lut
+                        */
+                    case ( DirContext.REMOVE_ATTRIBUTE ):
                         if ( modsOcHasReferral && isTargetReferral )
                         {
                             lut.referralDeleted( name );
                         }
                     
                         break;
-                        
-                    /* 
-                     * if REPLACE op on referral has new set of OC values which does 
-                     * not contain a referral value then we remove the referral from 
-                     * the lut
-                     * 
-                     * if REPLACE op on non-referral has new set of OC values with 
-                     * referral value then we add the new referral to the lut
-                     */
-                    case ( DirContext.REPLACE_ATTRIBUTE  ):
+
+                        /*
+                        * if REPLACE op on referral has new set of OC values which does
+                        * not contain a referral value then we remove the referral from
+                        * the lut
+                        *
+                        * if REPLACE op on non-referral has new set of OC values with
+                        * referral value then we add the new referral to the lut
+                        */
+                    case ( DirContext.REPLACE_ATTRIBUTE ):
                         if ( isTargetReferral && !modsOcHasReferral )
                         {
                             lut.referralDeleted( name );
@@ -825,7 +800,7 @@
                         }
                     
                         break;
-                        
+
                     default:
                         throw new IllegalStateException( "undefined modification operation" );
                 }
@@ -842,7 +817,7 @@
         ServerLdapContext caller = ( ServerLdapContext ) invocation.getCaller();
         String refval = ( String ) caller.getEnvironment().get( Context.REFERRAL );
         LdapDN name = opContext.getDn();
-        List<ModificationItem> mods = opContext.getModItems();
+        List<ModificationItemImpl> mods = opContext.getModItems();
 
         // handle a normal modify without following referrals
         if ( refval == null || refval.equals( IGNORE ) )
@@ -932,7 +907,7 @@
         while ( referrals.hasMore() )
         {   
             SearchResult r = referrals.next();
-            LdapDN referral = null;
+            LdapDN referral;
             LdapDN result = new LdapDN( r.getName() );
             result.normalize( attrRegistry.getNormalizerMapping() );
             
@@ -941,11 +916,7 @@
                 referral = ( LdapDN ) base.clone();
                 referral.addAll( result );
             }
-            else
-            {
-                referral = result;
-            }
-            
+
             // Now, add the referral to the cache
             lut.referralAdded( result );
         }
@@ -957,7 +928,7 @@
         while ( referrals.hasMore() )
         {
             SearchResult r = referrals.next();
-            LdapDN referral = null;
+            LdapDN referral;
             LdapDN result = new LdapDN( r.getName() );
             result.normalize( attrRegistry.getNormalizerMapping() );
 
@@ -966,10 +937,6 @@
                 referral = ( LdapDN ) base.clone();
                 referral.addAll( result );
             }
-            else
-            {
-                referral = result;
-            }
             
             // Now, remove the referral from the cache
             lut.referralDeleted( result );
@@ -1089,7 +1056,7 @@
             }
             catch ( LdapURLEncodingException e )
             {
-                log.error( "Bad URL (" + val + ") for ref in " + base + ".  Reference will be ignored." );
+                LOG.error( "Bad URL (" + val + ") for ref in " + base + ".  Reference will be ignored." );
             }
 
             StringBuilder buf = new StringBuilder();
@@ -1126,9 +1093,8 @@
 
             list.add( buf.toString() );
         }
-        
-        LdapReferralException lre = new LdapReferralException( list );
-        throw lre;
+
+        throw new LdapReferralException( list );
     }
 
 
@@ -1158,7 +1124,7 @@
             }
             catch ( LdapURLEncodingException e )
             {
-                log.error( "Bad URL (" + val + ") for ref in " + farthest + ".  Reference will be ignored." );
+                LOG.error( "Bad URL (" + val + ") for ref in " + farthest + ".  Reference will be ignored." );
             }
 
             LdapDN urlDn = new LdapDN( ldapUrl.getDn().toNormName() );
@@ -1207,9 +1173,8 @@
             
             list.add( buf.toString() );
         }
-        
-        LdapReferralException lre = new LdapReferralException( list );
-        throw lre;
+
+        throw new LdapReferralException( list );
     }
 
     /**

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/AbstractSchemaChangeHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/AbstractSchemaChangeHandler.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/AbstractSchemaChangeHandler.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/AbstractSchemaChangeHandler.java Fri Oct  5 23:48:35 2007
@@ -20,26 +20,25 @@
 package org.apache.directory.server.core.schema;
 
 
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.ModificationItem;
-import javax.naming.directory.SearchResult;
-
 import org.apache.directory.server.constants.MetaSchemaConstants;
 import org.apache.directory.server.schema.bootstrap.Schema;
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.exception.LdapNamingException;
+import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.SchemaObject;
 import org.apache.directory.shared.ldap.util.AttributeUtils;
 
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.SearchResult;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
 
 /**
  * An abstract schema change handler with some reused functionality.
@@ -109,7 +108,7 @@
     }
 
 
-    public final void modify( LdapDN name, List<ModificationItem> mods, Attributes entry, 
+    public final void modify( LdapDN name, List<ModificationItemImpl> mods, Attributes entry,
         Attributes targetEntry, boolean cascade ) throws NamingException
     {
         modify( name, entry, targetEntry, cascade );

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java Fri Oct  5 23:48:35 2007
@@ -20,17 +20,6 @@
 package org.apache.directory.server.core.schema;
 
 
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.ModificationItem;
-
 import org.apache.directory.server.constants.MetaSchemaConstants;
 import org.apache.directory.server.schema.bootstrap.Schema;
 import org.apache.directory.server.schema.registries.Registries;
@@ -38,6 +27,7 @@
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.exception.LdapInvalidNameException;
 import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
+import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
@@ -45,6 +35,16 @@
 import org.apache.directory.shared.ldap.util.AttributeUtils;
 import org.apache.directory.shared.ldap.util.NamespaceTools;
 
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.ModificationItem;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
 
 /**
  * Handles events where entries of objectClass metaSchema are modified.
@@ -124,7 +124,7 @@
      * @param mods the attribute modifications as an ModificationItem arry
      * @param entry the entry after the modifications have been applied
      */
-    public void modify( LdapDN name, List<ModificationItem> mods, Attributes entry, 
+    public void modify( LdapDN name, List<ModificationItemImpl> mods, Attributes entry,
         Attributes targetEntry, boolean cascade ) throws NamingException
     {
         Attribute disabledInEntry = AttributeUtils.getAttribute( entry, disabledAT );

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaChangeHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaChangeHandler.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaChangeHandler.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaChangeHandler.java Fri Oct  5 23:48:35 2007
@@ -20,13 +20,12 @@
 package org.apache.directory.server.core.schema;
 
 
-import java.util.List;
+import org.apache.directory.shared.ldap.message.ModificationItemImpl;
+import org.apache.directory.shared.ldap.name.LdapDN;
 
 import javax.naming.NamingException;
 import javax.naming.directory.Attributes;
-import javax.naming.directory.ModificationItem;
-
-import org.apache.directory.shared.ldap.name.LdapDN;
+import java.util.List;
 
 
 /**
@@ -47,7 +46,7 @@
     void modify( LdapDN name, int modOp, Attributes mods, Attributes entry, Attributes targetEntry, boolean cascaded ) 
         throws NamingException;
     
-    void modify( LdapDN name, List<ModificationItem> mods, Attributes entry, Attributes targetEntry, boolean cascaded ) 
+    void modify( LdapDN name, List<ModificationItemImpl> mods, Attributes entry, Attributes targetEntry, boolean cascaded )
         throws NamingException;
     
     void move( LdapDN oriChildName, LdapDN newParentName, String newRn, boolean deleteOldRn, Attributes entry, 

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java Fri Oct  5 23:48:35 2007
@@ -413,7 +413,7 @@
     }
 
 
-    public void modify( LdapDN name, List<ModificationItem> mods, Attributes entry, Attributes targetEntry, 
+    public void modify( LdapDN name, List<ModificationItemImpl> mods, Attributes entry, Attributes targetEntry,
         boolean doCascadeModify ) throws NamingException
     {
         Attribute oc = AttributeUtils.getAttribute( entry, objectClassAT );
@@ -537,7 +537,7 @@
      * @param subentry the attributes of the subentry
      * @param targetSubentry the target subentry after being modified
      */
-    public void modifySchemaSubentry( LdapDN name, List<ModificationItem> mods, Attributes subentry, 
+    public void modifySchemaSubentry( LdapDN name, List<ModificationItemImpl> mods, Attributes subentry, 
         Attributes targetSubentry, boolean doCascadeModify ) throws NamingException 
     {
         for ( ModificationItem mod : mods )
@@ -913,7 +913,7 @@
         String modifiersName = ctx.getPrincipal().getJndiName().getNormName();
         String modifyTimestamp = DateUtils.getGeneralizedTime();
         
-        List<ModificationItem> mods = new ArrayList<ModificationItem>( 2 );
+        List<ModificationItemImpl> mods = new ArrayList<ModificationItemImpl>( 2 );
         
         mods.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, 
             new AttributeImpl( ApacheSchemaConstants.SCHEMA_MODIFY_TIMESTAMP_AT, modifyTimestamp ) ) );

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java Fri Oct  5 23:48:35 2007
@@ -561,7 +561,7 @@
         dn.normalize( attrRegistry.getNormalizerMapping() );
         Attributes entry = partition.lookup( new LookupOperationContext( dn ) );
         Attribute disabledAttr = AttributeUtils.getAttribute( entry, disabledAttributeType );
-        List<ModificationItem> mods = new ArrayList<ModificationItem>( 3 );
+        List<ModificationItemImpl> mods = new ArrayList<ModificationItemImpl>( 3 );
         
         if ( disabledAttr == null )
         {

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java Fri Oct  5 23:48:35 2007
@@ -19,43 +19,14 @@
  */
 package org.apache.directory.server.core.schema;
 
- 
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.NoPermissionException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.InvalidAttributeValueException;
-import javax.naming.directory.ModificationItem;
-import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
 
 import org.apache.directory.server.constants.ApacheSchemaConstants;
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
+import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.enumeration.SearchResultFilter;
 import org.apache.directory.server.core.enumeration.SearchResultFilteringEnumeration;
 import org.apache.directory.server.core.interceptor.BaseInterceptor;
 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;
-import org.apache.directory.server.core.interceptor.context.ListOperationContext;
-import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
-import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
-import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
+import org.apache.directory.server.core.interceptor.context.*;
 import org.apache.directory.server.core.invocation.Invocation;
 import org.apache.directory.server.core.invocation.InvocationStack;
 import org.apache.directory.server.core.partition.PartitionNexus;
@@ -65,38 +36,15 @@
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.constants.JndiPropertyConstants;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.exception.LdapAttributeInUseException;
-import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeIdentifierException;
-import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeValueException;
-import org.apache.directory.shared.ldap.exception.LdapNameNotFoundException;
-import org.apache.directory.shared.ldap.exception.LdapNoSuchAttributeException;
-import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
+import org.apache.directory.shared.ldap.exception.*;
 import org.apache.directory.shared.ldap.filter.EqualityNode;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.filter.PresenceNode;
 import org.apache.directory.shared.ldap.filter.SimpleNode;
-import org.apache.directory.shared.ldap.message.AttributeImpl;
-import org.apache.directory.shared.ldap.message.AttributesImpl;
-import org.apache.directory.shared.ldap.message.CascadeControl;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
-import org.apache.directory.shared.ldap.message.ResultCodeEnum;
-import org.apache.directory.shared.ldap.message.ServerSearchResult;
+import org.apache.directory.shared.ldap.message.*;
 import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.shared.ldap.schema.AttributeType;
-import org.apache.directory.shared.ldap.schema.DITContentRule;
-import org.apache.directory.shared.ldap.schema.DITStructureRule;
-import org.apache.directory.shared.ldap.schema.MatchingRule;
-import org.apache.directory.shared.ldap.schema.MatchingRuleUse;
-import org.apache.directory.shared.ldap.schema.NameForm;
-import org.apache.directory.shared.ldap.schema.ObjectClass;
-import org.apache.directory.shared.ldap.schema.SchemaUtils;
-import org.apache.directory.shared.ldap.schema.Syntax;
-import org.apache.directory.shared.ldap.schema.UsageEnum;
-import org.apache.directory.shared.ldap.schema.syntax.AcceptAllSyntaxChecker;
-import org.apache.directory.shared.ldap.schema.syntax.ComparatorDescription;
-import org.apache.directory.shared.ldap.schema.syntax.NormalizerDescription;
-import org.apache.directory.shared.ldap.schema.syntax.SyntaxChecker;
-import org.apache.directory.shared.ldap.schema.syntax.SyntaxCheckerDescription;
+import org.apache.directory.shared.ldap.schema.*;
+import org.apache.directory.shared.ldap.schema.syntax.*;
 import org.apache.directory.shared.ldap.util.AttributeUtils;
 import org.apache.directory.shared.ldap.util.EmptyEnumeration;
 import org.apache.directory.shared.ldap.util.SingletonEnumeration;
@@ -104,6 +52,13 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.NoPermissionException;
+import javax.naming.directory.*;
+import java.io.UnsupportedEncodingException;
+import java.util.*;
+
 
 /**
  * An {@link org.apache.directory.server.core.interceptor.Interceptor} that manages and enforces schemas.
@@ -148,11 +103,6 @@
 
     private Set<String> binaries;
 
-    /**
-     * subschemaSubentry attribute's value from Root DSE
-     */
-    private LdapDN subschemaSubentryDn;
-
     /** A normalized form for the SubschemaSubentry DN */
     private String subschemaSubentryDnNorm;
 
@@ -182,23 +132,23 @@
     /**
      * Initialize the Schema Service
      *
-     * @param factoryCfg
-     * @throws NamingException
+     * @param directoryService the directory service core
+     * @throws NamingException if there are problems during initialization
      */
-    public void init(DirectoryServiceConfiguration factoryCfg) throws NamingException
+    public void init( DirectoryService directoryService ) throws NamingException
     {
         if ( IS_DEBUG )
         {
             log.debug( "Initializing SchemaService..." );
         }
 
-        nexus = factoryCfg.getPartitionNexus();
-        registries = factoryCfg.getRegistries();
+        nexus = directoryService.getPartitionNexus();
+        registries = directoryService.getRegistries();
         binaryAttributeFilter = new BinaryAttributeFilter();
         topFilter = new TopFilter();
         filters.add( binaryAttributeFilter );
         filters.add( topFilter );
-        binaries = ( Set<String> ) factoryCfg.getEnvironment().get( BINARY_KEY );
+        binaries = ( Set<String> ) directoryService.getEnvironment().get( BINARY_KEY );
 
         if ( binaries == null )
         {
@@ -210,11 +160,11 @@
         schemaBaseDN = new LdapDN( "ou=schema" );
         schemaBaseDN.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
 
-        schemaManager = factoryCfg.getSchemaManager();
+        schemaManager = directoryService.getSchemaManager();
 
         // stuff for dealing with subentries (garbage for now)
         String subschemaSubentry = ( String ) nexus.getRootDSE( null ).get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get();
-        subschemaSubentryDn = new LdapDN( subschemaSubentry );
+        LdapDN subschemaSubentryDn = new LdapDN( subschemaSubentry );
         subschemaSubentryDn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
         subschemaSubentryDnNorm = subschemaSubentryDn.getNormName();
 
@@ -233,6 +183,10 @@
     /**
      * Compute the MUST attributes for an objectClass. This method gather all the
      * MUST from all the objectClass and its superors.
+     *
+     * @param atSeen ???
+     * @param objectClass the object class to gather MUST attributes for
+     * @throws NamingException if there are problems resolving schema entitites
      */
     private void computeMustAttributes( ObjectClass objectClass, Set<String> atSeen ) throws NamingException
     {
@@ -272,6 +226,10 @@
      * MAY from all the objectClass and its superors.
      *
      * The allowed attributes is also computed, it's the union of MUST and MAY
+     *
+     * @param atSeen ???
+     * @param objectClass the object class to get all the MAY attributes for
+     * @throws NamingException with problems accessing registries
      */
     private void computeMayAttributes( ObjectClass objectClass, Set<String> atSeen ) throws NamingException
     {
@@ -344,10 +302,9 @@
                 }
             }
         }
-
-        return;
     }
 
+
     /**
      * Compute all ObjectClasses superiors, MAY and MUST attributes.
      * @throws NamingException
@@ -540,7 +497,7 @@
                 // We should get the value for the filter.
                 // only 'top' and 'subSchema' are valid values
                 SimpleNode node = ( SimpleNode ) filter;
-                String objectClass = null;
+                String objectClass;
 
                 if ( node.getValue() instanceof String )
                 {
@@ -1261,7 +1218,7 @@
     {
         Attributes entry = null; 
         LdapDN name = opContext.getDn();
-        List<ModificationItem> mods = opContext.getModItems();
+        List<ModificationItemImpl> mods = opContext.getModItems();
 
         // handle operations against the schema subentry in the schema service
         // and never try to look it up in the nexus below
@@ -1782,8 +1739,6 @@
      * Checks to see if an attribute is required by as determined from an entry's
      * set of objectClass attribute values.
      *
-     * @param attrId the attribute to test if required by a set of objectClass values
-     * @param objectClass the objectClass values
      * @return true if the objectClass values require the attribute, false otherwise
      * @throws NamingException if the attribute is not recognized
      */

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java Fri Oct  5 23:48:35 2007
@@ -19,39 +19,16 @@
  */
 package org.apache.directory.server.core.subtree;
 
+import org.apache.directory.server.core.interceptor.BaseInterceptor;
 
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.naming.Name;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.ModificationItem;
-import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
-import javax.naming.ldap.Control;
-import javax.naming.ldap.LdapContext;
 
 import org.apache.directory.server.constants.ApacheSchemaConstants;
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
+import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.enumeration.SearchResultFilter;
 import org.apache.directory.server.core.enumeration.SearchResultFilteringEnumeration;
 import org.apache.directory.server.core.interceptor.BaseInterceptor;
 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;
-import org.apache.directory.server.core.interceptor.context.ListOperationContext;
-import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
-import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
-import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
+import org.apache.directory.server.core.interceptor.context.*;
 import org.apache.directory.server.core.invocation.Invocation;
 import org.apache.directory.server.core.invocation.InvocationStack;
 import org.apache.directory.server.core.partition.PartitionNexus;
@@ -64,11 +41,7 @@
 import org.apache.directory.shared.ldap.filter.EqualityNode;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.filter.PresenceNode;
-import org.apache.directory.shared.ldap.message.AttributeImpl;
-import org.apache.directory.shared.ldap.message.AttributesImpl;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
-import org.apache.directory.shared.ldap.message.ResultCodeEnum;
-import org.apache.directory.shared.ldap.message.SubentriesControl;
+import org.apache.directory.shared.ldap.message.*;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.NormalizerMappingResolver;
@@ -79,6 +52,17 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.naming.Name;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.*;
+import javax.naming.ldap.Control;
+import javax.naming.ldap.LdapContext;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
 
 /**
  * The Subentry interceptor service which is responsible for filtering
@@ -114,12 +98,12 @@
     	SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT 
     	};
 
-    private static final Logger log = LoggerFactory.getLogger( SubentryService.class );
+    private static final Logger LOG = LoggerFactory.getLogger( SubentryService.class );
 
     /** the hash mapping the DN of a subentry to its SubtreeSpecification/types */
     private final SubentryCache subentryCache = new SubentryCache();
     
-    private DirectoryServiceConfiguration factoryCfg;
+    private DirectoryService directoryService;
     private SubtreeSpecificationParser ssParser;
     private SubtreeEvaluator evaluator;
     private PartitionNexus nexus;
@@ -129,13 +113,13 @@
     private AttributeType objectClassType;
 
 
-    public void init(DirectoryServiceConfiguration factoryCfg) throws NamingException
+    public void init( DirectoryService directoryService ) throws NamingException
     {
-        super.init( factoryCfg);
-        this.nexus = factoryCfg.getPartitionNexus();
-        this.factoryCfg = factoryCfg;
-        this.attrRegistry = factoryCfg.getRegistries().getAttributeTypeRegistry();
-        this.oidRegistry = factoryCfg.getRegistries().getOidRegistry();
+        super.init( directoryService );
+        this.nexus = directoryService.getPartitionNexus();
+        this.directoryService = directoryService;
+        this.attrRegistry = directoryService.getRegistries().getAttributeTypeRegistry();
+        this.oidRegistry = directoryService.getRegistries().getOidRegistry();
         
         // setup various attribute type values
         objectClassType = attrRegistry.lookup( oidRegistry.getOid( SchemaConstants.OBJECT_CLASS_AT ) );
@@ -147,7 +131,8 @@
                 return attrRegistry.getNormalizerMapping();
             }
         }, attrRegistry.getNormalizerMapping() );
-        evaluator = new SubtreeEvaluator( factoryCfg.getRegistries().getOidRegistry(), factoryCfg.getRegistries().getAttributeTypeRegistry() );
+        evaluator = new SubtreeEvaluator( directoryService.getRegistries().getOidRegistry(),
+                directoryService.getRegistries().getAttributeTypeRegistry() );
 
         // prepare to find all subentries in all namingContexts
         Iterator<String> suffixes = this.nexus.listSuffixes( null );
@@ -163,7 +148,7 @@
             //suffix = LdapDN.normalize( suffix, registry.getNormalizerMapping() );
             suffix.normalize( attrRegistry.getNormalizerMapping() );
             NamingEnumeration<SearchResult> subentries = nexus.search( 
-                new SearchOperationContext( suffix, factoryCfg.getEnvironment(), filter, controls ) );
+                new SearchOperationContext( suffix, directoryService.getEnvironment(), filter, controls ) );
             
             while ( subentries.hasMore() )
             {
@@ -179,7 +164,7 @@
                 }
                 catch ( Exception e )
                 {
-                    log.warn( "Failed while parsing subtreeSpecification for " + dn );
+                    LOG.warn( "Failed while parsing subtreeSpecification for " + dn );
                     continue;
                 }
 
@@ -274,7 +259,7 @@
      * Checks to see if subentries for the search and list operations should be
      * made visible based on the availability of the search request control
      *
-     * @param invocation
+     * @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
      */
@@ -288,12 +273,12 @@
         }
 
         // check all request controls to see if subentry control is present
-        for ( int ii = 0; ii < reqControls.length; ii++ )
+        for ( Control reqControl : reqControls )
         {
             // found the subentry request control so we return its value
-            if ( reqControls[ii].getID().equals( SUBENTRY_CONTROL ) )
+            if ( reqControl.getID().equals( SUBENTRY_CONTROL ) )
             {
-                SubentriesControl subentriesControl = ( SubentriesControl ) reqControls[ii];
+                SubentriesControl subentriesControl = ( SubentriesControl ) reqControl;
                 return subentriesControl.isVisible();
             }
         }
@@ -434,7 +419,7 @@
             catch ( Exception e )
             {
                 String msg = "Failed while parsing subtreeSpecification for " + name.getUpName();
-                log.warn( msg );
+                LOG.warn( msg );
                 throw new LdapInvalidAttributeValueException( msg, ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
             }
             
@@ -460,7 +445,7 @@
 
             NamingEnumeration<SearchResult> subentries = 
                 nexus.search( 
-                    new SearchOperationContext( baseDn, factoryCfg.getEnvironment(), filter, controls ) );
+                    new SearchOperationContext( baseDn, directoryService.getEnvironment(), filter, controls ) );
 
             while ( subentries.hasMore() )
             {
@@ -587,7 +572,7 @@
 
             NamingEnumeration<SearchResult> subentries = 
                 nexus.search( 
-                    new SearchOperationContext( baseDn, factoryCfg.getEnvironment(), filter, controls ) );
+                    new SearchOperationContext( baseDn, directoryService.getEnvironment(), filter, controls ) );
             
             while ( subentries.hasMore() )
             {
@@ -629,7 +614,7 @@
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
         NamingEnumeration<SearchResult> aps = 
             nexus.search( 
-                new SearchOperationContext( name, factoryCfg.getEnvironment(), filter, controls ) );
+                new SearchOperationContext( name, directoryService.getEnvironment(), filter, controls ) );
 
         if ( aps.hasMore() )
         {
@@ -641,10 +626,10 @@
     }
 
 
-    private List<ModificationItem> getModsOnEntryRdnChange( Name oldName, Name newName, Attributes entry )
+    private List<ModificationItemImpl> getModsOnEntryRdnChange( Name oldName, Name newName, Attributes entry )
         throws NamingException
     {
-        List<ModificationItem> modList = new ArrayList<ModificationItem>();
+        List<ModificationItemImpl> modList = new ArrayList<ModificationItemImpl>();
 
         /*
          * There are two different situations warranting action.  Firt if
@@ -678,10 +663,10 @@
             // need to remove references to the subentry
             if ( isOldNameSelected && !isNewNameSelected )
             {
-                for ( int ii = 0; ii < SUBENTRY_OPATTRS.length; ii++ )
+                for ( String aSUBENTRY_OPATTRS : SUBENTRY_OPATTRS )
                 {
                     int op = DirContext.REPLACE_ATTRIBUTE;
-                    Attribute opAttr = entry.get( SUBENTRY_OPATTRS[ii] );
+                    Attribute opAttr = entry.get( aSUBENTRY_OPATTRS );
                     
                     if ( opAttr != null )
                     {
@@ -700,10 +685,10 @@
             // need to add references to the subentry
             else if ( isNewNameSelected && !isOldNameSelected )
             {
-                for ( int ii = 0; ii < SUBENTRY_OPATTRS.length; ii++ )
+                for ( String aSUBENTRY_OPATTRS : SUBENTRY_OPATTRS )
                 {
                     int op = DirContext.ADD_ATTRIBUTE;
-                    Attribute opAttr = new AttributeImpl( SUBENTRY_OPATTRS[ii] );
+                    Attribute opAttr = new AttributeImpl( aSUBENTRY_OPATTRS );
                     opAttr.add( subentryDn );
                     modList.add( new ModificationItemImpl( op, opAttr ) );
                 }
@@ -749,7 +734,7 @@
             controls.setReturningAttributes( new String[] { SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES } );
             NamingEnumeration<SearchResult> subentries = 
                 nexus.search( 
-                    new SearchOperationContext( baseDn, factoryCfg.getEnvironment(), filter, controls ) );
+                    new SearchOperationContext( baseDn, directoryService.getEnvironment(), filter, controls ) );
             
             while ( subentries.hasMore() )
             {
@@ -769,7 +754,7 @@
             if ( hasAdministrativeDescendant( name ) )
             {
                 String msg = "Will not allow rename operation on entries with administrative descendants.";
-                log.warn( msg );
+                LOG.warn( msg );
                 throw new LdapSchemaViolationException( msg, ResultCodeEnum.NOT_ALLOWED_ON_RDN );
             }
             
@@ -781,7 +766,7 @@
             newName.remove( newName.size() - 1 );
             newName.add( newRdn );
             newName.normalize( attrRegistry.getNormalizerMapping() );
-            List<ModificationItem> mods = getModsOnEntryRdnChange( name, newName, entry );
+            List<ModificationItemImpl> mods = getModsOnEntryRdnChange( name, newName, entry );
 
             if ( mods.size() > 0 )
             {
@@ -796,7 +781,7 @@
     {
         LdapDN oriChildName = opContext.getDn();
         LdapDN parent = opContext.getParent();
-        String newRn = ((RenameOperationContext)opContext).getNewRdn();
+        String newRn = opContext.getNewRdn();
         
         
         Attributes entry = nexus.lookup( new LookupOperationContext( oriChildName ) );
@@ -830,7 +815,7 @@
             controls.setReturningAttributes( new String[] { SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES } );
             NamingEnumeration<SearchResult> subentries = 
                 nexus.search( 
-                    new SearchOperationContext( baseDn, factoryCfg.getEnvironment(), filter, controls ) );
+                    new SearchOperationContext( baseDn, directoryService.getEnvironment(), filter, controls ) );
             
             while ( subentries.hasMore() )
             {
@@ -851,7 +836,7 @@
             if ( hasAdministrativeDescendant( oriChildName ) )
             {
                 String msg = "Will not allow rename operation on entries with administrative descendants.";
-                log.warn( msg );
+                LOG.warn( msg );
                 throw new LdapSchemaViolationException( msg, ResultCodeEnum.NOT_ALLOWED_ON_RDN );
             }
             
@@ -862,7 +847,7 @@
             LdapDN newName = ( LdapDN ) parent.clone();
             newName.add( newRn );
             newName.normalize( attrRegistry.getNormalizerMapping() );
-            List<ModificationItem> mods = getModsOnEntryRdnChange( oriChildName, newName, entry );
+            List<ModificationItemImpl> mods = getModsOnEntryRdnChange( oriChildName, newName, entry );
 
             if ( mods.size() > 0 )
             {
@@ -905,7 +890,7 @@
                 { SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES } );
             NamingEnumeration<SearchResult> subentries = 
                 nexus.search( 
-                    new SearchOperationContext( baseDn, factoryCfg.getEnvironment(), filter, controls ) );
+                    new SearchOperationContext( baseDn, directoryService.getEnvironment(), filter, controls ) );
             
             while ( subentries.hasMore() )
             {
@@ -926,7 +911,7 @@
             if ( hasAdministrativeDescendant( oriChildName ) )
             {
                 String msg = "Will not allow rename operation on entries with administrative descendants.";
-                log.warn( msg );
+                LOG.warn( msg );
                 throw new LdapSchemaViolationException( msg, ResultCodeEnum.NOT_ALLOWED_ON_RDN );
             }
             
@@ -936,7 +921,7 @@
             // attributes contained within this regular entry with name changes
             LdapDN newName = ( LdapDN ) newParentName.clone();
             newName.add( oriChildName.get( oriChildName.size() - 1 ) );
-            List<ModificationItem> mods = getModsOnEntryRdnChange( oriChildName, newName, entry );
+            List<ModificationItemImpl> mods = getModsOnEntryRdnChange( oriChildName, newName, entry );
 
             if ( mods.size() > 0 )
             {
@@ -951,33 +936,30 @@
     // -----------------------------------------------------------------------
 
     
-    private int getSubentryTypes( Attributes entry, List<ModificationItem> mods ) throws NamingException
+    private int getSubentryTypes( Attributes entry, List<ModificationItemImpl> mods ) throws NamingException
     {
         Attribute ocFinalState = ( Attribute ) entry.get( SchemaConstants.OBJECT_CLASS_AT ).clone();
-        
-        for ( ModificationItem mod:mods )
+        for ( ModificationItemImpl mod : mods )
         {
             if ( mod.getAttribute().getID().equalsIgnoreCase( SchemaConstants.OBJECT_CLASS_AT ) )
             {
                 switch ( mod.getModificationOp() )
                 {
-                    case( DirContext.ADD_ATTRIBUTE ):
+                    case ( DirContext.ADD_ATTRIBUTE ):
                         for ( int jj = 0; jj < mod.getAttribute().size(); jj++ )
                         {
                             ocFinalState.add( mod.getAttribute().get( jj ) );
                         }
                     
                         break;
-                        
-                    case( DirContext.REMOVE_ATTRIBUTE ):
+                    case ( DirContext.REMOVE_ATTRIBUTE ):
                         for ( int jj = 0; jj < mod.getAttribute().size(); jj++ )
                         {
                             ocFinalState.remove( mod.getAttribute().get( jj ) );
                         }
                     
                         break;
-                        
-                    case( DirContext.REPLACE_ATTRIBUTE ):
+                    case ( DirContext.REPLACE_ATTRIBUTE ):
                         ocFinalState = mod.getAttribute();
                         break;
                 }
@@ -992,7 +974,7 @@
     public void modify( NextInterceptor next, ModifyOperationContext opContext ) throws NamingException
     {
         LdapDN name = opContext.getDn();
-        List<ModificationItem> mods = opContext.getModItems();
+        List<ModificationItemImpl> mods = opContext.getModItems();
         
         Attributes entry = nexus.lookup( new LookupOperationContext( name ) );
         Attributes oldEntry = (Attributes) entry.clone();
@@ -1000,7 +982,7 @@
         boolean isSubtreeSpecificationModification = false;
         ModificationItem subtreeMod = null;
 
-        for ( ModificationItem mod:mods )
+        for ( ModificationItem mod : mods )
         {
             if ( SchemaConstants.SUBTREE_SPECIFICATION_AT.equalsIgnoreCase( mod.getAttribute().getID() ) )
             {
@@ -1021,7 +1003,7 @@
             catch ( Exception e )
             {
                 String msg = "failed to parse the new subtreeSpecification";
-                log.error( msg, e );
+                LOG.error( msg, e );
                 throw new LdapInvalidAttributeValueException( msg, ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
             }
 
@@ -1040,7 +1022,7 @@
                 { SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES } );
             NamingEnumeration<SearchResult> subentries = 
                 nexus.search( 
-                    new SearchOperationContext( oldBaseDn, factoryCfg.getEnvironment(), filter, controls ) );
+                    new SearchOperationContext( oldBaseDn, directoryService.getEnvironment(), filter, controls ) );
             
             while ( subentries.hasMore() )
             {
@@ -1061,7 +1043,7 @@
             LdapDN newBaseDn = ( LdapDN ) apName.clone();
             newBaseDn.addAll( ssNew.getBase() );
             subentries = nexus.search( 
-                new SearchOperationContext( newBaseDn, factoryCfg.getEnvironment(), filter, controls ) );
+                new SearchOperationContext( newBaseDn, directoryService.getEnvironment(), filter, controls ) );
             while ( subentries.hasMore() )
             {
                 SearchResult result = ( SearchResult ) subentries.next();
@@ -1083,7 +1065,7 @@
             {
 	            Attributes newEntry = nexus.lookup( new LookupOperationContext( name ) );
 	            
-	            List<ModificationItem> subentriesOpAttrMods = getModsOnEntryModification( name, oldEntry, newEntry );
+	            List<ModificationItemImpl> subentriesOpAttrMods = getModsOnEntryModification( name, oldEntry, newEntry );
                 
 	            if ( subentriesOpAttrMods.size() > 0)
 	            {
@@ -1098,10 +1080,10 @@
     // Utility Methods
     // -----------------------------------------------------------------------
 
-    private List<ModificationItem> getOperationalModsForReplace( Name oldName, Name newName, Subentry subentry,
+    private List<ModificationItemImpl> getOperationalModsForReplace( Name oldName, Name newName, Subentry subentry,
         Attributes entry )
     {
-        List<ModificationItem> modList = new ArrayList<ModificationItem>();
+        List<ModificationItemImpl> modList = new ArrayList<ModificationItemImpl>();
         
         Attribute operational;
 
@@ -1186,9 +1168,8 @@
      * an entry selected by a subentry's subtreeSpecification.
      *
      * @param name the normalized distinguished name of the subentry (the value of op attrs)
-     * @param administrativeRole the roles the administrative point participates in
+     * @param subentry the subentry to get attributes from
      * @return the set of attributes to be added or removed from entries
-     * @throws NamingException if there are problems accessing attributes
      */
     private Attributes getSubentryOperatationalAttributes( Name name, Subentry subentry )
     {
@@ -1256,19 +1237,18 @@
      * @return the set of modifications required to remove an entry's reference to
      * a subentry
      */
-    private List<ModificationItem> getOperationalModsForRemove( LdapDN subentryDn, Attributes candidate )
+    private List<ModificationItemImpl> getOperationalModsForRemove( LdapDN subentryDn, Attributes candidate )
     {
-        List<ModificationItem> modList = new ArrayList<ModificationItem>();
+        List<ModificationItemImpl> modList = new ArrayList<ModificationItemImpl>();
         String dn = subentryDn.toNormName();
 
-        for ( int ii = 0; ii < SUBENTRY_OPATTRS.length; ii++ )
+        for ( String opAttrId : SUBENTRY_OPATTRS )
         {
-            String opAttrId = SUBENTRY_OPATTRS[ii];
             Attribute opAttr = candidate.get( opAttrId );
 
             if ( opAttr != null && opAttr.contains( dn ) )
             {
-                Attribute attr = new AttributeImpl( SUBENTRY_OPATTRS[ii] );
+                Attribute attr = new AttributeImpl( opAttrId );
                 attr.add( dn );
                 modList.add( new ModificationItemImpl( DirContext.REMOVE_ATTRIBUTE, attr ) );
             }
@@ -1291,11 +1271,12 @@
      * @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
      */
-    public List<ModificationItem> getOperationalModsForAdd( Attributes entry, Attributes operational )
+    public List<ModificationItemImpl> getOperationalModsForAdd( Attributes entry, Attributes operational )
         throws NamingException
     {
-        List<ModificationItem> modList = new ArrayList<ModificationItem>();
+        List<ModificationItemImpl> modList = new ArrayList<ModificationItemImpl>();
 
         NamingEnumeration<String> opAttrIds = operational.getIDs();
         
@@ -1451,10 +1432,10 @@
     }
     
     
-    private List<ModificationItem> getModsOnEntryModification( LdapDN name, Attributes oldEntry, Attributes newEntry )
+    private List<ModificationItemImpl> getModsOnEntryModification( LdapDN name, Attributes oldEntry, Attributes newEntry )
     throws NamingException
 	{
-	    List<ModificationItem> modList = new ArrayList<ModificationItem>();
+	    List<ModificationItemImpl> modList = new ArrayList<ModificationItemImpl>();
 	
 	    Iterator<String> subentries = subentryCache.nameIterator();
 	    
@@ -1475,34 +1456,34 @@
 	        // need to remove references to the subentry
 	        if ( isOldEntrySelected && !isNewEntrySelected )
 	        {
-	            for ( int ii = 0; ii < SUBENTRY_OPATTRS.length; ii++ )
-	            {
-	                int op = DirContext.REPLACE_ATTRIBUTE;
-	                Attribute opAttr = oldEntry.get( SUBENTRY_OPATTRS[ii] );
-	                if ( opAttr != null )
-	                {
-	                    opAttr = ( Attribute ) opAttr.clone();
-	                    opAttr.remove( subentryDn );
-	
-	                    if ( opAttr.size() < 1 )
-	                    {
-	                        op = DirContext.REMOVE_ATTRIBUTE;
-	                    }
-	
-	                    modList.add( new ModificationItemImpl( op, opAttr ) );
-	                }
-	            }
+                for ( String aSUBENTRY_OPATTRS : SUBENTRY_OPATTRS )
+                {
+                    int op = DirContext.REPLACE_ATTRIBUTE;
+                    Attribute opAttr = oldEntry.get( aSUBENTRY_OPATTRS );
+                    if ( opAttr != null )
+                    {
+                        opAttr = ( Attribute ) opAttr.clone();
+                        opAttr.remove( subentryDn );
+
+                        if ( opAttr.size() < 1 )
+                        {
+                            op = DirContext.REMOVE_ATTRIBUTE;
+                        }
+
+                        modList.add( new ModificationItemImpl( op, opAttr ) );
+                    }
+                }
 	        }
 	        // need to add references to the subentry
 	        else if ( isNewEntrySelected && !isOldEntrySelected )
 	        {
-	            for ( int ii = 0; ii < SUBENTRY_OPATTRS.length; ii++ )
-	            {
-	                int op = DirContext.ADD_ATTRIBUTE;
-	                Attribute opAttr = new AttributeImpl( SUBENTRY_OPATTRS[ii] );
-	                opAttr.add( subentryDn );
-	                modList.add( new ModificationItemImpl( op, opAttr ) );
-	            }
+                for ( String aSUBENTRY_OPATTRS : SUBENTRY_OPATTRS )
+                {
+                    int op = DirContext.ADD_ATTRIBUTE;
+                    Attribute opAttr = new AttributeImpl( aSUBENTRY_OPATTRS );
+                    opAttr.add( subentryDn );
+                    modList.add( new ModificationItemImpl( op, opAttr ) );
+                }
 	        }
 	    }
 	

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java Fri Oct  5 23:48:35 2007
@@ -39,7 +39,7 @@
 public class ModifyStoredProcedureParameterInjector extends AbstractStoredProcedureParameterInjector
 {
     private LdapDN modifiedEntryName;
-    private List<ModificationItem> modifications;
+    private List<ModificationItemImpl> modifications;
     private Attributes oldEntry;
     
     

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerService.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerService.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerService.java Fri Oct  5 23:48:35 2007
@@ -21,30 +21,11 @@
 package org.apache.directory.server.core.trigger;
 
 
-import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
-import org.apache.directory.server.core.configuration.StartupConfiguration;
+import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.interceptor.BaseInterceptor;
 import org.apache.directory.server.core.interceptor.InterceptorChain;
 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;
-import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
-import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
-import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
+import org.apache.directory.server.core.interceptor.context.*;
 import org.apache.directory.server.core.invocation.Invocation;
 import org.apache.directory.server.core.invocation.InvocationStack;
 import org.apache.directory.server.core.jndi.ServerLdapContext;
@@ -63,11 +44,18 @@
 import org.apache.directory.shared.ldap.trigger.ActionTime;
 import org.apache.directory.shared.ldap.trigger.LdapOperation;
 import org.apache.directory.shared.ldap.trigger.TriggerSpecification;
-import org.apache.directory.shared.ldap.trigger.TriggerSpecificationParser;
 import org.apache.directory.shared.ldap.trigger.TriggerSpecification.SPSpec;
+import org.apache.directory.shared.ldap.trigger.TriggerSpecificationParser;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import java.text.ParseException;
+import java.util.*;
+
 
 /**
  * The Trigger Service based on the Trigger Specification.
@@ -80,7 +68,7 @@
 public class TriggerService extends BaseInterceptor
 {
     /** the logger for this class */
-    private static final Logger log = LoggerFactory.getLogger( TriggerService.class );
+    private static final Logger LOG = LoggerFactory.getLogger( TriggerService.class );
     /** the entry trigger attribute string: entryTrigger */
     private static final String ENTRY_TRIGGER_ATTR = "entryTriggerSpecification";
 
@@ -113,6 +101,7 @@
      * @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
+     * @param proxy the partition nexus proxy 
      */
     private void addPrescriptiveTriggerSpecs( List<TriggerSpecification> triggerSpecs, PartitionNexusProxy proxy,
         LdapDN dn, Attributes entry ) throws NamingException
@@ -175,7 +164,7 @@
             catch ( ParseException e )
             {
                 String msg = "failed to parse entryTrigger: " + triggerString;
-                log.error( msg, e );
+                LOG.error( msg, e );
                 throw new LdapNamingException( msg, ResultCodeEnum.OPERATIONS_ERROR );
             }
 
@@ -188,18 +177,17 @@
      * 
      * @NOTE: This method serves as an extion point for new Action Time types.
      * 
-     * @param triggerSpecs
-     * @param ldapOperation
+     * @param triggerSpecs the trigger specifications
+     * @param ldapOperation the ldap operation being performed
+     * @return the set of trigger specs for a trigger action 
      */
     public Map<ActionTime, List<TriggerSpecification>> getActionTimeMappedTriggerSpecsForOperation( List<TriggerSpecification> triggerSpecs, LdapOperation ldapOperation )
     {
         List<TriggerSpecification> afterTriggerSpecs = new ArrayList<TriggerSpecification>();
         Map<ActionTime, List<TriggerSpecification>> triggerSpecMap = new HashMap<ActionTime, List<TriggerSpecification>>();
-        
-        Iterator<TriggerSpecification> it = triggerSpecs.iterator();
-        while ( it.hasNext() )
+
+        for ( TriggerSpecification triggerSpec : triggerSpecs )
         {
-            TriggerSpecification triggerSpec = it.next();
             if ( triggerSpec.getLdapOperation().equals( ldapOperation ) )
             {
                 if ( triggerSpec.getActionTime().equals( ActionTime.AFTER ) )
@@ -208,8 +196,8 @@
                 }
                 else
                 {
-                	
-                }    
+
+                }
             }
         }
         
@@ -222,11 +210,11 @@
     // Interceptor Overrides
     ////////////////////////////////////////////////////////////////////////////
     
-    public void init(DirectoryServiceConfiguration dirServCfg) throws NamingException
+    public void init( DirectoryService directoryService ) throws NamingException
     {
-        super.init( dirServCfg);
-        triggerSpecCache = new TriggerSpecCache( dirServCfg );
-        final AttributeTypeRegistry attrRegistry = dirServCfg.getRegistries().getAttributeTypeRegistry();
+        super.init( directoryService );
+        triggerSpecCache = new TriggerSpecCache( directoryService );
+        final AttributeTypeRegistry attrRegistry = directoryService.getRegistries().getAttributeTypeRegistry();
         triggerParser = new TriggerSpecificationParser
             ( new NormalizerMappingResolver()
                 {
@@ -236,7 +224,7 @@
                     }
                 }
             );
-        chain = dirServCfg.getInterceptorChain();
+        chain = directoryService.getInterceptorChain();
         
         //StoredProcEngineConfig javaxScriptSPEngineConfig = new JavaxStoredProcEngineConfig();
         StoredProcEngineConfig javaSPEngineConfig = new JavaStoredProcEngineConfig();
@@ -555,13 +543,9 @@
     private Object executeTriggers( List<TriggerSpecification> triggerSpecs, StoredProcedureParameterInjector injector, ServerLdapContext callerRootCtx ) throws NamingException
     {
         Object result = null;
-        
-        Iterator<TriggerSpecification> it = triggerSpecs.iterator();
-        
-        while( it.hasNext() )
+
+        for ( TriggerSpecification triggerSpec : triggerSpecs )
         {
-            TriggerSpecification tsec = it.next();
-            
             // TODO: Replace the Authorization Code with a REAL one.
             if ( triggerExecutionAuthorizer.hasPermission() )
             {
@@ -569,7 +553,7 @@
                  * If there is only one Trigger to be executed, this assignment
                  * will make sense (as in INSTEADOF search Triggers).
                  */
-                result = executeTrigger( tsec, injector, callerRootCtx );
+                result = executeTrigger( triggerSpec, injector, callerRootCtx );
             }
         }
         

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=582462&r1=582461&r2=582462&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 Fri Oct  5 23:48:35 2007
@@ -20,26 +20,8 @@
 
 package org.apache.directory.server.core.trigger;
 
-
-import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.ModificationItem;
-import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
-
 import org.apache.directory.server.constants.ApacheSchemaConstants;
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
+import org.apache.directory.server.core.DirectoryService;
 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;
@@ -47,15 +29,21 @@
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.filter.EqualityNode;
 import org.apache.directory.shared.ldap.filter.ExprNode;
+import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.NormalizerMappingResolver;
 import org.apache.directory.shared.ldap.schema.OidNormalizer;
 import org.apache.directory.shared.ldap.trigger.TriggerSpecification;
 import org.apache.directory.shared.ldap.trigger.TriggerSpecificationParser;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.*;
+import java.text.ParseException;
+import java.util.*;
+
 
 /**
  * A cache for Trigger Specifications which responds to specific events to
@@ -71,7 +59,7 @@
     private static final String PRESCRIPTIVE_TRIGGER_ATTR = "prescriptiveTriggerSpecification";
 
     /** the logger for this class */
-    private static final Logger log = LoggerFactory.getLogger( TriggerSpecCache.class );
+    private static final Logger LOG = LoggerFactory.getLogger( TriggerSpecCache.class );
 
     /** a map of strings to TriggerSpecification collections */
     private final Map<String, List<TriggerSpecification>> triggerSpecs = new HashMap<String, List<TriggerSpecification>>();
@@ -84,12 +72,13 @@
     /**
      * Creates a TriggerSpecification cache.
      *
-     * @param dirServCfg the context factory configuration for the server
+     * @param directoryService the directory service core
+     * @throws NamingException with problems initializing cache
      */
-    public TriggerSpecCache( DirectoryServiceConfiguration dirServCfg ) throws NamingException
+    public TriggerSpecCache( DirectoryService directoryService ) throws NamingException
     {
-        this.nexus = dirServCfg.getPartitionNexus();
-        final AttributeTypeRegistry registry = dirServCfg.getRegistries().getAttributeTypeRegistry();
+        this.nexus = directoryService.getPartitionNexus();
+        final AttributeTypeRegistry registry = directoryService.getRegistries().getAttributeTypeRegistry();
         triggerSpecParser = new TriggerSpecificationParser( new NormalizerMappingResolver()
             {
                 public Map<String, OidNormalizer> getNormalizerMapping() throws NamingException
@@ -97,9 +86,8 @@
                     return registry.getNormalizerMapping();
                 }
             });
-        
-        Hashtable<String, Object> env = ( Hashtable<String, Object> ) dirServCfg.getEnvironment().clone();
-        initialize(registry, env);
+        Hashtable env = ( Hashtable ) directoryService.getEnvironment().clone();
+        initialize( registry, env );
     }
 
 
@@ -129,7 +117,7 @@
                 
                 if ( triggerSpec == null )
                 {
-                    log.warn( "Found triggerExecutionSubentry '" + subentryDn + "' without any " + PRESCRIPTIVE_TRIGGER_ATTR );
+                    LOG.warn( "Found triggerExecutionSubentry '" + subentryDn + "' without any " + PRESCRIPTIVE_TRIGGER_ATTR );
                     continue;
                 }
 
@@ -146,13 +134,9 @@
     private boolean hasPrescriptiveTrigger( Attributes entry )
     {
         // only do something if the entry contains prescriptiveTrigger
-        Attribute triggerSpec = entry.get( PRESCRIPTIVE_TRIGGER_ATTR );       
-        
-        if ( triggerSpec == null )
-        {
-            return false;
-        }
-        return true;
+        Attribute triggerSpec = entry.get( PRESCRIPTIVE_TRIGGER_ATTR );
+
+        return triggerSpec != null;
     }
 
 
@@ -180,7 +164,7 @@
             catch ( ParseException e )
             {
                 String msg = "TriggerSpecification parser failure on '" + item + "'. Cannnot add Trigger Specificaitons to TriggerSpecCache.";
-                log.error( msg, e );
+                LOG.error( msg, e );
             }
             
         }
@@ -208,11 +192,11 @@
         }
 
         LdapDN normName = opContext.getDn();
-        List<ModificationItem> mods = opContext.getModItems();
+        List<ModificationItemImpl> mods = opContext.getModItems();
 
         boolean isTriggerSpecModified = false;
-        
-        for ( ModificationItem mod:mods )
+
+        for ( ModificationItemImpl mod : mods )
         {
             isTriggerSpecModified |= mod.getAttribute().contains( PRESCRIPTIVE_TRIGGER_ATTR );
         }