Applied feedbacks that Jan Willem sent to me about the new dm-lambda library:

- renamed the DependencyManagerActivator.activate() method to  init(BundleContext ctx, DependencyManager dm) 
- Removed abbreviated names like "cb()" or "cbi" methods, and replaced them with niced method names like "add()/changed()/removed()" ...
- Added a system property "org.apache.felix.dependencymanager.lambda.dependencymode" that allows to control the default
mode of dependency (still to be discussed).
- added full support or new configuration types.


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1731147 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/compositefactory/Activator.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/compositefactory/Activator.java
index 2aab3bc..dbb3c3c 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/compositefactory/Activator.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/compositefactory/Activator.java
@@ -20,7 +20,9 @@
 
 import static java.lang.System.out;
 
+import org.apache.felix.dm.DependencyManager;
 import org.apache.felix.dm.lambda.DependencyManagerActivator;
+import org.osgi.framework.BundleContext;
 import org.osgi.service.cm.ConfigurationAdmin;
 import org.osgi.service.log.LogService;
 
@@ -39,8 +41,8 @@
  */
 public class Activator extends DependencyManagerActivator {
     @Override
-    public void activate() throws Exception {
-    	out.println("type \"log info\" to see the logs emitted by this test.");
+    public void init(BundleContext ctx, DependencyManager dm) throws Exception {
+    	out.println("type \"log warn\" to see the logs emitted by this test.");
 
     	// Create the Factory used to instantiate ProvuderImpl, ProviderComposite1 and ProviderComposite2
         ProviderFactory factory = new ProviderFactory();
@@ -51,13 +53,11 @@
         // before creating the composition of classes.
         component(comp -> comp
             .factory(factory::create, factory::getComposition)
-            .start(ProviderImpl::start) // only call start on ProviderImpl          
-            .withSrv(LogService.class, srv -> srv.cb(ProviderImpl::bind).cb(ProviderComposite1::bind))
-            .withCnf(conf -> conf.pid(ProviderFactory.class).cbi(factory::updated)));
+            .start(ProviderImpl::start) // only call start on ProviderImpl
+            .withSvc(LogService.class, srv -> srv.add(ProviderImpl::bind).add(ProviderComposite1::bind))
+            .withCnf(conf -> conf.update(MyConfig.class, factory::updated)));
                 
         // Creates a configuration with pid name = "org.apache.felix.dependencymanager.lambda.samples.compositefactory.ProviderFactory"
-        component(comp -> comp
-            .impl(Configurator.class)
-            .withSrv(ConfigurationAdmin.class));
-    }
+        component(comp -> comp.impl(Configurator.class).withSvc(ConfigurationAdmin.class));
+    }    
 }
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/compositefactory/Configurator.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/compositefactory/Configurator.java
index b030616..7bc8984 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/compositefactory/Configurator.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/compositefactory/Configurator.java
@@ -12,7 +12,7 @@
     
     void start() throws IOException {
         // Configure the ServiceConsumer component
-        Configuration c = m_cm.getConfiguration(ProviderFactory.class.getName(), null);
+        Configuration c = m_cm.getConfiguration(MyConfig.class.getName(), null);
         Dictionary<String, Object> props = new Hashtable<>();
         props.put("foo", "bar");
         c.update(props);
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/compositefactory/MyConfig.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/compositefactory/MyConfig.java
new file mode 100644
index 0000000..72ee2e2
--- /dev/null
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/compositefactory/MyConfig.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.dm.lambda.samples.compositefactory;
+
+/**
+ * Our properties interface that is implemented by DependencyManager. 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public interface MyConfig {
+    String getFoo();
+}
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/compositefactory/ProviderComposite1.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/compositefactory/ProviderComposite1.java
index bad0463..0ee4d91 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/compositefactory/ProviderComposite1.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/compositefactory/ProviderComposite1.java
@@ -31,6 +31,10 @@
     }
 
     void start() {
-        m_log.log(LogService.LOG_INFO, "ProviderParticipant1.start()");
+        m_log.log(LogService.LOG_WARNING, "ProviderParticipant1.start()");
+    }
+    
+    public String toString() {
+        return "ProviderComposite1";
     }
 }
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/compositefactory/ProviderComposite2.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/compositefactory/ProviderComposite2.java
index 8386244..12b4fa3 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/compositefactory/ProviderComposite2.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/compositefactory/ProviderComposite2.java
@@ -22,5 +22,7 @@
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
 public class ProviderComposite2 {
-
+    public String toString() {
+        return "ProviderComposite2";
+    }
 }
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/compositefactory/ProviderFactory.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/compositefactory/ProviderFactory.java
index 3b35134..eba4df2 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/compositefactory/ProviderFactory.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/compositefactory/ProviderFactory.java
@@ -18,8 +18,6 @@
  */
 package org.apache.felix.dm.lambda.samples.compositefactory;
 
-import java.util.Dictionary;
-
 /**
  * Pojo used to create all the objects composition used to implements the "Provider" Service.
  * The manager is using a Configuration injected by Config Admin, in order to configure the 
@@ -32,11 +30,10 @@
     private ProviderComposite2 m_composite2;
     private ProviderImpl m_providerImpl;
     @SuppressWarnings("unused")
-	private Dictionary<String, Object> m_conf;
+	private MyConfig m_conf;
 
-    public void updated(Dictionary<String, Object> conf) {
-        // validate configuration and throw an exception if the properties are invalid
-        m_conf = conf;
+    public void updated(MyConfig conf) {
+        m_conf = conf; // conf.getFoo() returns "bar"
     }
 
     /**
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/compositefactory/ProviderImpl.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/compositefactory/ProviderImpl.java
index c874d71..1c69b85 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/compositefactory/ProviderImpl.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/compositefactory/ProviderImpl.java
@@ -44,6 +44,6 @@
     }
 
     void start() {
-        m_log.log(LogService.LOG_INFO, "ProviderImpl.start(): participants=" + m_participant1 + "," + m_participant2);
+        m_log.log(LogService.LOG_WARNING, "ProviderImpl.start(): participants=" + m_participant1 + "," + m_participant2);
     }
 }
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/Activator.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/Activator.java
index 3ccfd09..793a50d 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/Activator.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/Activator.java
@@ -20,7 +20,9 @@
 
 import static java.lang.System.out;
 
+import org.apache.felix.dm.DependencyManager;
 import org.apache.felix.dm.lambda.DependencyManagerActivator;
+import org.osgi.framework.BundleContext;
 import org.osgi.service.log.LogService;
 
 /**
@@ -28,8 +30,8 @@
  */
 public class Activator extends DependencyManagerActivator {
     @Override
-    public void activate() throws Exception {
-    	out.println("type \"log info\" to see the logs emitted by this test.");
+    public void init(BundleContext ctx, DependencyManager dm) throws Exception {
+    	out.println("type \"log warn\" to see the logs emitted by this test.");
 
     	// Create a pair of Device/DeviceParameter service with id=1
         createDeviceAndParameter(1);
@@ -44,8 +46,8 @@
         // Creates a component that simply displays all available DeviceParameter adapter services.
         component(comp -> comp
             .impl(DeviceAccessConsumer.class)
-            .withSrv(LogService.class)
-            .withSrv(DeviceAccess.class, device -> device.cb(DeviceAccessConsumer::add)));       
+            .withSvc(LogService.class)
+            .withSvc(DeviceAccess.class, device -> device.add(DeviceAccessConsumer::add)));       
     }
     
     private void createDeviceAndParameter(int id) {
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceAccessConsumer.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceAccessConsumer.java
index 1d46839..22dded4 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceAccessConsumer.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceAccessConsumer.java
@@ -29,7 +29,7 @@
     volatile LogService log;
 
     void add(DeviceAccess deviceAccess, Map<String, Object> props) {
-        log.log(LogService.LOG_INFO, "DeviceAccessConsumer: Handling device access: id=" + props.get("device.access.id") 
+        log.log(LogService.LOG_WARNING, "DeviceAccessConsumer: Handling device access: id=" + props.get("device.access.id") 
             + "\n\t device=" + deviceAccess.getDevice() 
             + "\n\t device parameter=" + deviceAccess.getDeviceParameter()
             + "\n\t device access properties=" + props);
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceAccessImpl.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceAccessImpl.java
index 9a8e321..5b4033d 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceAccessImpl.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceAccessImpl.java
@@ -35,7 +35,7 @@
                 
         component(c, builder -> builder
             .properties("device.access.id", device.getDeviceId())
-            .withSrv(DeviceParameter.class, srv -> srv.filter("(device.id=" + device.getDeviceId() + ")")));
+            .withSvc(DeviceParameter.class, srv -> srv.filter("(device.id=" + device.getDeviceId() + ")")));
     }
     
     @Override
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceImpl.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceImpl.java
index 6caacbe..28c2e15 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceImpl.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceImpl.java
@@ -32,4 +32,10 @@
     public int getDeviceId() {
         return id;
     }
+    
+    
+    @Override
+    public String toString() {
+        return "Device #" + id;
+    }
 }
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceParameterImpl.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceParameterImpl.java
index f7b9779..a97ae47 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceParameterImpl.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceParameterImpl.java
@@ -32,4 +32,9 @@
     public int getDeviceId() {
         return id;
     }
+    
+    @Override
+    public String toString() {
+        return "DeviceParameter #" + id;
+    }
 }
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/Activator.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/Activator.java
index 9d3bb7a..8e4482e 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/Activator.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/Activator.java
@@ -22,7 +22,9 @@
 import static org.apache.felix.service.command.CommandProcessor.COMMAND_FUNCTION;
 import static org.apache.felix.service.command.CommandProcessor.COMMAND_SCOPE;
 
+import org.apache.felix.dm.DependencyManager;
 import org.apache.felix.dm.lambda.DependencyManagerActivator;
+import org.osgi.framework.BundleContext;
 import org.osgi.service.log.LogService;
 
 /**
@@ -30,7 +32,7 @@
  */
 public class Activator extends DependencyManagerActivator {
     @Override
-    public void activate() throws Exception {
+    public void init(BundleContext ctx, DependencyManager dm) throws Exception {
     	out.println("type \"log info\" to see the logs emitted by this test.");
 
         // Create the factory configuration for our DictionaryImpl service. An instance of the DictionaryImpl is created for each
@@ -38,25 +40,24 @@
         factoryPidAdapter(adapter -> adapter
             .impl(DictionaryImpl.class)
             .provides(DictionaryService.class)
-            .factoryPid(DictionaryConfiguration.class)
             .propagate()
-            .cb(DictionaryImpl::updated)
-            .withSrv(LogService.class));
+            .update(DictionaryConfiguration.class, DictionaryImpl::updated)
+            .withSvc(LogService.class));
                             
         // Create the Dictionary Aspect that decorates any registered Dictionary service. For each Dictionary, an instance of the 
         // DictionaryAspect service is created).
         aspect(DictionaryService.class, aspect -> aspect
             .impl(DictionaryAspect.class)
             .filter("(lang=en)").rank(10)
-            .withCnf(conf -> conf.pid(DictionaryAspectConfiguration.class).cb(DictionaryAspect::addWords))
-            .withSrv(LogService.class));
+            .withCnf(conf -> conf.update(DictionaryAspectConfiguration.class, DictionaryAspect::addWords))
+            .withSvc(LogService.class));
                     
         // Create the SpellChecker component. It depends on all available DictionaryService instances, possibly
         // decorated by some DictionaryAspects.
         component(comp -> comp
             .impl(SpellChecker.class)
             .provides(SpellChecker.class, COMMAND_SCOPE, "dictionary", COMMAND_FUNCTION, new String[] {"spellcheck"}) 
-            .withSrv(DictionaryService.class)
-            .withSrv(LogService.class));
+            .withSvc(DictionaryService.class)
+            .withSvc(LogService.class));
     }
 }
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryAspect.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryAspect.java
index 1982db5..0e7060c 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryAspect.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryAspect.java
@@ -11,13 +11,10 @@
  */
 package org.apache.felix.dm.lambda.samples.dictionary;
 
-import java.util.Dictionary;
 import java.util.concurrent.CopyOnWriteArrayList;
 
 import org.osgi.service.log.LogService;
 
-import aQute.bnd.annotation.metatype.Configurable;
-
 /**
  * This aspect applies to the English DictionaryService, and allows to decorate it with some
  * custom English words, which are configurable from WebConsole.
@@ -43,13 +40,13 @@
     private LogService m_log;
 
     /**
-     * Defines a configuration dependency for retrieving our english custom words (by default,
-     * our PID is our full class name).
+     * Defines a configuration dependency for retrieving our english custom words.
+     * Dependency Manager will inject a dynamic proxy that implements our DictionaryAspectConfiguration interface.
+     * The dynamic proxy is used to wrap the actual Dictionary configuration.
+     * The pid for our configuration is by default the fqdn of our DictionaryAspectConfiguration interface.
      */
-    protected void addWords(Dictionary<String, ?> config) {
-        if (config != null) {
-            // We use the bnd "Configurable" helper in order to get an implementation for our DictionaryConfiguration interface.
-            DictionaryConfiguration cnf = Configurable.createConfigurable(DictionaryConfiguration.class, config);
+    protected void addWords(DictionaryAspectConfiguration cnf) {
+        if (cnf != null) {
             m_words.clear();
             for (String word : cnf.words()) {
                 m_words.add(word);
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryImpl.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryImpl.java
index 4167e77..ed1b499 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryImpl.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryImpl.java
@@ -18,13 +18,10 @@
  */
 package org.apache.felix.dm.lambda.samples.dictionary;
 
-import java.util.Dictionary;
 import java.util.concurrent.CopyOnWriteArrayList;
 
 import org.osgi.service.log.LogService;
 
-import aQute.bnd.annotation.metatype.Configurable;
-
 /**
  * A Dictionary Service, instantiated from webconsole, when you add some configurations instances to the
  * DictionaryConfiguration factory pid. The Configuration metatype informations is described using the
@@ -61,17 +58,12 @@
      * Our service will be initialized from ConfigAdmin.
      * @param config The configuration where we'll lookup our words list (key=".words").
      */
-    protected void updated(Dictionary<String, ?> config) {
-        if (config != null) {
-            // We use the bnd "Configurable" helper in order to get an implementation for our DictionaryConfiguration interface.
-            DictionaryConfiguration cnf = Configurable.createConfigurable(DictionaryConfiguration.class, config);
-
-            m_lang = cnf.lang();
-            m_words.clear();
-            for (String word : cnf.words()) {
-                m_words.add(word);
-            }
-        }
+    protected void updated(DictionaryConfiguration cnf) {
+        m_lang = cnf.lang();
+        m_words.clear();
+        for (String word : cnf.words()) {
+            m_words.add(word);
+        }        
     }
 
     /**
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/factory/Activator.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/factory/Activator.java
index 73a3b64..7e884e3 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/factory/Activator.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/factory/Activator.java
@@ -20,7 +20,9 @@
 
 import static java.lang.System.out;
 
+import org.apache.felix.dm.DependencyManager;
 import org.apache.felix.dm.lambda.DependencyManagerActivator;
+import org.osgi.framework.BundleContext;
 import org.osgi.service.log.LogService;
 
 /**
@@ -28,13 +30,13 @@
  */
 public class Activator extends DependencyManagerActivator {
     @Override
-    public void activate() throws Exception {
-    	out.println("type \"log info\" to see the logs emitted by this test.");
+    public void init(BundleContext ctx, DependencyManager dm) throws Exception {
+    	out.println("type \"log warn\" to see the logs emitted by this test.");
 
         component(comp -> comp
             .factory(ProviderFactory::new, ProviderFactory::create)       
             .provides(Provider.class)
             .start(ProviderImpl::start)                      
-            .withSrv(LogService.class, log -> log.cb(ProviderImpl::set)));
+            .withSvc(LogService.class, log -> log.add(ProviderImpl::set)));
     }
 }
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/factory/ProviderImpl.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/factory/ProviderImpl.java
index 220958e..11d72f4 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/factory/ProviderImpl.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/factory/ProviderImpl.java
@@ -33,6 +33,6 @@
     void set(LogService log) { m_log = log; }
 
     void start() {
-        m_log.log(LogService.LOG_INFO, "ProviderImpl.start()");
+        m_log.log(LogService.LOG_WARNING, "ProviderImpl.start()");
     }
 }
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/future/Activator.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/future/Activator.java
index 117af23..a1e9a9e 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/future/Activator.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/future/Activator.java
@@ -20,7 +20,9 @@
 
 import static java.lang.System.out;
 
+import org.apache.felix.dm.DependencyManager;
 import org.apache.felix.dm.lambda.DependencyManagerActivator;
+import org.osgi.framework.BundleContext;
 import org.osgi.service.log.LogService;
 
 /**
@@ -38,21 +40,21 @@
      * Initialize our components using new DM-lambda activator base.
      */
     @Override
-    public void activate() throws Exception {
-    	out.println("type \"log info\" to see the logs emitted by this test.");
+    public void init(BundleContext ctx, DependencyManager dm) throws Exception {
+    	out.println("type \"log warn\" to see the logs emitted by this test.");
     	
     	// System.setProperty("http.proxyHost","your.http.proxy.host");
     	// System.setProperty("http.proxyPort", "your.http.proxy.port");
     	    	
-        // Create the PageLinks service, which asynchronously download the content of the Felix web page.
+        // Create the PageLinks service, which asynchronously downloads the content of the Felix web page.
     	// The PageLink service will be started once the page has been downloaded (using a CompletableFuture).
         component(comp -> comp
             .factory(() -> new PageLinksImpl("http://felix.apache.org/"))
             .provides(PageLinks.class)
-            .withSrv(LogService.class, log -> log.cb(PageLinksImpl::bind)));
+            .withSvc(LogService.class, log -> log.add(PageLinksImpl::bind)));
         
         // Just wait for the PageLinks service and display all links found from the Felix web site.
-        component(comp -> comp.impl(this).withSrv(PageLinks.class, page -> page.cbi(this::setPageLinks))); 
+        component(comp -> comp.impl(this).withSvc(PageLinks.class, page -> page.add(this::setPageLinks))); 
     }
         
     /**
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/future/PageLinksImpl.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/future/PageLinksImpl.java
index 3017ccf..b78e469 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/future/PageLinksImpl.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/future/PageLinksImpl.java
@@ -37,7 +37,7 @@
 	        .thenApply(this::parseLinks);	       
 
 	    // Add the future dependency so we'll be started once the CompletableFuture "futureLinks" has completed.
-	    component(c, comp -> comp.withFuture(futureLinks, future -> future.cbi(this::setLinks)));
+	    component(c, comp -> comp.withFuture(futureLinks, future -> future.complete(this::setLinks)));
 	}
 	
 	// Called when our future has completed.
@@ -47,7 +47,7 @@
     
 	// once our future has completed, our component is started.
 	void start() {
-		m_log.log(LogService.LOG_INFO, "Service starting: number of links found from Felix web site: " + m_links.size());
+		m_log.log(LogService.LOG_WARNING, "Service starting: number of links found from Felix web site: " + m_links.size());
 	}
 	
 	@Override
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/Activator.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/Activator.java
index 8dfd611..98c970b 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/Activator.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/Activator.java
@@ -20,7 +20,9 @@
 
 import static java.lang.System.out;
 
+import org.apache.felix.dm.DependencyManager;
 import org.apache.felix.dm.lambda.DependencyManagerActivator;
+import org.osgi.framework.BundleContext;
 import org.osgi.service.cm.ConfigurationAdmin;
 import org.osgi.service.event.EventAdmin;
 import org.osgi.service.log.LogService;
@@ -30,25 +32,28 @@
  */
 public class Activator extends DependencyManagerActivator {
     @Override
-    public void activate() throws Exception {
-    	out.println("type \"log info\" to see the logs emitted by this test.");
+    public void init(BundleContext ctx, DependencyManager dm) throws Exception {
+    	out.println("type \"log warn\" to see the logs emitted by this test.");
     	
     	// Creates a Service Provider (property names are deduced from lambda parameter names).
     	// (service dependencies are required by default)
         component(comp -> comp.impl(ServiceProviderImpl.class)
             .provides(ServiceProvider.class, p1 -> "v1", p2 -> 123)
-            .withSrv(LogService.class));
+            .withSvc(LogService.class));
             
         // Creates a Service Consumer. we depend on LogService, EventAdmin and on our ServiceProvider.
         // (LogService and EventAdmin are declared in one single method call).
+        // We also depend on a configuration. Our ServiceConsumer.updated method takes as argument a "Configuration" interface
+        // which is used to wrap the actual properties behind a dynamic proxy for our "Configuration" interface that is implemented by Dependency Manager.
+        // (the pid is assumed to be by default the fqdn of our Configuration interface).
         component(comp -> comp.impl(ServiceConsumer.class)
-            .withSrv(LogService.class, EventAdmin.class)
-            .withSrv(ServiceProvider.class, srv -> srv.filter("(p1=v1)")) 
-            .withCnf(ServiceConsumer.class));  
+            .withSvc(LogService.class, EventAdmin.class)
+            .withSvc(ServiceProvider.class, srv -> srv.filter("(p1=v1)")) 
+            .withCnf(cnf -> cnf.update(Configuration.class, ServiceConsumer::updated))); 
         
         // Creates a component that populates some properties in the Configuration Admin.
         // Here, we inject the CM (Configuration Admin) service dependency using a method reference:
-        component(comp -> comp.impl(Configurator.class)
-            .withSrv(ConfigurationAdmin.class, srv -> srv.cb(Configurator::bind)));
+        component(comp -> comp.factory(() -> new Configurator(Configuration.class.getName()))
+            .withSvc(ConfigurationAdmin.class, srv -> srv.add(Configurator::bind)));
     }
 }
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/Configuration.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/Configuration.java
new file mode 100644
index 0000000..df3bf44
--- /dev/null
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/Configuration.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.dm.lambda.samples.hello;
+
+/**
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public interface Configuration {
+    /**
+     * Returns the value of the "foo" property.
+     * @return the value of the "foo" property.
+     */
+    String getFoo();
+}
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/Configurator.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/Configurator.java
index 648a92f..e73c769 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/Configurator.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/Configurator.java
@@ -8,7 +8,12 @@
 import org.osgi.service.cm.ConfigurationAdmin;
 
 public class Configurator {
-    ConfigurationAdmin m_cm; 
+    ConfigurationAdmin m_cm;
+    final String m_pid;
+    
+    Configurator(String pid) {
+        m_pid = pid;
+    }
     
     void bind(ConfigurationAdmin cm) {
         m_cm = cm;
@@ -16,7 +21,7 @@
     
     void start() throws IOException {
         // Configure the ServiceConsumer component
-        Configuration c = m_cm.getConfiguration(ServiceConsumer.class.getName(), null);
+        Configuration c = m_cm.getConfiguration(m_pid, null);
         Dictionary<String, Object> props = new Hashtable<>();
         props.put("foo", "bar");
         c.update(props);
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/ServiceConsumer.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/ServiceConsumer.java
index a67fa4c..1127173 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/ServiceConsumer.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/ServiceConsumer.java
@@ -18,8 +18,6 @@
  */
 package org.apache.felix.dm.lambda.samples.hello;
 
-import java.util.Dictionary;
-
 import org.osgi.service.event.EventAdmin;
 import org.osgi.service.log.LogService;
 
@@ -33,11 +31,12 @@
     volatile LogService log;
     volatile EventAdmin eventAdmin;
 
-    public void updated(Dictionary<String, Object> conf) {
+    public void updated(Configuration conf) {
+        // conf.getFoo() returns "bar"
     }
     
     public void start() {
-        log.log(LogService.LOG_INFO, "ServiceConsumer.start: calling service.hello()");
+        log.log(LogService.LOG_WARNING, "ServiceConsumer.start: calling service.hello()");
         this.service.hello();
     }
 }
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/ServiceProviderImpl.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/ServiceProviderImpl.java
index 2d1fbba..99af097 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/ServiceProviderImpl.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/ServiceProviderImpl.java
@@ -48,6 +48,6 @@
     
     @Override
     public void hello() {
-        log.log(LogService.LOG_INFO, "ServiceProviderImpl.hello");
+        log.log(LogService.LOG_WARNING, "ServiceProviderImpl.hello");
     }
 }