directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r582462 [6/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...
Date Sat, 06 Oct 2007 06:48:45 GMT
Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java (original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java Fri Oct  5 23:48:35 2007
@@ -20,37 +20,31 @@
 package org.apache.directory.server.core.authz.support;
 
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.NoSuchElementException;
-import java.util.Set;
-
-import javax.naming.NamingException;
-import javax.naming.Context;
-import javax.naming.NamingEnumeration;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.SearchResult;
-
 import junit.framework.Assert;
 import junit.framework.TestCase;
-
 import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
-import org.apache.directory.server.core.DirectoryServiceListener;
+import org.apache.directory.server.core.schema.SchemaManager;
+import org.apache.directory.server.core.interceptor.Interceptor;
+import org.apache.directory.server.core.interceptor.InterceptorChain;
 import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
 import org.apache.directory.server.core.jndi.DeadContext;
+import org.apache.directory.server.core.partition.Partition;
 import org.apache.directory.server.core.partition.PartitionNexusProxy;
-import org.apache.directory.shared.ldap.aci.ACITuple;
-import org.apache.directory.shared.ldap.aci.AuthenticationLevel;
-import org.apache.directory.shared.ldap.aci.MicroOperation;
-import org.apache.directory.shared.ldap.aci.ProtectedItem;
-import org.apache.directory.shared.ldap.aci.UserClass;
+import org.apache.directory.server.core.partition.PartitionNexus;
+import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.shared.ldap.aci.*;
+import org.apache.directory.shared.ldap.ldif.Entry;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
+import javax.naming.Context;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.SearchResult;
+import java.io.File;
+import java.util.*;
+
 
 /**
  * Tests {@link MaxImmSubFilter}.
@@ -170,33 +164,87 @@
         public NamingEnumeration<SearchResult> search( SearchOperationContext opContext )
             throws NamingException
         {
+            //noinspection unchecked
             return new BogusEnumeration( count );
         }
 
 
         public NamingEnumeration<SearchResult> search( SearchOperationContext opContext, Collection bypass ) throws NamingException
         {
+            //noinspection unchecked
             return new BogusEnumeration( count );
         }
     }
 
     class MockDirectoryService extends DirectoryService
     {
-        public void startup( DirectoryServiceListener listener, Hashtable environment ) throws NamingException
+        public Hashtable<String, Object> getEnvironment()
+        {
+            return null;
+        }
+
+
+        public void setEnvironment( Hashtable<String, Object> environment )
+        {
+        }
+
+
+        public PartitionNexus getPartitionNexus()
+        {
+            return null;
+        }
+
+
+        public InterceptorChain getInterceptorChain()
+        {
+            return null;
+        }
+
+
+        public void addPartition( Partition partition ) throws NamingException
+        {
+        }
+
+
+        public void removePartition( Partition partition ) throws NamingException
+        {
+        }
+
+
+        public Registries getRegistries()
+        {
+            return null;
+        }
+
+
+        public void setRegistries( Registries registries )
+        {
+        }
+
+
+        public SchemaManager getSchemaManager()
+        {
+            return null;
+        }
+
+
+        public void setSchemaManager( SchemaManager schemaManager )
+        {
+        }
+
+
+        public void startup() throws NamingException
         {
-            //To change body of implemented methods use File | Settings | File Templates.
         }
 
 
         public void shutdown() throws NamingException
         {
-            //To change body of implemented methods use File | Settings | File Templates.
         }
 
 
         public void sync() throws NamingException
         {
-            //To change body of implemented methods use File | Settings | File Templates.
         }
 
 
@@ -206,22 +254,179 @@
         }
 
 
-        public DirectoryServiceConfiguration getConfiguration()
+        public DirectoryService getDirectoryService()
         {
-            return null; //To change body of implemented methods use File | Settings | File Templates.
+            return null;
         }
 
 
         public Context getJndiContext( String baseName ) throws NamingException
         {
-            return null; //To change body of implemented methods use File | Settings | File Templates.
+            return null;
         }
 
 
         public Context getJndiContext( LdapDN principalDn, String principal, byte[] credential, 
             String authentication, String baseName ) throws NamingException
         {
-            return null; //To change body of implemented methods use File | Settings | File Templates.
+            return null;
+        }
+
+
+        public void setInstanceId( String instanceId )
+        {
+
+        }
+
+
+        public String getInstanceId()
+        {
+            return null;
+        }
+
+
+        public Set<? extends Partition> getPartitions()
+        {
+            return null;
+        }
+
+
+        public void setPartitions( Set<? extends Partition> partitions )
+        {
+        }
+
+
+        public boolean isAccessControlEnabled()
+        {
+            return false;
+        }
+
+
+        public void setAccessControlEnabled( boolean accessControlEnabled )
+        {
+        }
+
+
+        public boolean isAllowAnonymousAccess()
+        {
+            return false;
+        }
+
+
+        public void setAllowAnonymousAccess( boolean enableAnonymousAccess )
+        {
+
+        }
+
+
+        public List<Interceptor> getInterceptors()
+        {
+            return null;
+        }
+
+
+        public void setInterceptors( List<Interceptor> interceptors )
+        {
+
+        }
+
+
+        public List<Entry> getTestEntries()
+        {
+            return null;
+        }
+
+
+        public void setTestEntries( List<? extends Entry> testEntries )
+        {
+        }
+
+
+        public File getWorkingDirectory()
+        {
+            return null;
+        }
+
+
+        public void setWorkingDirectory( File workingDirectory )
+        {
+        }
+
+
+        public void validate()
+        {
+        }
+
+
+        public void setShutdownHookEnabled( boolean shutdownHookEnabled )
+        {
+
+        }
+
+
+        public boolean isShutdownHookEnabled()
+        {
+            return false;
+        }
+
+
+        public void setExitVmOnShutdown( boolean exitVmOnShutdown )
+        {
+
+        }
+
+
+        public boolean isExitVmOnShutdown()
+        {
+            return false;
+        }
+
+
+        public void setMaxSizeLimit( int maxSizeLimit )
+        {
+
+        }
+
+
+        public int getMaxSizeLimit()
+        {
+            return 0;
+        }
+
+
+        public void setMaxTimeLimit( int maxTimeLimit )
+        {
+
+        }
+
+
+        public int getMaxTimeLimit()
+        {
+            return 0;
+        }
+
+
+        public void setSystemPartition( Partition systemPartition )
+        {
+
+        }
+
+
+        public Partition getSystemPartition()
+        {
+            return null;
+        }
+
+
+        public boolean isDenormalizeOpAttrsEnabled()
+        {
+            return false;
+        }
+
+
+        public void setDenormalizeOpAttrsEnabled( boolean denormalizeOpAttrsEnabled )
+        {
+
         }
     }
 

Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java (original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java Fri Oct  5 23:48:35 2007
@@ -20,27 +20,25 @@
 package org.apache.directory.server.core.interceptor;
 
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Set;
-
-import javax.naming.Context;
-import javax.naming.NamingException;
-
 import junit.framework.TestCase;
 import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
-import org.apache.directory.server.core.DirectoryServiceListener;
+import org.apache.directory.server.core.schema.SchemaManager;
 import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
 import org.apache.directory.server.core.invocation.Invocation;
 import org.apache.directory.server.core.invocation.InvocationStack;
 import org.apache.directory.server.core.jndi.DeadContext;
+import org.apache.directory.server.core.partition.Partition;
 import org.apache.directory.server.core.partition.PartitionNexusProxy;
+import org.apache.directory.server.core.partition.PartitionNexus;
+import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.shared.ldap.ldif.Entry;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
+import javax.naming.Context;
+import javax.naming.NamingException;
+import java.io.File;
+import java.util.*;
+
 
 /**
  * Unit test cases for InterceptorChain methods which test bypass 
@@ -243,46 +241,246 @@
     
     class MockDirectoryService extends DirectoryService
     {
-        public void startup( DirectoryServiceListener listener, Hashtable environment ) throws NamingException
+        public Hashtable<String, Object> getEnvironment()
+        {
+            return null;
+        }
+
+
+        public void setEnvironment( Hashtable<String, Object> environment )
+        {
+        }
+
+
+        public PartitionNexus getPartitionNexus()
+        {
+            return null;
+        }
+
+
+        public InterceptorChain getInterceptorChain()
+        {
+            return null;
+        }
+
+
+        public void addPartition( Partition partition ) throws NamingException
+        {
+        }
+
+
+        public void removePartition( Partition partition ) throws NamingException
+        {
+        }
+
+
+        public Registries getRegistries()
+        {
+            return null;
+        }
+
+
+        public void setRegistries( Registries registries )
+        {
+        }
+
+
+        public SchemaManager getSchemaManager()
+        {
+            return null;
+        }
+
+
+        public void setSchemaManager( SchemaManager schemaManager )
+        {
+        }
+
+
+        public void startup() throws NamingException
         {
-            //To change body of implemented methods use File | Settings | File Templates.
         }
 
 
         public void shutdown() throws NamingException
         {
-            //To change body of implemented methods use File | Settings | File Templates.
         }
 
 
         public void sync() throws NamingException
         {
-            //To change body of implemented methods use File | Settings | File Templates.
         }
 
 
         public boolean isStarted()
         {
-            return false; //To change body of implemented methods use File | Settings | File Templates.
+            return false;
         }
 
 
-        public DirectoryServiceConfiguration getConfiguration()
+        public DirectoryService getDirectoryService()
         {
-            return null; //To change body of implemented methods use File | Settings | File Templates.
+            return null;
         }
 
 
         public Context getJndiContext( String baseName ) throws NamingException
         {
-            return null; //To change body of implemented methods use File | Settings | File Templates.
+            return null;
         }
 
 
         public Context getJndiContext( LdapDN principalDn, String principal, byte[] credential, 
             String authentication, String baseName ) throws NamingException
         {
-            return null; //To change body of implemented methods use File | Settings | File Templates.
+            return null;
+        }
+
+
+        public void setInstanceId( String instanceId )
+        {
+        }
+
+
+        public String getInstanceId()
+        {
+            return null;
+        }
+
+
+        public Set<? extends Partition> getPartitions()
+        {
+            return null;
+        }
+
+
+        public void setPartitions( Set<? extends Partition> partitions )
+        {
+        }
+
+
+        public boolean isAccessControlEnabled()
+        {
+            return false;
+        }
+
+
+        public void setAccessControlEnabled( boolean accessControlEnabled )
+        {
+        }
+
+
+        public boolean isAllowAnonymousAccess()
+        {
+            return false;
+        }
+
+
+        public void setAllowAnonymousAccess( boolean enableAnonymousAccess )
+        {
+        }
+
+
+        public List<Interceptor> getInterceptors()
+        {
+            return null;
+        }
+
+
+        public void setInterceptors( List<Interceptor> interceptors )
+        {
+        }
+
+
+        public List<Entry> getTestEntries()
+        {
+            return null;
+        }
+
+
+        public void setTestEntries( List<? extends Entry> testEntries )
+        {
+        }
+
+
+        public File getWorkingDirectory()
+        {
+            return null;
+        }
+
+
+        public void setWorkingDirectory( File workingDirectory )
+        {
+        }
+
+
+        public void validate()
+        {
+        }
+
+
+        public void setShutdownHookEnabled( boolean shutdownHookEnabled )
+        {
+        }
+
+
+        public boolean isShutdownHookEnabled()
+        {
+            return false;
+        }
+
+
+        public void setExitVmOnShutdown( boolean exitVmOnShutdown )
+        {
+        }
+
+
+        public boolean isExitVmOnShutdown()
+        {
+            return false;
+        }
+
+
+        public void setMaxSizeLimit( int maxSizeLimit )
+        {
+        }
+
+
+        public int getMaxSizeLimit()
+        {
+            return 0;
+        }
+
+
+        public void setMaxTimeLimit( int maxTimeLimit )
+        {
+        }
+
+
+        public int getMaxTimeLimit()
+        {
+            return 0;
+        }
+
+
+        public void setSystemPartition( Partition systemPartition )
+        {
+        }
+
+
+        public Partition getSystemPartition()
+        {
+            return null;
+        }
+
+
+        public boolean isDenormalizeOpAttrsEnabled()
+        {
+            return false;
+        }
+
+
+        public void setDenormalizeOpAttrsEnabled( boolean denormalizeOpAttrsEnabled )
+        {
         }
     }
 }

Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/interceptor/MockInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/interceptor/MockInterceptor.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/interceptor/MockInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/interceptor/MockInterceptor.java Fri Oct  5 23:48:35 2007
@@ -20,35 +20,15 @@
 package org.apache.directory.server.core.interceptor;
 
 
-import java.util.Iterator;
+import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.interceptor.context.*;
+import org.apache.directory.shared.ldap.name.LdapDN;
 
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.directory.Attributes;
 import javax.naming.directory.SearchResult;
-
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
-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.BindOperationContext;
-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.EntryOperationContext;
-import org.apache.directory.server.core.interceptor.context.GetMatchedNameOperationContext;
-import org.apache.directory.server.core.interceptor.context.GetRootDSEOperationContext;
-import org.apache.directory.server.core.interceptor.context.GetSuffixOperationContext;
-import org.apache.directory.server.core.interceptor.context.ListOperationContext;
-import org.apache.directory.server.core.interceptor.context.ListSuffixOperationContext;
-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.OperationContext;
-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.UnbindOperationContext;
-import org.apache.directory.shared.ldap.name.LdapDN;
+import java.util.Iterator;
 
 
 public class MockInterceptor implements Interceptor
@@ -75,7 +55,7 @@
     }
 
 
-    public void init(DirectoryServiceConfiguration factoryCfg)
+    public void init( DirectoryService directoryService )
         throws NamingException
     {
     }

Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java (original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java Fri Oct  5 23:48:35 2007
@@ -21,13 +21,8 @@
 
 
 import junit.framework.TestCase;
+import org.apache.directory.server.core.DefaultDirectoryService;
 import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
-import org.apache.directory.server.core.DirectoryServiceListener;
-import org.apache.directory.server.core.configuration.MutableStartupConfiguration;
-import org.apache.directory.server.core.configuration.StartupConfiguration;
-import org.apache.directory.server.core.interceptor.InterceptorChain;
-import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.server.core.partition.impl.btree.Index;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
@@ -43,10 +38,7 @@
 import javax.naming.directory.Attributes;
 import java.io.File;
 import java.io.IOException;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 
 
 /**
@@ -58,8 +50,7 @@
 public class PartitionSchemaLoaderTest extends TestCase
 {
     private Registries registries;
-    private MutableStartupConfiguration startupConfiguration = new MutableStartupConfiguration();
-    private DirectoryServiceConfiguration configuration;
+    private DirectoryService directoryService;
     private JdbmPartition schemaPartition;
 
 
@@ -68,12 +59,13 @@
         super.setUp();
 
         // setup working directory
+        directoryService = new DefaultDirectoryService();
         File workingDirectory = new File( System.getProperty( "workingDirectory", System.getProperty( "user.dir" ) ) );
         if ( ! workingDirectory.exists() )
         {
             workingDirectory.mkdirs();
         }
-        startupConfiguration.setWorkingDirectory( workingDirectory );
+        directoryService.setWorkingDirectory( workingDirectory );
         
         // --------------------------------------------------------------------
         // Load the bootstrap schemas to start up the schema partition
@@ -82,6 +74,7 @@
         // setup temporary loader and temp registry 
         BootstrapSchemaLoader loader = new BootstrapSchemaLoader();
         registries = new DefaultRegistries( "bootstrap", loader, new DefaultOidRegistry() );
+        directoryService.setRegistries( registries );
         
         // load essential bootstrap schemas 
         Set<Schema> bootstrapSchemas = new HashSet<Schema>();
@@ -101,8 +94,7 @@
         }
 
         SerializableComparator.setRegistry( registries.getComparatorRegistry() );
-        configuration = new TestConfiguration( registries, startupConfiguration );
-        
+
         // --------------------------------------------------------------------
         // If not present extract schema partition from jar
         // --------------------------------------------------------------------
@@ -110,7 +102,7 @@
         SchemaPartitionExtractor extractor = null; 
         try
         {
-            extractor = new SchemaPartitionExtractor( startupConfiguration.getWorkingDirectory() );
+            extractor = new SchemaPartitionExtractor( directoryService.getWorkingDirectory() );
             extractor.extract();
         }
         catch ( IOException e )
@@ -142,7 +134,7 @@
         entry.get( "objectClass" ).add( "organizationalUnit" );
         entry.put( "ou", "schema" );
         schemaPartition.setContextEntry( entry );
-        schemaPartition.init( configuration );
+        schemaPartition.init( directoryService );
     }
     
     
@@ -285,69 +277,5 @@
         assertTrue( schemaNames.contains( "inetorgperson" ) );
         assertTrue( schemaNames.contains( "system" ) );
         assertTrue( schemaNames.contains( "apachemeta" ) );
-    }
-    
-    
-    class TestConfiguration implements DirectoryServiceConfiguration
-    {
-        Registries registries;
-        StartupConfiguration startupConfiguration;
-        
-        
-        public TestConfiguration( Registries registries, StartupConfiguration startupConfiguration )
-        {
-            this.registries = registries;
-            this.startupConfiguration = startupConfiguration;
-        }
-        
-        public Hashtable getEnvironment()
-        {
-            return new Hashtable();
-        }
-
-        public String getInstanceId()
-        {
-            return "default";
-        }
-
-        public InterceptorChain getInterceptorChain()
-        {
-            return null;
-        }
-
-        public PartitionNexus getPartitionNexus()
-        {
-            return null;
-        }
-
-        public Registries getRegistries()
-        {
-            return registries;
-        }
-
-        public DirectoryService getService()
-        {
-            return null;
-        }
-
-        public DirectoryServiceListener getServiceListener()
-        {
-            return null;
-        }
-
-        public StartupConfiguration getStartupConfiguration()
-        {
-            return startupConfiguration;
-        }
-
-        public boolean isFirstStart()
-        {
-            return false;
-        }
-
-        public SchemaManager getSchemaManager()
-        {
-            return null;
-        }
     }
 }

Propchange: directory/apacheds/branches/bigbang/interceptor-kerberos/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Oct  5 23:48:35 2007
@@ -0,0 +1,16 @@
+target
+.clover
+.wtpmodules
+.settings
+.deployables
+apache.org
+.metadata
+*.md5
+*.log
+*.iml
+*.ipr
+*.iws
+.project
+.classpath
+nbproject
+schema

Added: directory/apacheds/branches/bigbang/interceptor-kerberos/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/interceptor-kerberos/pom.xml?rev=582462&view=auto
==============================================================================
--- directory/apacheds/branches/bigbang/interceptor-kerberos/pom.xml (added)
+++ directory/apacheds/branches/bigbang/interceptor-kerberos/pom.xml Fri Oct  5 23:48:35 2007
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<!-- $Rev:  $ $Date:  $ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.directory.server</groupId>
+    <artifactId>apacheds-parent</artifactId>
+    <version>1.5.2-SNAPSHOT</version>
+  </parent>
+  <artifactId>apacheds-interceptor-kerberos</artifactId>
+  <name>ApacheDS Interceptors for Kerberos</name>
+  <packaging>jar</packaging>
+
+  <description>
+    Interceptors used by the ApacheDS kerberos service.
+  </description>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-io</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-core</artifactId>
+      <version>${pom.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-bootstrap-partition</artifactId>
+      <version>${pom.version}</version>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-kerberos-shared</artifactId>
+      <version>${pom.version}</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration> 
+          <systemProperties>
+            <property>
+              <name>workingDirectory</name>
+              <value>${basedir}/target/server-work</value>
+            </property>
+          </systemProperties>
+        </configuration>
+      </plugin>
+    </plugins>
+
+    <resources>
+      <resource>
+        <directory>src/main/resources</directory>
+        <filtering>true</filtering>
+        <excludes>
+          <exclude>**/*.gif</exclude>
+        </excludes>
+      </resource>
+    </resources>
+  </build>
+</project>
+

Copied: directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationService.java (from r581137, directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationService.java)
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationService.java?p2=directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationService.java&p1=directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationService.java&r1=581137&r2=582462&rev=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationService.java (original)
+++ directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationService.java Fri Oct  5 23:48:35 2007
@@ -21,10 +21,12 @@
 
 
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
@@ -32,8 +34,8 @@
 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.core.configuration.StartupConfiguration;
 import org.apache.directory.server.core.interceptor.BaseInterceptor;
 import org.apache.directory.server.core.interceptor.Interceptor;
 import org.apache.directory.server.core.interceptor.NextInterceptor;
@@ -215,30 +217,32 @@
     void detectPasswordModification( ModifyOperationContext modContext, ModifySubContext subContext )
         throws NamingException
     {
-        ModificationItemImpl[] mods = modContext.getModItems();
+        List<ModificationItemImpl> mods = modContext.getModItems();
 
         String operation = null;
 
         // Loop over attributes being modified to pick out 'userPassword' and 'krb5PrincipalName'.
-        for ( int ii = 0; ii < mods.length; ii++ )
+        for ( ModificationItem mod:mods )
         {
             if ( log.isDebugEnabled() )
             {
-                switch ( mods[ii].getModificationOp() )
+                switch ( mod.getModificationOp() )
                 {
                     case DirContext.ADD_ATTRIBUTE:
                         operation = "Adding";
                         break;
+                        
                     case DirContext.REMOVE_ATTRIBUTE:
                         operation = "Removing";
                         break;
+                        
                     case DirContext.REPLACE_ATTRIBUTE:
                         operation = "Replacing";
                         break;
                 }
             }
 
-            Attribute attr = mods[ii].getAttribute();
+            Attribute attr = mod.getAttribute();
             String attrId = attr.getID();
 
             if ( attrId.equalsIgnoreCase( "userPassword" ) )
@@ -352,7 +356,7 @@
      */
     void deriveKeys( ModifyOperationContext modContext, ModifySubContext subContext )
     {
-        ModificationItemImpl[] mods = modContext.getModItems();
+        List<ModificationItemImpl> mods = modContext.getModItems();
 
         String principalName = subContext.getPrincipalName();
         String userPassword = subContext.getUserPassword();
@@ -362,12 +366,12 @@
 
         Map<EncryptionType, EncryptionKey> keys = generateKeys( principalName, userPassword );
 
-        Set<ModificationItemImpl> newModsList = new HashSet<ModificationItemImpl>();
+        List<ModificationItemImpl> newModsList = new ArrayList<ModificationItemImpl>();
 
         // Make sure we preserve any other modification items.
-        for ( int ii = 0; ii < mods.length; ii++ )
+        for ( ModificationItemImpl mod:mods )
         {
-            newModsList.add( mods[ii] );
+            newModsList.add( mod );
         }
 
         // Add our modification items.
@@ -377,9 +381,7 @@
             KerberosAttribute.VERSION, Integer.toString( kvno ) ) ) );
         newModsList.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, getKeyAttribute( keys ) ) );
 
-        ModificationItemImpl[] newMods = newModsList.toArray( mods );
-
-        modContext.setModItems( newMods );
+        modContext.setModItems( newModsList );
     }
 
 

Copied: directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyService.java (from r581137, directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyService.java)
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyService.java?p2=directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyService.java&p1=directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyService.java&r1=581137&r2=582462&rev=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyService.java (original)
+++ directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyService.java Fri Oct  5 23:48:35 2007
@@ -20,14 +20,6 @@
 package org.apache.directory.server.core.kerberos;
 
 
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.DirContext;
-
 import org.apache.directory.server.core.interceptor.BaseInterceptor;
 import org.apache.directory.server.core.interceptor.Interceptor;
 import org.apache.directory.server.core.interceptor.NextInterceptor;
@@ -41,6 +33,14 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+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.ArrayList;
+import java.util.List;
+
 
 /**
  * An {@link Interceptor} that enforces password policy for users.  Add or modify operations
@@ -126,11 +126,11 @@
     {
         LdapDN name = modContext.getDn();
 
-        ModificationItemImpl[] mods = modContext.getModItems();
+        List<ModificationItemImpl> mods = modContext.getModItems();
 
         String operation = null;
 
-        for ( ModificationItemImpl mod:mods )
+        for ( ModificationItem mod:mods )
         {
             if ( log.isDebugEnabled() )
             {

Modified: directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java (original)
+++ directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java Fri Oct  5 23:48:35 2007
@@ -24,7 +24,6 @@
 import jdbm.helper.MRU;
 import jdbm.recman.BaseRecordManager;
 import jdbm.recman.CacheRecordManager;
-
 import org.apache.directory.server.core.partition.Oid;
 import org.apache.directory.server.core.partition.impl.btree.*;
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
@@ -35,12 +34,12 @@
 import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
 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.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.util.AttributeUtils;
 import org.apache.directory.shared.ldap.util.NamespaceTools;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -50,7 +49,6 @@
 import javax.naming.directory.Attributes;
 import javax.naming.directory.DirContext;
 import javax.naming.directory.ModificationItem;
-
 import java.io.File;
 import java.io.IOException;
 import java.util.*;
@@ -1515,7 +1513,7 @@
     }
 
 
-    public void modify( LdapDN dn, List<ModificationItem> mods ) throws NamingException
+    public void modify( LdapDN dn, List<ModificationItemImpl> mods ) throws NamingException
     {
         Long id = getEntryId( dn.toString() );
         Attributes entry = master.get( id );

Modified: directory/apacheds/branches/bigbang/kerberos-shared/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/pom.xml?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/pom.xml (original)
+++ directory/apacheds/branches/bigbang/kerberos-shared/pom.xml Fri Oct  5 23:48:35 2007
@@ -40,6 +40,12 @@
 
     <dependency>
       <groupId>org.apache.directory.server</groupId>
+      <artifactId>apacheds-core</artifactId>
+      <version>${pom.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.directory.server</groupId>
       <artifactId>apacheds-protocol-shared</artifactId>
       <version>${pom.version}</version>
     </dependency>

Modified: directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/JndiPrincipalStoreImpl.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/JndiPrincipalStoreImpl.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/JndiPrincipalStoreImpl.java (original)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/JndiPrincipalStoreImpl.java Fri Oct  5 23:48:35 2007
@@ -20,11 +20,11 @@
 package org.apache.directory.server.kerberos.shared.store;
 
 
-import javax.naming.spi.InitialContextFactory;
-import javax.security.auth.kerberos.KerberosPrincipal;
-
+import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.protocol.shared.ServiceConfiguration;
 
+import javax.security.auth.kerberos.KerberosPrincipal;
+
 
 /**
  * A JNDI-backed implementation of the PrincipalStore interface.  This PrincipalStore uses
@@ -40,8 +40,8 @@
 {
     /** a handle on the configuration */
     private ServiceConfiguration config;
-    /** a handle on the provider factory */
-    private InitialContextFactory factory;
+    /** a handle on the core */
+    private DirectoryService directoryService;
     /** a handle on the search strategy */
     private PrincipalStore store;
 
@@ -49,14 +49,13 @@
     /**
      * Creates a new instance of JndiPrincipalStoreImpl.
      *
-     * @param config
-     * @param factory
+     * @param config the configuration
+     * @param directoryService the core service
      */
-    public JndiPrincipalStoreImpl( ServiceConfiguration config, InitialContextFactory factory )
+    public JndiPrincipalStoreImpl( ServiceConfiguration config, DirectoryService directoryService )
     {
         this.config = config;
-        this.factory = factory;
-
+        this.directoryService = directoryService;
         store = getStore();
     }
 
@@ -96,10 +95,10 @@
         if ( config.getCatalogBaseDn() != null )
         {
             // build a catalog from the backing store
-            return new MultiBaseSearch( config, factory );
+            return new MultiBaseSearch( config, directoryService );
         }
 
         // search only the configured entry baseDN
-        return new SingleBaseSearch( config, factory );
+        return new SingleBaseSearch( config, directoryService );
     }
 }

Modified: directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/MultiBaseSearch.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/MultiBaseSearch.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/MultiBaseSearch.java (original)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/MultiBaseSearch.java Fri Oct  5 23:48:35 2007
@@ -21,26 +21,22 @@
 package org.apache.directory.server.kerberos.shared.store;
 
 
-import java.util.Hashtable;
-import java.util.Map;
-
-import javax.naming.Context;
-import javax.naming.NamingException;
-import javax.naming.directory.DirContext;
-import javax.naming.spi.InitialContextFactory;
-import javax.security.auth.kerberos.KerberosPrincipal;
-
-import org.apache.directory.server.kerberos.shared.store.operations.AddPrincipal;
-import org.apache.directory.server.kerberos.shared.store.operations.ChangePassword;
-import org.apache.directory.server.kerberos.shared.store.operations.DeletePrincipal;
-import org.apache.directory.server.kerberos.shared.store.operations.GetAllPrincipals;
-import org.apache.directory.server.kerberos.shared.store.operations.GetPrincipal;
+import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.kerberos.shared.store.operations.*;
 import org.apache.directory.server.protocol.shared.ServiceConfiguration;
 import org.apache.directory.server.protocol.shared.ServiceConfigurationException;
 import org.apache.directory.server.protocol.shared.catalog.Catalog;
 import org.apache.directory.server.protocol.shared.catalog.GetCatalog;
 import org.apache.directory.server.protocol.shared.store.ContextOperation;
 
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.InitialDirContext;
+import javax.security.auth.kerberos.KerberosPrincipal;
+import java.util.Hashtable;
+import java.util.Map;
+
 
 /**
  * A JNDI-backed search strategy implementation.  This search strategy builds a
@@ -52,27 +48,24 @@
  */
 class MultiBaseSearch implements PrincipalStore
 {
-    private InitialContextFactory factory;
     private Hashtable<String, Object> env = new Hashtable<String, Object>();
-
     private Catalog catalog;
 
 
-    MultiBaseSearch( ServiceConfiguration config, InitialContextFactory factory )
+    MultiBaseSearch( ServiceConfiguration config, DirectoryService directoryService )
     {
-        this.factory = factory;
-
         env.put( Context.INITIAL_CONTEXT_FACTORY, config.getInitialContextFactory() );
         env.put( Context.PROVIDER_URL, config.getCatalogBaseDn() );
+        env.put( DirectoryService.JNDI_KEY, directoryService );
 
         try
         {
-            DirContext ctx = ( DirContext ) factory.getInitialContext( env );
+            DirContext ctx = new InitialDirContext( env );
             catalog = new KerberosCatalog( ( Map ) execute( ctx, new GetCatalog() ) );
         }
         catch ( Exception e )
         {
-            String message = "Failed to get catalog context " + ( String ) env.get( Context.PROVIDER_URL );
+            String message = "Failed to get catalog context " + env.get( Context.PROVIDER_URL );
             throw new ServiceConfigurationException( message, e );
         }
     }
@@ -80,16 +73,18 @@
 
     public String addPrincipal( PrincipalStoreEntry entry ) throws Exception
     {
-        env.put( Context.PROVIDER_URL, catalog.getBaseDn( entry.getRealmName() ) );
+        Hashtable<String, Object> cloned = new Hashtable<String, Object>();
+        cloned.putAll( env );
+        cloned.put( Context.PROVIDER_URL, catalog.getBaseDn( entry.getRealmName() ) );
 
         try
         {
-            DirContext ctx = ( DirContext ) factory.getInitialContext( env );
+            DirContext ctx = new InitialDirContext( cloned );
             return ( String ) execute( ctx, new AddPrincipal( entry ) );
         }
         catch ( NamingException ne )
         {
-            String message = "Failed to get initial context " + ( String ) env.get( Context.PROVIDER_URL );
+            String message = "Failed to get initial context " + env.get( Context.PROVIDER_URL );
             throw new ServiceConfigurationException( message, ne );
         }
     }
@@ -97,16 +92,18 @@
 
     public String deletePrincipal( KerberosPrincipal principal ) throws Exception
     {
-        env.put( Context.PROVIDER_URL, catalog.getBaseDn( principal.getRealm() ) );
+        Hashtable<String, Object> cloned = new Hashtable<String, Object>();
+        cloned.putAll( env );
+        cloned.put( Context.PROVIDER_URL, catalog.getBaseDn( principal.getRealm() ) );
 
         try
         {
-            DirContext ctx = ( DirContext ) factory.getInitialContext( env );
+            DirContext ctx = new InitialDirContext( cloned );
             return ( String ) execute( ctx, new DeletePrincipal( principal ) );
         }
         catch ( NamingException ne )
         {
-            String message = "Failed to get initial context " + ( String ) env.get( Context.PROVIDER_URL );
+            String message = "Failed to get initial context " + env.get( Context.PROVIDER_URL );
             throw new ServiceConfigurationException( message, ne );
         }
     }
@@ -114,16 +111,18 @@
 
     public PrincipalStoreEntry[] getAllPrincipals( String realm ) throws Exception
     {
-        env.put( Context.PROVIDER_URL, catalog.getBaseDn( realm ) );
+        Hashtable<String, Object> cloned = new Hashtable<String, Object>();
+        cloned.putAll( env );
+        cloned.put( Context.PROVIDER_URL, catalog.getBaseDn( realm ) );
 
         try
         {
-            DirContext ctx = ( DirContext ) factory.getInitialContext( env );
+            DirContext ctx = new InitialDirContext( cloned );
             return ( PrincipalStoreEntry[] ) execute( ctx, new GetAllPrincipals() );
         }
         catch ( NamingException ne )
         {
-            String message = "Failed to get initial context " + ( String ) env.get( Context.PROVIDER_URL );
+            String message = "Failed to get initial context " + env.get( Context.PROVIDER_URL );
             throw new ServiceConfigurationException( message, ne );
         }
     }
@@ -131,16 +130,18 @@
 
     public PrincipalStoreEntry getPrincipal( KerberosPrincipal principal ) throws Exception
     {
-        env.put( Context.PROVIDER_URL, catalog.getBaseDn( principal.getRealm() ) );
+        Hashtable<String, Object> cloned = new Hashtable<String, Object>();
+        cloned.putAll( env );
+        cloned.put( Context.PROVIDER_URL, catalog.getBaseDn( principal.getRealm() ) );
 
         try
         {
-            DirContext ctx = ( DirContext ) factory.getInitialContext( env );
+            DirContext ctx = new InitialDirContext( cloned );
             return ( PrincipalStoreEntry ) execute( ctx, new GetPrincipal( principal ) );
         }
         catch ( NamingException ne )
         {
-            String message = "Failed to get initial context " + ( String ) env.get( Context.PROVIDER_URL );
+            String message = "Failed to get initial context " + env.get( Context.PROVIDER_URL );
             throw new ServiceConfigurationException( message, ne );
         }
     }
@@ -148,16 +149,18 @@
 
     public String changePassword( KerberosPrincipal principal, String newPassword ) throws Exception
     {
-        env.put( Context.PROVIDER_URL, catalog.getBaseDn( principal.getRealm() ) );
+        Hashtable<String, Object> cloned = new Hashtable<String, Object>();
+        cloned.putAll( env );
+        cloned.put( Context.PROVIDER_URL, catalog.getBaseDn( principal.getRealm() ) );
 
         try
         {
-            DirContext ctx = ( DirContext ) factory.getInitialContext( env );
+            DirContext ctx = new InitialDirContext( cloned );
             return ( String ) execute( ctx, new ChangePassword( principal, newPassword ) );
         }
         catch ( NamingException ne )
         {
-            String message = "Failed to get initial context " + ( String ) env.get( Context.PROVIDER_URL );
+            String message = "Failed to get initial context " + env.get( Context.PROVIDER_URL );
             throw new ServiceConfigurationException( message, ne );
         }
     }

Modified: directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/SingleBaseSearch.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/SingleBaseSearch.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/SingleBaseSearch.java (original)
+++ directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/SingleBaseSearch.java Fri Oct  5 23:48:35 2007
@@ -21,22 +21,18 @@
 package org.apache.directory.server.kerberos.shared.store;
 
 
-import java.util.Hashtable;
+import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.kerberos.shared.store.operations.*;
+import org.apache.directory.server.protocol.shared.ServiceConfiguration;
+import org.apache.directory.server.protocol.shared.ServiceConfigurationException;
+import org.apache.directory.server.protocol.shared.store.ContextOperation;
 
 import javax.naming.Context;
 import javax.naming.NamingException;
 import javax.naming.directory.DirContext;
-import javax.naming.spi.InitialContextFactory;
+import javax.naming.directory.InitialDirContext;
 import javax.security.auth.kerberos.KerberosPrincipal;
-
-import org.apache.directory.server.kerberos.shared.store.operations.AddPrincipal;
-import org.apache.directory.server.kerberos.shared.store.operations.ChangePassword;
-import org.apache.directory.server.kerberos.shared.store.operations.DeletePrincipal;
-import org.apache.directory.server.kerberos.shared.store.operations.GetAllPrincipals;
-import org.apache.directory.server.kerberos.shared.store.operations.GetPrincipal;
-import org.apache.directory.server.protocol.shared.ServiceConfiguration;
-import org.apache.directory.server.protocol.shared.ServiceConfigurationException;
-import org.apache.directory.server.protocol.shared.store.ContextOperation;
+import java.util.Hashtable;
 
 
 /**
@@ -50,18 +46,17 @@
 {
     private DirContext ctx;
     private Hashtable<String, Object> env = new Hashtable<String, Object>();
-    private InitialContextFactory factory;
 
 
-    SingleBaseSearch( ServiceConfiguration config, InitialContextFactory factory )
+    SingleBaseSearch( ServiceConfiguration config, DirectoryService directoryService )
     {
         env.put( Context.INITIAL_CONTEXT_FACTORY, config.getInitialContextFactory() );
         env.put( Context.PROVIDER_URL, config.getSearchBaseDn() );
         env.put( Context.SECURITY_AUTHENTICATION, config.getSecurityAuthentication() );
         env.put( Context.SECURITY_CREDENTIALS, config.getSecurityCredentials() );
         env.put( Context.SECURITY_PRINCIPAL, config.getSecurityPrincipal() );
+        env.put( DirectoryService.JNDI_KEY, directoryService );
 
-        this.factory = factory;
     }
 
 
@@ -101,11 +96,11 @@
         {
             try
             {
-                ctx = ( DirContext ) factory.getInitialContext( env );
+                ctx = new InitialDirContext( env );
             }
             catch ( NamingException ne )
             {
-                String message = "Failed to get initial context " + ( String ) env.get( Context.PROVIDER_URL );
+                String message = "Failed to get initial context " + env.get( Context.PROVIDER_URL );
                 throw new ServiceConfigurationException( message, ne );
             }
         }

Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddAttributeOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddAttributeOperation.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddAttributeOperation.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddAttributeOperation.java Fri Oct  5 23:48:35 2007
@@ -20,19 +20,18 @@
 package org.apache.directory.mitosis.operation;
 
 
-import java.util.List;
+import org.apache.directory.mitosis.common.CSN;
+import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
+import org.apache.directory.server.core.partition.PartitionNexus;
+import org.apache.directory.shared.ldap.message.AttributesImpl;
+import org.apache.directory.shared.ldap.message.ModificationItemImpl;
+import org.apache.directory.shared.ldap.name.LdapDN;
 
 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.core.interceptor.context.ModifyOperationContext;
-import org.apache.directory.server.core.partition.PartitionNexus;
-import org.apache.directory.shared.ldap.message.AttributesImpl;
-import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.mitosis.common.CSN;
+import java.util.List;
 
 
 /**
@@ -66,7 +65,7 @@
     {
         Attributes attrs = new AttributesImpl( true );
         attrs.put( getAttribute() );
-        List<ModificationItem> items = ModifyOperationContext.createModItems( attrs, DirContext.ADD_ATTRIBUTE );
+        List<ModificationItemImpl> items = ModifyOperationContext.createModItems( attrs, DirContext.ADD_ATTRIBUTE );
         nexus.modify( new ModifyOperationContext( getName(), items ) );
     }
 }

Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/CompositeOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/CompositeOperation.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/CompositeOperation.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/CompositeOperation.java Fri Oct  5 23:48:35 2007
@@ -20,17 +20,6 @@
 package org.apache.directory.mitosis.operation;
 
 
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import javax.naming.Name;
-import javax.naming.NamingException;
-
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
-import org.apache.directory.server.core.partition.PartitionNexus;
-import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.mitosis.common.CSN;
 import org.apache.directory.mitosis.common.CSNVector;
 import org.apache.directory.mitosis.common.ReplicaId;
@@ -38,6 +27,15 @@
 import org.apache.directory.mitosis.configuration.ReplicationConfiguration;
 import org.apache.directory.mitosis.store.ReplicationLogIterator;
 import org.apache.directory.mitosis.store.ReplicationStore;
+import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.partition.PartitionNexus;
+import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
+
+import javax.naming.Name;
+import javax.naming.NamingException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
 
 
 /**
@@ -52,7 +50,7 @@
     private static final ReplicationStore DUMMY_STORE = new ReplicationStore()
     {
 
-        public void open( DirectoryServiceConfiguration serviceCfg, ReplicationConfiguration cfg )
+        public void open( DirectoryService directoryService, ReplicationConfiguration cfg )
         {
         }
 
@@ -165,10 +163,8 @@
     protected void execute0( PartitionNexus nexus, ReplicationStore store, AttributeTypeRegistry registry ) 
         throws NamingException
     {
-        Iterator<Operation> i = children.iterator();
-        while ( i.hasNext() )
+        for ( Operation op : children )
         {
-            Operation op = i.next();
             op.execute( nexus, DUMMY_STORE, registry );
         }
     }

Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/DeleteAttributeOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/DeleteAttributeOperation.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/DeleteAttributeOperation.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/DeleteAttributeOperation.java Fri Oct  5 23:48:35 2007
@@ -20,19 +20,18 @@
 package org.apache.directory.mitosis.operation;
 
 
-import java.util.List;
+import org.apache.directory.mitosis.common.CSN;
+import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
+import org.apache.directory.server.core.partition.PartitionNexus;
+import org.apache.directory.shared.ldap.message.AttributesImpl;
+import org.apache.directory.shared.ldap.message.ModificationItemImpl;
+import org.apache.directory.shared.ldap.name.LdapDN;
 
 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.core.interceptor.context.ModifyOperationContext;
-import org.apache.directory.server.core.partition.PartitionNexus;
-import org.apache.directory.shared.ldap.message.AttributesImpl;
-import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.mitosis.common.CSN;
+import java.util.List;
 
 
 /**
@@ -66,7 +65,7 @@
     {
         Attributes attrs = new AttributesImpl( true );
         attrs.put( getAttribute() );
-        List<ModificationItem> items = ModifyOperationContext.createModItems( attrs, DirContext.REMOVE_ATTRIBUTE );
+        List<ModificationItemImpl> items = ModifyOperationContext.createModItems( attrs, DirContext.REMOVE_ATTRIBUTE );
 
         nexus.modify( new ModifyOperationContext( getName(), items ) );
     }

Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java Fri Oct  5 23:48:35 2007
@@ -19,27 +19,9 @@
  */
 package org.apache.directory.mitosis.operation;
 
-
-import java.util.List;
-import java.util.Map;
-
-import javax.naming.NameAlreadyBoundException;
-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.mitosis.common.CSN;
-import org.apache.directory.mitosis.common.CSNFactory;
-import org.apache.directory.mitosis.common.Constants;
-import org.apache.directory.mitosis.common.ReplicaId;
-import org.apache.directory.mitosis.common.UUIDFactory;
+import org.apache.directory.mitosis.common.*;
 import org.apache.directory.mitosis.configuration.ReplicationConfiguration;
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
+import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.interceptor.context.EntryOperationContext;
 import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
@@ -50,9 +32,17 @@
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.filter.PresenceNode;
 import org.apache.directory.shared.ldap.message.AttributeImpl;
+import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.NamespaceTools;
 
+import javax.naming.NameAlreadyBoundException;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.*;
+import java.util.List;
+import java.util.Map;
+
 
 /**
  * Creates an {@link Operation} instance for a JNDI operation.  The
@@ -88,14 +78,14 @@
     private final AttributeTypeRegistry attributeRegistry;
 
 
-    public OperationFactory( DirectoryServiceConfiguration serviceCfg, ReplicationConfiguration cfg )
+    public OperationFactory( DirectoryService directoryService, ReplicationConfiguration cfg )
     {
         this.replicaId = cfg.getReplicaId();
-        this.environment = serviceCfg.getEnvironment();
-        this.nexus = serviceCfg.getPartitionNexus();
+        this.environment = directoryService.getEnvironment();
+        this.nexus = directoryService.getPartitionNexus();
         this.uuidFactory = cfg.getUuidFactory();
         this.csnFactory = cfg.getCsnFactory();
-        this.attributeRegistry = serviceCfg.getRegistries().getAttributeTypeRegistry();
+        this.attributeRegistry = directoryService.getRegistries().getAttributeTypeRegistry();
     }
 
 
@@ -164,7 +154,7 @@
      */
     public Operation newModify( ModifyOperationContext opContext )
     {
-        List<ModificationItem> items = opContext.getModItems();
+        List<ModificationItemImpl> items = opContext.getModItems();
         LdapDN normalizedName = opContext.getDn();
 
         CSN csn = newCSN();

Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/ReplaceAttributeOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/ReplaceAttributeOperation.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/ReplaceAttributeOperation.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/ReplaceAttributeOperation.java Fri Oct  5 23:48:35 2007
@@ -20,19 +20,18 @@
 package org.apache.directory.mitosis.operation;
 
 
-import java.util.List;
+import org.apache.directory.mitosis.common.CSN;
+import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
+import org.apache.directory.server.core.partition.PartitionNexus;
+import org.apache.directory.shared.ldap.message.AttributesImpl;
+import org.apache.directory.shared.ldap.message.ModificationItemImpl;
+import org.apache.directory.shared.ldap.name.LdapDN;
 
 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.core.interceptor.context.ModifyOperationContext;
-import org.apache.directory.server.core.partition.PartitionNexus;
-import org.apache.directory.shared.ldap.message.AttributesImpl;
-import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.mitosis.common.CSN;
+import java.util.List;
 
 
 /**
@@ -66,7 +65,7 @@
     {
         Attributes attrs = new AttributesImpl( true );
         attrs.put( getAttribute() );
-        List<ModificationItem> items = ModifyOperationContext.createModItems( attrs, DirContext.REPLACE_ATTRIBUTE );
+        List<ModificationItemImpl> items = ModifyOperationContext.createModItems( attrs, DirContext.REPLACE_ATTRIBUTE );
 
         nexus.modify( new ModifyOperationContext( getName(), items ) );
     }

Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/DefaultReplicationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/DefaultReplicationContext.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/DefaultReplicationContext.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/DefaultReplicationContext.java Fri Oct  5 23:48:35 2007
@@ -20,12 +20,6 @@
 package org.apache.directory.mitosis.service;
 
 
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Timer;
-import java.util.TimerTask;
-
 import org.apache.directory.mitosis.common.Replica;
 import org.apache.directory.mitosis.configuration.ReplicationConfiguration;
 import org.apache.directory.mitosis.service.protocol.handler.ReplicationClientContextHandler;
@@ -33,10 +27,12 @@
 import org.apache.directory.mitosis.service.protocol.handler.ReplicationContextHandler;
 import org.apache.directory.mitosis.service.protocol.handler.ReplicationProtocolHandler;
 import org.apache.directory.mitosis.service.protocol.message.BaseMessage;
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
+import org.apache.directory.server.core.DirectoryService;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.util.SessionLog;
 
+import java.util.*;
+
 /**
  * The default implementation of {@link ReplicationContext}
  * 
@@ -44,11 +40,11 @@
  */
 public class DefaultReplicationContext implements ReplicationContext
 {
-    private static final Timer expirationTimer = new Timer( "ReplicationMessageExpirer" );
+    private static final Timer EXPIRATION_TIMER = new Timer( "ReplicationMessageExpirer" );
 
     private final ReplicationService service;
     private final ReplicationConfiguration configuration;
-    private final DirectoryServiceConfiguration serviceConfiguration;
+    private final DirectoryService directoryService;
     private final IoSession session;
     private final Map<Integer,ExpirationTask> expirableMessages = new HashMap<Integer,ExpirationTask>();
     private int nextSequence;
@@ -56,12 +52,12 @@
     private State state = State.INIT;
 
 
-    public DefaultReplicationContext( ReplicationService service, DirectoryServiceConfiguration serviceCfg,
+    public DefaultReplicationContext( ReplicationService service, DirectoryService directoryService,
         ReplicationConfiguration configuration, IoSession session )
     {
         this.service = service;
         this.configuration = configuration;
-        this.serviceConfiguration = serviceCfg;
+        this.directoryService = directoryService;
         this.session = session;
     }
 
@@ -78,9 +74,9 @@
     }
 
 
-    public DirectoryServiceConfiguration getServiceConfiguration()
+    public DirectoryService getDirectoryService()
     {
-        return serviceConfiguration;
+        return directoryService;
     }
 
 
@@ -127,10 +123,10 @@
         ExpirationTask task = new ExpirationTask( bm );
         synchronized ( expirableMessages )
         {
-            expirableMessages.put( new Integer( bm.getSequence() ), task );
+            expirableMessages.put( bm.getSequence(), task );
         }
 
-        expirationTimer.schedule( task, configuration.getResponseTimeout() * 1000L );
+        EXPIRATION_TIMER.schedule( task, configuration.getResponseTimeout() * 1000L );
     }
 
 
@@ -165,10 +161,9 @@
     {
         synchronized ( expirableMessages )
         {
-            Iterator i = expirableMessages.values().iterator();
-            while ( i.hasNext() )
+            for ( ExpirationTask expirationTask : expirableMessages.values() )
             {
-                ( ( ExpirationTask ) i.next() ).cancel();
+                ( expirationTask ).cancel();
             }
         }
     }
@@ -188,7 +183,7 @@
         ExpirationTask task;
         synchronized ( expirableMessages )
         {
-            task = expirableMessages.remove( new Integer( sequence ) );
+            task = expirableMessages.remove( sequence );
         }
         return task;
     }

Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationContext.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationContext.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationContext.java Fri Oct  5 23:48:35 2007
@@ -25,7 +25,7 @@
 import org.apache.directory.mitosis.service.protocol.handler.ReplicationClientContextHandler;
 import org.apache.directory.mitosis.service.protocol.handler.ReplicationContextHandler;
 import org.apache.directory.mitosis.service.protocol.handler.ReplicationServerContextHandler;
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
+import org.apache.directory.server.core.DirectoryService;
 import org.apache.mina.common.IoSession;
 
 
@@ -61,10 +61,10 @@
 
 
     /**
-     * Returns the {@link DirectoryServiceConfiguration} which owns the
-     * {@link ReplicationService} which is managing this context.
+     * Returns the {@link DirectoryService} which owns the {@link ReplicationService}
+     * which is managing this context.
      */
-    DirectoryServiceConfiguration getServiceConfiguration();
+    DirectoryService getDirectoryService();
 
 
     /**

Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationLogCleanJob.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationLogCleanJob.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationLogCleanJob.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationLogCleanJob.java Fri Oct  5 23:48:35 2007
@@ -20,10 +20,6 @@
 package org.apache.directory.mitosis.service;
 
 
-import java.util.Iterator;
-
-import javax.naming.NamingException;
-
 import org.apache.directory.mitosis.common.Constants;
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.interceptor.Interceptor;
@@ -31,6 +27,10 @@
 import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
 
+import javax.naming.NamingException;
+import java.util.Map;
+
+
 /**
  * A <a href="http://www.opensymphony.com/quartz/">OpenSymphony Quartz</a>
  * {@link Job} that purges old replication logs and the old entries marked as
@@ -43,10 +43,12 @@
 public class ReplicationLogCleanJob implements Job
 {
     public static final String INSTANCE_ID = "instanceId";
+    private Map<String,DirectoryService> services;
 
 
-    public ReplicationLogCleanJob()
+    public ReplicationLogCleanJob( Map<String,DirectoryService> services )
     {
+        this.services = services;
     }
 
 
@@ -56,29 +58,25 @@
         if ( instanceId == null )
         {
             // Execute for all instances in the VM if instanceId is not specified.
-            Iterator it = DirectoryService.getAllInstances().iterator();
-            while ( it.hasNext() )
+            for ( DirectoryService service : services.values() )
             {
-                DirectoryService service = ( DirectoryService ) it.next();
-                execute0( service.getConfiguration().getInstanceId() );
+                execute0( service );
             }
         }
         else
         {
             // Execute for the instance with the specified instanceId if
             // it is specified.
-            execute0( instanceId );
+
+            execute0( services.get( instanceId ) );
         }
     }
 
 
-    private void execute0( String instanceId ) throws JobExecutionException
+    private void execute0( DirectoryService service ) throws JobExecutionException
     {
-        DirectoryService service = DirectoryService.getInstance( instanceId );
-        Iterator it = service.getConfiguration().getInterceptorChain().getAll().iterator();
-        while ( it.hasNext() )
+        for ( Interceptor interceptor : service.getInterceptorChain().getAll() )
         {
-            Interceptor interceptor = ( Interceptor ) it.next();
             if ( interceptor instanceof ReplicationService )
             {
                 try

Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java (original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java Fri Oct  5 23:48:35 2007
@@ -20,25 +20,7 @@
 package org.apache.directory.mitosis.service;
 
 
-import java.net.InetSocketAddress;
-import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.naming.NameNotFoundException;
-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.SearchControls;
-import javax.naming.directory.SearchResult;
-
-import org.apache.directory.mitosis.common.CSN;
-import org.apache.directory.mitosis.common.Constants;
-import org.apache.directory.mitosis.common.DefaultCSN;
-import org.apache.directory.mitosis.common.Replica;
-import org.apache.directory.mitosis.common.ReplicaId;
+import org.apache.directory.mitosis.common.*;
 import org.apache.directory.mitosis.configuration.ReplicationConfiguration;
 import org.apache.directory.mitosis.operation.Operation;
 import org.apache.directory.mitosis.operation.OperationFactory;
@@ -47,22 +29,12 @@
 import org.apache.directory.mitosis.service.protocol.handler.ReplicationServerContextHandler;
 import org.apache.directory.mitosis.service.protocol.handler.ReplicationServerProtocolHandler;
 import org.apache.directory.mitosis.store.ReplicationStore;
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
+import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.enumeration.SearchResultFilteringEnumeration;
 import org.apache.directory.server.core.interceptor.BaseInterceptor;
 import org.apache.directory.server.core.interceptor.Interceptor;
 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.EntryOperationContext;
-import org.apache.directory.server.core.interceptor.context.GetMatchedNameOperationContext;
-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.InvocationStack;
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
@@ -80,6 +52,15 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.naming.NameNotFoundException;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.*;
+import java.net.InetSocketAddress;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * An {@link Interceptor} that intercepts LDAP operations and propagates the
  * changes occurred by the operations into other {@link Replica}s so the DIT
@@ -122,7 +103,7 @@
  * <li><tt>entryDeleted</tt> - is <tt>TRUE</tt> if and only if the entry is
  *     deleted.  The entry is not deleted immediately by a delete operation
  *     because <tt>entryCSN</tt> attribute should be retained for certain
- *     amount of time to determine whether the incoming change log, which
+ *     amount of time to determine whether the incoming change LOG, which
  *     affects an entry with the same DN, is a conflict (modification on a
  *     deleted entry) or not (creation of a new entry). You can purge old
  *     deleted entries and related change logs in {@link ReplicationStore} by
@@ -141,7 +122,7 @@
  */
 public class ReplicationService extends BaseInterceptor
 {
-    private static final Logger log = LoggerFactory.getLogger( ReplicationService.class );
+    private static final Logger LOG = LoggerFactory.getLogger( ReplicationService.class );
 
     /** The service name */
     public static final String NAME = "replicationService";
@@ -155,7 +136,7 @@
      */
     private String name = NAME;
 
-    private DirectoryServiceConfiguration directoryServiceConfiguration;
+    private DirectoryService directoryService;
     private ReplicationConfiguration configuration;
     private PartitionNexus nexus;
     private OperationFactory operationFactory;
@@ -191,24 +172,19 @@
         this.configuration = configuration;
     }
 
-    public DirectoryServiceConfiguration getFactoryConfiguration()
-    {
-        return directoryServiceConfiguration;
-    }
 
-
-    public void init(DirectoryServiceConfiguration serviceCfg) throws NamingException
+    public void init( DirectoryService directoryService ) throws NamingException
     {
         configuration.validate();
         // and then preserve frequently used ones
-        directoryServiceConfiguration = serviceCfg;
-        nexus = serviceCfg.getPartitionNexus();
+        this.directoryService = directoryService;
+        nexus = directoryService.getPartitionNexus();
         store = configuration.getStore();
-        operationFactory = new OperationFactory( serviceCfg, configuration );
-        attrRegistry = serviceCfg.getRegistries().getAttributeTypeRegistry();
+        operationFactory = new OperationFactory( directoryService, configuration );
+        attrRegistry = directoryService.getRegistries().getAttributeTypeRegistry();
 
         // Initialize store and service
-        store.open( serviceCfg, configuration );
+        store.open( directoryService, configuration );
         boolean serviceStarted = false;
         try
         {
@@ -267,7 +243,7 @@
         }
         catch ( Exception e )
         {
-            log.warn( "Failed to stop the client connection manager.", e );
+            LOG.warn( "Failed to stop the client connection manager.", e );
         }
         registry.unbindAll();
     }
@@ -278,7 +254,7 @@
      */
     public void replicate()
     {
-        log.info( "Forcing replication..." );
+        LOG.info( "Forcing replication..." );
         this.clientConnectionManager.replicate();
     }
 
@@ -287,7 +263,7 @@
      */
     public void interruptConnectors()
     {
-        log.info( "Waking sleeping replicas..." );
+        LOG.info( "Waking sleeping replicas..." );
         this.clientConnectionManager.interruptConnectors();
     }
 
@@ -343,7 +319,7 @@
             }
 
             contextName.normalize( attrRegistry.getNormalizerMapping() );
-            log.info( "Purging aged data under '" + contextName + '"' );
+            LOG.info( "Purging aged data under '" + contextName + '"' );
             purgeAgedData( contextName, filter );
         }
 
@@ -358,7 +334,7 @@
         ctrl.setReturningAttributes( new String[] { "entryCSN", "entryDeleted" } );
 
         NamingEnumeration<SearchResult> e = nexus.search(
-            new SearchOperationContext( contextName, directoryServiceConfiguration.getEnvironment(), filter, ctrl ) );
+            new SearchOperationContext( contextName, directoryService.getEnvironment(), filter, ctrl ) );
 
         List<LdapDN> names = new ArrayList<LdapDN>();
         try
@@ -384,12 +360,12 @@
             {
                 name.normalize( attrRegistry.getNormalizerMapping() );
                 Attributes entry = nexus.lookup( new LookupOperationContext( name ) );
-                log.info( "Purge: " + name + " (" + entry + ')' );
+                LOG.info( "Purge: " + name + " (" + entry + ')' );
                 nexus.delete( new DeleteOperationContext( name ) );
             }
             catch ( NamingException ex )
             {
-                log.warn( "Failed to fetch/delete: " + name, ex );
+                LOG.warn( "Failed to fetch/delete: " + name, ex );
             }
         }
     }
@@ -556,5 +532,11 @@
 
         Attribute deleted = entry.get( Constants.ENTRY_DELETED );
         return ( deleted != null && "TRUE".equalsIgnoreCase( deleted.get().toString() ) );
+    }
+
+
+    public DirectoryService getDirectoryService()
+    {
+        return directoryService;
     }
 }



Mime
View raw message