You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by cc...@apache.org on 2007/07/14 09:55:59 UTC
svn commit: r556238 [3/8] - in /directory: apacheds/trunk-with-dependencies/
sandbox/ccustine/new_installers/apacheds/
sandbox/ccustine/new_installers/apacheds/benchmarks/
sandbox/ccustine/new_installers/apacheds/bootstrap-extract/
sandbox/ccustine/new...
Modified: directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java Sat Jul 14 00:55:44 2007
@@ -35,12 +35,12 @@
import org.apache.directory.server.core.DirectoryServiceConfiguration;
import org.apache.directory.server.core.configuration.InterceptorConfiguration;
-import org.apache.directory.server.core.configuration.MutableInterceptorConfiguration;
import org.apache.directory.server.core.interceptor.context.OperationContext;
import org.apache.directory.server.core.invocation.Invocation;
import org.apache.directory.server.core.invocation.InvocationStack;
import org.apache.directory.server.core.partition.PartitionNexus;
import org.apache.directory.server.core.partition.PartitionNexusProxy;
+import org.apache.directory.shared.ldap.exception.LdapConfigurationException;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -207,10 +207,7 @@
*/
public InterceptorChain()
{
- MutableInterceptorConfiguration tailCfg = new MutableInterceptorConfiguration();
- tailCfg.setName( "tail" );
- tailCfg.setInterceptor( FINAL_INTERCEPTOR );
- tail = new Entry( null, null, tailCfg );
+ tail = new Entry( "tail", null, null, FINAL_INTERCEPTOR );
head = tail;
}
@@ -281,11 +278,11 @@
{
try
{
- deregister( entry.configuration.getName() );
+ deregister( entry.getName() );
}
catch ( Throwable t )
{
- log.warn( "Failed to deregister an interceptor: " + entry.configuration.getName(), t );
+ log.warn( "Failed to deregister an interceptor: " + entry.getName(), t );
}
}
}
@@ -304,7 +301,7 @@
return null;
}
- return e.configuration.getInterceptor();
+ return e.interceptor;
}
@@ -318,7 +315,7 @@
do
{
- result.add( e.configuration.getInterceptor() );
+ result.add( e.interceptor );
e = e.nextEntry;
}
while ( e != tail );
@@ -351,7 +348,7 @@
}
- public synchronized InterceptorConfiguration remove( String interceptorName ) throws NamingException
+ public synchronized String remove( String interceptorName ) throws NamingException
{
return deregister( interceptorName );
}
@@ -382,7 +379,7 @@
/**
* Removes and deinitializes the interceptor with the specified name.
*/
- private InterceptorConfiguration deregister( String name ) throws ConfigurationException
+ private String deregister( String name ) throws ConfigurationException
{
Entry entry = checkOldName( name );
Entry prevEntry = entry.prevEntry;
@@ -406,34 +403,73 @@
}
name2entry.remove( name );
- entry.configuration.getInterceptor().destroy();
+ entry.interceptor.destroy();
- return entry.configuration;
+ return entry.getName();
}
+
+ private Interceptor getInterceptorInstance( InterceptorConfiguration interceptorConfiguration )
+ throws NamingException
+ {
+ Class interceptorClass = null;
+ Interceptor interceptor = null;
+
+ // Load the interceptor class and if we cannot find it blow a config exception
+ try
+ {
+ interceptorClass = Class.forName( interceptorConfiguration.getInterceptorClassName() );
+ }
+ catch( ClassNotFoundException e )
+ {
+ LdapConfigurationException lce = new LdapConfigurationException( "Failed to load interceptor class '" +
+ interceptorConfiguration.getInterceptorClassName() + "' for interceptor named '" +
+ interceptorConfiguration.getName() );
+ lce.setRootCause( e );
+ throw lce;
+ }
+
+ // Now instantiate the interceptor
+ try
+ {
+ interceptor = ( Interceptor ) interceptorClass.newInstance();
+ }
+ catch ( Exception e )
+ {
+ LdapConfigurationException lce =
+ new LdapConfigurationException( "Failed while trying to instantiate interceptor class '" +
+ interceptorConfiguration.getInterceptorClassName() + "' for interceptor named '" +
+ interceptorConfiguration.getName() );
+ lce.setRootCause( e );
+ throw lce;
+ }
+
+ return interceptor;
+ }
+
private void register0( InterceptorConfiguration cfg, Entry nextEntry ) throws NamingException
{
String name = cfg.getName();
- Interceptor interceptor = cfg.getInterceptor();
+ Interceptor interceptor = getInterceptorInstance( cfg );
interceptor.init( factoryCfg, cfg );
Entry newEntry;
if ( nextEntry == head )
{
- newEntry = new Entry( null, head, cfg );
+ newEntry = new Entry( cfg.getName(), null, head, interceptor );
head.prevEntry = newEntry;
head = newEntry;
}
else if ( head == tail )
{
- newEntry = new Entry( null, tail, cfg );
+ newEntry = new Entry( cfg.getName(), null, tail, interceptor );
tail.prevEntry = newEntry;
head = newEntry;
}
else
{
- newEntry = new Entry( nextEntry.prevEntry, nextEntry, cfg );
+ newEntry = new Entry( cfg.getName(), nextEntry.prevEntry, nextEntry, interceptor );
nextEntry.prevEntry.nextEntry = newEntry;
nextEntry.prevEntry = newEntry;
}
@@ -498,7 +534,7 @@
Entry next = head;
while ( next != tail )
{
- if ( invocation.isBypassed( next.configuration.getName() ) )
+ if ( invocation.isBypassed( next.getName() ) )
{
next = next.nextEntry;
}
@@ -515,7 +551,7 @@
public Attributes getRootDSE( OperationContext opContext ) throws NamingException
{
Entry entry = getStartingEntry();
- Interceptor head = entry.configuration.getInterceptor();
+ Interceptor head = entry.interceptor;
NextInterceptor next = entry.nextInterceptor;
try
@@ -537,7 +573,7 @@
public LdapDN getMatchedName( OperationContext opContext ) throws NamingException
{
Entry entry = getStartingEntry();
- Interceptor head = entry.configuration.getInterceptor();
+ Interceptor head = entry.interceptor;
NextInterceptor next = entry.nextInterceptor;
try
@@ -559,7 +595,7 @@
public LdapDN getSuffix( OperationContext opContext ) throws NamingException
{
Entry entry = getStartingEntry();
- Interceptor head = entry.configuration.getInterceptor();
+ Interceptor head = entry.interceptor;
NextInterceptor next = entry.nextInterceptor;
try
@@ -581,7 +617,7 @@
public boolean compare( OperationContext opContext ) throws NamingException
{
Entry entry = getStartingEntry();
- Interceptor head = entry.configuration.getInterceptor();
+ Interceptor head = entry.interceptor;
NextInterceptor next = entry.nextInterceptor;
try
@@ -603,7 +639,7 @@
public Iterator listSuffixes( OperationContext opContext ) throws NamingException
{
Entry entry = getStartingEntry();
- Interceptor head = entry.configuration.getInterceptor();
+ Interceptor head = entry.interceptor;
NextInterceptor next = entry.nextInterceptor;
try
@@ -625,7 +661,7 @@
public void addContextPartition( OperationContext opContext ) throws NamingException
{
Entry entry = getStartingEntry();
- Interceptor head = entry.configuration.getInterceptor();
+ Interceptor head = entry.interceptor;
NextInterceptor next = entry.nextInterceptor;
try
@@ -647,7 +683,7 @@
public void removeContextPartition( OperationContext opContext ) throws NamingException
{
Entry entry = getStartingEntry();
- Interceptor head = entry.configuration.getInterceptor();
+ Interceptor head = entry.interceptor;
NextInterceptor next = entry.nextInterceptor;
try
@@ -669,7 +705,7 @@
public void delete( OperationContext opContext ) throws NamingException
{
Entry entry = getStartingEntry();
- Interceptor head = entry.configuration.getInterceptor();
+ Interceptor head = entry.interceptor;
NextInterceptor next = entry.nextInterceptor;
try
@@ -690,7 +726,7 @@
public void add( OperationContext opContext ) throws NamingException
{
Entry node = getStartingEntry();
- Interceptor head = node.configuration.getInterceptor();
+ Interceptor head = node.interceptor;
NextInterceptor next = node.nextInterceptor;
try
@@ -711,7 +747,7 @@
public void bind( OperationContext opContext ) throws NamingException
{
Entry node = getStartingEntry();
- Interceptor head = node.configuration.getInterceptor();
+ Interceptor head = node.interceptor;
NextInterceptor next = node.nextInterceptor;
try
@@ -732,7 +768,7 @@
public void unbind( OperationContext opContext ) throws NamingException
{
Entry node = getStartingEntry();
- Interceptor head = node.configuration.getInterceptor();
+ Interceptor head = node.interceptor;
NextInterceptor next = node.nextInterceptor;
try
@@ -753,7 +789,7 @@
public void modify( OperationContext opContext ) throws NamingException
{
Entry entry = getStartingEntry();
- Interceptor head = entry.configuration.getInterceptor();
+ Interceptor head = entry.interceptor;
NextInterceptor next = entry.nextInterceptor;
try
@@ -795,7 +831,7 @@
public NamingEnumeration list( OperationContext opContext ) throws NamingException
{
Entry entry = getStartingEntry();
- Interceptor head = entry.configuration.getInterceptor();
+ Interceptor head = entry.interceptor;
NextInterceptor next = entry.nextInterceptor;
try
@@ -818,7 +854,7 @@
throws NamingException
{
Entry entry = getStartingEntry();
- Interceptor head = entry.configuration.getInterceptor();
+ Interceptor head = entry.interceptor;
NextInterceptor next = entry.nextInterceptor;
try
@@ -840,7 +876,7 @@
public Attributes lookup( OperationContext opContext ) throws NamingException
{
Entry entry = getStartingEntry();
- Interceptor head = entry.configuration.getInterceptor();
+ Interceptor head = entry.interceptor;
NextInterceptor next = entry.nextInterceptor;
try
@@ -862,7 +898,7 @@
public boolean hasEntry( OperationContext opContext ) throws NamingException
{
Entry entry = getStartingEntry();
- Interceptor head = entry.configuration.getInterceptor();
+ Interceptor head = entry.interceptor;
NextInterceptor next = entry.nextInterceptor;
try
@@ -884,7 +920,7 @@
public void rename( OperationContext opContext ) throws NamingException
{
Entry entry = getStartingEntry();
- Interceptor head = entry.configuration.getInterceptor();
+ Interceptor head = entry.interceptor;
NextInterceptor next = entry.nextInterceptor;
try
@@ -905,7 +941,7 @@
public void move( OperationContext opContext ) throws NamingException
{
Entry entry = getStartingEntry();
- Interceptor head = entry.configuration.getInterceptor();
+ Interceptor head = entry.interceptor;
NextInterceptor next = entry.nextInterceptor;
try
@@ -926,7 +962,7 @@
public void moveAndRename( OperationContext opContext ) throws NamingException
{
Entry entry = getStartingEntry();
- Interceptor head = entry.configuration.getInterceptor();
+ Interceptor head = entry.interceptor;
NextInterceptor next = entry.nextInterceptor;
try
@@ -952,21 +988,31 @@
private Entry nextEntry;
- private final InterceptorConfiguration configuration;
+ private final String name;
+
+ private final Interceptor interceptor;
private final NextInterceptor nextInterceptor;
+
+ private final String getName()
+ {
+ return name;
+ }
- private Entry(Entry prevEntry, Entry nextEntry, InterceptorConfiguration configuration)
+
+ private Entry( String name, Entry prevEntry, Entry nextEntry, Interceptor interceptor )
{
- if ( configuration == null )
+ this.name = name;
+
+ if ( interceptor == null )
{
- throw new NullPointerException( "configuration" );
+ throw new NullPointerException( "interceptor" );
}
this.prevEntry = prevEntry;
this.nextEntry = nextEntry;
- this.configuration = configuration;
+ this.interceptor = interceptor;
this.nextInterceptor = new NextInterceptor()
{
private Entry getNextEntry()
@@ -993,7 +1039,7 @@
Entry next = Entry.this.nextEntry;
while ( next != tail )
{
- if ( invocation.isBypassed( next.configuration.getName() ) )
+ if ( invocation.isBypassed( next.getName() ) )
{
next = next.nextEntry;
}
@@ -1010,7 +1056,7 @@
public boolean compare( OperationContext opContext ) throws NamingException
{
Entry next = getNextEntry();
- Interceptor interceptor = next.configuration.getInterceptor();
+ Interceptor interceptor = next.interceptor;
try
{
@@ -1031,7 +1077,7 @@
public Attributes getRootDSE( OperationContext opContext ) throws NamingException
{
Entry next = getNextEntry();
- Interceptor interceptor = next.configuration.getInterceptor();
+ Interceptor interceptor = next.interceptor;
try
{
@@ -1052,7 +1098,7 @@
public LdapDN getMatchedName( OperationContext opContext ) throws NamingException
{
Entry next = getNextEntry();
- Interceptor interceptor = next.configuration.getInterceptor();
+ Interceptor interceptor = next.interceptor;
try
{
@@ -1073,7 +1119,7 @@
public LdapDN getSuffix( OperationContext opContext ) throws NamingException
{
Entry next = getNextEntry();
- Interceptor interceptor = next.configuration.getInterceptor();
+ Interceptor interceptor = next.interceptor;
try
{
@@ -1094,7 +1140,7 @@
public Iterator listSuffixes( OperationContext opContext ) throws NamingException
{
Entry next = getNextEntry();
- Interceptor interceptor = next.configuration.getInterceptor();
+ Interceptor interceptor = next.interceptor;
try
{
@@ -1115,7 +1161,7 @@
public void delete( OperationContext opContext ) throws NamingException
{
Entry next = getNextEntry();
- Interceptor interceptor = next.configuration.getInterceptor();
+ Interceptor interceptor = next.interceptor;
try
{
@@ -1135,7 +1181,7 @@
public void add( OperationContext opContext ) throws NamingException
{
Entry next = getNextEntry();
- Interceptor interceptor = next.configuration.getInterceptor();
+ Interceptor interceptor = next.interceptor;
try
{
@@ -1155,7 +1201,7 @@
public void modify( OperationContext opContext ) throws NamingException
{
Entry next = getNextEntry();
- Interceptor interceptor = next.configuration.getInterceptor();
+ Interceptor interceptor = next.interceptor;
try
{
@@ -1175,7 +1221,7 @@
public NamingEnumeration list( OperationContext opContext ) throws NamingException
{
Entry next = getNextEntry();
- Interceptor interceptor = next.configuration.getInterceptor();
+ Interceptor interceptor = next.interceptor;
try
{
@@ -1197,7 +1243,7 @@
throws NamingException
{
Entry next = getNextEntry();
- Interceptor interceptor = next.configuration.getInterceptor();
+ Interceptor interceptor = next.interceptor;
try
{
@@ -1218,7 +1264,7 @@
public Attributes lookup( OperationContext opContext ) throws NamingException
{
Entry next = getNextEntry();
- Interceptor interceptor = next.configuration.getInterceptor();
+ Interceptor interceptor = next.interceptor;
try
{
@@ -1239,7 +1285,7 @@
public boolean hasEntry( OperationContext opContext ) throws NamingException
{
Entry next = getNextEntry();
- Interceptor interceptor = next.configuration.getInterceptor();
+ Interceptor interceptor = next.interceptor;
try
{
@@ -1260,7 +1306,7 @@
public void rename( OperationContext opContext ) throws NamingException
{
Entry next = getNextEntry();
- Interceptor interceptor = next.configuration.getInterceptor();
+ Interceptor interceptor = next.interceptor;
try
{
@@ -1280,7 +1326,7 @@
public void move( OperationContext opContext ) throws NamingException
{
Entry next = getNextEntry();
- Interceptor interceptor = next.configuration.getInterceptor();
+ Interceptor interceptor = next.interceptor;
try
{
@@ -1301,7 +1347,7 @@
throws NamingException
{
Entry next = getNextEntry();
- Interceptor interceptor = next.configuration.getInterceptor();
+ Interceptor interceptor = next.interceptor;
try
{
@@ -1321,7 +1367,7 @@
public void bind( OperationContext opContext ) throws NamingException
{
Entry next = getNextEntry();
- Interceptor interceptor = next.configuration.getInterceptor();
+ Interceptor interceptor = next.interceptor;
try
{
@@ -1341,7 +1387,7 @@
public void unbind( OperationContext opContext ) throws NamingException
{
Entry next = getNextEntry();
- Interceptor interceptor = next.configuration.getInterceptor();
+ Interceptor interceptor = next.interceptor;
try
{
@@ -1361,7 +1407,7 @@
public void addContextPartition( OperationContext opContext ) throws NamingException
{
Entry next = getNextEntry();
- Interceptor interceptor = next.configuration.getInterceptor();
+ Interceptor interceptor = next.interceptor;
try
{
@@ -1382,7 +1428,7 @@
public void removeContextPartition( OperationContext opContext ) throws NamingException
{
Entry next = getNextEntry();
- Interceptor interceptor = next.configuration.getInterceptor();
+ Interceptor interceptor = next.interceptor;
try
{
Modified: directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/AddContextPartitionOperationContext.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/AddContextPartitionOperationContext.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/AddContextPartitionOperationContext.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/interceptor/context/AddContextPartitionOperationContext.java Sat Jul 14 00:55:44 2007
@@ -19,61 +19,142 @@
*/
package org.apache.directory.server.core.interceptor.context;
+
+import javax.naming.NamingException;
+
import org.apache.directory.server.core.configuration.PartitionConfiguration;
+import org.apache.directory.server.core.partition.Partition;
+import org.apache.directory.shared.ldap.exception.LdapConfigurationException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* A AddContextPartition context used for Interceptors. It contains all the informations
- * needed for the addContextPartition operation, and used by all the interceptors
+ * needed for the addContextPartition operation, and used by all the interceptors. If
+ * it does not have a partition set for it, then it will load and instantiate it
+ * automatically using the information in the partition configuration.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
public class AddContextPartitionOperationContext extends EmptyOperationContext
{
+ private static final Logger log = LoggerFactory.getLogger( AddContextPartitionOperationContext.class );
+
/** The context partition configuration */
- private PartitionConfiguration cfg;
+ private PartitionConfiguration partitionConfiguration;
+ /** the instantiated partition class */
+ private Partition partition;
+
/**
* Creates a new instance of AddContextPartitionOperationContext.
+ *
+ * @param entryDn The partition configuration to add
*/
- public AddContextPartitionOperationContext()
+ public AddContextPartitionOperationContext( PartitionConfiguration cfg )
{
+ super();
+ this.partitionConfiguration = cfg;
}
+
/**
* Creates a new instance of AddContextPartitionOperationContext.
*
* @param entryDn The partition configuration to add
*/
- public AddContextPartitionOperationContext( PartitionConfiguration cfg )
+ public AddContextPartitionOperationContext( PartitionConfiguration cfg, Partition partition )
{
- super();
- this.cfg = cfg;
+ this( cfg );
+ this.partition = partition;
}
+
/**
* @see Object#toString()
*/
public String toString()
{
- return "AddContextPartitionOperationContext for partition context '" + cfg.getName() + "'";
+ return "AddContextPartitionOperationContext for partition context '" + partitionConfiguration.getId() + "'";
}
+
/**
* @return The partition configuration
*/
- public PartitionConfiguration getCfg()
+ public PartitionConfiguration getPartitionConfiguration()
{
- return cfg;
+ return partitionConfiguration;
}
+
/**
* Set the partition configuration
*
- * @param cfg The configuration
+ * @param partitionConfiguration The configuration
+ */
+ public void setPartitionConfiguration( PartitionConfiguration partitionConfiguration )
+ {
+ this.partitionConfiguration = partitionConfiguration;
+ }
+
+
+ /**
+ * Get's the partition instance.
+ *
+ * @return the partition to add
*/
- public void setCfg( PartitionConfiguration cfg )
+ public Partition getPartition() throws NamingException
{
- this.cfg = cfg;
+ if ( partition != null )
+ {
+ return partition;
+ }
+
+ if ( partitionConfiguration == null )
+ {
+ throw new IllegalStateException( "Cannot get instance of partition without a proper " +
+ "partition configuration." );
+ }
+
+ Class partitionClass;
+ try
+ {
+ partitionClass = Class.forName( partitionConfiguration.getPartitionClassName() );
+ }
+ catch ( ClassNotFoundException e )
+ {
+ String msg = "Could not load partition implementation class '"
+ + partitionConfiguration.getPartitionClassName() + "' for partition with id "
+ + partitionConfiguration.getId();
+ log.error( msg );
+ throw new LdapConfigurationException( msg, e );
+ }
+
+ try
+ {
+ partition = ( Partition ) partitionClass.newInstance();
+ }
+ catch ( InstantiationException e )
+ {
+ String msg = "No default constructor in partition implementation class '"
+ + partitionConfiguration.getPartitionClassName() + "' for partition with id "
+ + partitionConfiguration.getId();
+ log.error( msg );
+ throw new LdapConfigurationException( msg, e );
+ }
+ catch ( IllegalAccessException e )
+ {
+ String msg = "Default constructor for partition implementation class '"
+ + partitionConfiguration.getPartitionClassName() + "' for partition with id "
+ + partitionConfiguration.getId() + " is not publicly accessible.";
+ log.error( msg );
+ throw new LdapConfigurationException( msg, e );
+ }
+
+ return partition;
}
}
Modified: directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java Sat Jul 14 00:55:44 2007
@@ -31,6 +31,7 @@
import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.authn.LdapPrincipal;
+import org.apache.directory.server.core.configuration.StartupConfiguration;
import org.apache.directory.server.core.interceptor.context.CompareOperationContext;
import org.apache.directory.server.core.interceptor.context.UnbindOperationContext;
import org.apache.directory.server.core.referral.ReferralService;
@@ -65,7 +66,8 @@
public ServerLdapContext( DirectoryService service, Hashtable env ) throws NamingException
{
super( service, env );
- refService = (( ReferralService )service.getConfiguration().getInterceptorChain().get( ReferralService.NAME ) );
+ refService = (( ReferralService )service.getConfiguration()
+ .getInterceptorChain().get( StartupConfiguration.REFERRAL_SERVICE_NAME ) );
}
@@ -79,7 +81,8 @@
ServerLdapContext( DirectoryService service, LdapPrincipal principal, LdapDN dn ) throws NamingException
{
super( service, principal, dn );
- refService = (( ReferralService )service.getConfiguration().getInterceptorChain().get( ReferralService.NAME ) );
+ refService = (( ReferralService )service.getConfiguration()
+ .getInterceptorChain().get( StartupConfiguration.REFERRAL_SERVICE_NAME ) );
}
Modified: directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationService.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationService.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationService.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationService.java Sat Jul 14 00:55:44 2007
@@ -33,12 +33,7 @@
import javax.naming.directory.Attributes;
import javax.naming.directory.DirContext;
-import org.apache.directory.server.core.authn.AuthenticationService;
-import org.apache.directory.server.core.authz.AuthorizationService;
-import org.apache.directory.server.core.authz.DefaultAuthorizationService;
-import org.apache.directory.server.core.collective.CollectiveAttributeService;
-import org.apache.directory.server.core.event.EventService;
-import org.apache.directory.server.core.exception.ExceptionService;
+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;
@@ -48,13 +43,7 @@
import org.apache.directory.server.core.interceptor.context.OperationContext;
import org.apache.directory.server.core.invocation.Invocation;
import org.apache.directory.server.core.invocation.InvocationStack;
-import org.apache.directory.server.core.normalization.NormalizationService;
-import org.apache.directory.server.core.operational.OperationalAttributeService;
import org.apache.directory.server.core.partition.PartitionNexusProxy;
-import org.apache.directory.server.core.referral.ReferralService;
-import org.apache.directory.server.core.schema.SchemaService;
-import org.apache.directory.server.core.subtree.SubentryService;
-import org.apache.directory.server.core.trigger.TriggerService;
import org.apache.directory.server.kerberos.shared.crypto.encryption.EncryptionType;
import org.apache.directory.server.kerberos.shared.crypto.encryption.KerberosKeyFactory;
import org.apache.directory.server.kerberos.shared.crypto.encryption.RandomKeyFactory;
@@ -62,6 +51,7 @@
import org.apache.directory.server.kerberos.shared.io.encoder.EncryptionKeyEncoder;
import org.apache.directory.server.kerberos.shared.messages.value.EncryptionKey;
import org.apache.directory.server.kerberos.shared.store.KerberosAttribute;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.exception.LdapAuthenticationException;
import org.apache.directory.shared.ldap.message.AttributeImpl;
import org.apache.directory.shared.ldap.message.ModificationItemImpl;
@@ -74,9 +64,9 @@
/**
* An {@link Interceptor} that creates symmetric Kerberos keys for users. When a
- * userPassword is added or modified, the userPassword and krb5PrincipalName are used
- * to derive Kerberos keys. If the userPassword is the special keyword 'randomKey',
- * a random key is generated and used as the Kerberos key.
+ * 'userPassword' is added or modified, the 'userPassword' and 'krb5PrincipalName'
+ * are used to derive Kerberos keys. If the 'userPassword' is the special keyword
+ * 'randomKey', a random key is generated and used as the Kerberos key.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
@@ -92,22 +82,22 @@
/**
* Define the interceptors to bypass upon user lookup.
*/
- private static final Collection USERLOOKUP_BYPASS;
+ private static final Collection<String> USERLOOKUP_BYPASS;
static
{
Set<String> c = new HashSet<String>();
- c.add( NormalizationService.NAME );
- c.add( AuthenticationService.NAME );
- c.add( ReferralService.NAME );
- c.add( AuthorizationService.NAME );
- c.add( DefaultAuthorizationService.NAME );
- c.add( ExceptionService.NAME );
- c.add( OperationalAttributeService.NAME );
- c.add( SchemaService.NAME );
- c.add( SubentryService.NAME );
- c.add( CollectiveAttributeService.NAME );
- c.add( EventService.NAME );
- c.add( TriggerService.NAME );
+ c.add( StartupConfiguration.NORMALIZATION_SERVICE_NAME );
+ c.add( StartupConfiguration.AUTHENTICATION_SERVICE_NAME );
+ c.add( StartupConfiguration.REFERRAL_SERVICE_NAME );
+ c.add( StartupConfiguration.AUTHORIZATION_SERVICE_NAME );
+ c.add( StartupConfiguration.DEFAULT_AUTHORIZATION_SERVICE_NAME );
+ c.add( StartupConfiguration.EXCEPTION_SERVICE_NAME );
+ c.add( StartupConfiguration.OPERATIONAL_ATTRIBUTE_SERVICE_NAME );
+ c.add( StartupConfiguration.SCHEMA_SERVICE_NAME );
+ c.add( StartupConfiguration.SUBENTRY_SERVICE_NAME );
+ c.add( StartupConfiguration.COLLECTIVE_ATTRIBUTE_SERVICE_NAME );
+ c.add( StartupConfiguration.EVENT_SERVICE_NAME );
+ c.add( StartupConfiguration.TRIGGER_SERVICE_NAME );
USERLOOKUP_BYPASS = Collections.unmodifiableCollection( c );
}
@@ -126,30 +116,34 @@
if ( entry.get( "userPassword" ) != null && entry.get( KerberosAttribute.PRINCIPAL ) != null )
{
- log.debug( "Adding the entry " + AttributeUtils.toString( entry ) + " for DN = '" + normName.getUpName()
- + "'" );
+ log.debug( "Adding the entry '{}' for DN '{}'.", AttributeUtils.toString( entry ), normName.getUpName() );
Object firstValue = entry.get( "userPassword" ).get();
if ( firstValue instanceof String )
{
- log.debug( "Adding Attribute id : 'userPassword', Values : ['" + firstValue + "']" );
+ log.debug( "Adding Attribute id : 'userPassword', Values : [ '{}' ]", firstValue );
}
else if ( firstValue instanceof byte[] )
{
String string = StringTools.utf8ToString( ( byte[] ) firstValue );
- StringBuffer sb = new StringBuffer();
- sb.append( "'" + string + "' ( " );
- sb.append( StringTools.dumpBytes( ( byte[] ) firstValue ).trim() );
- log.debug( "Adding Attribute id : 'userPassword', Values : [ " + sb.toString() + " ) ]" );
+ if ( log.isDebugEnabled() )
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append( "'" + string + "' ( " );
+ sb.append( StringTools.dumpBytes( ( byte[] ) firstValue ).trim() );
+ sb.append( " )" );
+ log.debug( "Adding Attribute id : 'userPassword', Values : [ {} ]", sb.toString() );
+ }
+
firstValue = string;
}
String userPassword = ( String ) firstValue;
String principalName = ( String ) entry.get( KerberosAttribute.PRINCIPAL ).get();
- log.debug( "Got principal " + principalName + " with userPassword " + userPassword );
+ log.debug( "Got principal '{}' with userPassword '{}'.", principalName, userPassword );
Map<EncryptionType, EncryptionKey> keys = generateKeys( principalName, userPassword );
@@ -158,10 +152,8 @@
entry.put( getKeyAttribute( keys ) );
- log.debug( "Adding modified entry " + AttributeUtils.toString( entry ) + " for DN = '"
- + normName.getUpName() + "'" );
-
- // Optionally discard userPassword.
+ log.debug( "Adding modified entry '{}' for DN '{}'.", AttributeUtils.toString( entry ), normName
+ .getUpName() );
}
next.add( addContext );
@@ -169,30 +161,57 @@
/**
- * Intercept the modification of the 'userPassword' attribute. Use the 'userPassword' and 'krb5PrincipalName'
- * attributes to derive Kerberos keys for the principal. If the 'userPassword' is the special keyword
- * 'randomKey', set random keys for the principal. Perform a lookup to check for an existing key version
- * number (kvno). If a kvno exists, increment the kvno; otherwise, set the kvno to '0'.
+ * Intercept the modification of the 'userPassword' attribute. Perform a lookup to check for an
+ * existing principal name and key version number (kvno). If a 'krb5PrincipalName' is not in
+ * the modify request, attempt to use an existing 'krb5PrincipalName' attribute. If a kvno
+ * exists, increment the kvno; otherwise, set the kvno to '0'.
+ *
+ * If both a 'userPassword' and 'krb5PrincipalName' can be found, use the 'userPassword' and
+ * 'krb5PrincipalName' attributes to derive Kerberos keys for the principal.
+ *
+ * If the 'userPassword' is the special keyword 'randomKey', set random keys for the principal.
*/
public void modify( NextInterceptor next, OperationContext opContext ) throws NamingException
{
- LdapDN name = opContext.getDn();
ModifyOperationContext modContext = ( ModifyOperationContext ) opContext;
+ ModifySubContext subContext = new ModifySubContext();
+
+ detectPasswordModification( modContext, subContext );
+
+ if ( subContext.getUserPassword() != null )
+ {
+ lookupPrincipalAttributes( modContext, subContext );
+ }
+
+ if ( subContext.isPrincipal() && subContext.hasValues() )
+ {
+ deriveKeys( modContext, subContext );
+ }
+ next.modify( modContext );
+ }
+
+
+ /**
+ * Detect password modification by checking the modify request for the 'userPassword'. Additionally,
+ * check to see if a 'krb5PrincipalName' was provided.
+ *
+ * @param modContext
+ * @param subContext
+ * @throws NamingException
+ */
+ void detectPasswordModification( ModifyOperationContext modContext, ModifySubContext subContext )
+ throws NamingException
+ {
ModificationItemImpl[] mods = modContext.getModItems();
- String userPassword = null;
- String principalName = null;
+ String operation = null;
// Loop over attributes being modified to pick out 'userPassword' and 'krb5PrincipalName'.
for ( int ii = 0; ii < mods.length; ii++ )
{
- Attribute attr = mods[ii].getAttribute();
-
if ( log.isDebugEnabled() )
{
- String operation = null;
-
switch ( mods[ii].getModificationOp() )
{
case DirContext.ADD_ATTRIBUTE:
@@ -205,10 +224,9 @@
operation = "Replacing";
break;
}
-
- log.debug( operation + " for entry '" + name.getUpName() + "' the attribute " + attr );
}
+ Attribute attr = mods[ii].getAttribute();
String attrId = attr.getID();
if ( attrId.equalsIgnoreCase( "userPassword" ) )
@@ -217,117 +235,138 @@
if ( firstValue instanceof String )
{
- log.debug( "Adding Attribute id : 'userPassword', Values : ['" + firstValue + "']" );
+ log.debug( "{} Attribute id : 'userPassword', Values : [ '{}' ]", operation, firstValue );
}
else if ( firstValue instanceof byte[] )
{
String string = StringTools.utf8ToString( ( byte[] ) firstValue );
- StringBuffer sb = new StringBuffer();
- sb.append( "'" + string + "' ( " );
- sb.append( StringTools.dumpBytes( ( byte[] ) firstValue ).trim() );
- log.debug( "Adding Attribute id : 'userPassword', Values : [ " + sb.toString() + " ) ]" );
+ if ( log.isDebugEnabled() )
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append( "'" + string + "' ( " );
+ sb.append( StringTools.dumpBytes( ( byte[] ) firstValue ).trim() );
+ sb.append( " )" );
+ log.debug( "{} Attribute id : 'userPassword', Values : [ {} ]", operation, sb.toString() );
+ }
+
firstValue = string;
}
- userPassword = ( String ) firstValue;
- log.debug( "Got userPassword " + userPassword + "." );
+ subContext.setUserPassword( ( String ) firstValue );
+ log.debug( "Got userPassword '{}'.", subContext.getUserPassword() );
}
if ( attrId.equalsIgnoreCase( KerberosAttribute.PRINCIPAL ) )
{
- principalName = ( String ) attr.get();
- log.debug( "Got principal " + principalName + "." );
- }
- }
-
- if ( userPassword != null && principalName != null )
- {
- log.debug( "Got principal " + principalName + " with userPassword " + userPassword );
-
- int kvno = lookupKeyVersionNumber( name );
-
- Map<EncryptionType, EncryptionKey> keys = generateKeys( principalName, userPassword );
-
- Set<ModificationItemImpl> newModsList = new HashSet<ModificationItemImpl>();
-
- // Make sure we preserve any other modification items.
- for ( int ii = 0; ii < mods.length; ii++ )
- {
- newModsList.add( mods[ii] );
+ subContext.setPrincipalName( ( String ) attr.get() );
+ log.debug( "Got principal '{}'.", subContext.getPrincipalName() );
}
-
- // Add our modification items.
- newModsList.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, new AttributeImpl(
- KerberosAttribute.PRINCIPAL, principalName ) ) );
- newModsList.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, new AttributeImpl(
- KerberosAttribute.VERSION, Integer.toString( kvno ) ) ) );
- newModsList.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, getKeyAttribute( keys ) ) );
-
- mods = newModsList.toArray( mods );
-
- modContext.setModItems( mods );
}
-
- next.modify( opContext );
}
/**
- * Lookup the principal entry's krb5KeyVersionNumber attribute.
+ * Lookup the principal's attributes that are relevant to executing key derivation.
*
- * @param principalDn
- * @return The principal entry's krb5KeyVersionNumber attribute.
+ * @param modContext
+ * @param subContext
* @throws NamingException
*/
- protected int lookupKeyVersionNumber( LdapDN principalDn ) throws NamingException
+ void lookupPrincipalAttributes( ModifyOperationContext modContext, ModifySubContext subContext )
+ throws NamingException
{
+ LdapDN principalDn = modContext.getDn();
+
Invocation invocation = InvocationStack.getInstance().peek();
PartitionNexusProxy proxy = invocation.getProxy();
Attributes userEntry;
- try
- {
- LookupOperationContext lookupContext = new LookupOperationContext( new String[]
- { KerberosAttribute.VERSION, KerberosAttribute.PRINCIPAL } );
- lookupContext.setDn( principalDn );
+ LookupOperationContext lookupContext = new LookupOperationContext( new String[]
+ { SchemaConstants.OBJECT_CLASS_AT, KerberosAttribute.PRINCIPAL, KerberosAttribute.VERSION } );
+ lookupContext.setDn( principalDn );
- userEntry = proxy.lookup( lookupContext, USERLOOKUP_BYPASS );
+ userEntry = proxy.lookup( lookupContext, USERLOOKUP_BYPASS );
- if ( userEntry == null )
- {
- throw new LdapAuthenticationException( "Failed to lookup user for authentication: " + principalDn );
- }
+ if ( userEntry == null )
+ {
+ throw new LdapAuthenticationException( "Failed to authenticate user '" + principalDn + "'." );
}
- catch ( Exception cause )
+
+ Attribute objectClass = userEntry.get( SchemaConstants.OBJECT_CLASS_AT );
+ if ( !objectClass.contains( "krb5principal" ) )
{
- log.error( "Authentication error : " + cause.getMessage() );
- LdapAuthenticationException e = new LdapAuthenticationException();
- e.setRootCause( e );
- throw e;
+ return;
+ }
+ else
+ {
+ subContext.isPrincipal( true );
+ log.debug( "DN {} is a Kerberos principal. Will attempt key derivation.", principalDn.getUpName() );
}
- int newKeyVersionNumber;
+ if ( subContext.getPrincipalName() == null )
+ {
+ Attribute principalAttribute = userEntry.get( KerberosAttribute.PRINCIPAL );
+ String principalName = ( String ) principalAttribute.get();
+ subContext.setPrincipalName( principalName );
+ log.debug( "Found principal '{}' from lookup.", principalName );
+ }
Attribute keyVersionNumberAttr = userEntry.get( KerberosAttribute.VERSION );
if ( keyVersionNumberAttr == null )
{
- log.debug( "kvno was null, setting to 0." );
- newKeyVersionNumber = 0;
+ subContext.setNewKeyVersionNumber( 0 );
+ log.debug( "Key version number was null, setting to 0." );
}
else
{
int oldKeyVersionNumber = Integer.valueOf( ( String ) keyVersionNumberAttr.get() );
- newKeyVersionNumber = oldKeyVersionNumber + 1;
- log.debug( "Found kvno '" + oldKeyVersionNumber + "', setting to '" + newKeyVersionNumber + "'." );
+ int newKeyVersionNumber = oldKeyVersionNumber + 1;
+ subContext.setNewKeyVersionNumber( newKeyVersionNumber );
+ log.debug( "Found key version number '{}', setting to '{}'.", oldKeyVersionNumber, newKeyVersionNumber );
+ }
+ }
+
+
+ /**
+ * Use the 'userPassword' and 'krb5PrincipalName' attributes to derive Kerberos keys for the principal.
+ *
+ * If the 'userPassword' is the special keyword 'randomKey', set random keys for the principal.
+ *
+ * @param modContext
+ * @param subContext
+ */
+ void deriveKeys( ModifyOperationContext modContext, ModifySubContext subContext )
+ {
+ ModificationItemImpl[] mods = modContext.getModItems();
+
+ String principalName = subContext.getPrincipalName();
+ String userPassword = subContext.getUserPassword();
+ int kvno = subContext.getNewKeyVersionNumber();
+
+ log.debug( "Got principal '{}' with userPassword '{}'.", principalName, userPassword );
+
+ Map<EncryptionType, EncryptionKey> keys = generateKeys( principalName, userPassword );
+
+ Set<ModificationItemImpl> newModsList = new HashSet<ModificationItemImpl>();
+
+ // Make sure we preserve any other modification items.
+ for ( int ii = 0; ii < mods.length; ii++ )
+ {
+ newModsList.add( mods[ii] );
}
- // TODO - We may wish to lookup the principal name if one is not present in the modification items.
- Attribute principalName = userEntry.get( KerberosAttribute.PRINCIPAL );
- log.debug( "Found principal = " + ( String ) principalName.get() );
+ // Add our modification items.
+ newModsList.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, new AttributeImpl(
+ KerberosAttribute.PRINCIPAL, principalName ) ) );
+ newModsList.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, new AttributeImpl(
+ KerberosAttribute.VERSION, Integer.toString( kvno ) ) ) );
+ newModsList.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, getKeyAttribute( keys ) ) );
- return newKeyVersionNumber;
+ ModificationItemImpl[] newMods = newModsList.toArray( mods );
+
+ modContext.setModItems( newMods );
}
@@ -372,6 +411,68 @@
{
// Derive key based on password and principal name.
return KerberosKeyFactory.getKerberosKeys( principalName, userPassword );
+ }
+ }
+
+ class ModifySubContext
+ {
+ private boolean isPrincipal = false;
+ private String principalName;
+ private String userPassword;
+ private int newKeyVersionNumber = -1;
+
+
+ boolean isPrincipal()
+ {
+ return isPrincipal;
+ }
+
+
+ void isPrincipal( boolean isPrincipal )
+ {
+ this.isPrincipal = isPrincipal;
+ }
+
+
+ String getPrincipalName()
+ {
+ return principalName;
+ }
+
+
+ void setPrincipalName( String principalName )
+ {
+ this.principalName = principalName;
+ }
+
+
+ String getUserPassword()
+ {
+ return userPassword;
+ }
+
+
+ void setUserPassword( String userPassword )
+ {
+ this.userPassword = userPassword;
+ }
+
+
+ int getNewKeyVersionNumber()
+ {
+ return newKeyVersionNumber;
+ }
+
+
+ void setNewKeyVersionNumber( int newKeyVersionNumber )
+ {
+ this.newKeyVersionNumber = newKeyVersionNumber;
+ }
+
+
+ boolean hasValues()
+ {
+ return userPassword != null && principalName != null && newKeyVersionNumber > -1;
}
}
}
Modified: directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyService.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyService.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyService.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyService.java Sat Jul 14 00:55:44 2007
@@ -70,7 +70,7 @@
Attributes entry = ( ( AddOperationContext ) addContext ).getEntry();
- log.debug( "Adding the entry " + AttributeUtils.toString( entry ) + " for DN = '" + normName.getUpName() + "'" );
+ log.debug( "Adding the entry '{}' for DN '{}'.", AttributeUtils.toString( entry ), normName.getUpName() );
Object attr = null;
@@ -83,17 +83,21 @@
if ( attr instanceof String )
{
- log.debug( "Adding Attribute id : 'userPassword', Values : ['" + attr + "']" );
+ log.debug( "Adding Attribute id : 'userPassword', Values : [ '{}' ]", attr );
userPassword = ( String ) attr;
}
else if ( attr instanceof byte[] )
{
String string = StringTools.utf8ToString( ( byte[] ) attr );
- StringBuffer sb = new StringBuffer();
- sb.append( "'" + string + "' ( " );
- sb.append( StringTools.dumpBytes( ( byte[] ) attr ).trim() );
- log.debug( "Adding Attribute id : 'userPassword', Values : [ " + sb.toString() + " ) ]" );
+ if ( log.isDebugEnabled() )
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append( "'" + string + "' ( " );
+ sb.append( StringTools.dumpBytes( ( byte[] ) attr ).trim() );
+ sb.append( " )" );
+ log.debug( "Adding Attribute id : 'userPassword', Values : [ {} ]", sb.toString() );
+ }
userPassword = string;
}
@@ -127,17 +131,20 @@
for ( int ii = 0; ii < mods.length; ii++ )
{
- switch ( mods[ii].getModificationOp() )
+ if ( log.isDebugEnabled() )
{
- case DirContext.ADD_ATTRIBUTE:
- operation = "Adding";
- break;
- case DirContext.REMOVE_ATTRIBUTE:
- operation = "Removing";
- break;
- case DirContext.REPLACE_ATTRIBUTE:
- operation = "Replacing";
- break;
+ switch ( mods[ii].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();
@@ -151,16 +158,20 @@
{
if ( userPassword instanceof String )
{
- log.debug( "Adding Attribute id : 'userPassword', Values : ['" + attr + "']" );
+ log.debug( "{} Attribute id : 'userPassword', Values : [ '{}' ]", operation, attr );
}
else if ( userPassword instanceof byte[] )
{
String string = StringTools.utf8ToString( ( byte[] ) userPassword );
- StringBuffer sb = new StringBuffer();
- sb.append( "'" + string + "' ( " );
- sb.append( StringTools.dumpBytes( ( byte[] ) userPassword ).trim() );
- log.debug( "Adding Attribute id : 'userPassword', Values : [ " + sb.toString() + " ) ]" );
+ if ( log.isDebugEnabled() )
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append( "'" + string + "' ( " );
+ sb.append( StringTools.dumpBytes( ( byte[] ) userPassword ).trim() );
+ sb.append( " )" );
+ log.debug( "{} Attribute id : 'userPassword', Values : [ {} ]", operation, sb.toString() );
+ }
userPassword = string;
}
@@ -170,7 +181,10 @@
}
}
- log.debug( operation + " for entry '" + name.getUpName() + "' the attribute " + mods[ii].getAttribute() );
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( operation + " for entry '" + name.getUpName() + "' the attribute " + mods[ii].getAttribute() );
+ }
}
next.modify( opContext );
Modified: directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationService.java Sat Jul 14 00:55:44 2007
@@ -70,9 +70,6 @@
{
/** logger used by this class */
private static final Logger log = LoggerFactory.getLogger( NormalizationService.class );
-
- /** The service name */
- public static final String NAME = "normalizationService";
/** a filter node value normalizer and undefined node remover */
private NormalizingVisitor normVisitor;
Modified: directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java Sat Jul 14 00:55:44 2007
@@ -77,9 +77,6 @@
*/
public class OperationalAttributeService extends BaseInterceptor
{
- /** The service name */
- public static final String NAME = "operationalAttributeService";
-
private final SearchResultFilter DENORMALIZING_SEARCH_FILTER = new SearchResultFilter()
{
public boolean accept( Invocation invocation, SearchResult result, SearchControls controls )
Modified: directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java Sat Jul 14 00:55:44 2007
@@ -89,7 +89,7 @@
}
}
}
-
+
/**
* Override this method to put your initialization code.
Modified: directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java Sat Jul 14 00:55:44 2007
@@ -54,6 +54,9 @@
import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
import org.apache.directory.server.core.partition.impl.btree.MutableBTreePartitionConfiguration;
import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
+import org.apache.directory.server.core.partition.tree.LeafNode;
+import org.apache.directory.server.core.partition.tree.Node;
+import org.apache.directory.server.core.partition.tree.BranchNode;
import org.apache.directory.server.ldap.constants.SupportedSASLMechanisms;
import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
import org.apache.directory.server.schema.registries.OidRegistry;
@@ -117,14 +120,14 @@
private DirectoryServiceConfiguration factoryCfg;
- /** the system backend */
+ /** the system partition */
private Partition system;
- /** the backends keyed by normalized suffix strings */
+ /** the partitions keyed by normalized suffix strings */
private Map<String, Partition> partitions = new HashMap<String, Partition>();
/** A structure to hold all the partitions */
- private PartitionStructure partitionList = new PartitionContainer();
+ private BranchNode partitionLookupTree = new BranchNode();
/** the read only rootDSE attributes */
private final Attributes rootDSE;
@@ -202,7 +205,19 @@
rootDSE.put( attr );
}
+
+ public PartitionConfiguration getConfiguration()
+ {
+ throw new UnsupportedOperationException( "The NEXUS partition does not have a " +
+ "standard partition configuration associated with it." );
+ }
+
+ public String getId()
+ {
+ return "NEXUS";
+ }
+
public void init( DirectoryServiceConfiguration factoryCfg, PartitionConfiguration cfg )
throws NamingException
{
@@ -216,8 +231,9 @@
this.attrRegistry = this.factoryCfg.getRegistries().getAttributeTypeRegistry();
this.oidRegistry = this.factoryCfg.getRegistries().getOidRegistry();
- List<PartitionConfiguration> initializedPartitionCfgs = new ArrayList<PartitionConfiguration>();
- initializedPartitionCfgs.add( initializeSystemPartition() );
+ initializeSystemPartition();
+ List<Partition> initializedPartitions = new ArrayList<Partition>();
+ initializedPartitions.add( 0, this.system );
Iterator i = factoryCfg.getStartupConfiguration().getPartitionConfigurations().iterator();
try
@@ -225,8 +241,9 @@
while ( i.hasNext() )
{
PartitionConfiguration c = ( PartitionConfiguration ) i.next();
- addContextPartition( new AddContextPartitionOperationContext( c ) );
- initializedPartitionCfgs.add( 0, c );
+ AddContextPartitionOperationContext opCtx = new AddContextPartitionOperationContext( c );
+ addContextPartition( opCtx );
+ initializedPartitions.add( opCtx.getPartition() );
}
initialized = true;
}
@@ -234,11 +251,10 @@
{
if ( !initialized )
{
- i = initializedPartitionCfgs.iterator();
+ i = initializedPartitions.iterator();
while ( i.hasNext() )
{
- PartitionConfiguration partitionCfg = ( PartitionConfiguration ) i.next();
- Partition partition = partitionCfg.getContextPartition();
+ Partition partition = ( Partition ) i.next();
i.remove();
try
{
@@ -246,7 +262,7 @@
}
catch ( Exception e )
{
- log.warn( "Failed to destroy a partition: " + partitionCfg.getSuffix(), e );
+ log.warn( "Failed to destroy a partition: " + partition.getSuffix(), e );
}
finally
{
@@ -292,7 +308,7 @@
// check a few things to make sure users configured it properly
// ---------------------------------------------------------------
- if ( ! systemCfg.getName().equals( "system" ) )
+ if ( ! systemCfg.getId().equals( "system" ) )
{
throw new ConfigurationException( "System partition has wrong name: should be 'system'." );
}
@@ -353,7 +369,7 @@
else
{
systemCfg = new MutableBTreePartitionConfiguration();
- systemCfg.setName( "system" );
+ systemCfg.setId( "system" );
// @TODO need to make this configurable for the system partition
systemCfg.setCacheSize( 500 );
@@ -361,7 +377,7 @@
systemCfg.setSuffix( PartitionNexus.SYSTEM_PARTITION_SUFFIX );
// Add indexed attributes for system partition
- Set<String> indexedSystemAttrs = new HashSet<String>();
+ Set<Object> indexedSystemAttrs = new HashSet<Object>();
indexedSystemAttrs.add( Oid.ALIAS );
indexedSystemAttrs.add( Oid.EXISTANCE );
indexedSystemAttrs.add( Oid.HIERARCHY );
@@ -388,7 +404,6 @@
system = new JdbmPartition(); // using default implementation.
system.init( factoryCfg, systemCfg );
- systemCfg.setContextPartition( system );
String key = system.getSuffix().toString();
if ( partitions.containsKey( key ) )
@@ -396,11 +411,10 @@
throw new ConfigurationException( "Duplicate partition suffix: " + key );
}
- synchronized ( partitionList )
+ synchronized ( partitionLookupTree )
{
partitions.put( key, system );
-
- partitionList.buildPartitionStructure( partitionList, system.getSuffix(), 0, system );
+ partitionLookupTree.recursivelyAddPartition( partitionLookupTree, system.getSuffix(), 0, system );
Attribute namingContexts = rootDSE.get( NAMINGCTXS_ATTR );
namingContexts.add( system.getUpSuffix().getUpName() );
@@ -489,7 +503,7 @@
public boolean compare( OperationContext compareContext ) throws NamingException
{
- Partition partition = getBackend( compareContext.getDn() );
+ Partition partition = getPartition( compareContext.getDn() );
AttributeTypeRegistry registry = factoryCfg.getRegistries().getAttributeTypeRegistry();
CompareOperationContext ctx = (CompareOperationContext)compareContext;
@@ -558,8 +572,10 @@
public synchronized void addContextPartition( OperationContext addContextPartitionContext ) throws NamingException
{
- PartitionConfiguration config = ((AddContextPartitionOperationContext)addContextPartitionContext).getCfg();
- Partition partition = config.getContextPartition();
+ AddContextPartitionOperationContext operationContext =
+ ( AddContextPartitionOperationContext ) addContextPartitionContext;
+ PartitionConfiguration config = operationContext.getPartitionConfiguration();
+ Partition partition = operationContext.getPartition();
// Turn on default indices
String key = config.getSuffix();
@@ -574,11 +590,10 @@
partition.init( factoryCfg, config );
}
- synchronized ( partitionList )
+ synchronized ( partitionLookupTree )
{
partitions.put( partition.getSuffix().toString(), partition );
-
- partitionList.buildPartitionStructure( partitionList, partition.getSuffix(), 0, partition );
+ partitionLookupTree.recursivelyAddPartition( partitionLookupTree, partition.getSuffix(), 0, partition );
Attribute namingContexts = rootDSE.get( NAMINGCTXS_ATTR );
namingContexts.add( partition.getUpSuffix().getUpName() );
@@ -603,15 +618,15 @@
// This is easier to create a new structure from scratch than to reorganize
// the current structure. As this strcuture is not modified often
// this is an acceptable solution.
- synchronized (partitionList)
+ synchronized (partitionLookupTree)
{
partitions.remove( key );
- partitionList = new PartitionContainer();
+ partitionLookupTree = new BranchNode();
for ( Partition part:partitions.values() )
{
- partitionList.buildPartitionStructure( partitionList, part.getSuffix(), 0, partition );
+ partitionLookupTree.recursivelyAddPartition( partitionLookupTree, part.getSuffix(), 0, partition );
}
partition.sync();
@@ -672,7 +687,7 @@
*/
public LdapDN getSuffix ( OperationContext getSuffixContext ) throws NamingException
{
- Partition backend = getBackend( getSuffixContext.getDn() );
+ Partition backend = getPartition( getSuffixContext.getDn() );
return backend.getSuffix();
}
@@ -717,13 +732,13 @@
// ------------------------------------------------------------------------
public void bind( OperationContext bindContext ) throws NamingException
{
- Partition partition = getBackend( bindContext.getDn() );
+ Partition partition = getPartition( bindContext.getDn() );
partition.bind( bindContext );
}
public void unbind( OperationContext unbindContext ) throws NamingException
{
- Partition partition = getBackend( unbindContext.getDn() );
+ Partition partition = getPartition( unbindContext.getDn() );
partition.unbind( unbindContext );
}
@@ -733,7 +748,7 @@
*/
public void delete( OperationContext deleteContext ) throws NamingException
{
- Partition backend = getBackend( deleteContext.getDn() );
+ Partition backend = getPartition( deleteContext.getDn() );
backend.delete( deleteContext );
}
@@ -749,7 +764,7 @@
*/
public void add( OperationContext addContext ) throws NamingException
{
- Partition backend = getBackend( addContext.getDn() );
+ Partition backend = getPartition( addContext.getDn() );
backend.add( addContext );
}
@@ -759,7 +774,7 @@
*/
public void modify( OperationContext modifyContext ) throws NamingException
{
- Partition backend = getBackend( modifyContext.getDn() );
+ Partition backend = getPartition( modifyContext.getDn() );
backend.modify( modifyContext );
}
@@ -769,7 +784,7 @@
*/
public NamingEnumeration list( OperationContext opContext ) throws NamingException
{
- Partition backend = getBackend( opContext.getDn() );
+ Partition backend = getPartition( opContext.getDn() );
return backend.list( opContext );
}
@@ -918,7 +933,7 @@
throw new LdapNameNotFoundException();
}
- Partition backend = getBackend( base );
+ Partition backend = getPartition( base );
return backend.search( opContext );
}
@@ -963,7 +978,7 @@
return retval;
}
- Partition backend = getBackend( dn );
+ Partition backend = getPartition( dn );
return backend.lookup( ctx );
}
@@ -985,7 +1000,7 @@
return true;
}
- Partition backend = getBackend( dn );
+ Partition backend = getPartition( dn );
return backend.hasEntry( opContext );
}
@@ -995,7 +1010,7 @@
*/
public void rename( OperationContext opContext ) throws NamingException
{
- Partition backend = getBackend( opContext.getDn() );
+ Partition backend = getPartition( opContext.getDn() );
backend.rename( opContext );
}
@@ -1005,7 +1020,7 @@
*/
public void move( OperationContext opContext ) throws NamingException
{
- Partition backend = getBackend( opContext.getDn() );
+ Partition backend = getPartition( opContext.getDn() );
backend.move( opContext );
}
@@ -1015,48 +1030,51 @@
*/
public void moveAndRename( OperationContext opContext ) throws NamingException
{
- Partition backend = getBackend( opContext.getDn() );
+ Partition backend = getPartition( opContext.getDn() );
backend.moveAndRename( opContext );
}
- // ------------------------------------------------------------------------
- // Private Methods
- // ------------------------------------------------------------------------
-
/**
- * Gets the backend partition associated with a normalized dn.
+ * Gets the partition associated with a normalized dn.
*
- * @param dn the normalized distinguished name to resolve to a backend
+ * @param dn the normalized distinguished name to resolve to a partition
* @return the backend partition associated with the normalized dn
- * @throws NamingException if the name cannot be resolved to a backend
+ * @throws NamingException if the name cannot be resolved to a partition
*/
- private Partition getBackend( LdapDN dn ) throws NamingException
+ public Partition getPartition( LdapDN dn ) throws NamingException
{
Enumeration<String> rdns = dn.getAll();
- PartitionStructure currentPartition = partitionList;
+ Node currentNode = partitionLookupTree;
// This is synchronized so that we can't read the
// partitionList when it is modified.
- synchronized ( partitionList )
+ synchronized ( partitionLookupTree )
{
// Iterate through all the RDN until we find the associated partition
while ( rdns.hasMoreElements() )
{
String rdn = rdns.nextElement();
+
+ if ( currentNode == null )
+ {
+ break;
+ }
- if ( currentPartition.contains( rdn ) )
+ if ( currentNode instanceof LeafNode )
{
- currentPartition = currentPartition.getPartition( rdn );
-
- if ( currentPartition.isPartition() )
- {
- return currentPartition.getPartition();
- }
+ return ( ( LeafNode ) currentNode ).getPartition();
}
- else
+
+ BranchNode currentBranch = ( BranchNode ) currentNode;
+ if ( currentBranch.contains( rdn ) )
{
- break;
+ currentNode = currentBranch.getChild( rdn );
+
+ if ( currentNode instanceof LeafNode )
+ {
+ return ( ( LeafNode ) currentNode ).getPartition();
+ }
}
}
}
@@ -1065,10 +1083,9 @@
}
- public Partition getPartition( LdapDN dn ) throws NamingException
- {
- return getBackend( dn );
- }
+ // ------------------------------------------------------------------------
+ // Private Methods
+ // ------------------------------------------------------------------------
public void registerSupportedExtensions( Set extensionOids )
Modified: directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/partition/Partition.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/partition/Partition.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/partition/Partition.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/partition/Partition.java Sat Jul 14 00:55:44 2007
@@ -46,6 +46,22 @@
public interface Partition
{
/**
+ * Get's the configuration for this partition.
+ *
+ * @return the configuration for this partition.
+ */
+ PartitionConfiguration getConfiguration();
+
+
+ /**
+ * Get's the unique identifier for this partition.
+ *
+ * @return the unique identifier for this partition
+ */
+ String getId();
+
+
+ /**
* Initializes this partition.
*/
void init( DirectoryServiceConfiguration factoryCfg, PartitionConfiguration cfg ) throws NamingException;
Modified: directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java Sat Jul 14 00:55:44 2007
@@ -41,10 +41,8 @@
import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.DirectoryServiceConfiguration;
-import org.apache.directory.server.core.authn.AuthenticationService;
-import org.apache.directory.server.core.authz.AuthorizationService;
-import org.apache.directory.server.core.authz.DefaultAuthorizationService;
import org.apache.directory.server.core.configuration.PartitionConfiguration;
+import org.apache.directory.server.core.configuration.StartupConfiguration;
import org.apache.directory.server.core.enumeration.SearchResultFilter;
import org.apache.directory.server.core.enumeration.SearchResultFilteringEnumeration;
import org.apache.directory.server.core.event.EventService;
@@ -54,12 +52,6 @@
import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
import org.apache.directory.server.core.invocation.Invocation;
import org.apache.directory.server.core.invocation.InvocationStack;
-import org.apache.directory.server.core.normalization.NormalizationService;
-import org.apache.directory.server.core.operational.OperationalAttributeService;
-import org.apache.directory.server.core.referral.ReferralService;
-import org.apache.directory.server.core.schema.SchemaService;
-import org.apache.directory.server.core.subtree.SubentryService;
-import org.apache.directory.server.core.trigger.TriggerService;
import org.apache.directory.shared.ldap.exception.LdapSizeLimitExceededException;
import org.apache.directory.shared.ldap.exception.LdapTimeLimitExceededException;
import org.apache.directory.shared.ldap.filter.ExprNode;
@@ -112,38 +104,38 @@
static
{
Collection<String> c = new HashSet<String>();
- c.add( NormalizationService.NAME );
- c.add( AuthenticationService.NAME );
- c.add( AuthorizationService.NAME );
- c.add( DefaultAuthorizationService.NAME );
- c.add( SchemaService.NAME );
- c.add( SubentryService.NAME );
- c.add( OperationalAttributeService.NAME );
- c.add( ReferralService.NAME );
- c.add( EventService.NAME );
+ c.add( StartupConfiguration.NORMALIZATION_SERVICE_NAME );
+ c.add( StartupConfiguration.AUTHENTICATION_SERVICE_NAME );
+ c.add( StartupConfiguration.AUTHORIZATION_SERVICE_NAME );
+ c.add( StartupConfiguration.DEFAULT_AUTHORIZATION_SERVICE_NAME );
+ c.add( StartupConfiguration.SCHEMA_SERVICE_NAME );
+ c.add( StartupConfiguration.SUBENTRY_SERVICE_NAME );
+ c.add( StartupConfiguration.OPERATIONAL_ATTRIBUTE_SERVICE_NAME );
+ c.add( StartupConfiguration.REFERRAL_SERVICE_NAME );
+ c.add( StartupConfiguration.EVENT_SERVICE_NAME );
LOOKUP_BYPASS = Collections.unmodifiableCollection( c );
c = new HashSet<String>();
- c.add( AuthenticationService.NAME );
- c.add( AuthorizationService.NAME );
- c.add( DefaultAuthorizationService.NAME );
- c.add( SchemaService.NAME );
- c.add( SubentryService.NAME );
- c.add( OperationalAttributeService.NAME );
- c.add( ReferralService.NAME );
- c.add( EventService.NAME );
+ c.add( StartupConfiguration.AUTHENTICATION_SERVICE_NAME );
+ c.add( StartupConfiguration.AUTHORIZATION_SERVICE_NAME );
+ c.add( StartupConfiguration.DEFAULT_AUTHORIZATION_SERVICE_NAME );
+ c.add( StartupConfiguration.SCHEMA_SERVICE_NAME );
+ c.add( StartupConfiguration.SUBENTRY_SERVICE_NAME );
+ c.add( StartupConfiguration.OPERATIONAL_ATTRIBUTE_SERVICE_NAME );
+ c.add( StartupConfiguration.REFERRAL_SERVICE_NAME );
+ c.add( StartupConfiguration.EVENT_SERVICE_NAME );
GETMATCHEDDN_BYPASS = Collections.unmodifiableCollection( c );
c = new HashSet<String>();
- c.add( NormalizationService.NAME );
- c.add( AuthenticationService.NAME );
- c.add( AuthorizationService.NAME );
- c.add( DefaultAuthorizationService.NAME );
- c.add( SchemaService.NAME );
- c.add( SubentryService.NAME );
- c.add( ReferralService.NAME );
- c.add( EventService.NAME );
- c.add( TriggerService.NAME );
+ c.add( StartupConfiguration.NORMALIZATION_SERVICE_NAME );
+ c.add( StartupConfiguration.AUTHENTICATION_SERVICE_NAME );
+ c.add( StartupConfiguration.AUTHORIZATION_SERVICE_NAME );
+ c.add( StartupConfiguration.DEFAULT_AUTHORIZATION_SERVICE_NAME );
+ c.add( StartupConfiguration.SCHEMA_SERVICE_NAME );
+ c.add( StartupConfiguration.SUBENTRY_SERVICE_NAME );
+ c.add( StartupConfiguration.REFERRAL_SERVICE_NAME );
+ c.add( StartupConfiguration.EVENT_SERVICE_NAME );
+ c.add( StartupConfiguration.TRIGGER_SERVICE_NAME );
LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS = Collections.unmodifiableCollection( c );
}
@@ -167,7 +159,20 @@
return this.configuration.getPartitionNexus().getLdapContext();
}
+
+ public String getId()
+ {
+ throw new UnsupportedOperationException( "Nexus partition proxy objects do not have an Id." );
+ }
+
+
+ public PartitionConfiguration getConfiguration()
+ {
+ throw new UnsupportedOperationException( "Nexus partition proxy objects do not have a " +
+ "partition configuration." );
+ }
+
public void init( DirectoryServiceConfiguration factoryCfg, PartitionConfiguration cfg ) throws NamingException
{
}
@@ -790,7 +795,7 @@
NamingListener namingListener ) throws NamingException
{
InterceptorChain chain = this.configuration.getInterceptorChain();
- EventService interceptor = ( EventService ) chain.get( EventService.NAME );
+ EventService interceptor = ( EventService ) chain.get( StartupConfiguration.EVENT_SERVICE_NAME );
interceptor.addNamingListener( ctx, name, filter, searchControls, namingListener );
}
@@ -802,7 +807,7 @@
{
return;
}
- EventService interceptor = ( EventService ) chain.get( EventService.NAME );
+ EventService interceptor = ( EventService ) chain.get( StartupConfiguration.EVENT_SERVICE_NAME );
interceptor.removeNamingListener( ctx, namingListener );
}
}
Modified: directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java Sat Jul 14 00:55:44 2007
@@ -65,7 +65,8 @@
/** the search engine used to search the database */
private SearchEngine searchEngine = null;
- private Optimizer optimizer = new NoOpOptimizer();
+ private Optimizer optimizer;
+ private BTreePartitionConfiguration cfg;
protected AttributeTypeRegistry attributeTypeRegistry = null;
protected OidRegistry oidRegistry = null;
@@ -83,6 +84,18 @@
}
+ public BTreePartitionConfiguration getConfiguration()
+ {
+ return cfg;
+ }
+
+
+ public String getId()
+ {
+ return cfg.getId();
+ }
+
+
/**
* Allows for schema entity registries to be swapped out during runtime. This is
* primarily here to facilitate the swap out of a temporary bootstrap registry.
@@ -338,22 +351,32 @@
*
* @param cfg
*/
- protected void initOptimizer0( PartitionConfiguration cfg )
+ protected void initOptimizerAndConfiguration0( PartitionConfiguration cfg ) throws NamingException
{
if ( cfg instanceof BTreePartitionConfiguration )
{
- if ( ( ( BTreePartitionConfiguration ) cfg ).isOptimizerEnabled() )
+ this.cfg = ( BTreePartitionConfiguration ) cfg;
+ if ( ! this.cfg.isOptimizerEnabled() )
+ {
+ optimizer = new NoOpOptimizer();
+ }
+ else
{
optimizer = new DefaultOptimizer( this );
}
}
+ else
+ {
+ this.cfg = BTreePartitionConfiguration.convert( cfg );
+ optimizer = new DefaultOptimizer( this );
+ }
}
public void init( DirectoryServiceConfiguration factoryCfg, PartitionConfiguration cfg )
throws NamingException
{
- initOptimizer0( cfg );
+ initOptimizerAndConfiguration0( cfg );
initRegistries1( factoryCfg.getRegistries() );
initIndices2( cfg.getIndexedAttributes() );
initSuffixEntry3( cfg.getSuffix(), cfg.getContextEntry() );
Modified: directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartitionConfiguration.java
URL: http://svn.apache.org/viewvc/directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartitionConfiguration.java?view=diff&rev=556238&r1=556237&r2=556238
==============================================================================
--- directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartitionConfiguration.java (original)
+++ directory/sandbox/ccustine/new_installers/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartitionConfiguration.java Sat Jul 14 00:55:44 2007
@@ -77,9 +77,9 @@
BTreePartitionConfiguration newConfig = new BTreePartitionConfiguration();
newConfig.setCacheSize( config.getCacheSize() );
newConfig.setContextEntry( config.getContextEntry() );
- newConfig.setContextPartition( config.getContextPartition() );
+ newConfig.setPartitionClassName( config.getPartitionClassName() );
newConfig.setIndexedAttributes( config.getIndexedAttributes() );
- newConfig.setName( config.getName() );
+ newConfig.setId( config.getId() );
newConfig.setSuffix( config.getSuffix() );
return newConfig;
}