directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r193161 - in /directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi: ContextFactoryConfiguration.java ContextFactoryService.java DefaultContextFactoryConfiguration.java DefaultContextFactoryService.java
Date Thu, 23 Jun 2005 15:16:32 GMT
Author: trustin
Date: Thu Jun 23 08:16:30 2005
New Revision: 193161

URL: http://svn.apache.org/viewcvs?rev=193161&view=rev
Log:
Extracted out DefaultContextFactoryConfiguration from DefaultContextFactoryService.

Added:
    directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/DefaultContextFactoryConfiguration.java
  (with props)
Modified:
    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/ContextFactoryService.java
    directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/DefaultContextFactoryService.java

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=193161&r1=193160&r2=193161&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 08:16:30 2005
@@ -34,6 +34,12 @@
  */
 public interface ContextFactoryConfiguration
 {
+    
+    /**
+     * Returns the listener that listens to service events.
+     */
+    ContextFactoryServiceListener getServiceListener();
+    
     /**
      * Returns the initial context environment of the {@link ContextFactoryService}.
      */
@@ -58,6 +64,12 @@
      * Returns the interceptor chain of the {@link ContextFactoryService}.
      */
     InterceptorChain getInterceptorChain();
+    
+    /**
+     * Returns <tt>true</tt> if this service is started
+     * and bootstrap entries have been created for the first time.
+     */
+    boolean isFirstStart();
     
     /**
      * Returns an anonymous JNDI {@link Context} with the specified <tt>baseName</tt>

Modified: 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=193161&r1=193160&r2=193161&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ContextFactoryService.java
(original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/ContextFactoryService.java
Thu Jun 23 08:16:30 2005
@@ -55,12 +55,6 @@
     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();

Added: 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/DefaultContextFactoryConfiguration.java?rev=193161&view=auto
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/DefaultContextFactoryConfiguration.java
(added)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/DefaultContextFactoryConfiguration.java
Thu Jun 23 08:16:30 2005
@@ -0,0 +1,89 @@
+/*
+ *   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.Context;
+import javax.naming.NamingException;
+
+import org.apache.ldap.server.configuration.StartupConfiguration;
+import org.apache.ldap.server.interceptor.InterceptorChain;
+import org.apache.ldap.server.partition.ContextPartitionNexus;
+import org.apache.ldap.server.schema.GlobalRegistries;
+
+
+/**
+ * Default implementation of {@link ContextFactoryConfiguration}.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+class DefaultContextFactoryConfiguration implements ContextFactoryConfiguration
+{
+    private DefaultContextFactoryService parent;
+    
+    DefaultContextFactoryConfiguration( DefaultContextFactoryService parent )
+    {
+        this.parent = parent;
+    }
+
+    public ContextFactoryServiceListener getServiceListener()
+    {
+        return parent.getServiceListener();
+    }
+
+    public Hashtable getEnvironment()
+    {
+        return parent.getEnvironment();
+    }
+    
+    public StartupConfiguration getStartupConfiguration()
+    {
+        return parent.getStartupConfiguration();
+    }
+    
+    public GlobalRegistries getGlobalRegistries()
+    {
+        return parent.getGlobalRegistries();
+    }
+
+    public ContextPartitionNexus getPartitionNexus()
+    {
+        return parent.getPartitionNexus();
+    }
+    
+    public InterceptorChain getInterceptorChain()
+    {
+        return parent.getInterceptorChain();
+    }
+    
+    public boolean isFirstStart()
+    {
+        return parent.isFirstStart();
+    }
+
+    public Context getJndiContext( String baseName ) throws NamingException
+    {
+        return parent.getJndiContext( baseName );
+    }
+
+    public Context getJndiContext( String principal, byte[] credential, String authentication,
String baseName ) throws NamingException
+    {
+        return parent.getJndiContext( principal, credential, authentication, baseName );
+    }
+}

Propchange: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/DefaultContextFactoryConfiguration.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/DefaultContextFactoryService.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/DefaultContextFactoryService.java?rev=193161&r1=193160&r2=193161&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/DefaultContextFactoryService.java
(original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/jndi/DefaultContextFactoryService.java
Thu Jun 23 08:16:30 2005
@@ -53,15 +53,17 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-class DefaultContextFactoryService implements ContextFactoryService, ContextFactoryConfiguration
+class DefaultContextFactoryService implements ContextFactoryService
 {
-    private ContextFactoryServiceListener listener;
+    private final ContextFactoryConfiguration configuration = new DefaultContextFactoryConfiguration(
this );
+
+    private ContextFactoryServiceListener serviceListener;
     
     /** the initial context environment that fired up the backend subsystem */
     private Hashtable environment;
     
     /** the configuration */
-    private StartupConfiguration configuration;
+    private StartupConfiguration startupConfiguration;
 
     /** the registries for system schema objects */
     private GlobalRegistries globalRegistries;
@@ -170,7 +172,7 @@
         }
 
         this.environment = env;
-        this.configuration = cfg;
+        this.startupConfiguration = cfg;
         
         listener.beforeStartup( this );
         try
@@ -178,7 +180,7 @@
             initialize();
             firstStart = createBootstrapEntries();
             createTestEntries();
-            this.listener = listener;
+            this.serviceListener = listener;
             started = true;
         }
         finally
@@ -194,14 +196,14 @@
             return;
         }
 
-        listener.beforeSync( this );
+        serviceListener.beforeSync( this );
         try
         {
             this.partitionNexus.sync();
         }
         finally
         {
-            listener.afterSync( this );
+            serviceListener.afterSync( this );
         }
     }
 
@@ -213,7 +215,7 @@
             return;
         }
 
-        listener.beforeShutdown( this );
+        serviceListener.beforeShutdown( this );
         try
         {
             this.partitionNexus.sync();
@@ -225,25 +227,30 @@
         {
             environment = null;
             interceptorChain = null;
-            configuration = null;
-            listener.afterShutdown( this );
+            startupConfiguration = null;
+            serviceListener.afterShutdown( this );
         }
     }
     
+    public ContextFactoryConfiguration getConfiguration()
+    {
+        return configuration;
+    }
+    
     
     public Hashtable getEnvironment()
     {
         return ( Hashtable ) environment.clone();
     }
     
-    public ContextFactoryConfiguration getConfiguration()
+    public ContextFactoryServiceListener getServiceListener()
     {
-        return this;
+        return serviceListener;
     }
     
     public StartupConfiguration getStartupConfiguration()
     {
-        return configuration;
+        return startupConfiguration;
     }
     
     public GlobalRegistries getGlobalRegistries()
@@ -320,7 +327,7 @@
                         + Context.SECURITY_PRINCIPAL + " property is set" );
             }
             
-            if( !configuration.isAllowAnonymousAccess() )
+            if( !startupConfiguration.isAllowAnonymousAccess() )
             {
                 throw new LdapNoPermissionException( "Anonymous access disabled." );
             }
@@ -442,7 +449,7 @@
          * entries at startup due to a chicken and egg like problem.  The value
          * of this property is a list of attributes to be added.
          */
-        Iterator i = configuration.getTestEntries().iterator();
+        Iterator i = startupConfiguration.getTestEntries().iterator();
         while( i.hasNext() )
         {
             Attributes entry = ( Attributes ) i.next();
@@ -473,7 +480,7 @@
         BootstrapRegistries bootstrapRegistries = new BootstrapRegistries();
 
         BootstrapSchemaLoader loader = new BootstrapSchemaLoader();
-        loader.load( configuration.getBootstrapSchemas(), bootstrapRegistries );
+        loader.load( startupConfiguration.getBootstrapSchemas(), bootstrapRegistries );
 
         java.util.List errors = bootstrapRegistries.checkRefInteg();
         if ( !errors.isEmpty() )
@@ -488,9 +495,9 @@
         globalRegistries = new GlobalRegistries( bootstrapRegistries );
         
         partitionNexus = new DefaultContextPartitionNexus( new LockableAttributesImpl() );
-        partitionNexus.init( this, null );
+        partitionNexus.init( configuration, null );
         
         interceptorChain = new InterceptorChain();
-        interceptorChain.init( this );
+        interceptorChain.init( configuration );
     }
 }



Mime
View raw message