You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by pd...@apache.org on 2015/02/23 00:04:38 UTC

svn commit: r1661577 - in /felix/sandbox/pderop/dependencymanager: org.apache.felix.dependencymanager.annotation/resources/ org.apache.felix.dependencymanager.annotation/src/org/apache/felix/dm/annotation/api/ org.apache.felix.dependencymanager.annotat...

Author: pderop
Date: Sun Feb 22 23:04:37 2015
New Revision: 1661577

URL: http://svn.apache.org/r1661577
Log:
FELIX-4777: Dynamic initialization time configuration of @ConfigurationDependency.
FELIX-4805: Deprecate DM annotation metatypes.

Modified:
    felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager.annotation/resources/changelog.txt
    felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager.annotation/src/org/apache/felix/dm/annotation/api/ConfigurationDependency.java
    felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager.annotation/src/org/apache/felix/dm/annotation/api/FactoryConfigurationAdapterService.java
    felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager.annotation/src/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java
    felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager.annotation/src/org/apache/felix/dm/annotation/plugin/bnd/EntryParam.java
    felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager.runtime/resources/changelog.txt
    felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager.runtime/src/org/apache/felix/dm/runtime/ServiceLifecycleHandler.java

Modified: felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager.annotation/resources/changelog.txt
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager.annotation/resources/changelog.txt?rev=1661577&r1=1661576&r2=1661577&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager.annotation/resources/changelog.txt (original)
+++ felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager.annotation/resources/changelog.txt Sun Feb 22 23:04:37 2015
@@ -1,6 +1,8 @@
 Release 4.0.0:
 -------------
 
+FELIX-4805: Deprecate DM annotation metatypes
+FELIX-4777: Dynamic initialization time configuration of @ConfigurationDependency
 FELIX-4676: Add Provide-Capability for DependencyManager Runtime bundle
 FELIX-4600: Cherrypicking of propagated properties
-FELIX-4684: Replace DependencyManager Runtime "factorySet" by a cleaner API
\ No newline at end of file
+FELIX-4684: Replace DependencyManager Runtime "factorySet" by a cleaner API

Modified: felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager.annotation/src/org/apache/felix/dm/annotation/api/ConfigurationDependency.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager.annotation/src/org/apache/felix/dm/annotation/api/ConfigurationDependency.java?rev=1661577&r1=1661576&r2=1661577&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager.annotation/src/org/apache/felix/dm/annotation/api/ConfigurationDependency.java (original)
+++ felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager.annotation/src/org/apache/felix/dm/annotation/api/ConfigurationDependency.java Sun Feb 22 23:04:37 2015
@@ -32,55 +32,44 @@ import java.lang.annotation.Target;
  * <h3>Usage Examples</h3>
  * 
  * <p> In the following example, the "Printer" component depends on a configuration
- * whose PID name is "org.apache.felix.sample.Printer". This service will initialize
- * its ip/port number from the provided configuration:
- * <p>
+ * whose PID name is "sample.PrinterConfiguration". This service will initialize
+ * its ip/port number from the provided configuration.
+ * <p> First, we define the configuration metadata, using standard bndtools metatatype annotations 
+ * (see http://www.aqute.biz/Bnd/MetaType):
+ * 
  * <blockquote>
  * <pre>
- * package org.apache.felix.sample;
- * 
- * &#64;Component
- * public class Printer {
- *     &#64;ConfigurationDependency
- *     void updated(Dictionary config) {
- *         // load printer ip/port from the provided dictionary.
- *     }
+ * package sample;
+ * import aQute.bnd.annotation.metatype.Meta.AD;
+ * import aQute.bnd.annotation.metatype.Meta.OCD;
+ *
+ * &#64;OCD(description = "Declare here the Printer Configuration.")
+ * public interface PrinterConfiguration {
+ *     &#64;AD(description = "Enter the printer ip address")
+ *     String ipAddress();
+ *
+ *     &#64;AD(description = "Enter the printer address port number.")
+ *     int portNumber();
  * }
  * </pre>
  * </blockquote>
  * 
- * <p> This other example shows how to specify a configuration dependency, as well as meta data
- * used to customize the WebConsole GUI. Using these meta data, you can specify for example the
- * default value for your configurations data, some descriptions, the cardinality of configuration 
- * values, etc ... 
- * <p>
+ * Next, we define our Printer service which depends on the PrinterConfiguration:
+ * 
  * <blockquote>
  * <pre>
- * package org.apache.felix.sample;
- * 
+ * package sample;
+ * import aQute.bnd.annotation.metatype.*;
+ *
  * &#64;Component
  * public class Printer {
- *     &#64;ConfigurationDependency(
- *         heading = "Printer Service",
- *         description = "Declare here parameters used to configure the Printer service", 
- *         metadata = { 
- *             &#64;PropertyMetaData(heading = "Ip Address", 
- *                               description = "Enter the ip address for the Printer service",
- *                               defaults = { "127.0.0.1" }, 
- *                               type = String.class,
- *                               id = "IPADDR", 
- *                               cardinality = 0),
- *             &#64;PropertyMetaData(heading = "Port Number", 
- *                               description = "Enter the port number for the Printer service",
- *                               defaults = { "4444" }, 
- *                               type = Integer.class,
- *                               id = "PORTNUM", 
- *                               cardinality = 0) 
-
- *         }
- *     )
- *     void updated(Dictionary config) {
- *         // load configuration from the provided dictionary.
+ *     &#64;ConfigurationDependency(pidClass = PrinterConfiguration.class) // Will use pid "sample.PrinterConfiguration"
+ *     void updated(Dictionary props) {
+ *         // load configuration from the provided dictionary, or throw an exception of any configuration error.
+ *         PrinterConfig cnf = Configurable.createConfigurable(PrinterConfig.class, props);
+ *         String ip = cnf.ipAddress();
+ *         int port = cnf.portNumber();
+ *         ...
  *     }
  * }
  * </pre>
@@ -97,6 +86,13 @@ public @interface ConfigurationDependenc
      * @return the pid for a given service (default = Service class name)
      */
     String pid() default "";
+    
+    /**
+     * Returns the pid from a class name. The full class name will be used as the configuration PID.
+     * You can use this method when you use an interface annoted with standard bndtols metatype annotations.
+     * (see http://www.aqute.biz/Bnd/MetaType).
+     */
+    Class<?> pidClass() default Object.class;
 
     /**
      * Returns true if the configuration properties must be published along with the service. 
@@ -106,20 +102,75 @@ public @interface ConfigurationDependenc
     boolean propagate() default false;
     
     /**
+     * The name for this configuration dependency. When you give a name a dependency, it won't be evaluated
+     * immediately, but after the component's init method has been called, and from the init method, you can then return 
+     * a map in order to dynamically configure the configuration dependency (the map has to contain a "pid" and/or "propagate" 
+     * flag, prefixed with the dependency name). Then the dependency will be evaluated after the component init method, and will
+     * be injected before the start method.
+     * 
+     * <p> Usage example of a Configuration dependency whose pid and propagate flag is configured dynamically from init method:
+     * 
+     * <blockquote><pre>
+     *  &#47;**
+     *    * A Service that dynamically defines an extra dynamic configuration dependency from its init method. 
+     *    *&#47;
+     *  &#64;Component
+     *  class X {
+     *      private Dictionary m_config;
+     *      
+     *      // Inject initial Configuration (injected before any other required dependencies)
+     *      &#64;ConfigurationDependency
+     *      void componentConfiguration(Dictionary config) {
+     *           // you must throw an exception if the configuration is not valid
+     *           m_config = config;
+     *      }
+     *      
+     *      &#47;**
+     *       * All unnamed dependencies are injected: we can now configure our dynamic configuration whose dependency name is "global".
+     *       *&#47;
+     *      &#64;Init
+     *      Map init() {
+     *          return new HashMap() {{
+     *              put("global.pid", m_config.get("globalConfig.pid"));
+     *              put("global.propagate", m_config.get("globalConfig.propagate"));
+     *          }};
+     *      } 
+     * 
+     *      // Injected after init, and dynamically configured by the init method.
+     *      &#64;ConfigurationDependency(name="global")
+     *      void globalConfiguration(Dictionary globalConfig) {
+     *           // you must throw an exception if the configuration is not valid
+     *      }
+     * 
+     *      &#47;**
+     *       * All dependencies are injected and our service is now ready to be published.
+     *       *&#47;
+     *      &#64;Start
+     *      void start() {
+     *      }
+     *  }
+     *  </pre></blockquote>
+     */
+    String name() default "";
+    
+   /**
      * The label used to display the tab name (or section) where the properties are displayed. Example: "Printer Service".
      * @return The label used to display the tab name where the properties are displayed.
+     * @deprecated use standard bndtools metatype annotations instead (see http://www.aqute.biz/Bnd/MetaType)
      */
     String heading() default "";
 
     /**
      * A human readable description of the PID this annotation is associated with. Example: "Configuration for the PrinterService bundle".
      * @return A human readable description of the PID this annotation is associated with.
+     * @deprecated use standard bndtools metatype annotations instead (see http://www.aqute.biz/Bnd/MetaType)
      */
     String description() default "";
 
     /**
      * The list of properties types used to expose properties in web console. 
-     * @return The list of properties types used to expose properties in web console. 
+     * @return The list of properties types used to expose properties in web console.
+     * @deprecated use standard bndtools metatype annotations instead (see http://www.aqute.biz/Bnd/MetaType)
      */
     PropertyMetaData[] metadata() default {};
 }

Modified: felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager.annotation/src/org/apache/felix/dm/annotation/api/FactoryConfigurationAdapterService.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager.annotation/src/org/apache/felix/dm/annotation/api/FactoryConfigurationAdapterService.java?rev=1661577&r1=1661576&r2=1661577&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager.annotation/src/org/apache/felix/dm/annotation/api/FactoryConfigurationAdapterService.java (original)
+++ felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager.annotation/src/org/apache/felix/dm/annotation/api/FactoryConfigurationAdapterService.java Sun Feb 22 23:04:37 2015
@@ -25,114 +25,55 @@ import java.lang.annotation.Target;
 
 
 /**
- * Annotates a class that acts as a Factory Configuration Adapter Service. For each new <code>Config Admin</code> factory configuration matching
- * the specified factoryPid, an instance of this service will be created.
+ * Annotates a class that acts as a Factory Configuration Adapter Service. For each new <code>Config Admin</code> 
+ * factory configuration matching the specified factoryPid, an instance of this service will be created.
  * The adapter will be registered with the specified interface, and with the specified adapter service properties.
  * Depending on the <code>propagate</code> parameter, every public factory configuration properties 
  * (which don't start with ".") will be propagated along with the adapter service properties. <p>
  * 
- * Like in &#64;{@link ConfigurationDependency}, you can optionally specify the meta types of your
- * configurations for Web Console GUI customization (configuration heading/descriptions/default values/etc ...).
- *
  * <h3>Usage Examples</h3>
- * Here, a "Dictionary" service instance is instantiated for each existing factory configuration
- * instances matching the factory pid "DictionaryServiceFactory".
+ * Here, a "Dictionary" service instance is created for each existing "sample.DictionaryConfiguration" factory pids.
+ * 
+ * First, we declare our factory configuration metadata using standard bndtools metatatype annotations 
+ * (see http://www.aqute.biz/Bnd/MetaType):
+ * 
  * <blockquote>
  * <pre>
- * &#64;FactoryConfigurationAdapterService(factoryPid="DictionaryServiceFactory", updated="updated")
- * public class DictionaryImpl implements DictionaryService
- * {
- *     &#47;**
- *      * The key of our config admin dictionary language.
- *      *&#47;
- *     final static String LANG = "lang";
- *     
- *     &#47;**
- *      * The key of our config admin dictionary values.
- *      *&#47;
- *     final static String WORDS = "words";
- *     
- *     &#47;**
- *      * We store all configured words in a thread-safe data structure, because ConfigAdmin
- *      * may invoke our updated method at any time.
- *      *&#47;
- *     private CopyOnWriteArrayList&#60;String&#62; m_words = new CopyOnWriteArrayList&#60;String&#62;();
- *     
- *     &#47;**
- *      * Our Dictionary language.
- *      *&#47;
- *     private String m_lang;
- * 
- *     protected void updated(Dictionary&#60;String, ?&#62; config) {
- *         m_lang = (String) config.get(LANG);
- *         m_words.clear();
- *         String[] words = (String[]) config.get(WORDS);
- *         for (String word : words) {
- *             m_words.add(word);
- *         }
- *     }   
- *     ...
+ * package sample;
+ * import java.util.List;
+ * import aQute.bnd.annotation.metatype.Meta.AD;
+ * import aQute.bnd.annotation.metatype.Meta.OCD;
+ *
+ * &#64;OCD(factory = true, description = "Declare here some Dictionary instances.")
+ * public interface DictionaryConfiguration {
+ *   &#64;AD(description = "Describes the dictionary language.", deflt = "en")
+ *   String lang();
+ *
+ *   &#64;AD(description = "Declare here the list of words supported by this dictionary.")
+ *   List<String> words();
  * }
  * </pre>
  * </blockquote>
- * Here, this is the same example as above, but using meta types:
- * 
+ *
+ * And here is the Dictionary service:
+ *
  * <blockquote>
  * <pre>
- * &#64;FactoryConfigurationAdapterService(
- *     factoryPid="DictionaryServiceFactory", 
- *     propagate=true, 
- *     updated="updated",
- *     heading="Dictionary Services",
- *     description="Declare here some Dictionary instances, allowing to instantiates some DictionaryService services for a given dictionary language",
- *     metadata={
- *         &#64;PropertyMetaData(
- *             heading="Dictionary Language",
- *             description="Declare here the language supported by this dictionary. " +
- *                 "This property will be propagated with the Dictionary Service properties.",
- *             defaults={"en"},
- *             id=DictionaryImpl.LANG,
- *             cardinality=0),
- *         &#64;PropertyMetaData(
- *             heading="Dictionary words",
- *             description="Declare here the list of words supported by this dictionary. This properties starts with a Dot and won't be propagated with Dictionary OSGi service properties.",
- *             defaults={"hello", "world"},
- *             id=DictionaryImpl.WORDS,
- *             cardinality=Integer.MAX_VALUE)
- *     }
- * )  
- * public class DictionaryImpl implements DictionaryService
- * {
- *     &#47;**
- *      * The key of our config admin dictionary language.
- *      *&#47;
- *     final static String LANG = "lang";
- *     
- *     &#47;**
- *      * The key of our config admin dictionary values.
- *      *&#47;
- *     final static String WORDS = "words";
- *     
- *     &#47;**
- *      * We store all configured words in a thread-safe data structure, because ConfigAdmin
- *      * may invoke our updated method at any time.
- *      *&#47;
- *     private CopyOnWriteArrayList&#60;String&#62; m_words = new CopyOnWriteArrayList&#60;String&#62;();
- *     
- *     &#47;**
- *      * Our Dictionary language.
- *      *&#47;
- *     private String m_lang;
+ * import java.util.List;
+ * import aQute.bnd.annotation.metatype.Configurable;
+ *
+ * &#64;FactoryConfigurationAdapterService(factoryPidClass=DictionaryConfiguration.class)  
+ * public class DictionaryImpl implements DictionaryService {
+ *     protected void updated(Dictionary&#60;String, ?&#62; props) {
+ *         // load configuration from the provided dictionary, or throw an exception of any configuration error.
+ *         DictionaryConfiguration cnf = Configurable.createConfigurable(DictionaryConfiguration.class, props);
  * 
- *     protected void updated(Dictionary&#60;String, ?&#62; config) {
- *         m_lang = (String) config.get(LANG);
+ *         m_lang = config.lang();
  *         m_words.clear();
- *         String[] words = (String[]) config.get(WORDS);
- *         for (String word : words) {
+ *         for (String word : conf.words()) {
  *             m_words.add(word);
  *         }
  *     }
- *     
  *     ...
  * }
  * </pre>
@@ -161,6 +102,13 @@ public @interface FactoryConfigurationAd
      * service class name).
      */
     String factoryPid() default "";
+    
+    /**
+     * Returns the factory pid from a class name. The full class name will be used as the configuration PID.
+     * You can use this method when you use an interface annoted with standard bndtols metatype annotations.
+     * (see http://www.aqute.biz/Bnd/MetaType).
+     */
+    Class<?> factoryPidClass() default Object.class;
 
     /**
      * The Update method to invoke (defaulting to "updated"), when a factory configuration is created or updated
@@ -177,18 +125,21 @@ public @interface FactoryConfigurationAd
     /**
      * The label used to display the tab name (or section) where the properties are displayed. Example: "Printer Service".
      * @return The label used to display the tab name where the properties are displayed.
+     * @deprecated use standard bndtools metatype annotations instead (see http://www.aqute.biz/Bnd/MetaType)
      */
     String heading() default "";
 
     /**
      * A human readable description of the PID this annotation is associated with. Example: "Configuration for the PrinterService bundle".
      * @return A human readable description of the PID this annotation is associated with.
+     * @deprecated use standard bndtools metatype annotations instead (see http://www.aqute.biz/Bnd/MetaType)
      */
     String description() default "";
 
     /**
      * The list of properties types used to expose properties in web console. 
-     * @return The list of properties types used to expose properties in web console. 
+     * @return The list of properties types used to expose properties in web console.
+     * @deprecated use standard bndtools metatype annotations instead (see http://www.aqute.biz/Bnd/MetaType)
      */
     PropertyMetaData[] metadata() default {};
     

Modified: felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager.annotation/src/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager.annotation/src/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java?rev=1661577&r1=1661576&r2=1661577&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager.annotation/src/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java (original)
+++ felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager.annotation/src/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java Sun Feb 22 23:04:37 2015
@@ -532,9 +532,16 @@ public class AnnotationCollector extends
         EntryWriter writer = new EntryWriter(EntryType.ConfigurationDependency);
         m_writers.add(writer);
 
-        // pid attribute
-        writer.putString(annotation, EntryParam.pid, m_className);
-
+        // pid attribute (can be specified using the pid attribute, or using the classPid attribute)
+        String  pid = annotation.get(EntryParam.pidClass.toString());
+        if (pid != null)
+        {
+            pid = Patterns.parseClass(pid, Patterns.CLASS, 1);
+        } else {
+            pid = get(annotation, EntryParam.pid.toString(), m_className);
+        }
+        writer.put(EntryParam.pid, pid);
+        
         // the method on which the annotation is applied
         writer.put(EntryParam.updated, m_method);
 
@@ -542,8 +549,10 @@ public class AnnotationCollector extends
         writer.putString(annotation, EntryParam.propagate, null);
 
         // Property Meta Types
-        String pid = get(annotation, EntryParam.pid.toString(), m_className);
         parseMetaTypes(annotation, pid, false);
+        
+        // name attribute
+        parseDependencyName(writer, annotation);
     }
 
     /**
@@ -775,7 +784,16 @@ public class AnnotationCollector extends
         // Generate Adapter Implementation
         writer.put(EntryParam.impl, m_className);
 
-        // Parse factory Pid
+        // factory pid attribute (can be specified using the factoryPid attribute, or using the factoryPidClass attribute)
+        String  factoryPid = annotation.get(EntryParam.factoryPidClass.toString());
+        if (factoryPid != null)
+        {
+            factoryPid = Patterns.parseClass(factoryPid, Patterns.CLASS, 1);
+        } else {
+            factoryPid = get(annotation, EntryParam.factoryPid.toString(), m_className);
+        }
+        writer.put(EntryParam.factoryPid, factoryPid);
+
         writer.putString(annotation, EntryParam.factoryPid, m_className);
 
         // Parse updated callback
@@ -794,7 +812,6 @@ public class AnnotationCollector extends
         parseProperties(annotation, EntryParam.properties, writer);
 
         // Parse optional meta types for configuration description.
-        String factoryPid = get(annotation, EntryParam.factoryPid.toString(), m_className);
         parseMetaTypes(annotation, factoryPid, true);
         
         // Parse factoryMethod attribute

Modified: felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager.annotation/src/org/apache/felix/dm/annotation/plugin/bnd/EntryParam.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager.annotation/src/org/apache/felix/dm/annotation/plugin/bnd/EntryParam.java?rev=1661577&r1=1661576&r2=1661577&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager.annotation/src/org/apache/felix/dm/annotation/plugin/bnd/EntryParam.java (original)
+++ felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager.annotation/src/org/apache/felix/dm/annotation/plugin/bnd/EntryParam.java Sun Feb 22 23:04:37 2015
@@ -33,7 +33,7 @@ public enum EntryParam
     provides, 
     properties, 
     composition, 
-    service, 
+    service,
     filter, 
     defaultImpl, 
     required, 
@@ -42,8 +42,10 @@ public enum EntryParam
     removed,
     swap,
     autoConfig, 
-    pid, 
+    pid,
+    pidClass,
     factoryPid,
+    factoryPidClass,
     propagate, 
     updated, 
     timeout,

Modified: felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager.runtime/resources/changelog.txt
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager.runtime/resources/changelog.txt?rev=1661577&r1=1661576&r2=1661577&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager.runtime/resources/changelog.txt (original)
+++ felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager.runtime/resources/changelog.txt Sun Feb 22 23:04:37 2015
@@ -1,6 +1,7 @@
 Release 4.0.0:
 -------------
 
+FELIX-4777: Dynamic initialization time configuration of @ConfigurationDependency
 FELIX-4676: Add Provide-Capability for DependencyManager Runtime bundle
 FELIX-4600: Cherrypicking of propagated properties
 FELIX-4684: Replace DependencyManager Runtime "factorySet" by a cleaner API

Modified: felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager.runtime/src/org/apache/felix/dm/runtime/ServiceLifecycleHandler.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager.runtime/src/org/apache/felix/dm/runtime/ServiceLifecycleHandler.java?rev=1661577&r1=1661576&r2=1661577&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager.runtime/src/org/apache/felix/dm/runtime/ServiceLifecycleHandler.java (original)
+++ felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager.runtime/src/org/apache/felix/dm/runtime/ServiceLifecycleHandler.java Sun Feb 22 23:04:37 2015
@@ -204,14 +204,17 @@ public class ServiceLifecycleHandler
         {
             // Check if this dependency has a name, and if we find the name from the 
             // customization map, then apply filters and required flag from the map into it.
+            // Also parse optional pid/propagate flags for named Configuration dependencies
 
             String name = dependency.getString(Params.name, null);
             if (name != null)
             {
                 String filter = customization.get(name + ".filter");
                 String required = customization.get(name + ".required");
+                String pid = customization.get(name + ".pid");
+                String propagate = customization.get(name + ".propagate");
 
-                if (filter != null || required != null)
+                if (filter != null || required != null || pid != null || propagate != null)
                 {
                     dependency = (MetaData) dependency.clone();
                     if (filter != null)
@@ -222,6 +225,14 @@ public class ServiceLifecycleHandler
                     {
                         dependency.setString(Params.required, required);
                     }
+                    if (pid != null)
+                    {
+                        dependency.setString(Params.pid, pid);
+                    }
+                    if (propagate != null)
+                    {
+                        dependency.setString(Params.propagate, propagate);
+                    }
                 }
 
                 DependencyBuilder depBuilder = new DependencyBuilder(dependency);