directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gokt...@apache.org
Subject svn commit: r1210048 - in /directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component: ./ hub/ instance/ utilities/
Date Sun, 04 Dec 2011 03:38:32 GMT
Author: gokturk
Date: Sun Dec  4 03:38:32 2011
New Revision: 1210048

URL: http://svn.apache.org/viewvc?rev=1210048&view=rev
Log:
Second phase of code cleanup to switch component-hub to work with config&schema partition
references.

*ComponentCacheManager and its extensions on code are removed.
*Some class name changes for clarity.


Added:
    directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/ConfigurationManager.java
    directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/CachedComponentInstance.java
  (with props)
    directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/ComponentInstance.java
      - copied, changed from r1209115, directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/ADSComponentInstance.java
    directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/ComponentInstanceGenerator.java
      - copied, changed from r1209113, directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/ADSComponentInstanceGenerator.java
    directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/utilities/LdifConfigHelper.java
  (with props)
Removed:
    directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/ADSComponentCacheHandle.java
    directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/ComponentCacheManager.java
    directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/ADSComponentInstance.java
    directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/ADSComponentInstanceGenerator.java
Modified:
    directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/ADSComponent.java
    directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/ComponentHub.java
    directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/ComponentManager.java
    directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/DefaultComponentInstanceGenerator.java

Modified: directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/ADSComponent.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/ADSComponent.java?rev=1210048&r1=1210047&r2=1210048&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/ADSComponent.java
(original)
+++ directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/ADSComponent.java
Sun Dec  4 03:38:32 2011
@@ -24,9 +24,9 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Properties;
 
-import org.apache.directory.server.component.hub.ComponentCacheManager;
 import org.apache.directory.server.component.hub.ComponentManager;
-import org.apache.directory.server.component.instance.ADSComponentInstance;
+import org.apache.directory.server.component.instance.CachedComponentInstance;
+import org.apache.directory.server.component.instance.ComponentInstance;
 import org.apache.directory.server.component.schema.ADSComponentSchema;
 import org.apache.felix.ipojo.Factory;
 
@@ -62,17 +62,12 @@ public class ADSComponent
     /*
      * List holding all the created instances.
      */
-    private List<ADSComponentInstance> activeInstances;
-    
-    /*
-     * List holding all the cached instances.
-     */
-    private List<ADSComponentInstance> cachedInstances;
+    private List<ComponentInstance> activeInstances;
 
     /*
-     * cache handle for pointing places in the cache for that component.
+     * List holding all the cached instances.
      */
-    private ADSComponentCacheHandle cacheHandle;
+    private List<CachedComponentInstance> cachedInstances;
 
     /*
      * Generated/Choosed schema information
@@ -94,7 +89,7 @@ public class ADSComponent
     {
         this.componentManager = componentManager;
 
-        activeInstances = new ArrayList<ADSComponentInstance>();
+        activeInstances = new ArrayList<ComponentInstance>();
     }
 
 
@@ -103,7 +98,7 @@ public class ADSComponent
      *
      * @param instance instance reference to add to a list
      */
-    public void addInstance( ADSComponentInstance instance )
+    public void addInstance( ComponentInstance instance )
     {
         activeInstances.add( instance );
     }
@@ -114,38 +109,31 @@ public class ADSComponent
      *
      * @param instance to remove from the list
      */
-    public void removeInstance( ADSComponentInstance instance )
+    public void removeInstance( ComponentInstance instance )
     {
         activeInstances.remove( instance );
     }
 
 
     /**
-     * Gets the current instances of the component
+     * Sets the cached instances.
      *
-     * @return Cloned ADSComponentInstance list.
+     * @param cachedList List of CachedComponentInstances to set for this component.
      */
-    public List<ADSComponentInstance> getInstances()
+    public void setCachedInstances( List<CachedComponentInstance> cachedList )
     {
-        return new ArrayList<ADSComponentInstance>( activeInstances );
+        cachedInstances = cachedList;
     }
 
 
     /**
-     * @return the cacheHandle
-     */
-    public ADSComponentCacheHandle getCacheHandle()
-    {
-        return cacheHandle;
-    }
-
-
-    /**
-     * @param cacheHandle the cacheHandle to set
+     * Gets the current instances of the component
+     *
+     * @return Cloned ComponentInstance list.
      */
-    public void setCacheHandle( ADSComponentCacheHandle cacheHandle )
+    public List<ComponentInstance> getInstances()
     {
-        this.cacheHandle = cacheHandle;
+        return new ArrayList<ComponentInstance>( activeInstances );
     }
 
 

Modified: directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/ComponentHub.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/ComponentHub.java?rev=1210048&r1=1210047&r2=1210048&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/ComponentHub.java
(original)
+++ directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/ComponentHub.java
Sun Dec  4 03:38:32 2011
@@ -28,7 +28,7 @@ import java.util.List;
 
 import org.apache.directory.server.component.ADSComponent;
 import org.apache.directory.server.component.hub.listener.HubListener;
-import org.apache.directory.server.component.instance.ADSComponentInstanceGenerator;
+import org.apache.directory.server.component.instance.ComponentInstanceGenerator;
 import org.apache.directory.server.component.instance.DefaultComponentInstanceGenerator;
 import org.apache.directory.server.component.schema.ADSComponentSchema;
 import org.apache.directory.server.component.schema.ComponentSchemaGenerator;
@@ -95,11 +95,6 @@ public class ComponentHub
     private ComponentEventManager eventManager = new ComponentEventManager();
 
     /*
-     * Used to manage component caches.
-     */
-    private ComponentCacheManager cacheManager = new ComponentCacheManager();
-
-    /*
      * Used to manage instances' DIT hooks.
      */
     private InstanceManager configManager = new InstanceManager();
@@ -107,7 +102,7 @@ public class ComponentHub
     /*
      * Used to manage components
      */
-    private ComponentManager componentManager = new ComponentManager( cacheManager, configManager
);
+    private ComponentManager componentManager = new ComponentManager( configManager );
 
     /*
      * Allowed interfaces for components.
@@ -148,8 +143,6 @@ public class ComponentHub
     public void hubInvalidated()
     {
         logger.log( LogService.LOG_INFO, "ADSComponentHub being invalidated." );
-
-        cacheManager.cacheRemaningComponents();
     }
 
 
@@ -324,7 +317,6 @@ public class ComponentHub
         component.setComponentType( componentType );
         component.setComponentName( ADSComponentHelper.getComponentName( component.getFactory()
) );
         component.setComponentVersion( ADSComponentHelper.getComponentVersion( component.getFactory()
) );
-        component.setCacheHandle( cacheManager.getCacheHandle( component ) );
 
         return component;
     }

Modified: directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/ComponentManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/ComponentManager.java?rev=1210048&r1=1210047&r2=1210048&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/ComponentManager.java
(original)
+++ directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/ComponentManager.java
Sun Dec  4 03:38:32 2011
@@ -30,8 +30,8 @@ import java.util.Queue;
 import java.util.concurrent.LinkedBlockingQueue;
 
 import org.apache.directory.server.component.ADSComponent;
-import org.apache.directory.server.component.instance.ADSComponentInstance;
-import org.apache.directory.server.component.instance.ADSComponentInstanceGenerator;
+import org.apache.directory.server.component.instance.ComponentInstance;
+import org.apache.directory.server.component.instance.ComponentInstanceGenerator;
 import org.apache.directory.server.component.schema.ComponentSchemaGenerator;
 import org.apache.directory.server.core.api.LdapCoreSessionConnection;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
@@ -62,12 +62,7 @@ public class ComponentManager
     /*
      * Instance Generators
      */
-    private Dictionary<String, ADSComponentInstanceGenerator> instanceGenerators;
-
-    /*
-     * Cache Manager
-     */
-    private ComponentCacheManager cacheManager;
+    private Dictionary<String, ComponentInstanceGenerator> instanceGenerators;
 
     /*
      * Configuration Manager
@@ -85,12 +80,11 @@ public class ComponentManager
     private LdapCoreSessionConnection ldapConn;
 
 
-    public ComponentManager( ComponentCacheManager cacheManager, InstanceManager instanceManager
)
+    public ComponentManager( InstanceManager instanceManager )
     {
         schemaGenerators = new Hashtable<String, ComponentSchemaGenerator>();
-        instanceGenerators = new Hashtable<String, ADSComponentInstanceGenerator>();
+        instanceGenerators = new Hashtable<String, ComponentInstanceGenerator>();
 
-        this.cacheManager = cacheManager;
         this.instanceManager = instanceManager;
     }
 
@@ -132,7 +126,7 @@ public class ComponentManager
      * @param componentType component type to register instance generator
      * @param generator instance generator instance
      */
-    public void addInstanceGenerator( String componentType, ADSComponentInstanceGenerator
generator )
+    public void addInstanceGenerator( String componentType, ComponentInstanceGenerator generator
)
     {
         if ( instanceGenerators.get( componentType ) == null )
         {
@@ -143,17 +137,17 @@ public class ComponentManager
 
     /**
      * Create and return the instance of the given component
-     * using ADSComponentInstanceGenerator registered for its type.
+     * using ComponentInstanceGenerator registered for its type.
      *
      * @param component ADSComponent reference to instantiate
-     * @return created ADSComponentInstance reference
+     * @return created ComponentInstance reference
      */
-    public ADSComponentInstance createInstance( ADSComponent component, Properties properties
)
+    public ComponentInstance createInstance( ADSComponent component, Properties properties
)
     {
-        ADSComponentInstanceGenerator generator = instanceGenerators.get( component.getComponentType()
);
+        ComponentInstanceGenerator generator = instanceGenerators.get( component.getComponentType()
);
         if ( generator != null )
         {
-            ADSComponentInstance instance = generator.createInstance( component, properties
);
+            ComponentInstance instance = generator.createInstance( component, properties
);
 
             instance.setInstanceManager( instanceManager );
 
@@ -335,16 +329,6 @@ public class ComponentManager
     }
 
 
-    /**
-     * Caches the component manually
-     *
-     * @param component ADSComponent to initiate caching
-     */
-    public void cacheComponent( ADSComponent component )
-    {
-        cacheManager.cacheComponent( component );
-    }
-
 
     /**
      * Loads the cached instance configurations for component, and use
@@ -353,27 +337,9 @@ public class ComponentManager
      * @param component ADSComponent reference to load its cached instances.
      * @return loaded instances.
      */
-    public List<ADSComponentInstance> loadCachedInstances( ADSComponent component )
+    public List<ComponentInstance> loadCachedInstances( ADSComponent component )
     {
-        List<ADSComponentInstance> cachedInstances = new ArrayList<ADSComponentInstance>();
-
-        List<Properties> cachedConfigurations = cacheManager.getCachedInstanceConfigurations(
component );
-
-        if ( cachedConfigurations == null )
-        {
-            return null;
-        }
-
-        for ( Properties props : cachedConfigurations )
-        {
-            ADSComponentInstance ins = createInstance( component, props );
-            if ( ins != null )
-            {
-                cachedInstances.add( ins );
-            }
-        }
-
-        return cachedInstances;
+        return null;
     }
 
 }

Added: directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/ConfigurationManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/ConfigurationManager.java?rev=1210048&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/ConfigurationManager.java
(added)
+++ directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/ConfigurationManager.java
Sun Dec  4 03:38:32 2011
@@ -0,0 +1,7 @@
+
+package org.apache.directory.server.component.hub;
+
+public class ConfigurationManager
+{
+
+}

Added: directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/CachedComponentInstance.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/CachedComponentInstance.java?rev=1210048&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/CachedComponentInstance.java
(added)
+++ directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/CachedComponentInstance.java
Sun Dec  4 03:38:32 2011
@@ -0,0 +1,47 @@
+package org.apache.directory.server.component.instance;
+
+
+import java.util.Properties;
+
+
+public class CachedComponentInstance
+{
+    /*
+     * Dn of the cached instance entry in DIT
+     */
+    private String cacheDn;
+
+    /*
+     * Configuration of the cached instance entry
+     */
+    private Properties cachedConfiguration;
+
+
+    public CachedComponentInstance( String Dn, Properties conf )
+    {
+        cacheDn = Dn;
+        cachedConfiguration = conf;
+    }
+
+
+    /**
+     * Getter for cached configuration
+     *
+     * @return cached configuration for instance
+     */
+    public Properties getCachedConfiguration()
+    {
+        return cachedConfiguration;
+    }
+
+
+    /**
+     * Getter for cached instance location
+     *
+     * @return DIT location for cached instance
+     */
+    public String getCachedDn()
+    {
+        return cacheDn;
+    }
+}

Propchange: directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/CachedComponentInstance.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/ComponentInstance.java
(from r1209115, directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/ADSComponentInstance.java)
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/ComponentInstance.java?p2=directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/ComponentInstance.java&p1=directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/ADSComponentInstance.java&r1=1209115&r2=1210048&rev=1210048&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/ADSComponentInstance.java
(original)
+++ directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/ComponentInstance.java
Sun Dec  4 03:38:32 2011
@@ -31,7 +31,7 @@ import org.apache.directory.server.compo
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class ADSComponentInstance
+public class ComponentInstance
 {
     /*
      * Actual instance reference.

Copied: directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/ComponentInstanceGenerator.java
(from r1209113, directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/ADSComponentInstanceGenerator.java)
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/ComponentInstanceGenerator.java?p2=directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/ComponentInstanceGenerator.java&p1=directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/ADSComponentInstanceGenerator.java&r1=1209113&r2=1210048&rev=1210048&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/ADSComponentInstanceGenerator.java
(original)
+++ directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/ComponentInstanceGenerator.java
Sun Dec  4 03:38:32 2011
@@ -26,7 +26,7 @@ import org.apache.directory.server.compo
 import org.apache.felix.ipojo.Factory;
 
 
-public interface ADSComponentInstanceGenerator
+public interface ComponentInstanceGenerator
 {
     /**
      * Creates an instance of a supplied ADSComponent.
@@ -35,7 +35,7 @@ public interface ADSComponentInstanceGen
      * @param component ADSComponent reference to be instantiated
      * @return ADSInstance reference created from ADSComponent
      */
-    public ADSComponentInstance createInstance( ADSComponent component, Properties properties
);
+    public ComponentInstance createInstance( ADSComponent component, Properties properties
);
 
 
     /**

Modified: directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/DefaultComponentInstanceGenerator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/DefaultComponentInstanceGenerator.java?rev=1210048&r1=1210047&r2=1210048&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/DefaultComponentInstanceGenerator.java
(original)
+++ directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/instance/DefaultComponentInstanceGenerator.java
Sun Dec  4 03:38:32 2011
@@ -35,7 +35,7 @@ import org.slf4j.LoggerFactory;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class DefaultComponentInstanceGenerator implements ADSComponentInstanceGenerator
+public class DefaultComponentInstanceGenerator implements ComponentInstanceGenerator
 {
 
     private final Logger LOG = LoggerFactory.getLogger( DefaultComponentSchemaGenerator.class
);
@@ -43,10 +43,10 @@ public class DefaultComponentInstanceGen
 
     /*
      * (non-Javadoc)
-     * @see org.apache.directory.server.component.instance.ADSComponentInstanceGenerator#createInstance(org.apache.directory.server.component.ADSComponent)
+     * @see org.apache.directory.server.component.instance.ComponentInstanceGenerator#createInstance(org.apache.directory.server.component.ADSComponent)
      */
     @Override
-    public ADSComponentInstance createInstance( ADSComponent component, Properties properties
)
+    public ComponentInstance createInstance( ADSComponent component, Properties properties
)
     {
         if ( properties == null && component.getDefaultConfiguration() == null )
         {

Added: directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/utilities/LdifConfigHelper.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/utilities/LdifConfigHelper.java?rev=1210048&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/utilities/LdifConfigHelper.java
(added)
+++ directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/utilities/LdifConfigHelper.java
Sun Dec  4 03:38:32 2011
@@ -0,0 +1,7 @@
+
+package org.apache.directory.server.component.utilities;
+
+public class LdifConfigHelper
+{
+
+}

Propchange: directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/utilities/LdifConfigHelper.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message