You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by dj...@apache.org on 2013/09/11 23:13:48 UTC

svn commit: r1522045 - in /felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config: ConfigurationSupport.java ImmediateComponentHolder.java

Author: djencks
Date: Wed Sep 11 21:13:48 2013
New Revision: 1522045

URL: http://svn.apache.org/r1522045
Log:
FELIX-3651 components using factory pids can't fall back on less specific targeted pids when a configuration is deleted

Modified:
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurationSupport.java
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ImmediateComponentHolder.java

Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurationSupport.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurationSupport.java?rev=1522045&r1=1522044&r2=1522045&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurationSupport.java (original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurationSupport.java Wed Sep 11 21:13:48 2013
@@ -132,6 +132,8 @@ public class ConfigurationSupport implem
                                 boolean created = false;
                                 for (Configuration config: factory)
                                 {
+                                    Activator.log( LogService.LOG_DEBUG, null, "Configuring holder {0} with factory configuration {1}",
+                                            new Object[] {holder, config}, null );
                                     config = getConfiguration( ca, config.getPid() );
                                     if ( checkBundleLocation( config, bundleContext.getBundle() ))
                                     {
@@ -148,6 +150,8 @@ public class ConfigurationSupport implem
                                 if (singleton != null)
                                 {
                                     singleton = getConfiguration( ca, singleton.getPid() );
+                                    Activator.log( LogService.LOG_DEBUG, null, "Configuring holder {0} with configuration {1}",
+                                            new Object[] {holder, singleton}, null );
                                     if ( singleton != null && checkBundleLocation( singleton, bundleContext.getBundle() ))
                                     {
                                         long changeCount = changeCounter.getChangeCount( singleton, false, -1 );
@@ -251,7 +255,7 @@ public class ConfigurationSupport implem
             {
                 switch (event.getType()) {
                 case ConfigurationEvent.CM_DELETED:
-                    if ( !configureComponentHolder( componentHolder ) )
+                    if ( factoryPid != null || !configureComponentHolder( componentHolder ) )
                     {
                         componentHolder.configurationDeleted( pid.getServicePid() );
                     }

Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ImmediateComponentHolder.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ImmediateComponentHolder.java?rev=1522045&r1=1522044&r2=1522045&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ImmediateComponentHolder.java (original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ImmediateComponentHolder.java Wed Sep 11 21:13:48 2013
@@ -497,7 +497,7 @@ public class ImmediateComponentHolder<S>
 
         ImmediateComponentHolder other = (ImmediateComponentHolder) object;
         return m_activator == other.m_activator
-                && getComponentMetadata().getName().equals(other.getComponentMetadata().getName());
+                && getName().equals(other.getName());
     }
     
    /**
@@ -505,14 +505,26 @@ public class ImmediateComponentHolder<S>
     * 
     * @return An integer which is a hash code value for this object.
     */
+   @Override
    public int hashCode()
    {
-       return getComponentMetadata().getName().hashCode();
+       return getName().hashCode();
+   }
+   
+   @Override
+   public String toString()
+   {
+       return "[ImmediateComponentHolder:" + getName() + "]";
+   }
+   
+   String getName()
+   {
+       return m_componentMetadata.getName();
    }
 
     //---------- internal
 
-   /**
+    /**
      * Returns all components from the map, optionally also removing them
      * from the map. If there are no components in the map, <code>null</code>
      * is returned.