felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pde...@apache.org
Subject svn commit: r1781908 [2/5] - in /felix/trunk/dependencymanager: cnf/localrepo/ cnf/releaserepo/ org.apache.felix.dependencymanager.annotation/ org.apache.felix.dependencymanager.annotation/src/org/apache/felix/dm/annotation/api/ org.apache.felix.depend...
Date Mon, 06 Feb 2017 14:37:51 GMT
Added: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/FELIX5516Test.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/FELIX5516Test.java?rev=1781908&view=auto
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/FELIX5516Test.java (added)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/FELIX5516Test.java Mon Feb  6 14:37:49 2017
@@ -0,0 +1,92 @@
+/*
+ * 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.itest;
+
+import static org.apache.felix.dm.lambda.DependencyManagerActivator.component;
+
+import org.apache.felix.dm.Component;
+import org.apache.felix.dm.DependencyManager;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.PrototypeServiceFactory;
+import org.osgi.framework.ServiceObjects;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class FELIX5516Test extends TestBase {
+    private final static Ensure m_ensure = new Ensure();
+
+    public void testServiceNotDereferencedInternally() throws Exception {
+        final DependencyManager dm = getDM();
+        Component service = component(dm).impl(new Factory()).provides(Service.class).build();
+        Component client = component(dm).impl(new Client()).withSvc(Service.class, svc -> svc.required().dereference(false).add(Client::bind)).build();
+        dm.add(service);
+        dm.add(client);
+        m_ensure.waitForStep(9,  5000);        
+        dm.clear();
+    }
+
+    public interface Service {}
+    
+    public static class ServiceImpl implements Service {
+    	
+    }
+    
+    public static class Factory implements PrototypeServiceFactory<Service> {
+		@Override
+		public Service getService(Bundle bundle, ServiceRegistration<Service> registration) {
+			m_ensure.step();
+			return new ServiceImpl();
+		}
+
+		@Override
+		public void ungetService(Bundle bundle, ServiceRegistration<Service> registration, Service service) {					
+			m_ensure.step();
+		}
+    }
+    
+    public static class Client {
+    	ServiceReference<Service> m_ref;
+        BundleContext m_ctx;
+                
+        void bind(ServiceReference<Service> ref) {
+        	m_ref = ref;
+        }
+        
+        void start() {
+        	ServiceObjects<Service> sobjs = m_ctx.getServiceObjects(m_ref);
+        	
+        	m_ensure.step(1);
+        	Service s1 = sobjs.getService();
+
+        	m_ensure.step(3);
+        	Service s2 = sobjs.getService();
+        	
+        	m_ensure.step(5);   
+        	sobjs.ungetService(s1);
+        	
+        	m_ensure.step(7);   
+        	sobjs.ungetService(s2);
+        	m_ensure.step(9);   
+        }
+    }
+}

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/FactoryConfigurationAdapterTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/FactoryConfigurationAdapterTest.java?rev=1781908&r1=1781907&r2=1781908&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/FactoryConfigurationAdapterTest.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/FactoryConfigurationAdapterTest.java Mon Feb  6 14:37:49 2017
@@ -92,6 +92,55 @@ public class FactoryConfigurationAdapter
         m.clear();
     }
 
+    public void testFactoryConfigurationAdapterWithMethodRef() {
+        DependencyManager m = getDM();
+        // helper class that ensures certain steps get executed in sequence
+        m_ensure = new Ensure();
+        
+        // Create a Configuration instance, which will create/update/remove a configuration for factoryPid "MyFactoryPid"
+        ConfigurationCreator configurator = new ConfigurationCreator("MyFactoryPid", "key", "value1");
+        Component s1 = component(m).impl(configurator).withSvc(ConfigurationAdmin.class, true).build();
+           
+        // Create an Adapter that will be instantiated, once the configuration is created.
+        // This Adapter provides an AdapterService, and depends on an AdapterExtraDependency service.
+        Component s2 = factoryPidAdapter(m)
+            .factoryPid("MyFactoryPid")
+            .impl(Adapter.class)
+            .update(Adapter::updated)
+            .propagate()
+            .provides(AdapterService.class, "foo", "bar")            
+            .withSvc(AdapterExtraDependency.class, true)
+            .build();
+                    
+        // Create extra adapter service dependency upon which our adapter depends on.
+        Component s3 = component(m)
+            .impl(new AdapterExtraDependency()).provides(AdapterExtraDependency.class).build();
+        
+        // Create an AdapterService Consumer
+        Component s4 = component(m)
+            .impl(AdapterServiceConsumer.class).withSvc(AdapterService.class, srv -> srv.add("bind").change("change").remove("remove")).build();
+        
+        // Start services
+        m.add(s1);
+        m.add(s2);
+        m.add(s3);
+        m.add(s4);
+        
+        // Wait for step 8: the AdapterService consumer has been injected with the AdapterService, and has called the doService method.
+        m_ensure.waitForStep(8, 10000);
+        
+        // Modify configuration.
+        configurator.update("key", "value2");
+        
+        // Wait for step 13: the AdapterService has been updated, and the AdapterService consumer has seen the change
+        m_ensure.waitForStep(13, 10000);
+        
+        // Remove the configuration
+        m.remove(s1); // The stop method will remove the configuration
+        m_ensure.waitForStep(16, 10000);
+        m.clear();
+    }
+
     public static class ConfigurationCreator {
         private volatile ConfigurationAdmin m_ca;
         private String m_key;

Added: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/FactoryConfigurationCreator.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/FactoryConfigurationCreator.java?rev=1781908&view=auto
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/FactoryConfigurationCreator.java (added)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/FactoryConfigurationCreator.java Mon Feb  6 14:37:49 2017
@@ -0,0 +1,79 @@
+/*
+ * 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.itest;
+
+import java.io.IOException;
+import java.util.Hashtable;
+
+import org.junit.Assert;
+import org.osgi.service.cm.ConfigurationAdmin;
+
+public class FactoryConfigurationCreator {
+    private volatile ConfigurationAdmin m_ca;
+    private volatile org.osgi.service.cm.Configuration m_conf;
+    private final String m_key;
+    private final String m_value;
+    private final String m_factoryPid;
+    private final Ensure m_e;
+    private final int m_firstStep;
+    
+    public FactoryConfigurationCreator(Ensure e, String factoryPid, int firstStep, String key, String value) {
+        m_factoryPid = factoryPid;
+        m_key = key;
+        m_value = value;
+        m_e = e;
+        m_firstStep = firstStep;
+    }
+
+    public void start() {
+        try {
+            m_e.step(m_firstStep);
+            m_conf = m_ca.createFactoryConfiguration(m_factoryPid, null);
+            Hashtable<String, Object> props = new Hashtable<>();
+            props.put(m_key, m_value);
+            m_conf.update(props);
+        }
+        catch (IOException e) {
+            Assert.fail("Could not create configuration: " + e.getMessage());
+        }
+    }
+    
+    public void update(String key, String val) {
+        Hashtable<String, Object> props = new Hashtable<>();
+        props.put(key, val);
+        try {
+            m_conf.update(props);
+        }
+        catch (IOException e) {
+            Assert.fail("Could not update configuration: " + e.getMessage());
+        }
+    }
+    
+    public void stop() {
+        try
+        {
+            m_conf.delete();
+        }
+        catch (IOException e)
+        {
+            Assert.fail("Could not remove configuration: " + e.toString());
+        }
+    }
+}
+

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryAspectConfiguration.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryAspectConfiguration.java?rev=1781908&r1=1781907&r2=1781908&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryAspectConfiguration.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryAspectConfiguration.java Mon Feb  6 14:37:49 2017
@@ -20,8 +20,8 @@ package org.apache.felix.dm.lambda.sampl
 
 import java.util.List;
 
-import aQute.bnd.annotation.metatype.Meta.AD;
-import aQute.bnd.annotation.metatype.Meta.OCD;
+import org.osgi.service.metatype.annotations.AttributeDefinition;
+import org.osgi.service.metatype.annotations.ObjectClassDefinition;
 
 /**
  * This interface describes the configuration for our DictionaryAspect component. We are using the bnd metatype
@@ -29,9 +29,11 @@ import aQute.bnd.annotation.metatype.Met
  * 
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
-@OCD(name="Spell Checker Dictionary Aspect",
-     description = "Declare here the list of english words to be added into the default english dictionary")
+@ObjectClassDefinition(
+	name="Spell Checker Dictionary Aspect",
+    description = "Declare here the list of english words to be added into the default english dictionary",
+    pid="org.apache.felix.dm.lambda.samples.dictionary.DictionaryAspectConfiguration")     
 public interface DictionaryAspectConfiguration {
-    @AD(description = "Dictionary aspect words")
+    @AttributeDefinition(description = "Dictionary aspect words")
     List<String> words();
 }

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryConfiguration.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryConfiguration.java?rev=1781908&r1=1781907&r2=1781908&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryConfiguration.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda.samples/src/org/apache/felix/dm/lambda/samples/dictionary/DictionaryConfiguration.java Mon Feb  6 14:37:49 2017
@@ -20,8 +20,8 @@ package org.apache.felix.dm.lambda.sampl
 
 import java.util.List;
 
-import aQute.bnd.annotation.metatype.Meta.AD;
-import aQute.bnd.annotation.metatype.Meta.OCD;
+import org.osgi.service.metatype.annotations.AttributeDefinition;
+import org.osgi.service.metatype.annotations.ObjectClassDefinition;
 
 /**
  * This interface describes the configuration for our DictionaryImpl component. We are using the bnd metatype
@@ -29,13 +29,13 @@ import aQute.bnd.annotation.metatype.Met
  * 
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
-@OCD(name="Spell Checker Dictionary",
-     factory = true, 
+@ObjectClassDefinition(name="Spell Checker Dictionary",
+     factoryPid = "org.apache.felix.dm.lambda.samples.dictionary.DictionaryConfiguration",
      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")
+    @AttributeDefinition(description = "Describes the dictionary language", defaultValue = "en")
     String lang();
 
-    @AD(description = "Declare here the list of words supported by this dictionary.")
+    @AttributeDefinition(description = "Declare here the list of words supported by this dictionary.")
     List<String> words();
 }

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/ComponentBuilder.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/ComponentBuilder.java?rev=1781908&r1=1781907&r2=1781908&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/ComponentBuilder.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/ComponentBuilder.java Mon Feb  6 14:37:49 2017
@@ -26,6 +26,7 @@ import java.util.function.Supplier;
 import java.util.stream.Stream;
 
 import org.apache.felix.dm.Component;
+import org.apache.felix.dm.ComponentStateListener;
 import org.apache.felix.dm.lambda.callbacks.InstanceCb;
 import org.apache.felix.dm.lambda.callbacks.InstanceCbComponent;
 
@@ -761,6 +762,13 @@ public interface ComponentBuilder<B exte
      * @return this builder
      */
     B composition(Supplier<Object[]> getCompositionMethod);
+        
+    /**
+     * Adds a component state listener to this component.
+     * 
+     * @param listener the state listener
+     */
+	B listener(ComponentStateListener listener);
     
     /**
      * Builds the real DependencyManager Component.

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/ServiceCallbacksBuilder.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/ServiceCallbacksBuilder.java?rev=1781908&r1=1781907&r2=1781908&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/ServiceCallbacksBuilder.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/ServiceCallbacksBuilder.java Mon Feb  6 14:37:49 2017
@@ -18,6 +18,10 @@
  */
 package org.apache.felix.dm.lambda;
 
+import org.apache.felix.dm.lambda.callbacks.CbRef;
+import org.apache.felix.dm.lambda.callbacks.CbRefComponent;
+import org.apache.felix.dm.lambda.callbacks.CbRefRef;
+import org.apache.felix.dm.lambda.callbacks.CbRefRefComponent;
 import org.apache.felix.dm.lambda.callbacks.CbRefServiceRefService;
 import org.apache.felix.dm.lambda.callbacks.CbRefServiceRefServiceComponent;
 import org.apache.felix.dm.lambda.callbacks.CbService;
@@ -28,6 +32,10 @@ import org.apache.felix.dm.lambda.callba
 import org.apache.felix.dm.lambda.callbacks.CbServiceRef;
 import org.apache.felix.dm.lambda.callbacks.CbServiceService;
 import org.apache.felix.dm.lambda.callbacks.CbServiceServiceComponent;
+import org.apache.felix.dm.lambda.callbacks.InstanceCbRef;
+import org.apache.felix.dm.lambda.callbacks.InstanceCbRefComponent;
+import org.apache.felix.dm.lambda.callbacks.InstanceCbRefRef;
+import org.apache.felix.dm.lambda.callbacks.InstanceCbRefRefComponent;
 import org.apache.felix.dm.lambda.callbacks.InstanceCbRefServiceRefService;
 import org.apache.felix.dm.lambda.callbacks.InstanceCbRefServiceRefServiceComponent;
 import org.apache.felix.dm.lambda.callbacks.InstanceCbService;
@@ -38,6 +46,7 @@ import org.apache.felix.dm.lambda.callba
 import org.apache.felix.dm.lambda.callbacks.InstanceCbServiceRef;
 import org.apache.felix.dm.lambda.callbacks.InstanceCbServiceService;
 import org.apache.felix.dm.lambda.callbacks.InstanceCbServiceServiceComponent;
+import org.osgi.annotation.versioning.ProviderType;
 
 /**
  * Builds a service dependency callback. 
@@ -72,8 +81,12 @@ import org.apache.felix.dm.lambda.callba
  * method(S service, Dictionary<String, Object> serviceProperties)
  * method(S service, Component serviceComponent)
  * method(S service, Component serviceComponent, ServiceReference<S> serviceRef)
+ * method(ServiceReference<S> service)
+ * method(ServiceReference<S> service, Component serviceComponent)
  * swapMethod(S oldService, S newService)
+ * swapMethod(ServiceReference<> oldRef, ServiceReference<S> newRef)
  * swapMethod(S oldService, S newService, Component component))
+ * swapMethod(ServiceReference<> oldRef, ServiceReference<S> newRef, Component component)
  * swapMethod(ServiceReference<S> oldRef, S old, ServiceReference<S> newRef, S newService)
  * swapMethod(ServiceReference<S> oldRef, S old, ServiceReference<S> newRef, S newService, Component component)
  * }</pre>
@@ -112,6 +125,7 @@ import org.apache.felix.dm.lambda.callba
  * 
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
+@ProviderType
 public interface ServiceCallbacksBuilder<S, B extends ServiceCallbacksBuilder<S, B>> {
     
     /**
@@ -391,6 +405,66 @@ public interface ServiceCallbacksBuilder
     <T> B remove(CbServiceComponentRef<T, S> remove);
     
     /**
+     * Sets a <code>component callback(ServiceReference ref)</code> method reference. The callback is invoked when a service is added.
+     * The method reference must point to a Component implementation class method.
+     * 
+     * @param <T> the type of the component implementation class on which the callback is invoked.
+     * @param add the method reference invoked when a service is added.
+     * @return this builder
+     */
+    <T> B add(CbRef<T, S> add);
+ 
+    /**
+     * Sets a <code>component callback(ServiceReference)</code> method reference. The callback is invoked when a service is changed.
+     * The method reference must point to a Component implementation class method.
+     * 
+     * @param <T> the type of the component implementation class on which the callback is invoked.
+     * @param change the method reference invoked when a service is changed.
+     * @return this builder
+     */
+    <T> B change(CbRef<T, S> change);
+
+    /**
+     * Sets a <code>component callback(ServiceReference)</code> method reference. The callback is invoked when a service is removed.
+     * The method reference must point to a Component implementation class method.
+     * 
+     * @param <T> the type of the component implementation class on which the callback is invoked.
+     * @param remove the method reference invoked when a service is removed.
+     * @return this builder
+     */
+    <T> B remove(CbRef<T, S> remove);
+
+    /**
+     * Sets a <code>component callback(ServiceReference ref, Component comp)</code> method reference. The callback is invoked when a service is added.
+     * The method reference must point to a Component implementation class method.
+     * 
+     * @param <T> the type of the component implementation class on which the callback is invoked.
+     * @param add the method reference invoked when a service is added.
+     * @return this builder
+     */
+    <T> B add(CbRefComponent<T, S> add);
+ 
+    /**
+     * Sets a <code>component callback(ServiceReference, Component comp)</code> method reference. The callback is invoked when a service is changed.
+     * The method reference must point to a Component implementation class method.
+     * 
+     * @param <T> the type of the component implementation class on which the callback is invoked.
+     * @param change the method reference invoked when a service is changed.
+     * @return this builder
+     */
+    <T> B change(CbRefComponent<T, S> change);
+
+    /**
+     * Sets a <code>component callback(ServiceReference, Component comp)</code> method reference. The callback is invoked when a service is removed.
+     * The method reference must point to a Component implementation class method.
+     * 
+     * @param <T> the type of the component implementation class on which the callback is invoked.
+     * @param remove the method reference invoked when a service is removed.
+     * @return this builder
+     */
+    <T> B remove(CbRefComponent<T, S> remove);
+
+    /**
      * Sets an <code>Object instance callback(Service)</code> method reference. The callback is invoked when a service is added.
      * The method reference must point to a method from an Object instance. 
      * 
@@ -499,6 +573,33 @@ public interface ServiceCallbacksBuilder
     B remove(InstanceCbServiceRef<S> remove);
     
     /**
+     * Sets an <code>Object instance callback(ServiceReference)</code> method reference. The callback is invoked when a service is added.
+     * The method reference must point to a method from an Object instance. 
+     * 
+     * @param add the method reference invoked when a service is added.
+     * @return this builder
+     */
+    B add(InstanceCbRef<S> add);
+  
+    /**
+     * Sets an <code>Object instance callback(ServiceReference)</code> method reference. The callback is invoked when a service is changed.
+     * The method reference must point to method from an Object instance. 
+     * 
+     * @param change the method reference invoked when a service is changed.
+     * @return this builder
+     */
+    B change(InstanceCbRef<S> change);
+
+    /**
+     * Sets an <code>Object instance callback(ServiceReference)</code> method reference. The callback is invoked when a service is removed.
+     * The method reference must point to method from an Object instance. 
+     * 
+     * @param remove the method reference invoked when a service is removed.
+     * @return this builder
+     */
+    B remove(InstanceCbRef<S> remove);
+
+    /**
      * Sets an <code>Object instance callback(Service, Component)</code> method reference. The callback is when a service is added.
      * The method reference must point to a method from an Object instance. 
      * 
@@ -553,6 +654,33 @@ public interface ServiceCallbacksBuilder
     B remove(InstanceCbServiceComponentRef<S> remove);
   
     /**
+     * Sets an <code>Object instance callback(ServiceReference, Component)</code> method reference. The callback is invoked when a service is added.
+     * The method reference must point to a method from an Object instance. 
+     * 
+     * @param add the method reference invoked when a service is added.
+     * @return this builder
+     */
+    B add(InstanceCbRefComponent<S> add);
+   
+    /**
+     * Sets an <code>Object instance callback(ServiceReference, Component)</code> method reference. The callback is invoked when a service is changed.
+     * The method reference must point to method from an Object instance. 
+     * 
+     * @param change the method reference invoked when a service is changed.
+     * @return this builder
+     */
+    B change(InstanceCbRefComponent<S> change);
+    
+    /**
+     * Sets an <code>Object instance callback(ServiceReference, Component)</code> method reference. The callback is invoked when a service is removed.
+     * The method reference must point to method from an Object instance. 
+     * 
+     * @param remove the method reference invoked when a service is removed.
+     * @return this builder
+     */
+    B remove(InstanceCbRefComponent<S> remove);
+  
+    /**
      * Sets a swap <code>component callback(Service, Service)</code> method reference. The callback is invoked when a service is swapped.
      * The method reference must point to a Component implementation class method.
      * 
@@ -563,7 +691,17 @@ public interface ServiceCallbacksBuilder
     <T> B swap(CbServiceService<T, S> swap);
  
     /**
-     * Sets a wap <code>component callback(Service, Service, Component)</code> method reference. The callback is invoked when a service is swapped.
+     * Sets a swap <code>component callback(Service, Service)</code> method reference. The callback is invoked when a service is swapped.
+     * The method reference must point to a Component implementation class method.
+     * 
+     * @param <T> the type of the component implementation class on which the callback is invoked.
+     * @param swap the method reference invoked when the service is swapped.
+     * @return this builder
+     */
+    <T> B swap(CbRefRef<T, S> swap);
+
+    /**
+     * Sets a swap <code>component callback(Service, Service, Component)</code> method reference. The callback is invoked when a service is swapped.
      * The method reference must point to a Component implementation class method.
      * 
      * @param <T> the type of the component implementation class on which the callback is invoked.
@@ -573,6 +711,16 @@ public interface ServiceCallbacksBuilder
     <T> B swap(CbServiceServiceComponent<T, S> swap);
     
     /**
+     * Sets a swap <code>component callback(ServiceRefere, ServiceReference, Component)</code> method reference. The callback is invoked when a service is swapped.
+     * The method reference must point to a Component implementation class method.
+     * 
+     * @param <T> the type of the component implementation class on which the callback is invoked.
+     * @param swap the method reference invoked when the service is swapped.
+     * @return this builder
+     */
+    <T> B swap(CbRefRefComponent<T, S> swap);
+    
+    /**
      * Sets a swap <code>component callback(ServiceReference, Service, ServiceReference, Service)</code> method reference. The callback is invoked when a service is swapped.
      * The method reference must point to a Component implementation class method. 
      * the new service.
@@ -604,6 +752,24 @@ public interface ServiceCallbacksBuilder
     B swap(InstanceCbServiceService<S> swap);
    
     /**
+     * Sets a swap <code>instance callback(ServiceReference, ServiceReference)</code> method reference. The callback is invoked when a service is swapped.
+     * The method reference must point to a method from an Object instance. 
+     *
+     * @param swap the method reference invoked when the service is swapped.
+     * @return this builder
+     */
+    B swap(InstanceCbRefRef<S> swap);
+   
+    /**
+     * Sets a swap <code>instance callback(ServiceReference, ServiceReference, Component)</code> method reference. The callback is invoked when a service is swapped.
+     * The method reference must point to a method from an Object instance. 
+     *
+     * @param swap the method reference invoked when the service is swapped.
+     * @return this builder
+     */
+    B swap(InstanceCbRefRefComponent<S> swap);
+   
+    /**
      * Sets a swap <code>instance callback(Service, Service, Component)</code> method reference. The callback is invoked when a service is swapped.
      * The method reference must point to a method from an Object instance. 
      *
@@ -629,4 +795,15 @@ public interface ServiceCallbacksBuilder
      * @return this builder
      */
     B swap(InstanceCbRefServiceRefServiceComponent<S> swap);        
+
+    /**
+     * Configures whether or not this dependency should internally obtain the service object for all tracked service references.
+     * 
+     * By default, DM internally dereferences all discovered service references (using 
+     * <code>BundleContext.getService(ServiceReference ref)</code> methods. 
+     * However, sometimes, your callback only needs the ServiceReference, and sometimes you don't want to dereference the service.
+     * So, in this case you can use the <code>dereference(false)</code> method in order to tell to DM 
+     * that it should never internally dereference the service dependency internally. 
+     */
+    B dereference(boolean obtainServiceBeforeInjection);
 }

Added: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbRef.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbRef.java?rev=1781908&view=auto
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbRef.java (added)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbRef.java Mon Feb  6 14:37:49 2017
@@ -0,0 +1,47 @@
+/*
+ * 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.callbacks;
+
+import java.util.Objects;
+
+import org.osgi.framework.ServiceReference;
+
+/**
+ * Represents a callback(ServiceReference) that is invoked on a Component implementation class. 
+ * The type of the class on which the callback is invoked on is represented by the T generic parameter.
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+@FunctionalInterface
+public interface CbRef<T, S> extends SerializableLambda {
+    /**
+     * Handles the given arguments.
+     * @param instance the Component implementation instance on which the callback is invoked on. 
+     * @param ref a Service Reference
+     */
+    void accept(T instance, ServiceReference<S> ref);
+
+    default CbRef<T, S> andThen(CbRef<? super T, S> after) {
+        Objects.requireNonNull(after);
+        return (T instance, ServiceReference<S> ref) -> {
+            accept(instance, ref);
+            after.accept(instance, ref);
+        };
+    }
+}

Added: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbRefComponent.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbRefComponent.java?rev=1781908&view=auto
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbRefComponent.java (added)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbRefComponent.java Mon Feb  6 14:37:49 2017
@@ -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.callbacks;
+
+import java.util.Objects;
+
+import org.apache.felix.dm.Component;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * Represents a callback(ServiceReference, Component) that is invoked on a Component implementation class. 
+ * The type of the class on which the callback is invoked on is represented by the T generic parameter.
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+@FunctionalInterface
+public interface CbRefComponent<T, S> extends SerializableLambda {
+    /**
+     * Handles the given arguments.
+     * @param instance the Component implementation instance on which the callback is invoked on. 
+     * @param ref a Service Reference
+     * @param comp a Component
+     */
+    void accept(T instance, ServiceReference<S> ref, Component comp);
+
+    default CbRefComponent<T, S> andThen(CbRefComponent<? super T, S> after) {
+        Objects.requireNonNull(after);
+        return (T instance, ServiceReference<S> ref, Component comp) -> {
+            accept(instance, ref, comp);
+            after.accept(instance, ref, comp);
+        };
+    }
+}

Added: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbRefRef.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbRefRef.java?rev=1781908&view=auto
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbRefRef.java (added)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbRefRef.java Mon Feb  6 14:37:49 2017
@@ -0,0 +1,48 @@
+/*
+ * 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.callbacks;
+
+import java.util.Objects;
+
+import org.osgi.framework.ServiceReference;
+
+/**
+ * Represents a callback(ServiceReference, ServiceReference) that is invoked on a Component implementation class. 
+ * The type of the class on which the callback is invoked on is represented by the T generic parameter.
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+@FunctionalInterface
+public interface CbRefRef<T, S> extends SerializableLambda {
+    /**
+     * Handles the given arguments.
+     * @param instance the Component implementation instance on which the callback is invoked on. 
+     * @param ref1 first callback arg
+     * @param ref2 second callback arg
+     */
+    void accept(T instance, ServiceReference<S> ref1, ServiceReference<S> ref2);
+
+    default CbRefRef<T, S> andThen(CbRefRef<? super T, S> after) {
+        Objects.requireNonNull(after);
+        return (T instance, ServiceReference<S> ref1, ServiceReference<S> ref2) -> {
+            accept(instance, ref1, ref2);
+            after.accept(instance, ref1, ref2);
+        };
+    }
+}

Added: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbRefRefComponent.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbRefRefComponent.java?rev=1781908&view=auto
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbRefRefComponent.java (added)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbRefRefComponent.java Mon Feb  6 14:37:49 2017
@@ -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.callbacks;
+
+import java.util.Objects;
+
+import org.apache.felix.dm.Component;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * Represents a callback(ServiceReference, ServiceReference, Component) that is invoked on a Component implementation class. 
+ * The type of the class on which the callback is invoked on is represented by the T generic parameter.
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+@FunctionalInterface
+public interface CbRefRefComponent<T, S> extends SerializableLambda {
+    /**
+     * Handles the given arguments.
+     * @param instance the Component implementation instance on which the callback is invoked on. 
+     * @param ref1 a Service Reference
+     * @param ref2 a Service Reference
+     * @param comp a Component
+     */
+    void accept(T instance, ServiceReference<S> ref1, ServiceReference<S> ref2, Component comp);
+
+    default CbRefRefComponent<T, S> andThen(CbRefRefComponent<? super T, S> after) {
+        Objects.requireNonNull(after);
+        return (T instance, ServiceReference<S> ref1, ServiceReference<S> ref2, Component comp) -> {
+            accept(instance, ref1, ref2, comp);
+            after.accept(instance, ref1, ref2, comp);
+        };
+    }
+}

Added: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/InstanceCbRef.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/InstanceCbRef.java?rev=1781908&view=auto
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/InstanceCbRef.java (added)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/InstanceCbRef.java Mon Feb  6 14:37:49 2017
@@ -0,0 +1,48 @@
+/*
+ * 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.callbacks;
+
+import java.util.Objects;
+
+import org.osgi.framework.ServiceReference;
+
+/**
+ * Represents a callback(ServiceReference) on an Object instance.
+ * 
+ * <p> The type of the service passed in argument to the callback is defined by the "S" generic parameter.
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+@FunctionalInterface
+public interface InstanceCbRef<S> {
+    /**
+     * Handles the given arguments.
+     * @param ref a Service Reference
+     * @param service a Service
+     */
+    void accept(ServiceReference<S> ref);
+
+    default InstanceCbRef<S> andThen(InstanceCbRef<S> after) {
+        Objects.requireNonNull(after);
+        return (ServiceReference<S> ref) -> {
+            accept(ref);
+            after.accept(ref);
+        };
+    }
+}

Added: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/InstanceCbRefComponent.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/InstanceCbRefComponent.java?rev=1781908&view=auto
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/InstanceCbRefComponent.java (added)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/InstanceCbRefComponent.java Mon Feb  6 14:37:49 2017
@@ -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.callbacks;
+
+import java.util.Objects;
+
+import org.apache.felix.dm.Component;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * Represents a callback(ServiceReference, Component) on an Object instance.
+ * 
+ * <p> The type of the service passed in argument to the callback is defined by the "S" generic parameter.
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+@FunctionalInterface
+public interface InstanceCbRefComponent<S> {
+    /**
+     * Handles the given arguments.
+     * @param ref a Service Reference
+     * @param comp a Component
+     */
+    void accept(ServiceReference<S> ref, Component comp);
+
+    default InstanceCbRefComponent<S> andThen(InstanceCbRefComponent<S> after) {
+        Objects.requireNonNull(after);
+        return (ServiceReference<S> ref, Component comp) -> {
+            accept(ref, comp);
+            after.accept(ref, comp);
+        };
+    }
+}

Added: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/InstanceCbRefRef.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/InstanceCbRefRef.java?rev=1781908&view=auto
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/InstanceCbRefRef.java (added)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/InstanceCbRefRef.java Mon Feb  6 14:37:49 2017
@@ -0,0 +1,48 @@
+/*
+ * 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.callbacks;
+
+import java.util.Objects;
+
+import org.osgi.framework.ServiceReference;
+
+/**
+ * Represents a swap callback(ServiceReference, ServiceReference) on an Object instance.
+ * 
+ * <p> The type of the service passed in argument to the callback is defined by the "S" generic parameter.
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+@FunctionalInterface
+public interface InstanceCbRefRef<S> extends SerializableLambda {
+    /**
+     * Handles the given argument
+     * @param ref1 a Service Reference
+     * @param ref2 a Service Reference
+     */
+    void accept(ServiceReference<S> ref1, ServiceReference<S> ref2);
+
+    default InstanceCbRefRef<S> andThen(InstanceCbRefRef<S> after) {
+        Objects.requireNonNull(after);
+        return (ServiceReference<S> ref1, ServiceReference<S> ref2) -> {
+            accept(ref1, ref2);
+            after.accept(ref1, ref2);
+        };
+    }
+}

Added: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/InstanceCbRefRefComponent.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/InstanceCbRefRefComponent.java?rev=1781908&view=auto
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/InstanceCbRefRefComponent.java (added)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/InstanceCbRefRefComponent.java Mon Feb  6 14:37:49 2017
@@ -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.callbacks;
+
+import java.util.Objects;
+
+import org.apache.felix.dm.Component;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * Represents a callback(ServiceReference, ServiceReference, Component) on an Object instance.
+ * 
+ * <p> The type of the service passed in argument to the callback is defined by the "S" generic parameter.
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+@FunctionalInterface
+public interface InstanceCbRefRefComponent<S> {
+    /**
+     * Handles the given arguments.
+     * @param ref1 first service reference
+     * @param ref2 second service reference
+     * @param comp a Component
+     */
+    void accept(ServiceReference<S> ref1, ServiceReference<S> ref2, Component comp);
+
+    default InstanceCbRefRefComponent<S> andThen(InstanceCbRefRefComponent<S> after) {
+        Objects.requireNonNull(after);
+        return (ServiceReference<S> ref1, ServiceReference<S> ref2, Component comp) -> {
+            accept(ref1, ref2, comp);
+            after.accept(ref1, ref2, comp);
+        };
+    }
+}

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/packageinfo
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/packageinfo?rev=1781908&r1=1781907&r2=1781908&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/packageinfo (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/packageinfo Mon Feb  6 14:37:49 2017
@@ -1 +1 @@
-version 1.0.0
+version 1.1.0

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/impl/AdapterBase.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/impl/AdapterBase.java?rev=1781908&r1=1781907&r2=1781908&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/impl/AdapterBase.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/impl/AdapterBase.java Mon Feb  6 14:37:49 2017
@@ -24,6 +24,7 @@ import java.util.function.Consumer;
 import java.util.function.Function;
 import java.util.function.Supplier;
 
+import org.apache.felix.dm.ComponentStateListener;
 import org.apache.felix.dm.lambda.BundleDependencyBuilder;
 import org.apache.felix.dm.lambda.ComponentBuilder;
 import org.apache.felix.dm.lambda.ConfigurationDependencyBuilder;
@@ -302,4 +303,9 @@ public interface AdapterBase<B extends C
         andThenBuild(compBuilder -> compBuilder.composition(getCompositionMethod));
         return (B) this;
     }
+    
+    default B listener(ComponentStateListener listener) {
+        andThenBuild(compBuilder -> compBuilder.listener(listener));
+        return (B) this;
+    }
 }

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/impl/BundleAdapterBuilderImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/impl/BundleAdapterBuilderImpl.java?rev=1781908&r1=1781907&r2=1781908&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/impl/BundleAdapterBuilderImpl.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/impl/BundleAdapterBuilderImpl.java Mon Feb  6 14:37:49 2017
@@ -40,9 +40,6 @@ public class BundleAdapterBuilderImpl im
     protected final Map<Cb, List<MethodRef<Object>>> m_refs = new HashMap<>();
     private DependencyManager m_dm;
     private boolean m_autoAdd;
-    private String m_added;
-    private String m_changed;
-    private String m_removed;
     private String m_filter;
     private int m_stateMask = -1;
     private boolean m_propagate;
@@ -282,7 +279,7 @@ public class BundleAdapterBuilderImpl im
     }
     
     private void checkHasNoReflectionCallbacks() {
-        if (m_added != null || m_changed != null || m_removed != null) {
+        if (m_add != null || m_change != null || m_remove != null) {
             throw new IllegalStateException("Can't mix method references with reflection based callbacks");
         }
     }

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/impl/ComponentBuilderImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/impl/ComponentBuilderImpl.java?rev=1781908&r1=1781907&r2=1781908&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/impl/ComponentBuilderImpl.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/impl/ComponentBuilderImpl.java Mon Feb  6 14:37:49 2017
@@ -38,6 +38,7 @@ import java.util.function.Supplier;
 import java.util.stream.Stream;
 
 import org.apache.felix.dm.Component;
+import org.apache.felix.dm.ComponentStateListener;
 import org.apache.felix.dm.Dependency;
 import org.apache.felix.dm.DependencyManager;
 import org.apache.felix.dm.context.ComponentContext;
@@ -74,7 +75,8 @@ public class ComponentBuilderImpl implem
     private Object m_initCallbackInstance;
     private Object m_startCallbackInstance;
     private Object m_stopCallbackInstance;
-    private Object m_destroyCallbackInstance;   
+    private Object m_destroyCallbackInstance;
+    private final List<ComponentStateListener> m_listeners = new ArrayList<>();
     
     enum ComponentCallback { INIT, START, STOP, DESTROY };
     
@@ -546,6 +548,11 @@ public class ComponentBuilderImpl implem
         m_destroyCallbackInstance = null;
         return this;
     }
+        
+    public ComponentBuilderImpl listener(ComponentStateListener listener) {
+    	m_listeners.add(listener);
+    	return this;
+    }
     
     public Component build() {
         if (m_serviceNames != null) {
@@ -555,7 +562,9 @@ public class ComponentBuilderImpl implem
         if (m_properties != null) {
             m_component.setServiceProperties(m_properties);
         }
-                
+        
+        m_listeners.stream().forEach(m_component::add);
+
         if (! m_componentUpdated) { // Don't override impl or set callbacks if component is being updated
            if (m_impl != null) {               
                m_component.setImplementation(m_impl);

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/impl/ServiceCallbacksBuilderImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/impl/ServiceCallbacksBuilderImpl.java?rev=1781908&r1=1781907&r2=1781908&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/impl/ServiceCallbacksBuilderImpl.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/impl/ServiceCallbacksBuilderImpl.java Mon Feb  6 14:37:49 2017
@@ -26,6 +26,10 @@ import java.util.stream.Stream;
 
 import org.apache.felix.dm.Component;
 import org.apache.felix.dm.lambda.ServiceCallbacksBuilder;
+import org.apache.felix.dm.lambda.callbacks.CbRef;
+import org.apache.felix.dm.lambda.callbacks.CbRefComponent;
+import org.apache.felix.dm.lambda.callbacks.CbRefRef;
+import org.apache.felix.dm.lambda.callbacks.CbRefRefComponent;
 import org.apache.felix.dm.lambda.callbacks.CbRefServiceRefService;
 import org.apache.felix.dm.lambda.callbacks.CbRefServiceRefServiceComponent;
 import org.apache.felix.dm.lambda.callbacks.CbService;
@@ -36,6 +40,10 @@ import org.apache.felix.dm.lambda.callba
 import org.apache.felix.dm.lambda.callbacks.CbServiceRef;
 import org.apache.felix.dm.lambda.callbacks.CbServiceService;
 import org.apache.felix.dm.lambda.callbacks.CbServiceServiceComponent;
+import org.apache.felix.dm.lambda.callbacks.InstanceCbRef;
+import org.apache.felix.dm.lambda.callbacks.InstanceCbRefComponent;
+import org.apache.felix.dm.lambda.callbacks.InstanceCbRefRef;
+import org.apache.felix.dm.lambda.callbacks.InstanceCbRefRefComponent;
 import org.apache.felix.dm.lambda.callbacks.InstanceCbRefServiceRefService;
 import org.apache.felix.dm.lambda.callbacks.InstanceCbRefServiceRefServiceComponent;
 import org.apache.felix.dm.lambda.callbacks.InstanceCbService;
@@ -83,6 +91,11 @@ public class ServiceCallbacksBuilderImpl
 	protected final List<SwapMethodRef<?, S>> m_swapRefs = new ArrayList<>();
 	
 	/**
+	 * Indicates if the service must always be internally deference by dependency manager.
+	 */
+	protected boolean m_dereferenceServiceInternally = true;
+	
+	/**
 	 * This interface (lambda) is called when we want to invoke a method reference. the lambda is called with all necessary service dependency 
 	 * informations.
 	 * 
@@ -148,7 +161,13 @@ public class ServiceCallbacksBuilderImpl
         
     public B swap(String swap) {
         return callbacks(null, null, null, swap);
-    }
+    }    
+
+	@Override
+	public B dereference(boolean dereferenceServiceInternally) {
+		m_dereferenceServiceInternally = dereferenceServiceInternally; 
+		return (B) this;
+	}   
         
     private B callbacks(String added, String changed, String removed, String swapped) {
 		requiresNoMethodRefs();
@@ -336,6 +355,29 @@ public class ServiceCallbacksBuilderImpl
         return (B) this;
     }
     
+    public B add(InstanceCbRef<S> add) {
+        return callbacks(add, null, null);
+    }
+
+    public B change(InstanceCbRef<S> change) {
+        return callbacks(null, change, null);
+    }
+
+    public B remove(InstanceCbRef<S> remove) {
+        return callbacks(null, null, remove);
+    }
+
+    public B callbacks(InstanceCbRef<S> add, InstanceCbRef<S> change, InstanceCbRef<S> remove) {
+        if (add != null)
+            setInstanceCallbackRef(Cb.ADD, (inst, comp, ref, srv) -> add.accept(ref)); 
+        if (change != null)
+            setInstanceCallbackRef(Cb.CHG, (inst, comp, ref, srv) -> change.accept(ref)); 
+        if (remove != null)
+            setInstanceCallbackRef(Cb.REM, (inst, comp, ref, srv) -> remove.accept(ref));
+        m_dereferenceServiceInternally = false;
+        return (B) this;
+    }
+    
     public <T> B add(CbServiceComponent<T, S>  add) {
         return callbacks(add, null, null);
     }
@@ -402,6 +444,51 @@ public class ServiceCallbacksBuilderImpl
         return (B) this;
     }
 
+    public <T> B add(CbRef<T, S>  add) {
+        return callbacks(add, null, null);
+    }
+
+    public <T> B change(CbRef<T, S>  change) {
+        return callbacks(null, change, null);
+    }
+
+    public <T> B remove(CbRef<T, S>  remove) {
+        return callbacks(null, null, remove);
+    }
+
+    private <T> B callbacks(CbRef<T, S>  add, CbRef<T, S>  change, CbRef<T, S>  remove) {
+        if (add != null)
+            setComponentCallbackRef(Cb.ADD, Helpers.getLambdaArgType(add, 0), (inst, comp, ref, srv) -> add.accept((T) inst, ref)); 
+        if (change != null)
+            setComponentCallbackRef(Cb.CHG, Helpers.getLambdaArgType(change, 0), (inst, comp, ref, srv) -> change.accept((T) inst, ref)); 
+        if (remove != null)
+            setComponentCallbackRef(Cb.REM, Helpers.getLambdaArgType(remove, 0), (inst, comp, ref, srv) -> remove.accept((T) inst, ref));
+        m_dereferenceServiceInternally = false;
+        return (B) this;
+    }
+
+    public <T> B add(CbRefComponent<T, S>  add) {
+        return callbacks(add, null, null);
+    }
+
+    public <T> B change(CbRefComponent<T, S>  change) {
+        return callbacks(null, change, null);
+    }
+
+    public <T> B remove(CbRefComponent<T, S>  remove) {
+        return callbacks(null, null, remove);
+    }
+
+    private <T> B callbacks(CbRefComponent<T, S>  add, CbRefComponent<T, S>  change, CbRefComponent<T, S>  remove) {
+        if (add != null)
+            setComponentCallbackRef(Cb.ADD, Helpers.getLambdaArgType(add, 0), (inst, comp, ref, srv) -> add.accept((T) inst, ref, comp)); 
+        if (change != null)
+            setComponentCallbackRef(Cb.CHG, Helpers.getLambdaArgType(change, 0), (inst, comp, ref, srv) -> change.accept((T) inst, ref, comp)); 
+        if (remove != null)
+            setComponentCallbackRef(Cb.REM, Helpers.getLambdaArgType(remove, 0), (inst, comp, ref, srv) -> remove.accept((T) inst, ref, comp));
+        return (B) this;
+    }
+
     public B add(InstanceCbServiceComponentRef<S> add) {
         return callbacks(add, null, null);
     }
@@ -424,12 +511,42 @@ public class ServiceCallbacksBuilderImpl
         return (B) this;
     }
 
+    public B add(InstanceCbRefComponent<S> add) {
+        return callbacks(add, null, null);
+    }
+
+    public B change(InstanceCbRefComponent<S> change) {
+        return callbacks(null, change, null);
+    }
+
+    public B remove(InstanceCbRefComponent<S> remove) {
+        return callbacks(null, null, remove);
+    }
+
+    public B callbacks(InstanceCbRefComponent<S> add, InstanceCbRefComponent<S> change, InstanceCbRefComponent<S> remove) {
+        if (add != null)
+            setInstanceCallbackRef(Cb.ADD, (inst, comp, ref, srv) -> add.accept(ref, comp));
+        if (change != null)
+            setInstanceCallbackRef(Cb.CHG, (inst, comp, ref, srv) -> change.accept(ref, comp));
+        if (remove != null)
+            setInstanceCallbackRef(Cb.REM, (inst, comp, ref, srv) -> remove.accept(ref, comp));
+        m_dereferenceServiceInternally = false;
+        return (B) this;
+    }
+
     public <T> B swap(CbServiceService<T, S> swap) {
         Class<T> type = Helpers.getLambdaArgType(swap, 0);
         return setComponentSwapCallbackRef(type, (inst, component, oref, oserv, nref, nserv) ->
             swap.accept((T) inst, oserv, nserv));                              
     }
 
+    public <T> B swap(CbRefRef<T, S> swap) {
+        Class<T> type = Helpers.getLambdaArgType(swap, 0);
+        m_dereferenceServiceInternally = false;
+        return setComponentSwapCallbackRef(type, (inst, component, oref, oserv, nref, nserv) ->
+            swap.accept((T) inst, oref, nref));                              
+    }
+
     @Override
     public <T> B swap(CbServiceServiceComponent<T, S> swap) {
         Class<T> type = Helpers.getLambdaArgType(swap, 0);
@@ -437,6 +554,14 @@ public class ServiceCallbacksBuilderImpl
             swap.accept((T) inst, oserv, nserv, component));                              
     }
 
+    @Override
+    public <T> B swap(CbRefRefComponent<T, S> swap) {
+        Class<T> type = Helpers.getLambdaArgType(swap, 0);
+        m_dereferenceServiceInternally = false;
+        return setComponentSwapCallbackRef(type, (inst, component, oref, oserv, nref, nserv) ->
+            swap.accept((T) inst, oref, nref, component));                              
+    }
+
     public <T> B swap(CbRefServiceRefService<T, S> swap) {
         Class<T> type = Helpers.getLambdaArgType(swap, 0);
         return setComponentSwapCallbackRef(type, (inst, component, oref, oserv, nref, nserv) ->
@@ -453,10 +578,20 @@ public class ServiceCallbacksBuilderImpl
         return setInstanceSwapCallbackRef((inst, component, oref, oserv, nref, nserv) -> swap.accept(oserv, nserv));
     }
 
+    public B swap(InstanceCbRefRef<S> swap) {
+        m_dereferenceServiceInternally = false;
+        return setInstanceSwapCallbackRef((inst, component, oref, oserv, nref, nserv) -> swap.accept(oref, nref));
+    }
+
     public B swap(InstanceCbServiceServiceComponent<S> swap) {
         return setInstanceSwapCallbackRef((inst, component, oref, oserv, nref, nserv) -> swap.accept(oserv, nserv, component));
     }
 
+    public B swap(InstanceCbRefRefComponent<S> swap) {
+        m_dereferenceServiceInternally = false;
+        return setInstanceSwapCallbackRef((inst, component, oref, oserv, nref, nserv) -> swap.accept(oref, nref, component));
+    }
+
     public B swap(InstanceCbRefServiceRefService<S> swap) {
         return setInstanceSwapCallbackRef((inst, component, oref, oserv, nref, nserv) -> swap.accept(oref, oserv, nref, nserv));
     }
@@ -512,27 +647,43 @@ public class ServiceCallbacksBuilderImpl
      }
     
     Object createCallbackInstance() {
-       Object cb = null;
-       
-       cb = new Object() {
-           void add(Component c, ServiceReference<S> ref, Object service) {
-               invokeMethodRefs(Cb.ADD, c, ref, (S) service);
-           }
-
-           void change(Component c, ServiceReference<S> ref, Object service) {
-               invokeMethodRefs(Cb.CHG, c, ref, (S) service);
-           }
-
-           void remove(Component c, ServiceReference<S> ref, Object service) {
-               invokeMethodRefs(Cb.REM, c, ref, (S) service);
-           }
-
-           void swap(Component c, ServiceReference<S> oldRef, Object oldSrv, ServiceReference<S> newRef, Object newSrv) {                
-               invokeSwapMethodRefs(c, oldRef, (S) oldSrv, newRef, (S) newSrv);
-           }
-       };
-
-       return cb;
+    	if (m_dereferenceServiceInternally) {
+    		return new Object() {
+    			void add(Component c, ServiceReference<S> ref, Object service) {
+    				invokeMethodRefs(Cb.ADD, c, ref, (S) service);
+    			}
+    	   
+    			void change(Component c, ServiceReference<S> ref, Object service) {
+    				invokeMethodRefs(Cb.CHG, c, ref, (S) service);
+    			}
+
+    			void remove(Component c, ServiceReference<S> ref, Object service) {
+    				invokeMethodRefs(Cb.REM, c, ref, (S) service);
+    			}
+
+    			void swap(Component c, ServiceReference<S> oldRef, Object oldSrv, ServiceReference<S> newRef, Object newSrv) {
+    				invokeSwapMethodRefs(c, oldRef, (S) oldSrv, newRef, (S) newSrv);
+    			}
+    		};
+    	} else {
+    		return new Object() {
+    			void add(Component c, ServiceReference<S> ref) {
+    				invokeMethodRefs(Cb.ADD, c, ref, null);
+    			}
+    	   
+    			void change(Component c, ServiceReference<S> ref) {
+    				invokeMethodRefs(Cb.CHG, c, ref, null);
+    			}
+
+    			void remove(Component c, ServiceReference<S> ref) {
+    				invokeMethodRefs(Cb.REM, c, ref, null);
+    			}
+
+    			void swap(Component c, ServiceReference<S> oldRef, ServiceReference<S> newRef) {
+    				invokeSwapMethodRefs(c, oldRef, null, newRef, null);
+    			}
+    		};    		
+    	}
     }
     
     boolean hasRefs() {

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/impl/ServiceDependencyBuilderImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/impl/ServiceDependencyBuilderImpl.java?rev=1781908&r1=1781907&r2=1781908&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/impl/ServiceDependencyBuilderImpl.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/impl/ServiceDependencyBuilderImpl.java Mon Feb  6 14:37:49 2017
@@ -169,6 +169,8 @@ public class ServiceDependencyBuilderImp
         } else {
             sd.setAutoConfig(m_autoConfig);
         }
+        
+        sd.setDereference(m_dereferenceServiceInternally); // false if the callback signature only contains service ref and/or component parameters.
         return sd;
     }
     

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/bnd.bnd
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/bnd.bnd?rev=1781908&r1=1781907&r2=1781908&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/bnd.bnd (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/bnd.bnd Mon Feb  6 14:37:49 2017
@@ -14,14 +14,14 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
--buildpath:  \
-	osgi.core;version=4.2,\
-	osgi.cmpn;version=4.2,\
+-buildpath: \
 	${junit},\
 	org.apache.felix.dependencymanager.annotation;version=latest,\
 	org.apache.felix.dependencymanager;version=latest,\
 	org.apache.felix.dependencymanager.runtime;version=latest,\
-	org.apache.felix.dependencymanager.itest.api;version=latest
+	org.apache.felix.dependencymanager.itest.api;version=latest,\
+	osgi.core;version=6.0,\
+	osgi.cmpn;version=6.0
 -runbundles:  \
 	org.apache.felix.configadmin;version=1.8.8,\
 	org.apache.felix.metatype;version=1.0.4,\

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/AspectAnnotation.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/AspectAnnotation.java?rev=1781908&r1=1781907&r2=1781908&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/AspectAnnotation.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/AspectAnnotation.java Mon Feb  6 14:37:49 2017
@@ -33,6 +33,7 @@ import org.osgi.framework.ServiceRegistr
 /**
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
+@SuppressWarnings("rawtypes")
 public class AspectAnnotation {
     public interface ServiceInterface {
         public void invoke(Runnable run);

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/CompositeAnnotations.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/CompositeAnnotations.java?rev=1781908&r1=1781907&r2=1781908&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/CompositeAnnotations.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/CompositeAnnotations.java Mon Feb  6 14:37:49 2017
@@ -36,6 +36,7 @@ import org.osgi.framework.ServiceRegistr
 /**
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
+@SuppressWarnings("rawtypes")
 public class CompositeAnnotations {
     public interface C1Service {
     }

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/FELIX5337.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/FELIX5337.java?rev=1781908&r1=1781907&r2=1781908&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/FELIX5337.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/FELIX5337.java Mon Feb  6 14:37:49 2017
@@ -106,7 +106,7 @@ public class FELIX5337 implements Framew
 		if (m_bctx.getBundle(0).getState() != Bundle.ACTIVE) {
 			m_bctx.addFrameworkListener(this);
 		} else {
-			frameworkEvent(new FrameworkEvent(FrameworkEvent.STARTED, m_bctx.getBundle()));
+			frameworkEvent(new FrameworkEvent(FrameworkEvent.STARTED, m_bctx.getBundle(), null));
 		}
 	}
 

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/Felix4050.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/Felix4050.java?rev=1781908&r1=1781907&r2=1781908&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/Felix4050.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/Felix4050.java Mon Feb  6 14:37:49 2017
@@ -18,9 +18,10 @@
 */
 package org.apache.felix.dm.runtime.itest.components;
 
+import java.util.Dictionary;
 import java.util.HashMap;
+import java.util.Hashtable;
 import java.util.Map;
-import java.util.Properties;
 
 import org.apache.felix.dm.annotation.api.Component;
 import org.apache.felix.dm.annotation.api.Destroy;
@@ -71,7 +72,7 @@ public class Felix4050 {
                     } catch (InterruptedException e) {
                     }
                     System.out.println("Registering B2");
-                    Properties props = new Properties();
+                    Dictionary<String, Object> props = new Hashtable<>();
                     props.put("type", "b2");
                     _ctx.registerService(B.class.getName(), B2.this, props);
 

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/Felix4357.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/Felix4357.java?rev=1781908&r1=1781907&r2=1781908&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/Felix4357.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/Felix4357.java Mon Feb  6 14:37:49 2017
@@ -65,13 +65,14 @@ import org.osgi.framework.ServiceRegistr
 @Property(name="v28", value="65", type=Character.class)
 @Property(name="v29", charValue=65)
 @Property(name="v30", charValue={65, 66})
+@SuppressWarnings("rawtypes")
 public class Felix4357 {
     public final static String ENSURE = "Felix4357";
     
     @ServiceDependency(filter = "(name=" + ENSURE + ")")
     volatile Ensure m_ensure;
     
-    @Registered
+	@Registered
     void registered(ServiceRegistration sr) {
         ServiceReference ref = sr.getReference();
         assertEquals(m_ensure, ref, "v1", "s", 1);

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/Felix5236.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/Felix5236.java?rev=1781908&r1=1781907&r2=1781908&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/Felix5236.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/Felix5236.java Mon Feb  6 14:37:49 2017
@@ -33,6 +33,7 @@ import org.osgi.framework.ServiceRegistr
  */
 @Component(provides=Felix5236.class)
 @Property(name="v1", value="s")
+@SuppressWarnings("rawtypes")
 public class Felix5236 {
     public final static String ENSURE = "Felix5236";
     

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/MethodSignatures.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/MethodSignatures.java?rev=1781908&r1=1781907&r2=1781908&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/MethodSignatures.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/MethodSignatures.java Mon Feb  6 14:37:49 2017
@@ -38,6 +38,7 @@ import org.osgi.service.cm.Configuration
 /**
  * Tests various bind method signatures
  */
+@SuppressWarnings("rawtypes")
 public class MethodSignatures {
 	// For Consumer service
     public final static String ENSURE_SERVICE_DEPENDENCY = "MethodSignatures1";

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/OptionalConfiguration.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/OptionalConfiguration.java?rev=1781908&r1=1781907&r2=1781908&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/OptionalConfiguration.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/OptionalConfiguration.java Mon Feb  6 14:37:49 2017
@@ -19,11 +19,11 @@
 package org.apache.felix.dm.runtime.itest.components;
 
 import java.io.IOException;
-import java.util.Properties;
+import java.util.Dictionary;
+import java.util.Hashtable;
 
 import org.apache.felix.dm.annotation.api.Component;
 import org.apache.felix.dm.annotation.api.ConfigurationDependency;
-import org.apache.felix.dm.annotation.api.Init;
 import org.apache.felix.dm.annotation.api.ServiceDependency;
 import org.apache.felix.dm.annotation.api.Start;
 import org.apache.felix.dm.annotation.api.Stop;
@@ -99,7 +99,7 @@ public class OptionalConfiguration {
 	        try {
 	        	Assert.assertNotNull(m_ca);
 	            m_conf = m_ca.getConfiguration(PID, null);
-	            Properties props = new Properties();
+	            Dictionary<String, Object> props = new Hashtable<>();
 	            props.put("testkey", "testvalue");
 	            m_conf.update(props);
 	        }

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/ResourceAdapterServiceTestWithPublisher.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/ResourceAdapterServiceTestWithPublisher.java?rev=1781908&r1=1781907&r2=1781908&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/ResourceAdapterServiceTestWithPublisher.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/ResourceAdapterServiceTestWithPublisher.java Mon Feb  6 14:37:49 2017
@@ -40,6 +40,7 @@ import org.apache.felix.dm.itest.util.En
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Filter;
 import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
 
 /**
  * Test a ResourceAdapterService which provides its interface using a @ServiceLifecycle.
@@ -119,7 +120,7 @@ public class ResourceAdapterServiceTestW
                 m_handlers.put(handler, filter);
             }
             for (int i = 0; i < m_resources.length; i++) {
-                if (filter == null || filter.match(ResourceUtil.createProperties(m_resources[i]))) {
+                if (filter == null || filter.match((ServiceReference)ResourceUtil.createProperties(m_resources[i]))) {
                     handler.added(m_resources[i]);
                 }
             }
@@ -139,7 +140,7 @@ public class ResourceAdapterServiceTestW
 
         private void removeResources(ResourceHandler handler, Filter filter) {
             for (int i = 0; i < m_resources.length; i++) {
-                if (filter == null || filter.match(ResourceUtil.createProperties(m_resources[i]))) {
+                if (filter == null || filter.match((ServiceReference<?>)ResourceUtil.createProperties(m_resources[i]))) {
                     handler.removed(m_resources[i]);
                 }
             }

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/ResourceAnnotation.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/ResourceAnnotation.java?rev=1781908&r1=1781907&r2=1781908&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/ResourceAnnotation.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/ResourceAnnotation.java Mon Feb  6 14:37:49 2017
@@ -19,12 +19,11 @@
 package org.apache.felix.dm.runtime.itest.components;
 
 import java.net.URL;
+import java.util.Dictionary;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Map.Entry;
 
-import org.junit.Assert;
-
 import org.apache.felix.dm.DependencyManager;
 import org.apache.felix.dm.ResourceHandler;
 import org.apache.felix.dm.ResourceUtil;
@@ -39,6 +38,7 @@ import org.apache.felix.dm.annotation.ap
 import org.apache.felix.dm.annotation.api.Start;
 import org.apache.felix.dm.annotation.api.Stop;
 import org.apache.felix.dm.itest.util.Ensure;
+import org.junit.Assert;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Filter;
 import org.osgi.framework.InvalidSyntaxException;
@@ -165,7 +165,7 @@ public class ResourceAnnotation {
                 m_handlers.put(handler, filter);
             }
             for (int i = 0; i < m_resources.length; i++) {
-                if (filter == null || filter.match(ResourceUtil.createProperties(m_resources[i]))) {
+                if (filter == null || filter.match((Dictionary<String, ?>) ResourceUtil.createProperties(m_resources[i]))) {
                     System.out.println("ResourceProvider: calling handled.added(" + m_resources[i] + ")");
                     handler.added(m_resources[i], null);
                 }
@@ -186,9 +186,10 @@ public class ResourceAnnotation {
             removeResources(handler, filter);
         }
 
-        private void removeResources(ResourceHandler handler, Filter filter) {
+        @SuppressWarnings("unchecked")
+		private void removeResources(ResourceHandler handler, Filter filter) {
             for (int i = 0; i < m_resources.length; i++) {
-                if (filter == null || filter.match(ResourceUtil.createProperties(m_resources[i]))) {
+                if (filter == null || filter.match((Dictionary<String, ?>) ResourceUtil.createProperties(m_resources[i]))) {
                     handler.removed(m_resources[i], null);
                 }
             }

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/SimpleAnnotations.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/SimpleAnnotations.java?rev=1781908&r1=1781907&r2=1781908&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/SimpleAnnotations.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/SimpleAnnotations.java Mon Feb  6 14:37:49 2017
@@ -37,6 +37,7 @@ import org.osgi.service.log.LogService;
 /**
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
+@SuppressWarnings("rawtypes")
 public class SimpleAnnotations {
     /**
      * Provides a <code>Runnable</code> service, which is required by the

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/Utils.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/Utils.java?rev=1781908&r1=1781907&r2=1781908&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/Utils.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/Utils.java Mon Feb  6 14:37:49 2017
@@ -25,6 +25,7 @@ import org.osgi.framework.ServiceReferen
 /**
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
+@SuppressWarnings("rawtypes")
 public class Utils {
     public static final String DM_BSN = "org.apache.felix.dependencymanager"; 
 



Mime
View raw message