Added: 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/Activator.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/Activator.java?rev=1727487&view=auto
==============================================================================
--- 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/Activator.java
 (added)
+++ 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/Activator.java
 Fri Jan 29 06:50:09 2016
@@ -0,0 +1,54 @@
+/*
+ * 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.device;
+
+import static java.lang.System.out;
+
+import org.apache.felix.dm.lambda.DependencyManagerActivator;
+import org.osgi.service.log.LogService;
+
+/**
+ * @author <a href="mailto:[email protected]";>Felix Project Team</a>
+ */
+public class Activator extends DependencyManagerActivator {
+    @Override
+    public void activate() throws Exception { 
+       out.println("type \"log info\" to see the logs emitted by this test.");
+
+        createDeviceAndParameter(1);
+        createDeviceAndParameter(2);
+
+        adapter(Device.class, adpt -> 
adpt.provides(DeviceAccess.class).impl(DeviceAccessImpl.class));
+            
+        component(comp -> comp
+            .impl(DeviceAccessConsumer.class)
+            .withSrv(LogService.class)
+            .withSrv(DeviceAccess.class, device -> 
device.cb(DeviceAccessConsumer::add)));       
+    }
+    
+    private void createDeviceAndParameter(int id) {
+        component(comp -> comp
+            .factory(() -> new DeviceImpl(id))
+            .provides(Device.class, "device.id", id));
+                       
+        component(comp -> comp
+            .factory(() -> new DeviceParameterImpl(id))
+            .provides(DeviceParameter.class, "device.id", id));
+    }
+}

Added: 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/Device.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/Device.java?rev=1727487&view=auto
==============================================================================
--- 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/Device.java
 (added)
+++ 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/Device.java
 Fri Jan 29 06:50:09 2016
@@ -0,0 +1,26 @@
+/*
+ * 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.device;
+
+/**
+ * @author <a href="mailto:[email protected]";>Felix Project Team</a>
+ */
+public interface Device {
+    int getDeviceId();
+}

Added: 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceAccess.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceAccess.java?rev=1727487&view=auto
==============================================================================
--- 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceAccess.java
 (added)
+++ 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceAccess.java
 Fri Jan 29 06:50:09 2016
@@ -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.device;
+
+/**
+ * Provides unified access to a pair of Device/DeviceParameter services having 
the same device ID.
+
+ * @author <a href="mailto:[email protected]";>Felix Project Team</a>
+ */
+public interface DeviceAccess {
+    Device getDevice();
+
+    DeviceParameter getDeviceParameter();
+}

Added: 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceAccessConsumer.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceAccessConsumer.java?rev=1727487&view=auto
==============================================================================
--- 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceAccessConsumer.java
 (added)
+++ 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceAccessConsumer.java
 Fri Jan 29 06:50:09 2016
@@ -0,0 +1,37 @@
+/*
+ * 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.device;
+
+import java.util.Map;
+
+import org.osgi.service.log.LogService;
+
+/**
+ * @author <a href="mailto:[email protected]";>Felix Project Team</a>
+ */
+public class DeviceAccessConsumer {
+    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") 
+            + "\n\t device=" + deviceAccess.getDevice() 
+            + "\n\t device parameter=" + deviceAccess.getDeviceParameter()
+            + "\n\t device access properties=" + props);
+    }
+}

Added: 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceAccessImpl.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceAccessImpl.java?rev=1727487&view=auto
==============================================================================
--- 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceAccessImpl.java
 (added)
+++ 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceAccessImpl.java
 Fri Jan 29 06:50:09 2016
@@ -0,0 +1,50 @@
+/*
+ * 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.device;
+
+import static org.apache.felix.dm.lambda.DependencyManagerActivator.component;
+
+import org.apache.felix.dm.Component;
+
+/**
+ * @author <a href="mailto:[email protected]";>Felix Project Team</a>
+ */
+public class DeviceAccessImpl implements DeviceAccess {
+    volatile Device device;
+    volatile DeviceParameter deviceParameter;
+
+    void init(Component c) {
+        // Dynamically add an extra dependency on a DeviceParameter (using 
java8 builder).
+       // Notice that we also add a "device.access.id" service property 
dynamically.
+                
+        component(c, builder -> builder
+                       .properties("device.access.id", device.getDeviceId())
+                       .withSrv(DeviceParameter.class, srv -> 
srv.filter("(device.id=" + device.getDeviceId() + ")")));
+    }
+    
+    @Override
+    public Device getDevice() {
+        return device;
+    }
+
+    @Override
+    public DeviceParameter getDeviceParameter() {
+        return deviceParameter;
+    }
+}

Added: 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceImpl.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceImpl.java?rev=1727487&view=auto
==============================================================================
--- 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceImpl.java
 (added)
+++ 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceImpl.java
 Fri Jan 29 06:50:09 2016
@@ -0,0 +1,35 @@
+/*
+ * 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.device;
+
+/**
+ * @author <a href="mailto:[email protected]";>Felix Project Team</a>
+ */
+public class DeviceImpl implements Device {
+    final int id;
+
+    public DeviceImpl(int id) {
+        this.id = id;
+    }
+
+    @Override
+    public int getDeviceId() {
+        return id;
+    }
+}

Added: 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceParameter.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceParameter.java?rev=1727487&view=auto
==============================================================================
--- 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceParameter.java
 (added)
+++ 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceParameter.java
 Fri Jan 29 06:50:09 2016
@@ -0,0 +1,26 @@
+/*
+ * 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.device;
+
+/**
+ * @author <a href="mailto:[email protected]";>Felix Project Team</a>
+ */
+public interface DeviceParameter {
+    int getDeviceId();
+}

Added: 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceParameterImpl.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceParameterImpl.java?rev=1727487&view=auto
==============================================================================
--- 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceParameterImpl.java
 (added)
+++ 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/DeviceParameterImpl.java
 Fri Jan 29 06:50:09 2016
@@ -0,0 +1,35 @@
+/*
+ * 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.device;
+
+/**
+ * @author <a href="mailto:[email protected]";>Felix Project Team</a>
+ */
+public class DeviceParameterImpl implements DeviceParameter {
+    final int id;
+
+    public DeviceParameterImpl(int id) {
+        this.id = id;
+    }
+
+    @Override
+    public int getDeviceId() {
+        return id;
+    }
+}

Added: 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/README
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/README?rev=1727487&view=auto
==============================================================================
--- 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/README
 (added)
+++ 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/device/README
 Fri Jan 29 06:50:09 2016
@@ -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.
+ */
+
+This is an example showing a Dependency Manager "Adapter" in action. Two kinds 
of services are
+registered in the registry: some Device, and some DeviceParameter services. 
For each Device (having
+a given id), there is also a corresponding "DeviceParameter" service, having 
the same id.
+
+Then a "DeviceAccessImpl" adapter service is defined: it is used to "adapt" 
the "Device" service to
+a "DeviceAccess" service, which provides the union of each pair of 
Device/DeviceParameter having the
+same device.id . The adapter also dynamically propagate the service properties 
of the adapted Device
+service.
+
+So see logs, just type this command under gogo shell:
+
+g! log info|grep device.api
+

Added: 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/Activator.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/Activator.java?rev=1727487&view=auto
==============================================================================
--- 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/Activator.java
 (added)
+++ 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/Activator.java
 Fri Jan 29 06:50:09 2016
@@ -0,0 +1,59 @@
+/*
+ * 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.dictionary;
+
+import static java.lang.System.out;
+
+import org.apache.felix.dm.lambda.DependencyManagerActivator;
+import org.osgi.service.log.LogService;
+import static 
org.apache.felix.service.command.CommandProcessor.COMMAND_FUNCTION;
+import static org.apache.felix.service.command.CommandProcessor.COMMAND_SCOPE;
+
+/**
+ * @author <a href="mailto:[email protected]";>Felix Project Team</a>
+ */
+public class Activator extends DependencyManagerActivator {
+    @Override
+    public void activate() throws Exception {
+       out.println("type \"log info\" to see the logs emitted by this test.");
+
+        // Create the factory configuration for our DictionaryImpl service.
+        factoryPidAdapter(adapter -> adapter
+            .impl(DictionaryImpl.class)
+            .provides(DictionaryService.class)
+            .factoryPid(DictionaryConfiguration.class)
+            .propagate()
+            .cb(DictionaryImpl::updated)
+            .withSrv(LogService.class, log -> log.optional()));
+                            
+        // Create the Dictionary Aspect
+        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, log -> log.optional()));
+                    
+        // Create the SpellChecker component        
+        component(comp -> comp
+            .impl(SpellChecker.class)
+            .provides(SpellChecker.class, COMMAND_SCOPE, "dictionary", 
COMMAND_FUNCTION, new String[] {"spellcheck"}) 
+            .withSrv(DictionaryService.class)
+            .withSrv(LogService.class, log -> log.optional()));
+    }
+}

Added: 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryAspect.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryAspect.java?rev=1727487&view=auto
==============================================================================
--- 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryAspect.java
 (added)
+++ 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryAspect.java
 Fri Jan 29 06:50:09 2016
@@ -0,0 +1,84 @@
+/*
+ * 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.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.
+ * 
+ * @author <a href="mailto:[email protected]";>Felix Project Team</a>
+ */
+public class DictionaryAspect implements DictionaryService {
+    /**
+     * This is the service this aspect is applying to.
+     */
+    private volatile DictionaryService m_originalDictionary;
+
+    /**
+     * We store all configured words in a thread-safe data structure, because 
ConfigAdmin may
+     * invoke our updated method at any time.
+     */
+    private CopyOnWriteArrayList<String> m_words = new 
CopyOnWriteArrayList<String>();
+
+    /**
+     * We'll use the OSGi log service for logging. If no log service is 
available, then we'll
+     * use a NullObject.
+     */
+    private LogService m_log;
+
+    /**
+     * Defines a configuration dependency for retrieving our english custom 
words (by default,
+     * our PID is our full class name).
+     */
+    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);
+            m_words.clear();
+            for (String word : cnf.words()) {
+                m_words.add(word);
+            }
+        }
+    }
+
+    /**
+     * Our Aspect Service is starting and is about to be registered in the 
OSGi regsitry.
+     */
+    protected void start() {
+        m_log.log(LogService.LOG_INFO, "Starting aspect Dictionary with words: 
" + m_words
+            + "; original dictionary service=" + m_originalDictionary);
+    }
+
+    /**
+     * Checks if a word is found from our custom word list. if not, delegate 
to the decorated
+     * dictionary.
+     */
+    public boolean checkWord(String word) {
+        m_log.log(LogService.LOG_INFO, "DictionaryAspect: checking word " + 
word + " (original dictionary="
+            + m_originalDictionary + ")");
+        if (m_words.contains(word)) {
+            return true;
+        }
+        return m_originalDictionary.checkWord(word);
+    }
+
+    public String toString() {
+        return "DictionaryAspect: words=" + m_words + "; original dictionary=" 
+ m_originalDictionary;
+    }
+}

Added: 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryAspectConfiguration.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryAspectConfiguration.java?rev=1727487&view=auto
==============================================================================
--- 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryAspectConfiguration.java
 (added)
+++ 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryAspectConfiguration.java
 Fri Jan 29 06:50:09 2016
@@ -0,0 +1,37 @@
+/*
+ * 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.dictionary;
+
+import java.util.List;
+
+import aQute.bnd.annotation.metatype.Meta.AD;
+import aQute.bnd.annotation.metatype.Meta.OCD;
+
+/**
+ * This interface describes the configuration for our DictionaryAspect 
component. We are using the bnd metatype
+ * annotations, allowing to configure our Dictionary Services from web console.
+ * 
+ * @author <a href="mailto:[email protected]";>Felix Project Team</a>
+ */
+@OCD(name="Spell Checker Aspect Dictionary (api)",
+     description = "Declare here the list of english words to be added into 
the default english dictionary")
+public interface DictionaryAspectConfiguration {
+    @AD(description = "Dictionary aspect words")
+    List<String> words();
+}

Added: 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryConfiguration.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryConfiguration.java?rev=1727487&view=auto
==============================================================================
--- 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryConfiguration.java
 (added)
+++ 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryConfiguration.java
 Fri Jan 29 06:50:09 2016
@@ -0,0 +1,41 @@
+/*
+ * 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.dictionary;
+
+import java.util.List;
+
+import aQute.bnd.annotation.metatype.Meta.AD;
+import aQute.bnd.annotation.metatype.Meta.OCD;
+
+/**
+ * This interface describes the configuration for our DictionaryImpl 
component. We are using the bnd metatype
+ * annotations, allowing to configure our Dictionary Services from web console.
+ * 
+ * @author <a href="mailto:[email protected]";>Felix Project Team</a>
+ */
+@OCD(name="Spell Checker Dictionary (api)",
+     factory = true, 
+     description = "Declare here some Dictionary instances, allowing to 
instantiates some DictionaryService services for a given dictionary language")
+public interface DictionaryConfiguration {
+    @AD(description = "Describes the dictionary language", deflt = "en")
+    String lang();
+
+    @AD(description = "Declare here the list of words supported by this 
dictionary.")
+    List<String> words();
+}

Added: 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryImpl.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryImpl.java?rev=1727487&view=auto
==============================================================================
--- 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryImpl.java
 (added)
+++ 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryImpl.java
 Fri Jan 29 06:50:09 2016
@@ -0,0 +1,96 @@
+/*
+ * 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.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
+ * bnd metatype information (see the DictionaryConfiguration interface).
+ * 
+ * You must configure at least one Dictionary from web console, since the 
SpellCheck won't start if no Dictionary
+ * Service is available.
+ * 
+ * @author <a href="mailto:[email protected]";>Felix Project Team</a>
+ */
+public class DictionaryImpl implements DictionaryService {
+    /**
+     * The key of our config admin dictionary values.
+     */
+    final static String WORDS = "words";
+
+    /**
+     * We store all configured words in a thread-safe data structure, because 
ConfigAdmin
+     * may invoke our updated method at any time.
+     */
+    private CopyOnWriteArrayList<String> m_words = new 
CopyOnWriteArrayList<String>();
+
+    /**
+     * We'll use the OSGi log service for logging. If no log service is 
available, then we'll use a NullObject.
+     */
+    private LogService m_log;
+
+    /**
+     * Our Dictionary language.
+     */
+    private String m_lang;
+
+    /**
+     * 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);
+            }
+        }
+    }
+
+    /**
+     * A new Dictionary Service is starting (because a new factory 
configuration has been created
+     * from webconsole).
+     */
+    protected void start() {
+        m_log.log(LogService.LOG_INFO, "Starting Dictionary Service with 
language: " + m_lang);
+    }
+
+    /**
+     * Check if a word exists if the list of words we have been configured 
from ConfigAdmin/WebConsole.
+     */
+    public boolean checkWord(String word) {
+        return m_words.contains(word);
+    }
+
+    @Override
+    public String toString() {
+        return "Dictionary: language=" + m_lang + ", words=" + m_words;
+    }
+}

Added: 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryService.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryService.java?rev=1727487&view=auto
==============================================================================
--- 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryService.java
 (added)
+++ 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryService.java
 Fri Jan 29 06:50:09 2016
@@ -0,0 +1,35 @@
+/*
+ * 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.dictionary;
+
+/**
+ * A simple service interface that defines a dictionary service. A dictionary
+ * service simply verifies the existence of a word. 
+ * 
+ * @author <a href="mailto:[email protected]";>Felix Project Team</a>
+ */
+public interface DictionaryService {
+    /**
+     * Check for the existence of a word.
+     * 
+     * @param word the word to be checked.
+     * @return true if the word is in the dictionary, false otherwise.
+     */
+    public boolean checkWord(String word);
+}

Added: 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/README
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/README?rev=1727487&view=auto
==============================================================================
--- 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/README
 (added)
+++ 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/README
 Fri Jan 29 06:50:09 2016
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+This sample shows a "SpellChecker" application (using DM API) which provides a
+"dictionary:spellcheck" GOGO shell command. The GOGO "dictionary:spellcheck" 
command accepts a
+string as parameter, which is checked for proper existence. The SpellChecker 
class has a
+required/multiple (1..N) dependency over every available "DictionaryService" 
services, which are
+internally used by the SpellChecker command, when checking word existence.
+
+A DictionaryService is defined using a FactoryConfigurationAdapterService , 
allowing to instantiate
+many "DictionaryService" instances for each configuration that are added to the
+factory pid "Spell Checker Configuration (api)" from web console.
+The factory pid configuration metatypes are defined using the bnd "metatype" 
annotations
+(see DictionaryConfiguration.java).
+
+The DictionaryService is decorated with a DictionaryAspect, which you can 
instantiate by adding a
+configuration to the "Spell Checker Aspect Dictionary (api)" pid from web 
console. The
+aspect configuration metatype is also declared using the bnd metatype 
annotations (see
+DictionaryAspectConfiguration.java). 
+
+Before running this sample, go to webconsole, and add some words in the Spell 
Checker Configuration (api) factory PID, and
+in the Spell Checker Aspect Dictionary (api) PID.
+
+Then go to gogo shell, and type dm help. You will normally see the 
dictionary:spellcheck command.
+Type dictionary:spellcheck <some words configured either in the spell checker 
configuration, or in the spell checker aspect configuration, 
+and the dictionary will check for proper word existance in the configuration.
+

Added: 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/SpellChecker.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/SpellChecker.java?rev=1727487&view=auto
==============================================================================
--- 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/SpellChecker.java
 (added)
+++ 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/SpellChecker.java
 Fri Jan 29 06:50:09 2016
@@ -0,0 +1,76 @@
+/*
+ * 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.dictionary;
+
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+import org.apache.felix.service.command.Descriptor;
+import org.osgi.service.log.LogService;
+
+/**
+ * Felix "spellcheck" Gogo Shell Command. This command allows to check if some 
given words are valid or not.
+ * This command will be activated only if (at least) one DictionaryService has 
been injected.
+ * To create a Dictionary Service, you have to go the the web console and add 
a configuration in the 
+ * "Dictionary Configuration" factory pid.
+ * 
+ * @author <a href="mailto:[email protected]";>Felix Project Team</a>
+ */
+public class SpellChecker {
+    /**
+     * We'll use the OSGi log service for logging. If no log service is 
available, then we'll use a NullObject.
+     */
+    private volatile LogService m_log;
+
+    /**
+     * We'll store all Dictionaries in a concurrent list, in order to avoid 
method synchronization.
+     * (Auto-Injected from Activator, at any time). DependencyManager detects 
that the field is an 
+     * Iterable of a DictionaryService and automatically adds any available 
DictionaryService, at any time.
+     */
+    private final Iterable<DictionaryService> m_dictionaries = new 
ConcurrentLinkedQueue<>();
+
+    /**
+     * Lifecycle method callback, used to check if our service has been 
activated.
+     */
+    protected void start() {
+        m_log.log(LogService.LOG_WARNING, "Spell Checker started");
+    }
+
+    /**
+     * Lifecycle method callback, used to check if our service has been 
activated.
+     */
+    protected void stop() {
+        m_log.log(LogService.LOG_WARNING, "Spell Checker stopped");
+    }
+
+    // --- Gogo Shell command
+
+    @Descriptor("checks if word is found from an available dictionary")
+    public void spellcheck(@Descriptor("the word to check") String word) {
+        m_log.log(LogService.LOG_INFO, "Checking spelling of word \"" + word + 
"\" using the following dictionaries: "
+            + m_dictionaries);
+
+        for (DictionaryService dictionary : m_dictionaries) {
+            if (dictionary.checkWord(word)) {
+                System.out.println("word " + word + " is correct");
+                return;
+            }
+        }
+        System.err.println("word " + word + " is incorrect");
+    }
+}

Added: 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/factory/Activator.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/factory/Activator.java?rev=1727487&view=auto
==============================================================================
--- 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/factory/Activator.java
 (added)
+++ 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/factory/Activator.java
 Fri Jan 29 06:50:09 2016
@@ -0,0 +1,40 @@
+/*
+ * 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.factory;
+
+import static java.lang.System.out;
+
+import org.apache.felix.dm.lambda.DependencyManagerActivator;
+import org.osgi.service.log.LogService;
+
+/**
+ * @author <a href="mailto:[email protected]";>Felix Project Team</a>
+ */
+public class Activator extends DependencyManagerActivator {
+    @Override
+    public void activate() throws Exception {   
+       out.println("type \"log info\" 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.required().cb(ProviderImpl::set)));
+    }
+}

Added: 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/factory/Provider.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/factory/Provider.java?rev=1727487&view=auto
==============================================================================
--- 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/factory/Provider.java
 (added)
+++ 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/factory/Provider.java
 Fri Jan 29 06:50:09 2016
@@ -0,0 +1,25 @@
+/*
+ * 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.factory;
+
+/**
+ * @author <a href="mailto:[email protected]";>Felix Project Team</a>
+ */
+public interface Provider {
+}

Added: 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/factory/ProviderFactory.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/factory/ProviderFactory.java?rev=1727487&view=auto
==============================================================================
--- 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/factory/ProviderFactory.java
 (added)
+++ 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/factory/ProviderFactory.java
 Fri Jan 29 06:50:09 2016
@@ -0,0 +1,7 @@
+package org.apache.felix.dm.lambda.samples.factory;
+
+public class ProviderFactory {
+    public ProviderImpl create() {
+        return new ProviderImpl();
+    }
+}

Added: 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/factory/ProviderImpl.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/factory/ProviderImpl.java?rev=1727487&view=auto
==============================================================================
--- 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/factory/ProviderImpl.java
 (added)
+++ 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/factory/ProviderImpl.java
 Fri Jan 29 06:50:09 2016
@@ -0,0 +1,38 @@
+/*
+ * 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.factory;
+
+import org.osgi.service.log.LogService;
+
+/**
+ * This is the main implementation for our "Provider" service.
+ * This service is using a composition of two participants, which are used to 
provide the service
+ * (ProviderParticipant1, and ProviderParticipant2).
+ * 
+ * @author <a href="mailto:[email protected]";>Felix Project Team</a>
+ */
+public class ProviderImpl implements Provider {
+    private volatile LogService m_log;
+            
+    void set(LogService log) { m_log = log; }
+
+    void start() {
+        m_log.log(LogService.LOG_INFO, "ProviderImpl.start()");
+    }
+}

Added: 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/factory/README
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/factory/README?rev=1727487&view=auto
==============================================================================
--- 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/factory/README
 (added)
+++ 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/factory/README
 Fri Jan 29 06:50:09 2016
@@ -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.
+ */
+
+This sample is an example usage of DM composite components. A composite 
component is implemented
+using a composition of multiple object instances, which are used to implement 
a given complex
+service. Here, we define a "Provider" service, which is implemented by three 
object instances:
+ProviderImpl, ProviderParticipant1, ProviderParticipant2.
+
+Dependencies are injected in all objects being part of the composition.
+
+To see logs, type this command under the gogo shell:
+
+g! log info|grep compositefactory

Added: 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/future/Activator.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/future/Activator.java?rev=1727487&view=auto
==============================================================================
--- 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/future/Activator.java
 (added)
+++ 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/future/Activator.java
 Fri Jan 29 06:50:09 2016
@@ -0,0 +1,61 @@
+/*
+ * 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.future;
+
+import static java.lang.System.out;
+
+import org.apache.felix.dm.lambda.DependencyManagerActivator;
+import org.osgi.service.log.LogService;
+
+/**
+ * This examples show how to use the new "Future" dependency available from 
the dependencymanager-lambda library.
+ * The PageLink component provides the list of available hrefs found from the 
Felix web site.
+ * The page is downloaded asynchronously using a CompletableFuture, and the 
component of the PageLinkImpl class
+ * will wait for the completion of the future before start.
+ * 
+ * The interesting thing to look at is located in the PageLinkImpl.init() 
method.
+ * 
+ * @author <a href="mailto:[email protected]";>Felix Project Team</a>
+ */
+public class Activator extends DependencyManagerActivator {
+    /**
+     * 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.");
+               
+        // Create the PageLinks service, which asynchronously download 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)));
+        
+        // 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))); 
+    }
+        
+    /**
+     * display all the hrefs (links) found from the Felix web site.
+     */
+    void setPageLinks(PageLinks page) {
+        out.println("Felix site links: " + page.getLinks());
+    }
+}

Added: 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/future/PageLinks.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/future/PageLinks.java?rev=1727487&view=auto
==============================================================================
--- 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/future/PageLinks.java
 (added)
+++ 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/future/PageLinks.java
 Fri Jan 29 06:50:09 2016
@@ -0,0 +1,10 @@
+package org.apache.felix.dm.lambda.samples.future;
+
+import java.util.List;
+
+/**
+ * Service that displays all links found from a given web page.
+ */
+public interface PageLinks {
+    List<String> getLinks();
+}

Added: 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/future/PageLinksImpl.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/future/PageLinksImpl.java?rev=1727487&view=auto
==============================================================================
--- 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/future/PageLinksImpl.java
 (added)
+++ 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/future/PageLinksImpl.java
 Fri Jan 29 06:50:09 2016
@@ -0,0 +1,81 @@
+package org.apache.felix.dm.lambda.samples.future;
+
+import static org.apache.felix.dm.lambda.DependencyManagerActivator.component;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Scanner;
+import java.util.concurrent.CompletableFuture;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.felix.dm.Component;
+import org.osgi.service.log.LogService;
+
+/**
+ * Provides all hrefs found from a given web page.
+ */
+public class PageLinksImpl implements PageLinks {
+       private LogService m_log;
+       private final static String HREF_PATTERN = 
"<a\\s+href\\s*=\\s*(\"[^\"]*\"|[^\\s>]*)\\s*>";
+       private List<String> m_links; // web page hrefs (links).
+    private String m_url;
+
+       PageLinksImpl(String url) {
+           m_url = url;
+       }
+       
+       void bind(LogService log) {
+               m_log = log;
+       }
+       
+       void init(Component c) {
+           // asynchronously download the content of the URL specified in the 
constructor.
+           CompletableFuture<List<String>> futureLinks = 
CompletableFuture.supplyAsync(() -> download(m_url)) 
+               .thenApply(this::parseLinks);          
+
+           // Add the future dependency so we'll be started once the 
CompletableFuture "futureLinks" has completed.
+           component(c, comp -> comp.withFuture(futureLinks, links -> 
links.cbi(this::setLinks)));
+       }
+       
+       // Called when our future has completed.
+    void setLinks(List<String> links) {
+        m_links = links;
+    }
+    
+       // 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());
+       }
+       
+       @Override
+       public List<String> getLinks() {
+               return m_links;
+       }
+
+       private String download(String url) {
+               try (Scanner in = new Scanner(new URL(url).openStream())) {
+                       StringBuilder builder = new StringBuilder();
+                       while (in.hasNextLine()) {
+                               builder.append(in.nextLine());
+                               builder.append("\n");
+                       }
+                       return builder.toString();
+               } catch (IOException ex) {
+                       RuntimeException rex = new RuntimeException();
+                       rex.initCause(ex);
+                       throw rex;
+               }
+       }
+       
+       private List<String> parseLinks(String content) {                
+               Pattern pattern = Pattern.compile(HREF_PATTERN, 
Pattern.CASE_INSENSITIVE);
+               Matcher matcher = pattern.matcher(content);
+               List<String> result = new ArrayList<>();
+               while (matcher.find())
+                       result.add(matcher.group(1));
+               return result;
+       }
+}

Added: 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/future/README
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/future/README?rev=1727487&view=auto
==============================================================================
--- 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/future/README
 (added)
+++ 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/future/README
 Fri Jan 29 06:50:09 2016
@@ -0,0 +1,10 @@
+The purpose of this sample is to show an example usage of the new 
"CompletableFuture" dependency that has been
+added in the dm-lambda library. CompletableFuture java8 class provides 
functional operations and promotes an asynchronous event-driven model.
+
+In such model, you can use the new dm-lambda library to add dependencies on 
asynchronous events using the standard JDK CompletableFuture class.
+
+In this example, the Activator first defines a PageLink component that depends 
on a LogService.
+The PageLink is initialized with the Felix web site URL and from the 
PageLinkImpl.init() method, the Felix web page is asynchronously downloaded,
+using a CompletableFuture. The CF is then added as a "FutureDependency" in the 
PageLinkImpl.init() method.
+And when the CF completes, the PageLinkImpl.start() callback is invoked and 
the service is registered.
+The Activator is then getting injected with the PageLink service, and displays 
the links (hrefs) found from the Felix web site.
\ No newline at end of file

Added: 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/Activator.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/Activator.java?rev=1727487&view=auto
==============================================================================
--- 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/Activator.java
 (added)
+++ 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/Activator.java
 Fri Jan 29 06:50:09 2016
@@ -0,0 +1,49 @@
+/*
+ * 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;
+
+import static java.lang.System.out;
+
+import org.apache.felix.dm.lambda.DependencyManagerActivator;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.osgi.service.log.LogService;
+
+/**
+ * @author <a href="mailto:[email protected]";>Felix Project Team</a>
+ */
+public class Activator extends DependencyManagerActivator {
+    @Override
+    public void activate() throws Exception {
+       out.println("type \"log info\" to see the logs emitted by this test.");
+       
+        component(comp -> comp
+            .impl(ServiceProviderImpl.class)
+            .provides(ServiceProvider.class, property1 -> "value1", property2 
-> 123) // property names are deduced from lambda parameter names
+            .start(ServiceProviderImpl::activate)
+            .withSrv(LogService.class, log -> 
log.cb(ServiceProviderImpl::bind)));
+
+        component(comp -> comp
+            .impl(ServiceConsumer.class)
+            .withSrv(LogService.class)
+            .withSrv(ServiceProvider.class, srv -> 
srv.filter("(property1=value1)")) 
+            .withCnf(conf -> 
conf.pid(ServiceConsumer.class).cb(ServiceConsumer::updated)));  
+        
+        component(comp -> 
comp.impl(Configurator.class).withSrv(ConfigurationAdmin.class));
+    }
+}

Added: 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/Configurator.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/Configurator.java?rev=1727487&view=auto
==============================================================================
--- 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/Configurator.java
 (added)
+++ 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/Configurator.java
 Fri Jan 29 06:50:09 2016
@@ -0,0 +1,20 @@
+package org.apache.felix.dm.lambda.samples.hello;
+
+import java.io.IOException;
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+
+public class Configurator {
+    volatile ConfigurationAdmin m_cm; // injected by reflection.
+    
+    void start() throws IOException {
+        // Configure the ServiceConsumer component
+        Configuration c = 
m_cm.getConfiguration(ServiceConsumer.class.getName(), null);
+        Dictionary<String, Object> props = new Hashtable<>();
+        props.put("foo", "bar");
+        c.update(props);
+    }
+}

Added: 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/README
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/README?rev=1727487&view=auto
==============================================================================
--- 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/README
 (added)
+++ 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/README
 Fri Jan 29 06:50:09 2016
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+
+This sample provides a DM Activator declaring one service consumer and a 
service provider. The
+ServiceConsumer is also depending on a configuration pid  (see 
org.apache.felix.dependencymanager.samples.hello.Configurator).
+To see logs, just type this under gogo shell:
+
+g! log info|grep hello.annot
+

Added: 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/ServiceConsumer.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/ServiceConsumer.java?rev=1727487&view=auto
==============================================================================
--- 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/ServiceConsumer.java
 (added)
+++ 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/ServiceConsumer.java
 Fri Jan 29 06:50:09 2016
@@ -0,0 +1,43 @@
+/*
+ * 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;
+
+import java.util.Dictionary;
+
+import org.osgi.service.log.LogService;
+
+/**
+ * Our service consumer. We depend on a ServiceProvider, and on a 
configuration.
+ * 
+ * @author <a href="mailto:[email protected]";>Felix Project Team</a>
+ */
+public class ServiceConsumer {
+    volatile ServiceProvider service;
+    volatile LogService log;
+    Dictionary<?, ?> conf;
+
+    public void updated(Dictionary<String, Object> conf) {
+        this.conf = conf;
+    }
+    
+    public void start() {
+        log.log(LogService.LOG_INFO, "ServiceConsumer.start: calling 
service.hello()");
+        this.service.hello();
+    }
+}

Added: 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/ServiceProvider.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/ServiceProvider.java?rev=1727487&view=auto
==============================================================================
--- 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/ServiceProvider.java
 (added)
+++ 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/ServiceProvider.java
 Fri Jan 29 06:50:09 2016
@@ -0,0 +1,28 @@
+/*
+ * 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;
+
+/**
+ * The interface for our service provider.
+ *
+ * @author <a href="mailto:[email protected]";>Felix Project Team</a>
+ */
+public interface ServiceProvider {
+    public void hello();
+}

Added: 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/ServiceProviderImpl.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/ServiceProviderImpl.java?rev=1727487&view=auto
==============================================================================
--- 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/ServiceProviderImpl.java
 (added)
+++ 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/hello/ServiceProviderImpl.java
 Fri Jan 29 06:50:09 2016
@@ -0,0 +1,41 @@
+/*
+ * 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;
+
+import org.osgi.service.log.LogService;
+
+/**
+ * The implementation for our service provider.
+ * 
+ * @author <a href="mailto:[email protected]";>Felix Project Team</a>
+ */
+public class ServiceProviderImpl implements ServiceProvider {
+    volatile LogService log;
+
+    void bind(LogService log) { this.log = log; }
+    
+    void activate() {
+        log.log(LogService.LOG_INFO, "ServiceProviderImpl.start");
+    }
+
+    @Override
+    public void hello() {
+        log.log(LogService.LOG_INFO, "ServiceProviderImpl.hello");
+    }
+}

Added: 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/rx/completable/Activator.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/rx/completable/Activator.java?rev=1727487&view=auto
==============================================================================
--- 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/rx/completable/Activator.java
 (added)
+++ 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/rx/completable/Activator.java
 Fri Jan 29 06:50:09 2016
@@ -0,0 +1,54 @@
+/*
+ * 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.rx.completable;
+
+import static java.lang.System.out;
+
+import org.apache.felix.dm.lambda.DependencyManagerActivator;
+import org.osgi.service.log.LogService;
+
+/**
+ * Defines two components: FelixSite which provides some informations about 
the Felix Web site, 
+ * and Test, which depends in the FelixSite service.
+ * 
+ * The FelixSite component will asynchronously download the Felix web page, 
and uses a "CompletableFuture" 
+ * dependency, in order to block the activation of the FelixSite service, 
until the web page is downloaded and parsed.
+ * 
+ * The download is done using some CompletableFuture asynchronous tasks.
+ * 
+ * @author <a href="mailto:[email protected]";>Felix Project Team</a>
+ */
+public class Activator extends DependencyManagerActivator {
+    @Override
+    public void activate() throws Exception {
+       out.println("type \"log info\" to see the logs emitted by this test.");
+       
+       // Define the FelixSiteInfo component that provides some informations 
about the Felix web site.
+       // (see the SiteInfoImpl::init method, which asynchronously download 
Felix).
+        component(comp -> comp
+               .provides(SiteInfo.class)
+               .factory(() -> new SiteInfoImpl("http://felix.apache.org/";))
+            .withSrv(LogService.class, srv -> srv.cb(SiteInfoImpl::bind)));
+        
+        // Define the FelixSite component that depends on the FelixSiteInfo 
service
+        component(comp -> comp
+            .impl(DisplaySite.class)
+            .withSrv(LogService.class, SiteInfo.class));
+    }
+}

Added: 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/rx/completable/DisplaySite.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/rx/completable/DisplaySite.java?rev=1727487&view=auto
==============================================================================
--- 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/rx/completable/DisplaySite.java
 (added)
+++ 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/rx/completable/DisplaySite.java
 Fri Jan 29 06:50:09 2016
@@ -0,0 +1,13 @@
+package org.apache.felix.dm.lambda.samples.rx.completable;
+
+import org.osgi.service.log.LogService;
+
+public class DisplaySite {
+       volatile SiteInfo m_siteInfo;
+       volatile LogService m_log;
+       
+       void start() {
+               m_log.log(LogService.LOG_INFO,  "DisplaySite.start(): links 
available from the Felix web site: " + m_siteInfo.getLinks());
+       }
+
+}

Added: 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/rx/completable/ObservableCompletableFuture.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/rx/completable/ObservableCompletableFuture.java?rev=1727487&view=auto
==============================================================================
--- 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/rx/completable/ObservableCompletableFuture.java
 (added)
+++ 
felix/sandbox/pderop/dependencymanager-lambda/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/rx/completable/ObservableCompletableFuture.java
 Fri Jan 29 06:50:09 2016
@@ -0,0 +1,26 @@
+package org.apache.felix.dm.lambda.samples.rx.completable;
+
+import java.util.concurrent.CompletableFuture;
+
+import io.reactivex.Observable;
+import io.reactivex.disposables.Disposable;
+import io.reactivex.schedulers.Schedulers;
+
+/**
+ * Inspired from 
http://blog.krecan.net/2015/04/28/converting-rxjava-observables-to-java-8-completable-future-and-back/
+ */
+class ObservableCompletableFuture<T> extends CompletableFuture<T> {
+    private final Disposable m_subscription;
+
+    public ObservableCompletableFuture(Observable<T> observable) {
+        m_subscription = observable
+                       .subscribeOn(Schedulers.io())
+                       .subscribe(this::complete, 
this::completeExceptionally);                        
+    }
+        
+    @Override
+    public boolean cancel(boolean mayInterruptIfRunning) {
+        m_subscription.dispose();
+        return super.cancel(mayInterruptIfRunning);
+    }
+}
\ No newline at end of file


Reply via email to