You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by tr...@apache.org on 2005/06/23 16:54:59 UTC
svn commit: r193154 - in
/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server:
authn/ configuration/ interceptor/ jndi/ normalization/ operational/
partition/ partition/impl/btree/ partition/impl/btree/jdbm/
Author: trustin
Date: Thu Jun 23 07:54:58 2005
New Revision: 193154
URL: http://svn.apache.org/viewcvs?rev=193154&view=rev
Log:
* Revised JavaDoc for jndi package
* Add a new interface separated from ContextFactoryConfiguration: ContextFactoryService
* Made access modifiers for internal classes to 'package'.
Added:
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ContextFactoryService.java (with props)
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ContextFactoryServiceListener.java (with props)
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/DefaultContextFactoryService.java
- copied, changed from r193130, directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/DefaultContextFactoryConfiguration.java
Removed:
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/DefaultContextFactoryConfiguration.java
Modified:
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/authn/AnonymousAuthenticator.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/authn/AuthenticationService.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/configuration/AttributesPropertyEditor.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/configuration/Configuration.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/configuration/SyncConfiguration.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/interceptor/Interceptor.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/interceptor/InterceptorChain.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/AbstractContextFactory.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ContextFactoryConfiguration.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ContextPartitionNexusProxy.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/CoreContextFactory.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/DeadContext.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/JavaLdapSupport.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ServerContext.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ServerDirContext.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ServerDirObjectFactory.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ServerLdapContext.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/normalization/NormalizationService.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/operational/OperationalAttributeService.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/AbstractContextPartition.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/ContextPartition.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/DefaultContextPartitionNexus.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/impl/btree/BTreeContextPartition.java
directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/impl/btree/jdbm/JdbmContextPartition.java
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/authn/AnonymousAuthenticator.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/authn/AnonymousAuthenticator.java?rev=193154&r1=193153&r2=193154&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/authn/AnonymousAuthenticator.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/authn/AnonymousAuthenticator.java Thu Jun 23 07:54:58 2005
@@ -43,7 +43,7 @@
*/
public LdapPrincipal authenticate( ServerContext ctx ) throws NamingException
{
- if ( getFactoryConfiguration().getConfiguration().isAllowAnonymousAccess() )
+ if ( getFactoryConfiguration().getStartupConfiguration().isAllowAnonymousAccess() )
{
return LdapPrincipal.ANONYMOUS ;
}
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/authn/AuthenticationService.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/authn/AuthenticationService.java?rev=193154&r1=193153&r2=193154&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/authn/AuthenticationService.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/authn/AuthenticationService.java Thu Jun 23 07:54:58 2005
@@ -75,7 +75,7 @@
this.factoryCfg = factoryCfg;
// Register all authenticators
- Iterator i = factoryCfg.getConfiguration().getAuthenticatorConfigurations().iterator();
+ Iterator i = factoryCfg.getStartupConfiguration().getAuthenticatorConfigurations().iterator();
while( i.hasNext() )
{
try
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/configuration/AttributesPropertyEditor.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/configuration/AttributesPropertyEditor.java?rev=193154&r1=193153&r2=193154&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/configuration/AttributesPropertyEditor.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/configuration/AttributesPropertyEditor.java Thu Jun 23 07:54:58 2005
@@ -36,12 +36,13 @@
import org.apache.ldap.common.ldif.LdifParser;
import org.apache.ldap.common.ldif.LdifParserImpl;
import org.apache.ldap.common.util.MultiMap;
+import org.apache.ldap.server.jndi.ContextFactoryService;
/**
* A JavaBeans {@link PropertyEditor} that can convert {@link Attributes}
* to LDIF string and vice versa. This class is useful when you're going
- * to configure a context factory with 3rd party containers such as
- * <a href="http://www.springframework.org/">Spring Framework</a>.
+ * to configure a {@link ContextFactoryService} with 3rd party containers
+ * such as <a href="http://www.springframework.org/">Spring Framework</a>.
*
* @author The Apache Directory Project
* @version $Rev$, $Date$
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/configuration/Configuration.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/configuration/Configuration.java?rev=193154&r1=193153&r2=193154&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/configuration/Configuration.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/configuration/Configuration.java Thu Jun 23 07:54:58 2005
@@ -21,9 +21,11 @@
import java.io.Serializable;
import java.util.Hashtable;
+import org.apache.ldap.server.jndi.ContextFactoryService;
+
/**
* A configuration that provides required, optional, or default properties
- * to configure context factory.
+ * to configure {@link ContextFactoryService}.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/configuration/SyncConfiguration.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/configuration/SyncConfiguration.java?rev=193154&r1=193153&r2=193154&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/configuration/SyncConfiguration.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/configuration/SyncConfiguration.java Thu Jun 23 07:54:58 2005
@@ -18,13 +18,10 @@
*/
package org.apache.ldap.server.configuration;
-import org.apache.ldap.server.partition.ContextPartition;
-import org.apache.ldap.server.partition.ContextPartitionNexus;
+import org.apache.ldap.server.jndi.ContextFactoryService;
/**
- * A {@link Configuration} that makes context factory to call
- * {@link ContextPartition#sync()} for all partitions that are registered
- * to {@link ContextPartitionNexus}.
+ * A {@link Configuration} that makes a call to {@link ContextFactoryService#sync()}.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/interceptor/Interceptor.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/interceptor/Interceptor.java?rev=193154&r1=193153&r2=193154&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/interceptor/Interceptor.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/interceptor/Interceptor.java Thu Jun 23 07:54:58 2005
@@ -100,14 +100,14 @@
public interface Interceptor
{
/**
- * Intializes this interceptor. This is invoked by context factory
+ * Intializes this interceptor. This is invoked by {@link InterceptorChain}
* when this intercepter is loaded into interceptor chain.
*/
void init( ContextFactoryConfiguration factoryCfg, InterceptorConfiguration cfg ) throws NamingException;
/**
- * Deinitializes this interceptor. This is invoked by context factory
+ * Deinitializes this interceptor. This is invoked by {@link InterceptorChain}
* when this intercepter is unloaded from interceptor chain.
*/
void destroy();
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/interceptor/InterceptorChain.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/interceptor/InterceptorChain.java?rev=193154&r1=193153&r2=193154&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/interceptor/InterceptorChain.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/interceptor/InterceptorChain.java Thu Jun 23 07:54:58 2005
@@ -198,7 +198,7 @@
FINAL_INTERCEPTOR.init( factoryCfg, null );
// And register and initialize all interceptors
- ListIterator i = factoryCfg.getConfiguration().getInterceptorConfigurations().listIterator();
+ ListIterator i = factoryCfg.getStartupConfiguration().getInterceptorConfigurations().listIterator();
Interceptor interceptor = null;
try
{
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/AbstractContextFactory.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/AbstractContextFactory.java?rev=193154&r1=193153&r2=193154&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/AbstractContextFactory.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/AbstractContextFactory.java Thu Jun 23 07:54:58 2005
@@ -21,6 +21,7 @@
import javax.naming.ConfigurationException;
import javax.naming.Context;
+import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.naming.spi.InitialContextFactory;
@@ -28,13 +29,12 @@
import org.apache.ldap.server.configuration.ShutdownConfiguration;
import org.apache.ldap.server.configuration.StartupConfiguration;
import org.apache.ldap.server.configuration.SyncConfiguration;
-import org.apache.ldap.server.partition.ContextPartition;
/**
- * A server-side provider implementation of {@link InitialContextFactory}.
+ * A server-side JNDI provider implementation of {@link InitialContextFactory}.
* This class can be utilized via JNDI API in the standard fashion:
- *
+ * <p>
* <code>
* Hashtable env = new Hashtable();
* env.put( Context.PROVIDER_URL, "ou=system" );
@@ -42,20 +42,31 @@
* Context.INITIAL_CONTEXT_FACTORY, "org.apache.ldap.server.jndi.CoreContextFactory" );
* InitialContext initialContext = new InitialContext( env );
* </code>
- *
+ * <p>
+ * Unfortunately, {@link InitialContext} creates a new instance of
+ * {@link InitialContextFactory} implementation everytime it is instantiated,
+ * so this factory maintains only a static, singleton instance of
+ * {@link ContextFactoryService}, which provides actual implementation.
+ * Please note that you'll also have to maintain any stateful information
+ * as using singleton pattern if you're going to extend this factory.
+ * <p>
+ * This class implements {@link ContextFactoryServiceListener}. This means that
+ * you can listen to the changes occurs to {@link ContextFactoryService}, and
+ * react to it (e.g. executing additional business logic).
+ *
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*
* @see javax.naming.spi.InitialContextFactory
*/
-public abstract class AbstractContextFactory implements InitialContextFactory
+public abstract class AbstractContextFactory implements InitialContextFactory, ContextFactoryServiceListener
{
// ------------------------------------------------------------------------
// Members
// ------------------------------------------------------------------------
- /** The singleton JndiProvider instance */
- private static final ContextFactoryConfiguration provider = new DefaultContextFactoryConfiguration();
+ /** The singleton service instance */
+ private static final ContextFactoryService service = new DefaultContextFactoryService();
/**
* Creates a new instance.
@@ -77,22 +88,22 @@
// Execute configuration
if( cfg instanceof ShutdownConfiguration )
{
- provider.shutdown();
+ ( ( DefaultContextFactoryService ) service ).shutdown();
}
else if( cfg instanceof SyncConfiguration )
{
- provider.sync();
+ service.sync();
}
else if( cfg instanceof StartupConfiguration )
{
- ( ( DefaultContextFactoryConfiguration ) provider ).startup( this, env );
+ service.startup( this, env );
}
- else if( provider == null )
+ else if( service == null )
{
throw new NamingException( "Unknown configuration: " + cfg );
}
- return provider.getJndiContext( principal, credential, authentication, providerUrl );
+ return service.getConfiguration().getJndiContext( principal, credential, authentication, providerUrl );
}
private String extractProviderUrl( Hashtable env )
@@ -160,29 +171,4 @@
}
return principal;
}
-
- /**
- * Invoked before starting up JNDI provider.
- */
- protected abstract void beforeStartup( ContextFactoryConfiguration ctx ) throws NamingException;
- /**
- * Invoked after starting up JNDI provider.
- */
- protected abstract void afterStartup( ContextFactoryConfiguration ctx ) throws NamingException;
- /**
- * Invoked before shutting down JNDI provider.
- */
- protected abstract void beforeShutdown( ContextFactoryConfiguration ctx ) throws NamingException;
- /**
- * Invoked after shutting down JNDI provider.
- */
- protected abstract void afterShutdown( ContextFactoryConfiguration ctx ) throws NamingException;
- /**
- * Invoked before calling {@link ContextPartition#sync()} for all registered {@link ContextPartition}s.
- */
- protected abstract void beforeSync( ContextFactoryConfiguration ctx ) throws NamingException;
- /**
- * Invoked after calling {@link ContextPartition#sync()} for all registered {@link ContextPartition}s.
- */
- protected abstract void afterSync( ContextFactoryConfiguration ctx ) throws NamingException;
}
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ContextFactoryConfiguration.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ContextFactoryConfiguration.java?rev=193154&r1=193153&r2=193154&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ContextFactoryConfiguration.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ContextFactoryConfiguration.java Thu Jun 23 07:54:58 2005
@@ -26,49 +26,54 @@
import org.apache.ldap.server.partition.ContextPartitionNexus;
import org.apache.ldap.server.schema.GlobalRegistries;
-/** FIXME Rename to ContextFactoryContext */
+/**
+ * Represents the global configuration of currently running
+ * {@link ContextFactoryService}. You can access all properties of
+ * {@link ContextFactoryService} and get JNDI {@link Context}s it provides
+ * via this interface.
+ */
public interface ContextFactoryConfiguration
{
/**
- * Returns the initial context environment of this context factory.
+ * Returns the initial context environment of the {@link ContextFactoryService}.
*/
Hashtable getEnvironment();
/**
- * Returns the startup configuration of this context factory.
+ * Returns the startup configuration of the {@link ContextFactoryService}.
*/
- StartupConfiguration getConfiguration();
+ StartupConfiguration getStartupConfiguration();
/**
- * Returns the registries for system schema objects
+ * Returns the registries for system schema objects of the {@link ContextFactoryService}.
*/
GlobalRegistries getGlobalRegistries();
/**
- * Returns the root nexus of this context factory.
+ * Returns the {@link ContextPartitionNexus} of the {@link ContextFactoryService}.
*/
ContextPartitionNexus getPartitionNexus();
/**
- * Returns the interceptor chain of this context factory
+ * Returns the interceptor chain of the {@link ContextFactoryService}.
*/
InterceptorChain getInterceptorChain();
/**
- * Returns <tt>true</tt> if this context is started for the first time
- * and bootstrap entries have been created.
+ * Returns an anonymous JNDI {@link Context} with the specified <tt>baseName</tt>
+ * @throws NamingException if failed to create a context
*/
- boolean isFirstStart();
+ Context getJndiContext( String baseName ) throws NamingException;
/**
- * Returns <tt>true</tt> if this context is started.
+ * Returns a JNDI {@link Context} with the specified authentication information
+ * (<tt>principal</tt>, <tt>credential</tt>, and <tt>authentication</tt>) and
+ * <tt>baseName</tt>.
+ *
+ * @param principal {@link Context#SECURITY_PRINCIPAL} value
+ * @param credential {@link Context#SECURITY_CREDENTIALS} value
+ * @param authentication {@link Context#SECURITY_AUTHENTICATION} value
+ * @throws NamingException if failed to create a context
*/
- boolean isStarted();
-
- Context getJndiContext( String rootDN ) throws NamingException;
- Context getJndiContext( String principal, byte[] credential, String authentication, String rootDN ) throws NamingException;
-
- void sync() throws NamingException;
-
- void shutdown() throws NamingException;
+ Context getJndiContext( String principal, byte[] credential, String authentication, String baseName ) throws NamingException;
}
Added: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ContextFactoryService.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ContextFactoryService.java?rev=193154&view=auto
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ContextFactoryService.java (added)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ContextFactoryService.java Thu Jun 23 07:54:58 2005
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed 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.
+ *
+ */
+package org.apache.ldap.server.jndi;
+
+import java.util.Hashtable;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.apache.ldap.server.partition.ContextPartition;
+
+/**
+ * Provides JNDI service to {@link AbstractContextFactory}.
+ *
+ * @author The Apache Directory Project
+ * @version $Rev$, $Date$
+ */
+public interface ContextFactoryService
+{
+ /**
+ * Starts up this service.
+ *
+ * @param listener a listener that listens to the lifecycle of this service
+ * @param environment JNDI {@link InitialContext} environment
+ *
+ * @throws NamingException if failed to start up
+ */
+ void startup( ContextFactoryServiceListener listener, Hashtable environment ) throws NamingException;
+
+ /**
+ * Shuts down this service.
+ *
+ * @throws NamingException if failed to shut down
+ */
+ void shutdown() throws NamingException;
+
+ /**
+ * Calls {@link ContextPartition#sync()} for all registered {@link ContextPartition}s.
+ * @throws NamingException if synchronization failed
+ */
+ void sync() throws NamingException;
+
+ /**
+ * Returns <tt>true</tt> if this service is started
+ * and bootstrap entries have been created for the first time.
+ */
+ boolean isFirstStart();
+
+ /**
+ * Returns <tt>true</tt> if this service is started.
+ */
+ boolean isStarted();
+
+ /**
+ * Returns the configuration of this service.
+ */
+ ContextFactoryConfiguration getConfiguration();
+}
Propchange: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ContextFactoryService.java
------------------------------------------------------------------------------
svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
Added: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ContextFactoryServiceListener.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ContextFactoryServiceListener.java?rev=193154&view=auto
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ContextFactoryServiceListener.java (added)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ContextFactoryServiceListener.java Thu Jun 23 07:54:58 2005
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed 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.
+ *
+ */
+package org.apache.ldap.server.jndi;
+
+import javax.naming.NamingException;
+
+/**
+ * An event handler that listens to the changes occurs to
+ * {@link ContextFactoryService}.
+ *
+ * @author The Apache Directory Project
+ * @version $Rev$, $Date$
+ */
+public interface ContextFactoryServiceListener
+{
+ /**
+ * Invoked before starting up {@link ContextFactoryService}.
+ */
+ void beforeStartup( ContextFactoryService service ) throws NamingException;
+ /**
+ * Invoked after starting up {@link ContextFactoryService}.
+ */
+ void afterStartup( ContextFactoryService service ) throws NamingException;
+ /**
+ * Invoked before shutting down {@link ContextFactoryService}.
+ */
+ void beforeShutdown( ContextFactoryService service ) throws NamingException;
+ /**
+ * Invoked after shutting down {@link ContextFactoryService}.
+ */
+ void afterShutdown( ContextFactoryService service ) throws NamingException;
+ /**
+ * Invoked before calling {@link ContextFactoryService#sync()}.
+ */
+ void beforeSync( ContextFactoryService service ) throws NamingException;
+ /**
+ * Invoked after calling {@link ContextFactoryService#sync()}.
+ */
+ void afterSync( ContextFactoryService service ) throws NamingException;
+}
Propchange: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ContextFactoryServiceListener.java
------------------------------------------------------------------------------
svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ContextPartitionNexusProxy.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ContextPartitionNexusProxy.java?rev=193154&r1=193153&r2=193154&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ContextPartitionNexusProxy.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ContextPartitionNexusProxy.java Thu Jun 23 07:54:58 2005
@@ -30,66 +30,83 @@
import org.apache.ldap.common.filter.ExprNode;
import org.apache.ldap.server.configuration.ContextPartitionConfiguration;
+import org.apache.ldap.server.interceptor.InterceptorChain;
import org.apache.ldap.server.invocation.Invocation;
import org.apache.ldap.server.invocation.InvocationStack;
import org.apache.ldap.server.partition.ContextPartition;
import org.apache.ldap.server.partition.ContextPartitionNexus;
+/**
+ * A decorator that wraps other {@link ContextPartitionNexus} to enable
+ * {@link InterceptorChain} and {@link InvocationStack} support.
+ * All {@link Invocation}s made to this nexus is automatically pushed to
+ * {@link InvocationStack} of the current thread, and popped when
+ * the operation ends. All invocations are filtered by {@link InterceptorChain}.
+ *
+ * @author The Apache Directory Project
+ * @version $Rev$, $Date$
+ */
class ContextPartitionNexusProxy extends ContextPartitionNexus
{
- private final Context target;
- private final ContextFactoryConfiguration provider;
-
- ContextPartitionNexusProxy( Context target, ContextFactoryConfiguration provider )
+ private final Context caller;
+ private final ContextFactoryService service;
+ private final ContextFactoryConfiguration configuration;
+
+ /**
+ * Creates a new instance.
+ *
+ * @param caller a JNDI {@link Context} object that will call this proxy
+ * @param service a JNDI service
+ */
+ ContextPartitionNexusProxy( Context caller, ContextFactoryService service )
{
- this.target = target;
- this.provider = provider;
+ this.caller = caller;
+ this.service = service;
+ this.configuration = service.getConfiguration();
}
public LdapContext getLdapContext() {
- return this.provider.getPartitionNexus().getLdapContext();
+ return this.configuration.getPartitionNexus().getLdapContext();
}
public void init( ContextFactoryConfiguration factoryCfg, ContextPartitionConfiguration cfg )
{
- throw new IllegalStateException();
}
public void destroy()
{
- throw new IllegalStateException();
}
public ContextPartition getSystemPartition()
{
- return this.provider.getPartitionNexus().getSystemPartition();
+ return this.configuration.getPartitionNexus().getSystemPartition();
}
public Name getSuffix( boolean normalized ) throws NamingException
{
- return this.provider.getPartitionNexus().getSuffix( normalized );
+ return this.configuration.getPartitionNexus().getSuffix( normalized );
}
public void sync() throws NamingException {
- this.provider.sync();
+ this.service.sync();
}
public void close() throws NamingException {
- this.provider.shutdown();
+ this.service.shutdown();
}
public boolean isInitialized() {
- return this.provider.isStarted();
+ return this.service.isStarted();
}
public Name getMatchedDn(Name dn, boolean normalized) throws NamingException {
InvocationStack stack = InvocationStack.getInstance();
stack.push( new Invocation(
- target, "getMatchedDn",
+ caller, "getMatchedDn",
new Object[] { dn, normalized? Boolean.TRUE : Boolean.FALSE } ) );
try
{
- return this.provider.getInterceptorChain().getMatchedDn( dn, normalized );
+ return this.configuration.getInterceptorChain().getMatchedDn( dn, normalized );
}
finally
{
@@ -100,11 +117,11 @@
public Name getSuffix(Name dn, boolean normalized) throws NamingException {
InvocationStack stack = InvocationStack.getInstance();
stack.push( new Invocation(
- target, "getSuffix",
+ caller, "getSuffix",
new Object[] { dn, normalized? Boolean.TRUE : Boolean.FALSE } ) );
try
{
- return this.provider.getInterceptorChain().getSuffix( dn, normalized );
+ return this.configuration.getInterceptorChain().getSuffix( dn, normalized );
}
finally
{
@@ -115,11 +132,11 @@
public Iterator listSuffixes(boolean normalized) throws NamingException {
InvocationStack stack = InvocationStack.getInstance();
stack.push( new Invocation(
- target, "listSuffixes",
+ caller, "listSuffixes",
new Object[] { normalized? Boolean.TRUE : Boolean.FALSE } ) );
try
{
- return this.provider.getInterceptorChain().listSuffixes( normalized );
+ return this.configuration.getInterceptorChain().listSuffixes( normalized );
}
finally
{
@@ -130,11 +147,11 @@
public void delete(Name name) throws NamingException {
InvocationStack stack = InvocationStack.getInstance();
stack.push( new Invocation(
- target, "delete",
+ caller, "delete",
new Object[] { name } ) );
try
{
- this.provider.getInterceptorChain().delete( name );
+ this.configuration.getInterceptorChain().delete( name );
}
finally
{
@@ -145,11 +162,11 @@
public void add(String upName, Name normName, Attributes entry) throws NamingException {
InvocationStack stack = InvocationStack.getInstance();
stack.push( new Invocation(
- target, "add",
+ caller, "add",
new Object[] { upName, normName, entry } ) );
try
{
- this.provider.getInterceptorChain().add( upName, normName, entry );
+ this.configuration.getInterceptorChain().add( upName, normName, entry );
}
finally
{
@@ -161,11 +178,11 @@
InvocationStack stack = InvocationStack.getInstance();
// TODO Use predefined modOp Interger constants.
stack.push( new Invocation(
- target, "modify",
+ caller, "modify",
new Object[] { name, new Integer( modOp ), mods } ) );
try
{
- this.provider.getInterceptorChain().modify( name, modOp, mods );
+ this.configuration.getInterceptorChain().modify( name, modOp, mods );
}
finally
{
@@ -176,11 +193,11 @@
public void modify(Name name, ModificationItem[] mods) throws NamingException {
InvocationStack stack = InvocationStack.getInstance();
stack.push( new Invocation(
- target, "modify",
+ caller, "modify",
new Object[] { name, mods } ) );
try
{
- this.provider.getInterceptorChain().modify( name, mods );
+ this.configuration.getInterceptorChain().modify( name, mods );
}
finally
{
@@ -191,11 +208,11 @@
public NamingEnumeration list(Name base) throws NamingException {
InvocationStack stack = InvocationStack.getInstance();
stack.push( new Invocation(
- target, "list",
+ caller, "list",
new Object[] { base } ) );
try
{
- return this.provider.getInterceptorChain().list( base );
+ return this.configuration.getInterceptorChain().list( base );
}
finally
{
@@ -206,11 +223,11 @@
public NamingEnumeration search(Name base, Map env, ExprNode filter, SearchControls searchCtls) throws NamingException {
InvocationStack stack = InvocationStack.getInstance();
stack.push( new Invocation(
- target, "search",
+ caller, "search",
new Object[] { base, env, filter, searchCtls } ) );
try
{
- return this.provider.getInterceptorChain().search( base, env, filter, searchCtls );
+ return this.configuration.getInterceptorChain().search( base, env, filter, searchCtls );
}
finally
{
@@ -221,11 +238,11 @@
public Attributes lookup(Name name) throws NamingException {
InvocationStack stack = InvocationStack.getInstance();
stack.push( new Invocation(
- target, "lookup",
+ caller, "lookup",
new Object[] { name } ) );
try
{
- return this.provider.getInterceptorChain().lookup( name );
+ return this.configuration.getInterceptorChain().lookup( name );
}
finally
{
@@ -236,11 +253,11 @@
public Attributes lookup(Name dn, String[] attrIds) throws NamingException {
InvocationStack stack = InvocationStack.getInstance();
stack.push( new Invocation(
- target, "lookup",
+ caller, "lookup",
new Object[] { dn, attrIds } ) );
try
{
- return this.provider.getInterceptorChain().lookup( dn, attrIds );
+ return this.configuration.getInterceptorChain().lookup( dn, attrIds );
}
finally
{
@@ -251,11 +268,11 @@
public boolean hasEntry(Name name) throws NamingException {
InvocationStack stack = InvocationStack.getInstance();
stack.push( new Invocation(
- target, "hasEntry",
+ caller, "hasEntry",
new Object[] { name } ) );
try
{
- return this.provider.getInterceptorChain().hasEntry( name );
+ return this.configuration.getInterceptorChain().hasEntry( name );
}
finally
{
@@ -266,11 +283,11 @@
public boolean isSuffix(Name name) throws NamingException {
InvocationStack stack = InvocationStack.getInstance();
stack.push( new Invocation(
- target, "isSuffix",
+ caller, "isSuffix",
new Object[] { name } ) );
try
{
- return this.provider.getInterceptorChain().isSuffix( name );
+ return this.configuration.getInterceptorChain().isSuffix( name );
}
finally
{
@@ -281,11 +298,11 @@
public void modifyRn(Name name, String newRn, boolean deleteOldRn) throws NamingException {
InvocationStack stack = InvocationStack.getInstance();
stack.push( new Invocation(
- target, "modifyRn",
+ caller, "modifyRn",
new Object[] { name, newRn, deleteOldRn? Boolean.TRUE : Boolean.FALSE } ) );
try
{
- this.provider.getInterceptorChain().modifyRn( name, newRn, deleteOldRn );
+ this.configuration.getInterceptorChain().modifyRn( name, newRn, deleteOldRn );
}
finally
{
@@ -296,11 +313,11 @@
public void move(Name oriChildName, Name newParentName) throws NamingException {
InvocationStack stack = InvocationStack.getInstance();
stack.push( new Invocation(
- target, "move",
+ caller, "move",
new Object[] { oriChildName, newParentName } ) );
try
{
- this.provider.getInterceptorChain().move( oriChildName, newParentName );
+ this.configuration.getInterceptorChain().move( oriChildName, newParentName );
}
finally
{
@@ -311,11 +328,11 @@
public void move(Name oriChildName, Name newParentName, String newRn, boolean deleteOldRn) throws NamingException {
InvocationStack stack = InvocationStack.getInstance();
stack.push( new Invocation(
- target, "move",
+ caller, "move",
new Object[] { oriChildName, newParentName, newRn, deleteOldRn? Boolean.TRUE : Boolean.FALSE } ) );
try
{
- this.provider.getInterceptorChain().move( oriChildName, newParentName, newRn, deleteOldRn );
+ this.configuration.getInterceptorChain().move( oriChildName, newParentName, newRn, deleteOldRn );
}
finally
{
@@ -326,10 +343,10 @@
public Attributes getRootDSE() throws NamingException
{
InvocationStack stack = InvocationStack.getInstance();
- stack.push( new Invocation( target, "getRootDSE" ) );
+ stack.push( new Invocation( caller, "getRootDSE" ) );
try
{
- return this.provider.getInterceptorChain().getRootDSE();
+ return this.configuration.getInterceptorChain().getRootDSE();
}
finally
{
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/CoreContextFactory.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/CoreContextFactory.java?rev=193154&r1=193153&r2=193154&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/CoreContextFactory.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/CoreContextFactory.java Thu Jun 23 07:54:58 2005
@@ -23,7 +23,7 @@
/**
* A simplistic implementation of {@link AbstractContextFactory}.
* This class simply extends {@link AbstractContextFactory} and leaves all
- * abstract hook methods as empty.
+ * abstract event listener methods as empty.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
@@ -40,42 +40,42 @@
/**
* Does nothing by default.
*/
- protected void beforeStartup( ContextFactoryConfiguration ctx ) throws NamingException
+ public void beforeStartup( ContextFactoryService service ) throws NamingException
{
}
/**
* Does nothing by default.
*/
- protected void afterStartup( ContextFactoryConfiguration ctx ) throws NamingException
+ public void afterStartup( ContextFactoryService service ) throws NamingException
{
}
/**
* Does nothing by default.
*/
- protected void beforeShutdown( ContextFactoryConfiguration ctx ) throws NamingException
+ public void beforeShutdown( ContextFactoryService service ) throws NamingException
{
}
/**
* Does nothing by default.
*/
- protected void afterShutdown( ContextFactoryConfiguration ctx ) throws NamingException
+ public void afterShutdown( ContextFactoryService service ) throws NamingException
{
}
/**
* Does nothing by default.
*/
- protected void beforeSync( ContextFactoryConfiguration ctx ) throws NamingException
+ public void beforeSync( ContextFactoryService service ) throws NamingException
{
}
/**
* Does nothing by default.
*/
- protected void afterSync( ContextFactoryConfiguration ctx ) throws NamingException
+ public void afterSync( ContextFactoryService service ) throws NamingException
{
}
}
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/DeadContext.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/DeadContext.java?rev=193154&r1=193153&r2=193154&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/DeadContext.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/DeadContext.java Thu Jun 23 07:54:58 2005
@@ -20,6 +20,7 @@
import java.util.Hashtable;
import javax.naming.Context;
+import javax.naming.InitialContext;
import javax.naming.Name;
import javax.naming.NameParser;
import javax.naming.NamingEnumeration;
@@ -35,18 +36,19 @@
import org.apache.ldap.common.exception.LdapServiceUnavailableException;
import org.apache.ldap.common.message.ResultCodeEnum;
+import org.apache.ldap.server.configuration.SyncConfiguration;
/**
* A do nothing placeholder context whose methods throw ConfigurationExceptions.
- * The provider returns these context when the shutdown environment property key
- * is set. By returning a non-null Context we prevent an unnecessary exception
- * being thrown by InitialConext and any one of its subclasses.
+ * JNDI provider returns this context when your specify {@link SyncConfiguration}
+ * in JNDI environment. By returning a non-null Context we prevent an unnecessary
+ * exception being thrown by {@link InitialContext} and any one of its subclasses.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$
+ * @version $Rev$, $Date$
*/
-public class DeadContext implements LdapContext
+class DeadContext implements LdapContext
{
private final String EXCEPTION_MSG = "Context operation unavailable when " +
"invoked after Eve provider has been shutdown";
Copied: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/DefaultContextFactoryService.java (from r193130, directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/DefaultContextFactoryConfiguration.java)
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/DefaultContextFactoryService.java?p2=directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/DefaultContextFactoryService.java&p1=directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/DefaultContextFactoryConfiguration.java&r1=193130&r2=193154&rev=193154&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/DefaultContextFactoryConfiguration.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/DefaultContextFactoryService.java Thu Jun 23 07:54:58 2005
@@ -48,15 +48,14 @@
/**
- * Provides everything required to {@link AbstractContextFactory}.
- * FIXME Rename to DefaultContextFactoryContext
+ * Default implementation of {@link ContextFactoryService}.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-class DefaultContextFactoryConfiguration implements ContextFactoryConfiguration
+class DefaultContextFactoryService implements ContextFactoryService, ContextFactoryConfiguration
{
- private AbstractContextFactory factory;
+ private ContextFactoryServiceListener listener;
/** the initial context environment that fired up the backend subsystem */
private Hashtable environment;
@@ -73,7 +72,7 @@
/** whether or not server is started for the first time */
private boolean firstStart;
- /** The interceptor (or interceptor chain) for this provider */
+ /** The interceptor (or interceptor chain) for this service */
private InterceptorChain interceptorChain;
/** whether or not this instance has been shutdown */
@@ -87,7 +86,7 @@
/**
* Creates a new instance.
*/
- public DefaultContextFactoryConfiguration()
+ public DefaultContextFactoryService()
{
// Register shutdown hook.
Runtime.getRuntime().addShutdownHook( new Thread( new Runnable() {
@@ -148,7 +147,7 @@
return new ServerLdapContext( this, environment );
}
- public synchronized void startup( AbstractContextFactory factory, Hashtable env ) throws NamingException
+ public synchronized void startup( ContextFactoryServiceListener listener, Hashtable env ) throws NamingException
{
if( started )
{
@@ -173,18 +172,18 @@
this.environment = env;
this.configuration = cfg;
- factory.beforeStartup( this );
+ listener.beforeStartup( this );
try
{
initialize();
firstStart = createBootstrapEntries();
createTestEntries();
- this.factory = factory;
+ this.listener = listener;
started = true;
}
finally
{
- factory.afterStartup( this );
+ listener.afterStartup( this );
}
}
@@ -195,14 +194,14 @@
return;
}
- factory.beforeSync( this );
+ listener.beforeSync( this );
try
{
this.partitionNexus.sync();
}
finally
{
- factory.afterSync( this );
+ listener.afterSync( this );
}
}
@@ -214,7 +213,7 @@
return;
}
- factory.beforeShutdown( this );
+ listener.beforeShutdown( this );
try
{
this.partitionNexus.sync();
@@ -227,7 +226,7 @@
environment = null;
interceptorChain = null;
configuration = null;
- factory.afterShutdown( this );
+ listener.afterShutdown( this );
}
}
@@ -237,7 +236,12 @@
return ( Hashtable ) environment.clone();
}
- public StartupConfiguration getConfiguration()
+ public ContextFactoryConfiguration getConfiguration()
+ {
+ return this;
+ }
+
+ public StartupConfiguration getStartupConfiguration()
{
return configuration;
}
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/JavaLdapSupport.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/JavaLdapSupport.java?rev=193154&r1=193153&r2=193154&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/JavaLdapSupport.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/JavaLdapSupport.java Thu Jun 23 07:54:58 2005
@@ -36,7 +36,7 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-public class JavaLdapSupport
+class JavaLdapSupport
{
// ------------------------------------------------------------------------
// Attribute Id Constants Used By The Java LDAP BootstrapSchema
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ServerContext.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ServerContext.java?rev=193154&r1=193153&r2=193154&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ServerContext.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ServerContext.java Thu Jun 23 07:54:58 2005
@@ -85,15 +85,17 @@
* referenced name actually exists within the system. This constructor
* is used for all InitialContext requests.
*
- * @param nexusProxy the intercepting proxy to the nexus.
+ * @param service the parent service that manages this context
* @param env the environment properties used by this context.
* @throws NamingException if the environment parameters are not set
* correctly.
*/
- protected ServerContext( ContextFactoryConfiguration cfg, Hashtable env ) throws NamingException
+ protected ServerContext( ContextFactoryService service, Hashtable env ) throws NamingException
{
// set references to cloned env and the proxy
- this.nexusProxy = new ContextPartitionNexusProxy( this, cfg );
+ this.nexusProxy = new ContextPartitionNexusProxy( this, service );
+
+ ContextFactoryConfiguration cfg = service.getConfiguration();
this.env = ( Hashtable ) cfg.getEnvironment().clone();
this.env.putAll( env );
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ServerDirContext.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ServerDirContext.java?rev=193154&r1=193153&r2=193154&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ServerDirContext.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ServerDirContext.java Thu Jun 23 07:54:58 2005
@@ -67,13 +67,13 @@
* Creates a new ServerDirContext by reading the PROVIDER_URL to resolve the
* distinguished name for this context.
*
- * @param nexusProxy the proxy to the backend nexus
+ * @param service the parent service that manages this context
* @param env the environment used for this context
* @throws NamingException if something goes wrong
*/
- public ServerDirContext( ContextFactoryConfiguration cfg, Hashtable env ) throws NamingException
+ public ServerDirContext( ContextFactoryService service, Hashtable env ) throws NamingException
{
- super( cfg, env );
+ super( service, env );
}
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ServerDirObjectFactory.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ServerDirObjectFactory.java?rev=193154&r1=193153&r2=193154&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ServerDirObjectFactory.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ServerDirObjectFactory.java Thu Jun 23 07:54:58 2005
@@ -31,7 +31,7 @@
* looks up the most specific object factory based on this additional
* information. This makes a huge difference when the number of ObjectFactory
* instances is large.
- * <br/>
+ * <p/>
* Eventually, it is highly feasible for generated schemas, to also include
* state and object factories for various objectClasses, or domain objects.
* This means the number of factories will increase. By associating object and
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ServerLdapContext.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ServerLdapContext.java?rev=193154&r1=193153&r2=193154&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ServerLdapContext.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ServerLdapContext.java Thu Jun 23 07:54:58 2005
@@ -32,7 +32,7 @@
/**
- * An Eve implementation of a JNDI LdapContext.
+ * An implementation of a JNDI LdapContext.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
@@ -48,13 +48,13 @@
/**
* Creates an instance of an ServerLdapContext.
*
- * @param nexusProxy the proxy to a partition nexus
+ * @param service the parent service that manages this context
* @param env the JNDI environment parameters
* @throws NamingException the context cannot be created
*/
- public ServerLdapContext( ContextFactoryConfiguration cfg, Hashtable env ) throws NamingException
+ public ServerLdapContext( ContextFactoryService service, Hashtable env ) throws NamingException
{
- super( cfg, env );
+ super( service, env );
}
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/normalization/NormalizationService.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/normalization/NormalizationService.java?rev=193154&r1=193153&r2=193154&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/normalization/NormalizationService.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/normalization/NormalizationService.java Thu Jun 23 07:54:58 2005
@@ -34,13 +34,14 @@
import org.apache.ldap.server.interceptor.BaseInterceptor;
import org.apache.ldap.server.interceptor.NextInterceptor;
import org.apache.ldap.server.jndi.ContextFactoryConfiguration;
+import org.apache.ldap.server.partition.ContextPartitionNexus;
import org.apache.ldap.server.schema.AttributeTypeRegistry;
/**
* A name normalization service. This service makes sure all relative and distinuished
* names are normalized before calls are made against the respective interface methods
- * on the root nexus.
+ * on {@link ContextPartitionNexus}.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/operational/OperationalAttributeService.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/operational/OperationalAttributeService.java?rev=193154&r1=193153&r2=193154&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/operational/OperationalAttributeService.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/operational/OperationalAttributeService.java Thu Jun 23 07:54:58 2005
@@ -37,9 +37,10 @@
import org.apache.ldap.common.schema.UsageEnum;
import org.apache.ldap.common.util.DateUtils;
import org.apache.ldap.server.configuration.InterceptorConfiguration;
-import org.apache.ldap.server.enumeration.SearchResultFilteringEnumeration;
import org.apache.ldap.server.enumeration.SearchResultFilter;
+import org.apache.ldap.server.enumeration.SearchResultFilteringEnumeration;
import org.apache.ldap.server.interceptor.BaseInterceptor;
+import org.apache.ldap.server.interceptor.Interceptor;
import org.apache.ldap.server.interceptor.NextInterceptor;
import org.apache.ldap.server.invocation.InvocationStack;
import org.apache.ldap.server.jndi.ContextFactoryConfiguration;
@@ -48,10 +49,10 @@
/**
- * An {@link org.apache.ldap.server.interceptor.Interceptor} that adds or modifies the default attributes
- * of entries. There are four default attributes for now;<code>'creatorsName'
- * </code>, <code>'createTimestamp'</code>, <code>'modifiersName'</code>, and
- * <code>'modifyTimestamp'</code>.
+ * An {@link Interceptor} that adds or modifies the default attributes
+ * of entries. There are four default attributes for now;
+ * <tt>'creatorsName'</tt>, <tt>'createTimestamp'</tt>, <tt>'modifiersName'</tt>,
+ * and <tt>'modifyTimestamp'</tt>.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/AbstractContextPartition.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/AbstractContextPartition.java?rev=193154&r1=193153&r2=193154&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/AbstractContextPartition.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/AbstractContextPartition.java Thu Jun 23 07:54:58 2005
@@ -93,9 +93,9 @@
/**
* Calls {@link #doDestroy()} where you have to put your destroy code in,
* and clears default properties. Once this method is invoked, {@link #isInitialized()}
- * will return <tt>false</tt> even if {@link #doDestroy()} failed.
+ * will return <tt>false</tt>.
*/
- public final void destroy() throws NamingException
+ public final void destroy()
{
if( cfg == null )
{
@@ -118,7 +118,7 @@
/**
* Override this method to put your initialization code.
*/
- protected void doDestroy() throws NamingException
+ protected void doDestroy()
{
}
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/ContextPartition.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/ContextPartition.java?rev=193154&r1=193153&r2=193154&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/ContextPartition.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/ContextPartition.java Thu Jun 23 07:54:58 2005
@@ -61,7 +61,7 @@
* Closes or shuts down this ContextPartition. Operations against closed
* ContextPartitions will fail.
*/
- void destroy() throws NamingException;
+ void destroy();
/**
* Checks to see if this partition is initialized or not.
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/DefaultContextPartitionNexus.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/DefaultContextPartitionNexus.java?rev=193154&r1=193153&r2=193154&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/DefaultContextPartitionNexus.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/DefaultContextPartitionNexus.java Thu Jun 23 07:54:58 2005
@@ -137,7 +137,7 @@
initializeSystemPartition( factoryCfg );
initializedPartitions.add( system );
- Iterator i = factoryCfg.getConfiguration().getContextPartitionConfigurations().iterator();
+ Iterator i = factoryCfg.getStartupConfiguration().getContextPartitionConfigurations().iterator();
try
{
while( i.hasNext() )
@@ -240,7 +240,7 @@
}
- public synchronized void destroy() throws NamingException
+ public synchronized void destroy()
{
if ( !initialized )
{
@@ -285,8 +285,7 @@
NamingException total = new NamingException( msg );
total.setRootCause( error );
-
- throw total;
+ total.printStackTrace();
}
}
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/impl/btree/BTreeContextPartition.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/impl/btree/BTreeContextPartition.java?rev=193154&r1=193153&r2=193154&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/impl/btree/BTreeContextPartition.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/impl/btree/BTreeContextPartition.java Thu Jun 23 07:54:58 2005
@@ -299,7 +299,7 @@
public abstract void sync() throws NamingException;
- public abstract void destroy() throws NamingException;
+ public abstract void destroy();
public abstract boolean isInitialized();
public boolean isSuffix( Name dn ) throws NamingException
Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/impl/btree/jdbm/JdbmContextPartition.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/impl/btree/jdbm/JdbmContextPartition.java?rev=193154&r1=193153&r2=193154&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/impl/btree/jdbm/JdbmContextPartition.java (original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/partition/impl/btree/jdbm/JdbmContextPartition.java Thu Jun 23 07:54:58 2005
@@ -118,7 +118,7 @@
this.normSuffix = cfg.getNormalizedSuffix( factoryCfg.getGlobalRegistries().getMatchingRuleRegistry() );
File workingDirectory = new File(
- factoryCfg.getConfiguration().getWorkingDirectory().getPath() +
+ factoryCfg.getStartupConfiguration().getWorkingDirectory().getPath() +
File.separator + cfg.getName() );
workingDirectory.mkdirs();
@@ -149,7 +149,7 @@
}
- public synchronized void destroy() throws NamingException
+ public synchronized void destroy()
{
if ( !initialized )
{
@@ -250,7 +250,7 @@
{
NamingException ne = new NamingException( "Failed to close all" );
ne.setRootCause( rootCause );
- throw ne;
+ ne.printStackTrace();
}
}