You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by fm...@apache.org on 2012/07/05 19:20:35 UTC

svn commit: r1357748 - /felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/helper/ManagedServiceTracker.java

Author: fmeschbe
Date: Thu Jul  5 17:20:34 2012
New Revision: 1357748

URL: http://svn.apache.org/viewvc?rev=1357748&view=rev
Log:
FELIX-3481 - support forced configuration assignment for replacement

Modified:
    felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/helper/ManagedServiceTracker.java

Modified: felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/helper/ManagedServiceTracker.java
URL: http://svn.apache.org/viewvc/felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/helper/ManagedServiceTracker.java?rev=1357748&r1=1357747&r2=1357748&view=diff
==============================================================================
--- felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/helper/ManagedServiceTracker.java (original)
+++ felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/helper/ManagedServiceTracker.java Thu Jul  5 17:20:34 2012
@@ -46,6 +46,19 @@ public class ManagedServiceTracker exten
     }
 
 
+    /**
+     * Provides the given configuration to the managed service.
+     * <p>
+     * Depending on targeted PIDs this configuration may not actually be
+     * provided if the service already has more strictly binding
+     * configuration from a targeted configuration bound.
+     * <p>
+     * If the revision is a negative value, the provided configuration
+     * is assigned to the ManagedService in any case without further
+     * checks. This allows a replacement configuration for a deleted
+     * or invisible configuration to be assigned without first removing
+     * the deleted or invisible configuration.
+     */
     @Override
     public void provideConfiguration( ServiceReference<ManagedService> service, TargetedPID configPid,
         TargetedPID factoryPid, Dictionary<String, ?> properties, long revision )
@@ -82,11 +95,12 @@ public class ManagedServiceTracker exten
                 revision = -1;
                 doUpdate = true;
             }
-            else if ( configs.shallTake( configPid, null, revision ) )
+            else if ( revision < 0 || configs.shallTake( configPid, null, revision ) )
             {
                 // run the plugins and cause the update
                 properties = getProperties( properties, service, configPid.toString(), null );
                 doUpdate = true;
+                revision = Math.abs( revision );
             }
             else
             {