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/26 18:55:38 UTC

svn commit: r201874 - in /directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi: AbstractContextFactory.java ContextFactoryService.java DefaultContextFactoryService.java

Author: trustin
Date: Sun Jun 26 09:55:37 2005
New Revision: 201874

URL: http://svn.apache.org/viewcvs?rev=201874&view=rev
Log:
Enabled global access to ContextFactoryService instance by adding ContextFactoryService.getInstance().

Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/AbstractContextFactory.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ContextFactoryService.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/DefaultContextFactoryService.java

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/AbstractContextFactory.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/AbstractContextFactory.java?rev=201874&r1=201873&r2=201874&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/AbstractContextFactory.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/AbstractContextFactory.java Sun Jun 26 09:55:37 2005
@@ -65,9 +65,6 @@
     // Members
     // ------------------------------------------------------------------------
 
-    /** The singleton service instance */
-    private static final ContextFactoryService service = new DefaultContextFactoryService();
-
     /**
      * Creates a new instance.
      */
@@ -83,10 +80,12 @@
         String authentication = getAuthentication( env );
         String providerUrl = getProviderUrl( env );
 
+        ContextFactoryService service = ContextFactoryService.getInstance();
+
         // Execute configuration
         if( cfg instanceof ShutdownConfiguration )
         {
-            ( ( DefaultContextFactoryService ) service ).shutdown();
+            service.shutdown();
         }
         else if( cfg instanceof SyncConfiguration )
         {

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ContextFactoryService.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ContextFactoryService.java?rev=201874&r1=201873&r2=201874&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ContextFactoryService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ContextFactoryService.java Sun Jun 26 09:55:37 2005
@@ -29,8 +29,15 @@
  * @author The Apache Directory Project
  * @version $Rev$, $Date$
  */
-public interface ContextFactoryService
+public abstract class ContextFactoryService
 {
+    private static final ContextFactoryService instance = new DefaultContextFactoryService();
+
+    public static ContextFactoryService getInstance()
+    {
+        return instance;
+    }
+
     /**
      * Starts up this service.
      * 
@@ -39,28 +46,28 @@
      * 
      * @throws NamingException if failed to start up
      */
-    void startup( ContextFactoryServiceListener listener, Hashtable environment ) throws NamingException;
+    public abstract void startup( ContextFactoryServiceListener listener, Hashtable environment ) throws NamingException;
     
     /**
      * Shuts down this service.
      * 
      * @throws NamingException if failed to shut down
      */
-    void shutdown() throws NamingException;
+    public abstract void shutdown() throws NamingException;
     
     /**
      * Calls {@link ContextPartition#sync()} for all registered {@link ContextPartition}s.
      * @throws NamingException if synchronization failed
      */
-    void sync() throws NamingException;
+    public abstract void sync() throws NamingException;
     
     /**
      * Returns <tt>true</tt> if this service is started.
      */
-    boolean isStarted();
+    public abstract boolean isStarted();
     
     /**
      * Returns the configuration of this service.
      */
-    ContextFactoryConfiguration getConfiguration();
+    public abstract ContextFactoryConfiguration getConfiguration();
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/DefaultContextFactoryService.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/DefaultContextFactoryService.java?rev=201874&r1=201873&r2=201874&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/DefaultContextFactoryService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/DefaultContextFactoryService.java Sun Jun 26 09:55:37 2005
@@ -53,7 +53,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-class DefaultContextFactoryService implements ContextFactoryService
+class DefaultContextFactoryService extends ContextFactoryService
 {
     private final ContextFactoryConfiguration configuration = new DefaultContextFactoryConfiguration( this );