felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pde...@apache.org
Subject svn commit: r1125823 - in /felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl: AbstractDecorator.java BundleAdapterServiceImpl.java FactoryConfigurationAdapterServiceImpl.java ResourceAdapterServiceImpl.java
Date Sat, 21 May 2011 21:30:02 GMT
Author: pderop
Date: Sat May 21 21:30:02 2011
New Revision: 1125823

URL: http://svn.apache.org/viewvc?rev=1125823&view=rev
Log:
FELIX-2964 (NPE on some dependency manager adapters, when auto-configuration mode is disabled)

Modified:
    felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/AbstractDecorator.java
    felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/BundleAdapterServiceImpl.java
    felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/FactoryConfigurationAdapterServiceImpl.java
    felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ResourceAdapterServiceImpl.java

Modified: felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/AbstractDecorator.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/AbstractDecorator.java?rev=1125823&r1=1125822&r2=1125823&view=diff
==============================================================================
--- felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/AbstractDecorator.java
(original)
+++ felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/AbstractDecorator.java
Sat May 21 21:30:02 2011
@@ -45,6 +45,13 @@ public abstract class AbstractDecorator 
     public abstract Component createService(Object[] properties);
     
     /**
+     * Catches our DependencyManager handle from our component init method.
+     */
+    public void init(Component c) {
+        m_manager = c.getDependencyManager();
+    }
+    
+    /**
      * Extra method, which may be used by sub-classes, when adaptee has changed.
      * For now, it's only used by the FactoryConfigurationAdapterImpl class, 
      * but it might also make sense to use this for Resource Adapters ...

Modified: felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/BundleAdapterServiceImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/BundleAdapterServiceImpl.java?rev=1125823&r1=1125822&r2=1125823&view=diff
==============================================================================
--- felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/BundleAdapterServiceImpl.java
(original)
+++ felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/BundleAdapterServiceImpl.java
Sat May 21 21:30:02 2011
@@ -95,6 +95,7 @@ public class BundleAdapterServiceImpl ex
             for (int i = 0; i < m_stateListeners.size(); i ++) {
                 service.addStateListener((ComponentStateListener) m_stateListeners.get(i));
             }
+            configureAutoConfigState(service, m_component);
             return service;
         }
     }

Modified: felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/FactoryConfigurationAdapterServiceImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/FactoryConfigurationAdapterServiceImpl.java?rev=1125823&r1=1125822&r2=1125823&view=diff
==============================================================================
--- felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/FactoryConfigurationAdapterServiceImpl.java
(original)
+++ felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/FactoryConfigurationAdapterServiceImpl.java
Sat May 21 21:30:02 2011
@@ -68,10 +68,7 @@ public class FactoryConfigurationAdapter
     /**
      * Creates, updates, or removes a service, when a ConfigAdmin factory configuration is
created/updated or deleted.
      */
-    public class AdapterImpl extends AbstractDecorator implements ManagedServiceFactory {
-        // Our injected dependency manager
-        protected volatile DependencyManager m_dm;
-        
+    public class AdapterImpl extends AbstractDecorator implements ManagedServiceFactory {
       
         // Our Managed Service Factory PID
         protected String m_factoryPid;
         
@@ -109,7 +106,7 @@ public class FactoryConfigurationAdapter
          */
         public Component createService(Object[] properties) {
             Dictionary settings = (Dictionary) properties[0];     
-            Component newService = m_dm.createComponent();        
+            Component newService = m_manager.createComponent();        
             Object impl = null;
             
             try {
@@ -133,12 +130,13 @@ public class FactoryConfigurationAdapter
             newService.setInterface(m_serviceInterfaces, serviceProperties);
             newService.setImplementation(impl);
             List dependencies = m_component.getDependencies();
-            newService.add(dependencies);
+            newService.add(dependencies); // TODO check if we should create a copy of dependencies
?
             newService.setComposition(m_compositionInstance, m_compositionMethod); // if
not set, no effect
             newService.setCallbacks(m_callbackObject, m_init, m_start, m_stop, m_destroy);
// if not set, no effect
             for (int i = 0; i < m_stateListeners.size(); i ++) {
                 newService.addStateListener((ComponentStateListener) m_stateListeners.get(i));
             }
+            configureAutoConfigState(newService, m_component);
             return newService;
         }
 

Modified: felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ResourceAdapterServiceImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ResourceAdapterServiceImpl.java?rev=1125823&r1=1125822&r2=1125823&view=diff
==============================================================================
--- felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ResourceAdapterServiceImpl.java
(original)
+++ felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ResourceAdapterServiceImpl.java
Sat May 21 21:30:02 2011
@@ -118,6 +118,8 @@ public class ResourceAdapterServiceImpl 
                 .setCallbacks(m_callbackObject, m_init, m_start, m_stop, m_destroy) // if
not set, no effect
                 .add(resourceDependency);
             
+            configureAutoConfigState(service, m_component);
+
             for (int i = 0; i < dependencies.size(); i++) {
                 service.add(((Dependency) dependencies.get(i)).createCopy());
             }



Mime
View raw message