directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gokt...@apache.org
Subject svn commit: r1225545 - in /directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component: hub/ instance/
Date Thu, 29 Dec 2011 14:38:38 GMT
Author: gokturk
Date: Thu Dec 29 14:38:38 2011
New Revision: 1225545

URL: http://svn.apache.org/viewvc?rev=1225545&view=rev
Log:
* Embed IPojo's InstanceManager reference to ADSComponentInstance for more instance management
facilities.
    (InstanceManager class has same name as our InstanceManager for instance management, i
will refactor it to ComponentInstanceManager later after implementation)
* ADSComponentInstance interface is refined to take advantages of new IPojo InstanceManager

Modified:
    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/hub/ConfigurationManager.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/DefaultComponentInstanceGenerator.java

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=1225545&r1=1225544&r2=1225545&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
Thu Dec 29 14:38:38 2011
@@ -190,6 +190,7 @@ public class ComponentManager
             return null;
         }
 
+        instance.setDITHookDn( cachedInstance.getCachedDn() );
         component.addInstance( instance );
 
         return instance;

Modified: 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=1225545&r1=1225544&r2=1225545&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/ConfigurationManager.java
(original)
+++ directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/ConfigurationManager.java
Thu Dec 29 14:38:38 2011
@@ -161,6 +161,8 @@ public class ConfigurationManager
         try
         {
             configPartition.add( ac );
+
+            instance.setDITHookDn( instanceEntry.getDn().getName() );
         }
         catch ( LdapException e )
         {

Modified: 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/ADSComponentInstance.java?rev=1225545&r1=1225544&r2=1225545&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/ADSComponentInstance.java
Thu Dec 29 14:38:38 2011
@@ -23,6 +23,8 @@ package org.apache.directory.server.comp
 import java.util.Properties;
 
 import org.apache.directory.server.component.ADSComponent;
+import org.apache.directory.server.component.utilities.ADSConstants;
+import org.apache.felix.ipojo.InstanceManager;
 
 
 /**
@@ -33,6 +35,16 @@ import org.apache.directory.server.compo
 public class ADSComponentInstance
 {
     /*
+     * IPojo instance name
+     */
+    private String instanceName;
+
+    /*
+     * An IPojo instance manager reference
+     */
+    private InstanceManager instanceManager;
+
+    /*
      * Actual instance reference.
      */
     private Object instance;
@@ -61,29 +73,31 @@ public class ADSComponentInstance
      * @param pojo Underlying Pojo object if the component instance
      * @param configuration Configuration of the Pojo
      */
-    public ADSComponentInstance( ADSComponent component, Object pojo, Properties configuration
)
+    public ADSComponentInstance( ADSComponent component, InstanceManager instanceManager,
Properties configuration )
     {
         this.parentComponent = component;
-        this.instance = pojo;
+        this.instanceManager = instanceManager;
         this.instanceConfiguration = configuration;
+        this.instance = instanceManager.getPojoObject();
+        this.instanceName = configuration.getProperty( ADSConstants.ADS_COMPONENT_INSTANCE_PROP_NAME
);
     }
 
 
     /**
-     * @return the instance
+     * @return the instance name
      */
-    public Object getInstance()
+    public String getInstanceName()
     {
-        return instance;
+        return instanceName;
     }
 
 
     /**
-     * @param instance the instance to set
+     * @return the instance
      */
-    public void setInstance( Object instance )
+    public Object getInstance()
     {
-        this.instance = instance;
+        return instance;
     }
 
 
@@ -97,47 +111,56 @@ public class ADSComponentInstance
 
 
     /**
-     * @param parentComponent the parentComponent to set
+     * @return the instanceConfiguration
      */
-    public void setParentComponent( ADSComponent parentComponent )
+    public Properties getInstanceConfiguration()
     {
-        this.parentComponent = parentComponent;
+        return instanceConfiguration;
     }
 
 
     /**
-     * @return the instanceConfiguration
+     * @return the configHookDn
      */
-    public Properties getInstanceConfiguration()
+    public String getDITHookDn()
     {
-        return instanceConfiguration;
+        return DITHookDn;
     }
 
 
     /**
-     * @param instanceConfiguration the instanceConfiguration to set
+     * @param configHookDn the configHookDn to set
      */
-    public void setInstanceConfiguration( Properties instanceConfiguration )
+    public void setDITHookDn( String DITHookDn )
     {
-        this.instanceConfiguration = instanceConfiguration;
+        this.DITHookDn = DITHookDn;
     }
 
 
     /**
-     * @return the configHookDn
+     * Reconfigures the underlying IPojo instance with the supplied configuration.
+     * When called with null configuration, it reconfigures itself with the current configuration
+     *
+     * @param instanceConfiguration Instance configuration
      */
-    public String getDITHookDn()
+    public void reconfigure( Properties instanceConfiguration )
     {
-        return DITHookDn;
+        if ( instanceConfiguration != null )
+        {
+            this.instanceConfiguration = instanceConfiguration;
+        }
+
+        instanceManager.reconfigure( instanceConfiguration );
     }
 
 
     /**
-     * @param configHookDn the configHookDn to set
+     * Stops the IPojo instance management for this instance
+     *
      */
-    public void setDITHookDn( String DITHookDn )
+    public void stop()
     {
-        this.DITHookDn = DITHookDn;
+        instanceManager.stop();
     }
 
 }

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=1225545&r1=1225544&r2=1225545&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
Thu Dec 29 14:38:38 2011
@@ -63,10 +63,10 @@ public class DefaultComponentInstanceGen
         try
         {
             ComponentInstance comp = component.getFactory().createComponentInstance( properties
);
-            Object pojo = ( ( InstanceManager ) comp ).getPojoObject();
+            InstanceManager instanceManager = ( ( InstanceManager ) comp );
 
-            //Create the ADSComponentInstance reference using the pojo just created.
-            ADSComponentInstance instance = new ADSComponentInstance( component, pojo, properties
);
+            //Create the ADSComponentInstance reference using the  pojo manager just created.
+            ADSComponentInstance instance = new ADSComponentInstance( component, instanceManager,
properties );
 
             return instance;
         }



Mime
View raw message