Applied feedbacks that Jan Willem sent to me about the new dm-lambda library:
- renamed the DependencyManagerActivator.activate() method to init(BundleContext ctx, DependencyManager dm)
- Removed abbreviated names like "cb()" or "cbi" methods, and replaced them with niced method names like "add()/changed()/removed()" ...
- Added a system property "org.apache.felix.dependencymanager.lambda.dependencymode" that allows to control the default
mode of dependency (still to be discussed).
- added full support or new configuration types.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1731147 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AbstractServiceDependencyTest.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AbstractServiceDependencyTest.java
index daa1e22..92ecfd6 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AbstractServiceDependencyTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AbstractServiceDependencyTest.java
@@ -37,7 +37,7 @@
Component sp =
component(m).provides(ServiceAbstract.class).impl(new ServiceProvider(e)).build();
Component sc =
- component(m).impl(new ServiceConsumer(e)).withSrv(ServiceAbstract.class, srv -> srv.cb(ServiceConsumer::bind, ServiceConsumer::unbind)).build();
+ component(m).impl(new ServiceConsumer(e)).withSvc(ServiceAbstract.class, srv -> srv.add(ServiceConsumer::bind).remove(ServiceConsumer::unbind)).build();
m.add(sp);
m.add(sc);
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterAndConsumerTest.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterAndConsumerTest.java
index eea9782..54c9d58 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterAndConsumerTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterAndConsumerTest.java
@@ -35,7 +35,7 @@
Ensure e = new Ensure();
Component provider = component(m).provides(OriginalService.class).impl(new ServiceProvider(e)).build();
- Component consumer = component(m).impl(new ServiceConsumer(e)).withSrv(AdaptedService.class).build();
+ Component consumer = component(m).impl(new ServiceConsumer(e)).withSvc(AdaptedService.class).build();
Component adapter = adapter(m, OriginalService.class).provides(AdaptedService.class).impl(ServiceAdapter.class).build();
// add the provider and the adapter
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterNoAutoConfigIfInstanceCallbackIsUsed.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterNoAutoConfigIfInstanceCallbackIsUsed.java
index 32d30df..95c3297 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterNoAutoConfigIfInstanceCallbackIsUsed.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterNoAutoConfigIfInstanceCallbackIsUsed.java
@@ -40,7 +40,7 @@
// Declare S1 adapter
S1AdapterCallback s1AdapterCB = new S1AdapterCallback();
- adapter(m, S1.class, a -> a.impl(S1Adapter.class).cbi(s1AdapterCB, "set"));
+ adapter(m, S1.class, a -> a.impl(S1Adapter.class).callbackInstance(s1AdapterCB).add("set"));
// At this point, the s1AdapterCB.set(S1 s1) method should be called, and s1Adapter.start() method should then be called.
// but s1 should not be injected on s1Adapter class fields.
@@ -58,7 +58,7 @@
// Declare S1 adapter
S1AdapterCallback s1AdapterCB = new S1AdapterCallback();
- adapter(m, S1.class, a -> a.impl(S1Adapter.class).cbi(s1AdapterCB::set));
+ adapter(m, S1.class, a -> a.impl(S1Adapter.class).add(s1AdapterCB::set));
// At this point, the s1AdapterCB.set(S1 s1) method should be called, and s1Adapter.start() method should then be called.
// but s1 should not be injected on s1Adapter class fields.
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithCallbackInstanceTest.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithCallbackInstanceTest.java
index f6bcbe2..fa622b6 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithCallbackInstanceTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithCallbackInstanceTest.java
@@ -41,13 +41,13 @@
ServiceProvider serviceProvider = new ServiceProvider(e);
Component provider = component(m).provides(OriginalService.class).impl(serviceProvider).build();
- Component consumer = component(m).impl(new ServiceConsumer(e)).withSrv(AdaptedService.class).build();
+ Component consumer = component(m).impl(new ServiceConsumer(e)).withSvc(AdaptedService.class).build();
ServiceAdapterCallbackInstance callbackInstance = new ServiceAdapterCallbackInstance(e);
Component adapter = adapter(m, OriginalService.class)
.provides(AdaptedService.class).impl(new ServiceAdapter(e)).propagate(true)
.autoConfig("m_originalService")
- .cbi(callbackInstance, "set", "changed", "unset")
+ .callbackInstance(callbackInstance).add("set").change("changed").remove("unset")
.build();
// add the provider and the adapter
@@ -82,14 +82,14 @@
ServiceProvider serviceProvider = new ServiceProvider(e);
Component provider = component(m).provides(OriginalService.class).impl(serviceProvider).build();
- Component consumer = component(m).impl(new ServiceConsumer(e)).withSrv(AdaptedService.class).build();
+ Component consumer = component(m).impl(new ServiceConsumer(e)).withSvc(AdaptedService.class).build();
ServiceAdapterCallbackInstance callbackInstance = new ServiceAdapterCallbackInstance(e);
Component adapter = adapter(m, OriginalService.class, adp -> adp
.provides(AdaptedService.class).impl(new ServiceAdapter(e))
.autoAdd(false).propagate(true)
.autoConfig("m_originalService")
- .cbi(callbackInstance::set, callbackInstance::changed, callbackInstance::unset));
+ .add(callbackInstance::set).change(callbackInstance::changed).remove(callbackInstance::unset));
// add the provider and the adapter
m.add(provider);
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithExtraDependenciesTest.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithExtraDependenciesTest.java
index c514b2d..a62878b 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithExtraDependenciesTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithExtraDependenciesTest.java
@@ -36,7 +36,7 @@
Ensure e = new Ensure();
// create a service adapter that adapts to services S1 and has an optional dependency on services S2
- Component sa = adapter(m, S1.class).impl(SA.class).withSrv(S2.class, s2 -> s2.cb("add", "remove")).build();
+ Component sa = adapter(m, S1.class).impl(SA.class).withSvc(S2.class, s2 -> s2.add("add").remove("remove")).build();
m.add(sa);
// create a service S1, which triggers the creation of the first adapter instance (A1)
@@ -71,7 +71,7 @@
Ensure e = new Ensure();
// create a service adapter that adapts to services S1 and has an optional dependency on services S2
- Component sa = adapter(m, S1.class).impl(SA.class).withSrv(S2.class, s2 -> s2.cb(SA::add, SA::remove)).build();
+ Component sa = adapter(m, S1.class).impl(SA.class).withSvc(S2.class, s2 -> s2.add(SA::add).remove(SA::remove)).build();
m.add(sa);
// create a service S1, which triggers the creation of the first adapter instance (A1)
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithInstanceBoundDependencyTest.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithInstanceBoundDependencyTest.java
index 4d436fb..1008dbb 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithInstanceBoundDependencyTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithInstanceBoundDependencyTest.java
@@ -38,7 +38,7 @@
Component sp = component(m).provides(ServiceInterface.class).impl(new ServiceProvider(e)).build();
Component sp2 = component(m).provides(ServiceInterface2.class).impl(new ServiceProvider2(e)).build();
- Component sc = component(m).impl(new ServiceConsumer(e)).autoAdd(false).withSrv(ServiceInterface3.class).build();
+ Component sc = component(m).impl(new ServiceConsumer(e)).autoAdd(false).withSvc(ServiceInterface3.class).build();
Component sa = adapter(m, ServiceInterface.class).provides(ServiceInterface3.class).impl(new ServiceAdapter(e)).build();
m.add(sc);
m.add(sp);
@@ -107,7 +107,7 @@
}
public void init() {
m_ensure.step(1);
- component(m_component, c->c.withSrv(ServiceInterface2.class));
+ component(m_component, c->c.withSvc(ServiceInterface2.class));
}
public void start() {
m_ensure.step(2);
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithModifiedInstanceBoundDependencyTest.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithModifiedInstanceBoundDependencyTest.java
index 93fe8b6..10e2f08 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithModifiedInstanceBoundDependencyTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithModifiedInstanceBoundDependencyTest.java
@@ -74,7 +74,7 @@
void init(Component comp) {
m_e.step(2);
- component(comp, c->c.withSrv(C.class, s->s.cb("addC", "removeC")));
+ component(comp, c->c.withSvc(C.class, s->s.add("addC").remove("removeC")));
}
void addA(A a, Map<String, Object> properties) {
@@ -116,8 +116,8 @@
Ensure e = new Ensure();
Component a = component(m).impl(new AImpl(e)).provides(A.class).properties(foo -> "bar").build();
- Component b = adapter(m, A.class).provides(B.class).impl(new BImpl(e)).cb("addA", "changeA", "removeA").build();
- Component c = component(m).impl(new CImpl()).provides(C.class).withSrv(A.class, "(foo=bar)").build();
+ Component b = adapter(m, A.class).provides(B.class).impl(new BImpl(e)).add("addA").change("changeA").remove("removeA").build();
+ Component c = component(m).impl(new CImpl()).provides(C.class).withSvc(A.class, "(foo=bar)").build();
m.add(a);
m.add(c);
@@ -144,8 +144,8 @@
Ensure e = new Ensure();
Component a = component(m).impl(new AImpl(e)).provides(A.class).properties(foo -> "bar").build();
- Component b = adapter(m, A.class).impl(new BImpl(e)).provides(B.class).cb(BImpl::addA, BImpl::changeA, BImpl::removeA).build();
- Component c = component(m).impl(new CImpl()).provides(C.class).withSrv(A.class, s -> s.filter("(foo=bar)")).build();
+ Component b = adapter(m, A.class).impl(new BImpl(e)).provides(B.class).add(BImpl::addA).change(BImpl::changeA).remove(BImpl::removeA).build();
+ Component c = component(m).impl(new CImpl()).provides(C.class).withSvc(A.class, s -> s.filter("(foo=bar)")).build();
m.add(a);
m.add(c);
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithPropagationTest.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithPropagationTest.java
index e56bd44..4e57806 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithPropagationTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithPropagationTest.java
@@ -102,8 +102,8 @@
Ensure e = new Ensure();
Component s1 = component(m).impl(new S1Impl(e)).provides(S1.class).properties(p1 -> "v1", p2 -> "v2overriden").build();
- Component s1Adapter = adapter(m, S1.class).cb("add", "change", null).impl(new S1Adapter(e)).provides(S2.class).properties(p2 -> "v2").build();
- Component s3 = component(m).impl(new S3(e)).withSrv(S2.class, s -> s.cb("add", "change", null)).build();
+ Component s1Adapter = adapter(m, S1.class).add("add").change("change").impl(new S1Adapter(e)).provides(S2.class).properties(p2 -> "v2").build();
+ Component s3 = component(m).impl(new S3(e)).withSvc(S2.class, s -> s.add("add").change("change")).build();
m.add(s1);
m.add(s1Adapter);
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithoutPropagationTest.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithoutPropagationTest.java
index 41c4ad9..1170c38 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithoutPropagationTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AdapterWithoutPropagationTest.java
@@ -45,11 +45,11 @@
// The Adapter will see the "foo=bar" property from the adaptee
Component adapter = adapter(m, OriginalService.class)
- .propagate(false).cb("set", "change", null).provides(AdaptedService.class).impl(new ServiceAdapter(e)).build();
+ .propagate(false).add("set").change("change").provides(AdaptedService.class).impl(new ServiceAdapter(e)).build();
// The consumer depends on the AdaptedService, but won't see foo=bar property from the adaptee
Component consumer = component(m)
- .impl(new ServiceConsumer(e)).withSrv(AdaptedService.class, b -> b.cb("set", "change", null)).build();
+ .impl(new ServiceConsumer(e)).withSvc(AdaptedService.class, b -> b.add("set").change("change")).build();
// add the provider and the adapter
m.add(provider);
@@ -80,11 +80,11 @@
// The Adapter will see the "foo=bar" property from the adaptee
ServiceAdapter saimpl = new ServiceAdapter(e);
- Component adapter = adapter(m, OriginalService.class).propagate(false).impl(saimpl).provides(AdaptedService.class).cbi(saimpl::set, saimpl::change, null).build();
+ Component adapter = adapter(m, OriginalService.class).propagate(false).impl(saimpl).provides(AdaptedService.class).add(saimpl::set).change(saimpl::change).build();
// The consumer depends on the AdaptedService, but won't see foo=bar property from the adaptee
ServiceConsumer scimpl = new ServiceConsumer(e);
- Component consumer = component(m).impl(scimpl).withSrv(AdaptedService.class, s -> s.cbi(scimpl::set, scimpl::change, null)).build();
+ Component consumer = component(m).impl(scimpl).withSvc(AdaptedService.class, s -> s.add(scimpl::set).change(scimpl::change)).build();
// add the provider and the adapter
m.add(provider);
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectBaseTest.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectBaseTest.java
index e207545..d652eb7 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectBaseTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectBaseTest.java
@@ -45,7 +45,7 @@
ServiceConsumer c = new ServiceConsumer(e);
Component sp = component(m).impl(p).provides(ServiceInterface.class).properties(name -> "a").build();
- Component sc = component(m).impl(c).withSrv(ServiceInterface.class, srv -> srv.cb("add", "remove").autoConfig("m_service")).build();
+ Component sc = component(m).impl(c).withSvc(ServiceInterface.class, srv -> srv.add("add").remove("remove").autoConfig("m_service")).build();
Component sa = aspect(m, ServiceInterface.class).rank(20).impl(ServiceAspect.class).build();
m.add(sc);
@@ -81,7 +81,7 @@
Component sp = component(m).impl(p).provides(ServiceInterface.class).properties(name -> "a").build();
Component sc = component(m)
- .impl(c).withSrv(ServiceInterface.class, srv -> srv.cbi(c::add, c::remove).autoConfig("m_service")).build();
+ .impl(c).withSvc(ServiceInterface.class, srv -> srv.add(c::addRef).remove(c::removeRef).autoConfig("m_service")).build();
Component sa = aspect(m, ServiceInterface.class).rank(20).impl(ServiceAspect.class).build();
m.add(sc);
@@ -116,7 +116,7 @@
ServiceProvider p = new ServiceProvider(e, "a");
ServiceConsumer c = new ServiceConsumer(e);
Component sp = component(m).impl(p).provides(ServiceInterface.class).properties(name -> "a").build();
- Component sc = component(m).impl(c).withSrv(ServiceInterface.class, srv -> srv.cb("add", "remove").autoConfig("m_service")).build();
+ Component sc = component(m).impl(c).withSvc(ServiceInterface.class, srv -> srv.add("add").remove("remove").autoConfig("m_service")).build();
Component sa = aspect(m, ServiceInterface.class).rank(20).impl(ServiceAspect.class).build();
// we first add the aspect
@@ -158,7 +158,7 @@
ServiceConsumer c = new ServiceConsumer(e);
Component sp = component(m).impl(p).provides(ServiceInterface.class).properties(name -> "a").build();
- Component sc = component(m).impl(c).withSrv(ServiceInterface.class, srv -> srv.cbi(c::add, c::remove).autoConfig("m_service")).build();
+ Component sc = component(m).impl(c).withSvc(ServiceInterface.class, srv -> srv.add(c::addRef).remove(c::removeRef).autoConfig("m_service")).build();
Component sa = aspect(m, ServiceInterface.class).rank(20).impl(ServiceAspect.class).build();
// we first add the aspect
@@ -199,7 +199,7 @@
ServiceConsumer c = new ServiceConsumer(e);
Component sp = component(m).impl(new ServiceProvider(e, "a")).provides(ServiceInterface.class).properties(name -> "a").build();
Component sp2 = component(m).impl(new ServiceProvider(e, "b")).provides(ServiceInterface.class).properties(name -> "b").build();
- Component sc = component(m).impl(c).withSrv(ServiceInterface.class, srv -> srv.cb("add", "remove")).build();
+ Component sc = component(m).impl(c).withSvc(ServiceInterface.class, srv -> srv.add("add").remove("remove")).build();
Component sa = aspect(m, ServiceInterface.class).rank(20).impl(ServiceAspect.class).build();
Component sa2 = aspect(m, ServiceInterface.class).rank(10).impl(ServiceAspect.class).build();
@@ -241,7 +241,7 @@
ServiceConsumer c = new ServiceConsumer(e);
Component sp = component(m).impl(new ServiceProvider(e, "a")).provides(ServiceInterface.class).properties(name -> "a").build();
Component sp2 = component(m).impl(new ServiceProvider(e, "b")).provides(ServiceInterface.class).properties(name -> "b").build();
- Component sc = component(m).impl(c).withSrv(ServiceInterface.class, srv -> srv.cbi(c::add, c::remove)).build();
+ Component sc = component(m).impl(c).withSvc(ServiceInterface.class, srv -> srv.add(c::addRef).remove(c::removeRef)).build();
Component sa = aspect(m, ServiceInterface.class).rank(20).impl(ServiceAspect.class).build();
Component sa2 = aspect(m, ServiceInterface.class).rank(10).impl(ServiceAspect.class).build();
@@ -310,13 +310,21 @@
m_ensure = e;
}
- public void add(ServiceReference<ServiceInterface> ref, ServiceInterface si) {
+ public void addRef(ServiceInterface si, ServiceReference<ServiceInterface> ref) { // method ref callback
+ add(ref, si);
+ }
+
+ public void add(ServiceReference<ServiceInterface> ref, ServiceInterface si) { // reflection callback
System.out.println("add: " + ServiceUtil.toString(ref));
m_services.add(si);
m_ensure.step();
}
- public void remove(ServiceReference<ServiceInterface> ref, ServiceInterface si) {
+ public void removeRef(ServiceInterface si, ServiceReference<ServiceInterface> ref) { // method ref callback
+ remove(ref, si);
+ }
+
+ public void remove(ServiceReference<ServiceInterface> ref, ServiceInterface si) { // reflection callback
System.out.println("rem: " + ServiceUtil.toString(ref));
m_services.remove(si);
m_ensure.step();
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectChainTest.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectChainTest.java
index 81bfa7e..6e16f25 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectChainTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectChainTest.java
@@ -35,7 +35,7 @@
Ensure e = new Ensure();
// create a service provider and consumer
Component sp = component(m).impl(new ServiceProvider(e)).provides(ServiceInterface.class).build();
- Component sc = component(m).impl(new ServiceConsumer(e)).withSrv(ServiceInterface.class).build();
+ Component sc = component(m).impl(new ServiceConsumer(e)).withSvc(ServiceInterface.class).build();
Component sa2 = aspect(m, ServiceInterface.class).rank(20).impl(new ServiceAspect(e, 3)).build();
Component sa3 = aspect(m, ServiceInterface.class).rank(30).impl(new ServiceAspect(e, 2)).build();
Component sa1 = aspect(m, ServiceInterface.class).rank(10).impl(new ServiceAspect(e, 4)).build();
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectDynamicsTest.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectDynamicsTest.java
index b89ef9a..b9812dd 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectDynamicsTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectDynamicsTest.java
@@ -37,7 +37,7 @@
// create a service provider and consumer
Component provider = component(m).impl(new ServiceProvider(e)).provides(ServiceInterface.class).build();
Component provider2 = component(m).impl(new ServiceProvider2(e)).provides(ServiceInterface2.class.getName()).build();
- Component consumer = component(m).impl(new ServiceConsumer(e)).withSrv(ServiceInterface.class, s->s.cb("add", null, null, "swap")).build();
+ Component consumer = component(m).impl(new ServiceConsumer(e)).withSvc(ServiceInterface.class, s->s.add("add").swap("swap")).build();
Component aspect = aspect(m, ServiceInterface.class).autoAdd(false).rank(1).impl(new ServiceAspect(e, aspectStopEnsure)).build();
m.add(consumer);
@@ -94,7 +94,7 @@
// create a service provider and consumer
Component provider = component(m).impl(new ServiceProvider(e)).provides(ServiceInterface.class.getName()).build();
Component provider2 = component(m).impl(new ServiceProvider2(e)).provides(ServiceInterface2.class.getName()).build();
- Component consumer = component(m).impl(new ServiceConsumer(e)).withSrv(ServiceInterface.class, s->s.cb(ServiceConsumer::add).sw(ServiceConsumer::swap)).build();
+ Component consumer = component(m).impl(new ServiceConsumer(e)).withSvc(ServiceInterface.class, s->s.add(ServiceConsumer::add).swap(ServiceConsumer::swap)).build();
Component aspect = aspect(m, ServiceInterface.class).autoAdd(false).rank(1).impl(new ServiceAspect(e, aspectStopEnsure)).build();
m.add(consumer);
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectServiceDependencyTest.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectServiceDependencyTest.java
index 145cc8c..c555d79 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectServiceDependencyTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectServiceDependencyTest.java
@@ -35,7 +35,7 @@
Ensure e = new Ensure();
// create a service provider and consumer
Component sp = component(m).impl(new ServiceProvider(e)).provides(ServiceInterface.class.getName()).build();
- Component sc = component(m).impl(new ServiceConsumer(e)).withSrv(ServiceInterface.class, s->s.cb("add", "remove")).build();
+ Component sc = component(m).impl(new ServiceConsumer(e)).withSvc(ServiceInterface.class, s->s.add("add").remove("remove")).build();
Component asp = aspect(m, ServiceInterface.class).rank(100).impl(ServiceProviderAspect.class).build();
m.add(sp);
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectServiceDependencyWithSwapCallbackTest.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectServiceDependencyWithSwapCallbackTest.java
index 6140f8e..89d0113 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectServiceDependencyWithSwapCallbackTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectServiceDependencyWithSwapCallbackTest.java
@@ -35,7 +35,7 @@
Ensure e = new Ensure();
// create a service provider and consumer
Component sp = component(m).impl(new ServiceProvider(e)).provides(ServiceInterface.class).build();
- Component sc = component(m).impl(new ServiceConsumer(e)).withSrv(ServiceInterface.class, s->s.cb("add", null, "remove", "swap")).build();
+ Component sc = component(m).impl(new ServiceConsumer(e)).withSvc(ServiceInterface.class, s->s.add("add").remove("remove").swap("swap")).build();
Component asp = aspect(m, ServiceInterface.class).rank(100).impl(ServiceProviderAspect.class).build();
m.add(sp);
m.add(sc);
@@ -55,7 +55,7 @@
// create a service provider and consumer
ServiceConsumer scimpl = new ServiceConsumer(e);
Component sp = component(m).impl(new ServiceProvider(e)).provides(ServiceInterface.class).build();
- Component sc = component(m).impl(scimpl).withSrv(ServiceInterface.class, s->s.cbi(scimpl::add, scimpl::remove).swi(scimpl::swap)).build();
+ Component sc = component(m).impl(scimpl).withSvc(ServiceInterface.class, s->s.add(scimpl::add).remove(scimpl::remove).swap(scimpl::swap)).build();
Component asp = aspect(m, ServiceInterface.class).rank(100).impl(ServiceProviderAspect.class).build();
m.add(sp);
m.add(sc);
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectWhiteboardTest.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectWhiteboardTest.java
index ae45b3c..8271808 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectWhiteboardTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectWhiteboardTest.java
@@ -43,7 +43,7 @@
Component sp1 = component(m).impl(new ServiceProvider(e)).provides(ServiceInterface.class.getName()).build();
Component sp2 = component(m).impl(new ServiceProvider(e)).provides(ServiceInterface.class.getName()).build();
ServiceConsumer sci = new ServiceConsumer(e);
- Component sc = component(m).impl(sci).withSrv(ServiceInterface.class, srv->srv.required(false).cb("add", "remove")).build();
+ Component sc = component(m).impl(sci).withSvc(ServiceInterface.class, srv->srv.required(false).add("add").remove("remove")).build();
Component sa2 = aspect(m, ServiceInterface.class).rank(20).autoAdd(false).impl(new ServiceAspect(e, 3)).build();
Component sa1 = aspect(m, ServiceInterface.class).rank(10).autoAdd(false).impl(new ServiceAspect(e, 4)).build();
@@ -120,9 +120,9 @@
Component sp1 = component(m).impl(new ServiceProvider(e)).provides(ServiceInterface.class.getName()).build();
Component sp2 = component(m).impl(new ServiceProvider(e)).provides(ServiceInterface.class.getName()).build();
ServiceConsumer sci = new ServiceConsumer(e);
- Component sc = component(m).impl(sci).withSrv(ServiceInterface.class, srv->srv.required(false).cbi(sci::add, sci::remove)).build();
- Component sa2 = aspect(m, ServiceInterface.class).rank(20).autoAdd(false).impl(new ServiceAspect(e, 3)).build();
- Component sa1 = aspect(m, ServiceInterface.class).rank(10).autoAdd(false).impl(new ServiceAspect(e, 4)).build();
+ Component sc = component(m).impl(sci).withSvc(ServiceInterface.class, srv->srv.optional().add(sci::addRef).remove(sci::removeRef)).build();
+ Component sa2 = aspect(m, ServiceInterface.class).rank(20).impl(new ServiceAspect(e, 3)).build();
+ Component sa1 = aspect(m, ServiceInterface.class).rank(10).impl(new ServiceAspect(e, 4)).build();
// start with a service consumer
System.out.println("Adding consumer");
@@ -265,13 +265,26 @@
return ranking;
}
+ // method ref callback
+ public void addRef(ServiceInterface svc, ServiceReference ref) {
+ add(ref, svc);
+ }
+
+ // refection callback
public void add(ServiceReference ref, ServiceInterface svc) {
System.out.println("Added: " + ServiceUtil.toString(ref));
m_services.add(ref);
}
+
+ // method ref callback
+ public void removeRef(ServiceInterface svc, ServiceReference ref) {
+ remove(ref, svc);
+ }
+
+ // refection callback
public void remove(ServiceReference ref, ServiceInterface svc) {
System.out.println("Removed: " + ServiceUtil.toString(ref));
m_services.remove(ref);
- }
+ }
}
}
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectWithCallbacksServiceDependencyTest.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectWithCallbacksServiceDependencyTest.java
index 4cffad6..06f0d35 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectWithCallbacksServiceDependencyTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectWithCallbacksServiceDependencyTest.java
@@ -35,8 +35,8 @@
Ensure e = new Ensure();
// create a service provider and consumer
Component sp = component(m).impl(new ServiceProvider(e)).provides(ServiceInterface.class.getName()).build();
- Component sc = component(m).impl(new ServiceConsumer(e)).withSrv(ServiceInterface.class, s->s.cb("add", "remove")).build();
- Component asp = aspect(m, ServiceInterface.class).rank(100).cb("add", null, "remove", "swap").impl(ServiceProviderAspect.class).build();
+ Component sc = component(m).impl(new ServiceConsumer(e)).withSvc(ServiceInterface.class, s->s.add("add").remove("remove")).build();
+ Component asp = aspect(m, ServiceInterface.class).rank(100).add("add").remove("remove").swap("swap").impl(ServiceProviderAspect.class).build();
m.add(sp);
m.add(sc);
@@ -55,10 +55,10 @@
Ensure e = new Ensure();
// create a service provider and consumer
Component sp = component(m).impl(new ServiceProvider(e)).provides(ServiceInterface.class.getName()).build();
- Component sc = component(m).impl(new ServiceConsumer(e)).withSrv(ServiceInterface.class, s->s.cb(ServiceConsumer::add, ServiceConsumer::remove)).build();
+ Component sc = component(m).impl(new ServiceConsumer(e)).withSvc(ServiceInterface.class, s->s.add(ServiceConsumer::add).remove(ServiceConsumer::remove)).build();
Component asp = aspect(m, ServiceInterface.class)
.impl(ServiceProviderAspect.class).rank(100)
- .cb(ServiceProviderAspect::add, ServiceProviderAspect::remove).sw(ServiceProviderAspect::swap)
+ .add(ServiceProviderAspect::add).remove(ServiceProviderAspect::remove).swap(ServiceProviderAspect::swap)
.build();
m.add(sp);
@@ -78,11 +78,11 @@
Ensure e = new Ensure();
// create a service provider and consumer
Component sp = component(m).impl(new ServiceProvider(e)).provides(ServiceInterface.class).build();
- Component sc = component(m).impl(new ServiceConsumer(e)).withSrv(ServiceInterface.class, s->s.cb("add", "remove")).build();
+ Component sc = component(m).impl(new ServiceConsumer(e)).withSvc(ServiceInterface.class, s->s.add("add").remove("remove")).build();
ServiceProviderAspect providerAspect = new ServiceProviderAspect();
ServiceProviderAspectCallbackInstance aspectCb = new ServiceProviderAspectCallbackInstance(providerAspect);
- Component asp = aspect(m, ServiceInterface.class).rank(100).impl(providerAspect).cbi(aspectCb::add, aspectCb::remove).swi(aspectCb::swap).build();
+ Component asp = aspect(m, ServiceInterface.class).rank(100).impl(providerAspect).add(aspectCb::add).remove(aspectCb::remove).swap(aspectCb::swap).build();
m.add(sp);
m.add(sc);
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectWithPropagationTest.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectWithPropagationTest.java
index 0a6b336..bcf8e84 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectWithPropagationTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AspectWithPropagationTest.java
@@ -99,7 +99,7 @@
}
}
};
- Component clientComp = component(m).impl(client).withSrv(S.class, srv->srv.cb("add", "change", null)).build();
+ Component clientComp = component(m).impl(client).withSvc(S.class, srv->srv.add("add").change("change")).build();
// Add components in dependency manager
m.add(sComp);
@@ -151,12 +151,12 @@
// Create an aspect aware client, depending on "S" service.
Client clientImpl;
- Component client = component(m).impl((clientImpl = new Client())).withSrv(S.class, srv -> srv.cb("add", "change", "remove", "swap")).build();
+ Component client = component(m).impl((clientImpl = new Client())).withSvc(S.class, srv -> srv.add("add").change("change").remove("remove").swap("swap")).build();
// Create some "S" aspects
Component[] aspects = new Component[ASPECTS];
for (int rank = 1; rank <= ASPECTS; rank ++) {
- aspects[rank-1] = aspect(m, S.class).rank(rank).impl(new A("A" + rank, rank)).cb("add", "change", "remove", "swap").build();
+ aspects[rank-1] = aspect(m, S.class).rank(rank).impl(new A("A" + rank, rank)).add("add").change("change").remove("remove").swap("swap").build();
props = new Hashtable();
props.put("a" + rank, "v" + rank);
aspects[rank-1].setServiceProperties(props);
@@ -261,7 +261,7 @@
// Create an aspect aware client, depending on "S" service.
Client clientImpl;
- Component client = component(m).impl((clientImpl = new Client())).withSrv(S.class, srv->srv.cb("add", "change", "remove")).build();
+ Component client = component(m).impl((clientImpl = new Client())).withSvc(S.class, srv->srv.add("add").change("change").remove("remove")).build();
// Create some "S" aspects
Component[] aspects = new Component[ASPECTS];
@@ -354,18 +354,18 @@
// Create some "S" aspects
Component[] aspects = new Component[ASPECTS];
for (int rank = 1; rank <= ASPECTS; rank ++) {
- aspects[rank-1] = aspect(m, S.class).rank(rank).impl(new A("A" + rank, rank)).cb("add", "change", "remove", "swap").build();
+ aspects[rank-1] = aspect(m, S.class).rank(rank).impl(new A("A" + rank, rank)).add("add").change("change").remove("remove").swap("swap").build();
props = new Hashtable();
props.put("a" + rank, "v" + rank);
aspects[rank-1].setServiceProperties(props);
}
// Create S2 adapter (which adapts S1 to S2 interface)
- Component adapter = adapter(m, S.class).cb("add", "change", "remove", "swap").provides(S2.class).impl(new S2Impl()).build();
+ Component adapter = adapter(m, S.class).add("add").change("change").remove("remove").swap("swap").provides(S2.class).impl(new S2Impl()).build();
// Create Client2, which depends on "S2" service.
Client2 client2Impl;
- Component client2 = component(m).impl((client2Impl = new Client2())).withSrv(S2.class, srv -> srv.cb("add", "change", null)).build();
+ Component client2 = component(m).impl((client2Impl = new Client2())).withSvc(S2.class, srv -> srv.add("add").change("change")).build();
// Register client2
m.add(client2);
@@ -451,7 +451,7 @@
// Create Client2, which depends on "S2" service.
Client2 client2Impl;
- Component client2 = component(m).impl((client2Impl = new Client2())).withSrv(S2.class, srv->srv.cb("add", "change", null)).build();
+ Component client2 = component(m).impl((client2Impl = new Client2())).withSvc(S2.class, srv->srv.add("add").change("change")).build();
// Register client2
m.add(client2);
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AutoConfigTest.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AutoConfigTest.java
index 3f9839c..36e84b1 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AutoConfigTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/AutoConfigTest.java
@@ -148,7 +148,7 @@
}
private Component createConsumer(DependencyManager dm, Object consumer) {
- return component(dm).impl(consumer).withSrv(Provider.class).build();
+ return component(dm).impl(consumer).withSvc(Provider.class).build();
}
public static interface Provider extends Runnable {
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/BundleAdapterTest.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/BundleAdapterTest.java
index f91c1ff..bfee928 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/BundleAdapterTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/BundleAdapterTest.java
@@ -66,7 +66,8 @@
Component adapter = bundleAdapter(m)
.mask(Bundle.INSTALLED | Bundle.RESOLVED | Bundle.ACTIVE)
- .cbi(cbInstance, "add", "remove")
+ .callbackInstance(cbInstance)
+ .add("add").remove("remove")
.impl(baWithCb)
.provides(BundleAdapter.class.getName())
.build();
@@ -75,7 +76,7 @@
Consumer c = new Consumer();
Component consumer = component(m)
.impl(c)
- .withSrv(BundleAdapter.class, s->s.cb("add", "remove"))
+ .withSvc(BundleAdapter.class, s->s.add("add").remove("remove"))
.build();
// add the bundle adapter
@@ -100,7 +101,7 @@
Component adapter = bundleAdapter(m)
.mask(Bundle.INSTALLED | Bundle.RESOLVED | Bundle.ACTIVE)
- .cbi(cbInstance::add, cbInstance::remove)
+ .add(cbInstance::addRef).remove(cbInstance::removeRef)
.impl(baWithCb)
.provides(BundleAdapter.class.getName())
.build();
@@ -109,7 +110,7 @@
Consumer c = new Consumer();
Component consumer = component(m)
.impl(c)
- .withSrv(BundleAdapter.class, s->s.cb("add", "remove"))
+ .withSvc(BundleAdapter.class, s->s.add("add").remove("remove"))
.build();
// add the bundle adapter
@@ -151,13 +152,21 @@
m_ba = ba;
}
- void add(Component c, Bundle b) {
+ void add(Component c, Bundle b) { // reflection callback
m_ba.add(b);
}
-
- void remove(Component c, Bundle b) {
+
+ void addRef(Bundle b, Component c) { // method reference callback
+ add(c, b);
+ }
+
+ void remove(Component c, Bundle b) { // reflection callback
m_ba.remove(b);
}
+
+ void removeRef(Bundle b, Component c) { // method reference callback
+ remove (c, b);
+ }
}
static class Consumer {
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/BundleAdapterWithCallbacksNotAutoConfiguredTest.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/BundleAdapterWithCallbacksNotAutoConfiguredTest.java
index 76b6eb8..2a55f03 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/BundleAdapterWithCallbacksNotAutoConfiguredTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/BundleAdapterWithCallbacksNotAutoConfiguredTest.java
@@ -38,7 +38,7 @@
String bsn = "org.apache.felix.dependencymanager";
String filter = "(Bundle-SymbolicName=" + bsn + ")";
- Component adapter = bundleAdapter(m).mask(Bundle.ACTIVE).filter(filter).cb("add").impl(baWithCb).build();
+ Component adapter = bundleAdapter(m).mask(Bundle.ACTIVE).filter(filter).add("add").impl(baWithCb).build();
// add the bundle adapter
m.add(adapter);
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/BundleDependencyTest.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/BundleDependencyTest.java
index b9d1937..5924d93 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/BundleDependencyTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/BundleDependencyTest.java
@@ -35,7 +35,7 @@
DependencyManager m = getDM();
// create a service provider and consumer
MyConsumer c = new MyConsumer();
- Component consumer = component(m, comp -> comp.impl(c).withBundle(bundle -> bundle.cb("add", "remove")));
+ Component consumer = component(m, comp -> comp.impl(c).withBundle(bundle -> bundle.add("add").remove("remove")));
// check if at least one bundle was found
c.check();
@@ -48,7 +48,7 @@
Ensure e = new Ensure();
String filter = "(Bundle-SymbolicName=" + BSN + ")";
Component consumerWithFilter = component(m, comp -> comp.impl(new FilteredConsumer(e))
- .withBundle(bundle-> bundle.filter(filter).cb("add", "remove")));
+ .withBundle(bundle-> bundle.filter(filter).add("add").remove("remove")));
e.step(2);
// remove the consumer again
m.remove(consumerWithFilter);
@@ -59,7 +59,7 @@
DependencyManager m = getDM();
// create a service provider and consumer
MyConsumer c = new MyConsumer();
- Component consumer = component(m, comp -> comp.impl(c).withBundle(bundle -> bundle.cb(MyConsumer::add, MyConsumer::remove)));
+ Component consumer = component(m, comp -> comp.impl(c).withBundle(bundle -> bundle.add(MyConsumer::add).remove(MyConsumer::remove)));
// check if at least one bundle was found
c.check();
@@ -72,7 +72,7 @@
Ensure e = new Ensure();
String filter = "(Bundle-SymbolicName=" + BSN + ")";
Component consumerWithFilter = component(m, comp -> comp.impl(new FilteredConsumer(e))
- .withBundle(bundle-> bundle.filter(filter).cb(FilteredConsumer::add, FilteredConsumer::remove)));
+ .withBundle(bundle-> bundle.filter(filter).add(FilteredConsumer::add).remove(FilteredConsumer::remove)));
e.step(2);
// remove the consumer again
m.remove(consumerWithFilter);
@@ -85,7 +85,7 @@
// helper class that ensures certain steps get executed in sequence
Ensure e = new Ensure();
Component consumerWithFilter = component(m, c -> c.impl(new FilteredConsumerRequired(e))
- .withBundle(b -> b.filter("(Bundle-SymbolicName=" + BSN + ")").cb("add", "remove")));
+ .withBundle(b -> b.filter("(Bundle-SymbolicName=" + BSN + ")").add("add").remove("remove")));
e.waitForStep(1, 5000);
// remove the consumer again
m.remove(consumerWithFilter);
@@ -99,7 +99,7 @@
Ensure e = new Ensure();
FilteredConsumerRequired impl = new FilteredConsumerRequired(e);
Component consumerWithFilter = component(m, c -> c.impl(impl)
- .withBundle(b -> b.filter("(Bundle-SymbolicName=" + BSN + ")").cbi(impl::add, impl::remove)));
+ .withBundle(b -> b.filter("(Bundle-SymbolicName=" + BSN + ")").add(impl::add).remove(impl::remove)));
e.waitForStep(1, 5000);
// remove the consumer again
m.remove(consumerWithFilter);
@@ -114,7 +114,7 @@
// add a consumer with a filter
FilteredConsumerRequiredWithComponentArg impl = new FilteredConsumerRequiredWithComponentArg(e);
Component consumerWithFilter = component(m, c -> c.impl(impl)
- .withBundle(b -> b.filter("(Bundle-SymbolicName=" + BSN + ")").cb("add", "remove")));
+ .withBundle(b -> b.filter("(Bundle-SymbolicName=" + BSN + ")").add("add").remove("remove")));
e.waitForStep(1, 5000);
// remove the consumer again
m.remove(consumerWithFilter);
@@ -128,7 +128,7 @@
Ensure e = new Ensure();
FilteredConsumerRequiredWithComponentArg impl = new FilteredConsumerRequiredWithComponentArg(e);
Component consumerWithFilter = component(m).impl(impl)
- .withBundle(b -> b.filter("(Bundle-SymbolicName=" + BSN + ")").cbi(impl::add, impl::remove)).build();
+ .withBundle(b -> b.filter("(Bundle-SymbolicName=" + BSN + ")").add(impl::addRef).remove(impl::removeRef)).build();
// add a consumer with a filter
m.add(consumerWithFilter);
e.waitForStep(1, 5000);
@@ -206,15 +206,23 @@
m_ensure = e;
}
- public void add(Component component, Bundle b) {
- Assert.assertNotNull(component);
+ public void add(Component component, Bundle b) { // method ref callback
+ Assert.assertNotNull(component);
if (b.getSymbolicName().equals(BSN)) {
m_ensure.step(1);
}
}
- public void remove(Component component, Bundle b) {
- Assert.assertNotNull(component);
+ public void addRef(Bundle b, Component component) { // method ref callback
+ add(component, b);
+ }
+
+ public void removeRef(Bundle b, Component component) { // method ref callback
+ remove(component, b);
+ }
+
+ public void remove(Component component, Bundle b) { // method ref callback
+ Assert.assertNotNull(component);
Assert.assertNotNull(b);
if (b.getSymbolicName().equals(BSN)) {
m_ensure.step(2);
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ComponentTest.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ComponentTest.java
index 9b90cea..27c8d4f 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ComponentTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ComponentTest.java
@@ -37,8 +37,8 @@
// Create consumer (dependency is required by default using builder api).
component(dm, comp -> comp
.factory(Consumer::new)
- .withSrv(Provider.class, srv -> srv.filter("(name=provider2)").cb(Consumer::add, Consumer::remove))
- .withSrv(Provider.class, srv -> srv.filter("(name=provider1)").autoConfig("m_autoConfiguredProvider")));
+ .withSvc(Provider.class, srv -> srv.filter("(name=provider2)").add(Consumer::add).remove(Consumer::remove))
+ .withSvc(Provider.class, srv -> srv.filter("(name=provider1)").autoConfig("m_autoConfiguredProvider")));
// Create providers (auto added to dependency manager)
component(dm, comp -> comp
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/CompositionTest.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/CompositionTest.java
index 20fc990..87cf2a9 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/CompositionTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/CompositionTest.java
@@ -35,7 +35,7 @@
// create a service provider and consumer
Component sp = component(m).impl(new ServiceProvider(e)).provides(ServiceInterface.class).build();
Component sc = component(m).impl(new ServiceConsumer(e)).composition("getComposition")
- .withSrv(ServiceInterface.class, sb->sb.cb("add")).build();
+ .withSvc(ServiceInterface.class, sb->sb.add("add")).build();
m.add(sp);
m.add(sc);
// ensure we executed all steps inside the component instance
@@ -51,7 +51,7 @@
Component sp = component(m).impl(new ServiceProvider(e)).provides(ServiceInterface.class).build();
ServiceConsumer scimpl = new ServiceConsumer(e);
Component sc = component(m).impl(scimpl).composition(scimpl::getComposition)
- .withSrv(ServiceInterface.class, sb->sb.cb("add")).build();
+ .withSvc(ServiceInterface.class, sb->sb.add("add")).build();
m.add(sp);
m.add(sc);
// ensure we executed all steps inside the component instance
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/DynamicProxyAspectTest.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/DynamicProxyAspectTest.java
index 16a0f4b..e13f41f 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/DynamicProxyAspectTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/DynamicProxyAspectTest.java
@@ -62,7 +62,7 @@
// through the proxy twice
Component sc = component(m)
.impl(new ServiceConsumer(e))
- .withSrv(ServiceInterface.class, ServiceInterface2.class).build();
+ .withSvc(ServiceInterface.class, ServiceInterface2.class).build();
// register both producers, validate that both services are started
m.add(sp1);
@@ -114,7 +114,7 @@
// through the proxy twice
Component sc = component(m)
.impl(new ServiceConsumer(e))
- .withSrv(ServiceInterface.class, ServiceInterface2.class).build();
+ .withSvc(ServiceInterface.class, ServiceInterface2.class).build();
// register both producers, validate that both services are started
m.add(sp1);
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/FactoryConfigurationAdapterTest.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/FactoryConfigurationAdapterTest.java
index e01ac73..d6759dd 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/FactoryConfigurationAdapterTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/FactoryConfigurationAdapterTest.java
@@ -54,13 +54,13 @@
// 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).withSrv(ConfigurationAdmin.class).build();
+ Component s1 = component(m).impl(configurator).withSvc(ConfigurationAdmin.class).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(adapterImplClass).cb(adapterUpdate).propagate().provides(AdapterService.class, "foo", "bar")
- .withSrv(AdapterExtraDependency.class)
+ .factoryPid("MyFactoryPid").impl(adapterImplClass).update(adapterUpdate).propagate().provides(AdapterService.class, "foo", "bar")
+ .withSvc(AdapterExtraDependency.class)
.build();
// Create extra adapter service dependency upon which our adapter depends on.
@@ -69,7 +69,7 @@
// Create an AdapterService Consumer
Component s4 = component(m)
- .impl(AdapterServiceConsumer.class).withSrv(AdapterService.class, srv -> srv.cb("bind", "change", "remove")).build();
+ .impl(AdapterServiceConsumer.class).withSvc(AdapterService.class, srv -> srv.add("bind").change("change").remove("remove")).build();
// Start services
m.add(s1);
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/FactoryInjectedWithConfigurationBeforeTheCreateMethod.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/FactoryInjectedWithConfigurationBeforeTheCreateMethod.java
index f1ac3a9..01a3d93 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/FactoryInjectedWithConfigurationBeforeTheCreateMethod.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/FactoryInjectedWithConfigurationBeforeTheCreateMethod.java
@@ -45,13 +45,13 @@
m_e = new Ensure();
// Create the component that creates a configuration.
- Component configurator = component(m).impl(new Configurator("foobar")).withSrv(ConfigurationAdmin.class).build();
+ Component configurator = component(m).impl(new Configurator("foobar")).withSvc(ConfigurationAdmin.class).build();
// Create the object that has to be injected with the configuration before its create method is called.
MyFactory factory = new MyFactory();
// Create the Component for the MyComponent class that is created using the factory above.
- Component myComponent = component(m).factory(factory, "create").withCnf(b->b.pid("foobar").cbi(factory, "updated")).build();
+ Component myComponent = component(m).factory(factory, "create").withCnf(b->b.pid("foobar").update(factory, "updated")).build();
// provide the configuration
m.add(configurator);
@@ -67,13 +67,13 @@
m_e = new Ensure();
// Create the component that creates a configuration.
- Component configurator = component(m).impl(new Configurator("foobar")).withSrv(ConfigurationAdmin.class).build();
+ Component configurator = component(m).impl(new Configurator("foobar")).withSvc(ConfigurationAdmin.class).build();
// Create the object that has to be injected with the configuration before its create method is called.
MyFactory factory = new MyFactory();
// Create the Component for the MyComponent class that is created using the factory above.
- Component myComponent = component(m).factory(factory, "create").withCnf(b->b.pid("foobar").cbi(factory::updated)).build();
+ Component myComponent = component(m).factory(factory, "create").withCnf(b->b.pid("foobar").update(factory::updated)).build();
// provide the configuration
m.add(configurator);
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/InstanceBoundDependencyTest.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/InstanceBoundDependencyTest.java
index 8844a0c..c2d3cd9 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/InstanceBoundDependencyTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/InstanceBoundDependencyTest.java
@@ -46,7 +46,7 @@
// Create a "C" component: it depends on some S1 services, and on some S2 instance-bound services (declared from C.init() method)
C cimpl = new C();
Component c = component(m).impl(cimpl)
- .withSrv(S1.class, sb->sb.cb("addS1", "changeS1", "removeS1").autoConfig(true)).build();
+ .withSvc(S1.class, sb->sb.add("addS1").change("changeS1").remove("removeS1").autoConfig(true)).build();
m.add(c);
// Add S1 (s1_1): C.add(S1 s1) is called, then init() is called where a dependency is declared on S2
@@ -108,6 +108,7 @@
}
// Our "C" component: it depends on S1 (required) and S2 (required/instance bound)
+ // Class tested with reflection based callbacks
class C {
final Map<String, ServiceReference> m_s1Map = new HashMap();
final Map<String, ServiceReference> m_s2Map = new HashMap();
@@ -150,7 +151,7 @@
}
void init(Component c) {
- component(c, comp->comp.withSrv(S2.class, srv -> srv.cb(C::addS2, C::changeS2, C::removeS2)));
+ component(c, comp->comp.withSvc(S2.class, srv -> srv.add("addS2").change("changeS2").remove("removeS2")));
m_e.step(1);
}
}
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ModifiedBundleDependencyTest.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ModifiedBundleDependencyTest.java
index ade9bff..474a7de 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ModifiedBundleDependencyTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ModifiedBundleDependencyTest.java
@@ -64,7 +64,7 @@
void init(Component c) {
m_e.step(2);
- component(c, comp -> comp.withSrv(A.class, srv -> srv.cb("add", "remove")));
+ component(c, comp -> comp.withSvc(A.class, srv -> srv.add("add").remove("remove")));
}
public void add(A a) {
@@ -105,7 +105,7 @@
String filter = "(Bundle-SymbolicName=org.apache.felix.metatype)";
int mask = Bundle.INSTALLED|Bundle.ACTIVE|Bundle.RESOLVED|Bundle.STARTING;
Component b = component(m)
- .provides(B.class).impl(new BImpl(e)).withBundle(bd -> bd.filter(filter).mask(mask).cb("add", "change", "remove")).build();
+ .provides(B.class).impl(new BImpl(e)).withBundle(bd -> bd.filter(filter).mask(mask).add("add").change("change").remove("remove")).build();
Bundle dmtest = getBundle("org.apache.felix.metatype");
try {
@@ -141,7 +141,7 @@
String filter = "(Bundle-SymbolicName=org.apache.felix.metatype)";
int mask = Bundle.INSTALLED|Bundle.ACTIVE|Bundle.RESOLVED|Bundle.STARTING;
Component b = component(m).provides(B.class).impl(impl)
- .withBundle(bd -> bd.filter(filter).mask(mask).cbi(impl::add, impl::change, impl::remove)).build();
+ .withBundle(bd -> bd.filter(filter).mask(mask).add(impl::add).change(impl::change).remove(impl::remove)).build();
Bundle dmtest = getBundle("org.apache.felix.metatype");
try {
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/MultipleExtraDependenciesTest.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/MultipleExtraDependenciesTest.java
index b48d5ee..c6cc634 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/MultipleExtraDependenciesTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/MultipleExtraDependenciesTest.java
@@ -38,8 +38,8 @@
DependencyManager m = getDM();
// Helper class that ensures certain steps get executed in sequence
Ensure e = new Ensure();
- Component c1 = component(m).provides(Service1.class).impl(new MyComponent1(e)).withSrv(Service2.class, srv->srv.autoConfig("m_service2")).build();
- Component c2 = component(m).impl(new MyComponent2(e)).withSrv(Service1.class, srv->srv.required(false).autoConfig(false).cb("added")).build();
+ Component c1 = component(m).provides(Service1.class).impl(new MyComponent1(e)).withSvc(Service2.class, srv->srv.autoConfig("m_service2")).build();
+ Component c2 = component(m).impl(new MyComponent2(e)).withSvc(Service1.class, srv->srv.required(false).autoConfig(false).add("added")).build();
Component c3 = component(m).provides(Service2.class).impl(Service2Impl.class).build();
Component c4 = component(m).impl(Service3Impl1.class).provides(Service3.class, type -> "xx").build();
Component c5 = component(m).impl(Service3Impl2.class).provides(Service3.class, type -> "yy").build();
@@ -72,8 +72,8 @@
DependencyManager m = getDM();
// Helper class that ensures certain steps get executed in sequence
Ensure e = new Ensure();
- Component c1 = component(m).provides(Service1.class).impl(new MyComponent1(e)).withSrv(Service2.class, srv->srv.autoConfig("m_service2")).build();
- Component c2 = component(m).impl(new MyComponent2(e)).withSrv(Service1.class, srv->srv.required(false).autoConfig(false).cb("added")).build();
+ Component c1 = component(m).provides(Service1.class).impl(new MyComponent1(e)).withSvc(Service2.class, srv->srv.autoConfig("m_service2")).build();
+ Component c2 = component(m).impl(new MyComponent2(e)).withSvc(Service1.class, srv->srv.required(false).autoConfig(false).add("added")).build();
Component c3 = component(m).provides(Service2.class).impl(Service2Impl.class).build();
Component c4 = component(m).impl(Service3Impl1.class).provides(Service3.class, type -> "xx").build();
Component c5 = component(m).impl(Service3Impl2.class).provides(Service3.class, type -> "yy").build();
@@ -121,8 +121,8 @@
// Service3/yy not yet available
component(c, comp -> comp
- .withSrv(Service3.class, srv->srv.filter("(type=xx)").autoConfig("m_service3_xx"))
- .withSrv(Service3.class, srv->srv.filter("(type=yy)").autoConfig("m_service3_yy")));
+ .withSvc(Service3.class, srv->srv.filter("(type=xx)").autoConfig("m_service3_xx"))
+ .withSvc(Service3.class, srv->srv.filter("(type=yy)").autoConfig("m_service3_yy")));
}
void start() {
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/MultipleExtraDependencyTest.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/MultipleExtraDependencyTest.java
index 301bdf9..fa58126 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/MultipleExtraDependencyTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/MultipleExtraDependencyTest.java
@@ -37,8 +37,8 @@
Component sp2 = component(m)
.impl(ServiceProvider2.class).provides(ServiceProvider2.class)
- .withSrv(Runnable.class, srv->srv.filter("(foo=bar)").required(false).autoConfig("m_runnable"))
- .withSrv(Sequencer.class, srv->srv.cb("bind"))
+ .withSvc(Runnable.class, srv->srv.filter("(foo=bar)").required(false).autoConfig("m_runnable"))
+ .withSvc(Sequencer.class, srv->srv.add("bind"))
.composition("getComposition")
.build();
@@ -46,15 +46,15 @@
.impl(ServiceProvider.class)
.provides(ServiceInterface.class, foo -> "bar")
.start("start").stop("stop")
- .withSrv(Sequencer.class, srv->srv.autoConfig("m_sequencer"))
- .withSrv(ServiceProvider2.class, srv->srv.cb("bind", "unbind"))
+ .withSvc(Sequencer.class, srv->srv.autoConfig("m_sequencer"))
+ .withSvc(ServiceProvider2.class, srv->srv.add("bind").remove("unbind"))
.build();
Component sc = component(m)
.impl(ServiceConsumer.class)
.start("start").stop("stop")
- .withSrv(Sequencer.class, srv->srv.autoConfig("m_sequencer"))
- .withSrv(ServiceInterface.class, srv->srv.filter("(foo=bar)").autoConfig("m_service"))
+ .withSvc(Sequencer.class, srv->srv.autoConfig("m_sequencer"))
+ .withSvc(ServiceInterface.class, srv->srv.filter("(foo=bar)").autoConfig("m_service"))
.build();
Component sequencer = component(m)
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/MultipleExtraDependencyTest2.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/MultipleExtraDependencyTest2.java
index b0c2c36..def5566 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/MultipleExtraDependencyTest2.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/MultipleExtraDependencyTest2.java
@@ -127,8 +127,8 @@
public void init(Component s) {
component(s, comp->comp
- .withSrv(Sequencer.class, srv->srv.autoConfig("m_sequencer"))
- .withSrv(ServiceInterface.class, srv->srv.filter("(foo=bar)").autoConfig("m_service")));
+ .withSvc(Sequencer.class, srv->srv.autoConfig("m_sequencer"))
+ .withSvc(ServiceInterface.class, srv->srv.filter("(foo=bar)").autoConfig("m_service")));
}
void start() {
@@ -150,8 +150,8 @@
public void init(Component c)
{
component(c, comp->comp
- .withSrv(Sequencer.class, srv->srv.autoConfig("m_sequencer"))
- .withSrv(ServiceProvider2.class, srv->srv.cb("bind", "unbind")));
+ .withSvc(Sequencer.class, srv->srv.autoConfig("m_sequencer"))
+ .withSvc(ServiceProvider2.class, srv->srv.add("bind").remove("unbind")));
}
void bind(ServiceProvider2 provider2)
@@ -191,8 +191,8 @@
public void init(Component c)
{
component(c, comp->comp
- .withSrv(Runnable.class, srv->srv.optional().filter("(foo=bar)"))
- .withSrv(Sequencer.class, srv->srv.cb("bind")));
+ .withSvc(Runnable.class, srv->srv.optional().filter("(foo=bar)"))
+ .withSvc(Sequencer.class, srv->srv.add("bind")));
}
void bind(Sequencer seq)
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/MultipleServiceDependencyTest.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/MultipleServiceDependencyTest.java
index 8a8af42..dc9d294 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/MultipleServiceDependencyTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/MultipleServiceDependencyTest.java
@@ -36,7 +36,7 @@
// create a service provider and consumer
Component provider = component(m).impl(new ServiceProvider(e)).provides(ServiceInterface.class.getName()).build();
Component providerWithHighRank = component(m).impl(new ServiceProvider2(e)).provides(ServiceInterface.class.getName(), Constants.SERVICE_RANKING, Integer.valueOf(5)).build();
- Component consumer = component(m).impl(new ServiceConsumer(e)).withSrv(ServiceInterface.class).build();
+ Component consumer = component(m).impl(new ServiceConsumer(e)).withSvc(ServiceInterface.class).build();
m.add(provider);
m.add(providerWithHighRank);
m.add(consumer);
@@ -56,7 +56,7 @@
// create a service provider and consumer
Component provider = component(m).impl(new ServiceProvider(e)).provides(ServiceInterface.class.getName()).build();
Component provider2 = component(m).impl(new ServiceProvider2(e)).provides(ServiceInterface.class.getName()).build();
- Component consumer = component(m).impl(new ServiceConsumer(e)).withSrv(ServiceInterface.class).build();
+ Component consumer = component(m).impl(new ServiceConsumer(e)).withSvc(ServiceInterface.class).build();
m.add(provider2);
m.add(consumer);
e.waitForStep(3, 5000);
@@ -76,7 +76,7 @@
// create a service provider and consumer
Component provider = component(m).impl(new ServiceProvider(e)).provides(ServiceInterface.class.getName()).build();
Component provider2 = component(m).impl(new ServiceProvider2(e)).provides(ServiceInterface.class.getName()).build();
- Component consumer = component(m).impl(new ServiceConsumer(e)).withSrv(ServiceInterface.class, srv->srv.cb("add", "remove")).build();
+ Component consumer = component(m).impl(new ServiceConsumer(e)).withSvc(ServiceInterface.class, srv->srv.add("add").remove("remove")).build();
m.add(provider2);
m.add(consumer);
e.waitForStep(3, 15000);
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/RemovedDependencyTest.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/RemovedDependencyTest.java
index 30424d0..9c1a4b1 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/RemovedDependencyTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/RemovedDependencyTest.java
@@ -67,8 +67,8 @@
ServiceConsumer consumer = new ServiceConsumer(e, d3);
Component sc = component(m).impl(consumer).build();
- Dependency d1 = serviceDependency(sc, ServiceInterface.class).filter("(name=provider1)").cb("add", "remove").build();
- Dependency d2 = serviceDependency(sc, ServiceInterface.class).filter("(name=provider2)").cb("add", "remove").build();
+ Dependency d1 = serviceDependency(sc, ServiceInterface.class).filter("(name=provider1)").add("add").remove("remove").build();
+ Dependency d2 = serviceDependency(sc, ServiceInterface.class).filter("(name=provider2)").add("add").remove("remove").build();
sc.add(d1, d2);
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ResourceProvider.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ResourceProvider.java
index 260fa59..54b4800 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ResourceProvider.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ResourceProvider.java
@@ -66,7 +66,7 @@
}
@SuppressWarnings({ "deprecation", "unchecked" })
- public void add(ServiceReference<ResourceHandler> ref, ResourceHandler handler) {
+ public void add(ResourceHandler handler, ServiceReference<ResourceHandler> ref) {
String filterString = (String) ref.getProperty("filter");
Filter filter = null;
if (filterString != null) {
@@ -88,7 +88,7 @@
}
}
- public void remove(ServiceReference<ResourceHandler> ref, ResourceHandler handler) {
+ public void remove(ResourceHandler handler, ServiceReference<ResourceHandler> ref) {
Filter filter;
synchronized (m_handlers) {
filter = (Filter) m_handlers.remove(handler);
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ServiceDependencyCallbackSignaturesTest.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ServiceDependencyCallbackSignaturesTest.java
index 609cca1..76e3f66 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ServiceDependencyCallbackSignaturesTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ServiceDependencyCallbackSignaturesTest.java
@@ -47,15 +47,15 @@
Component provider = component(m)
.impl(new ProviderImpl()).provides(Provider.class.getName(), props).build();
- component(m, c->c.impl(new Consumer1()).withSrv(Provider.class, srv->srv.cb("bind", "change", "remove")));
- component(m, c->c.impl(new Consumer2()).withSrv(Provider.class, srv->srv.cb("bind", "change", "remove")));
- component(m, c->c.impl(new Consumer3()).withSrv(Provider.class, srv->srv.cb("bind", "change", "remove")));
- component(m, c->c.impl(new Consumer4()).withSrv(Provider.class, srv->srv.cb("bind", "change", "remove")));
- component(m, c->c.impl(new Consumer5()).withSrv(Provider.class, srv->srv.cb("bind", "change", "remove")));
- component(m, c->c.impl(new Consumer6()).withSrv(Provider.class, srv->srv.cb("bind", "change", "remove")));
- component(m, c->c.impl(new Consumer7()).withSrv(Provider.class, srv->srv.cb("bind", "change", "remove")));
- component(m, c->c.impl(new Consumer8()).withSrv(Provider.class, srv->srv.cb("bind", "change", "remove")));
- component(m, c->c.impl(new Consumer9()).withSrv(Provider.class, srv->srv.cb("bind", "change", "remove")));
+ component(m, c->c.impl(new Consumer1()).withSvc(Provider.class, srv->srv.add("bind").change("change").remove("remove")));
+ component(m, c->c.impl(new Consumer2()).withSvc(Provider.class, srv->srv.add("bind").change("change").remove("remove")));
+ component(m, c->c.impl(new Consumer3()).withSvc(Provider.class, srv->srv.add("bind").change("change").remove("remove")));
+ component(m, c->c.impl(new Consumer4()).withSvc(Provider.class, srv->srv.add("bind").change("change").remove("remove")));
+ component(m, c->c.impl(new Consumer5()).withSvc(Provider.class, srv->srv.add("bind").change("change").remove("remove")));
+ component(m, c->c.impl(new Consumer6()).withSvc(Provider.class, srv->srv.add("bind").change("change").remove("remove")));
+ component(m, c->c.impl(new Consumer7()).withSvc(Provider.class, srv->srv.add("bind").change("change").remove("remove")));
+ component(m, c->c.impl(new Consumer8()).withSvc(Provider.class, srv->srv.add("bind").change("change").remove("remove")));
+ component(m, c->c.impl(new Consumer9()).withSvc(Provider.class, srv->srv.add("bind").change("change").remove("remove")));
m.add(provider);
m_ensure.waitForStep(9, 5000);
@@ -68,7 +68,7 @@
m.remove(provider);
m_ensure.waitForStep(26, 5000);
}
-
+
/**
* Tests if all possible dependency callbacks signatures supported by ServiceDependency.
*/
@@ -80,15 +80,15 @@
Component provider = component(m)
.impl(new ProviderImpl()).provides(Provider.class.getName(), props).build();
- component(m, c->c.impl(new Consumer1()).withSrv(Provider.class, srv->srv.cb(Consumer1::bind, Consumer1::change, Consumer1::remove)));
- component(m, c->c.impl(new Consumer2()).withSrv(Provider.class, srv->srv.cb(Consumer2::bind, Consumer2::change, Consumer2::remove)));
- component(m, c->c.impl(new Consumer3()).withSrv(Provider.class, srv->srv.cb(Consumer3::bind, Consumer3::change, Consumer3::remove)));
- component(m, c->c.impl(new Consumer4()).withSrv(Provider.class, srv->srv.cb(Consumer4::bind, Consumer4::change, Consumer4::remove)));
- component(m, c->c.impl(new Consumer5()).withSrv(Provider.class, srv->srv.cb(Consumer5::bind, Consumer5::change, Consumer5::remove)));
- component(m, c->c.impl(new Consumer6()).withSrv(Provider.class, srv->srv.cb(Consumer6::bind, Consumer6::change, Consumer6::remove)));
- component(m, c->c.impl(new Consumer7()).withSrv(Provider.class, srv->srv.cb(Consumer7::bind, Consumer7::change, Consumer7::remove)));
- component(m, c->c.impl(new Consumer8()).withSrv(Provider.class, srv->srv.cb(Consumer8::bind, Consumer8::change, Consumer8::remove)));
- component(m, c->c.impl(new Consumer9()).withSrv(Provider.class, srv->srv.cb(Consumer9::bind, Consumer9::change, Consumer9::remove)));
+ component(m, c->c.impl(new Consumer1()).withSvc(Provider.class, srv->srv.add(Consumer1::bind).change(Consumer1::change).remove(Consumer1::remove)));
+ component(m, c->c.impl(new Consumer2()).withSvc(Provider.class, srv->srv.add(Consumer2::bind).change(Consumer2::change).remove(Consumer2::remove)));
+ component(m, c->c.impl(new Consumer3()).withSvc(Provider.class, srv->srv.add(Consumer3::bind).change(Consumer3::change).remove(Consumer3::remove)));
+ component(m, c->c.impl(new Consumer4()).withSvc(Provider.class, srv->srv.add(Consumer4::bindRef).change(Consumer4::changeRef).remove(Consumer4::removeRef)));
+ component(m, c->c.impl(new Consumer5()).withSvc(Provider.class, srv->srv.add(Consumer5::bindRef).change(Consumer5::changeRef).remove(Consumer5::removeRef)));
+ component(m, c->c.impl(new Consumer6()).withSvc(Provider.class, srv->srv.add(Consumer6::bindRef).change(Consumer6::changeRef).remove(Consumer6::removeRef)));
+ component(m, c->c.impl(new Consumer7()).withSvc(Provider.class, srv->srv.add(Consumer7::bindRef).change(Consumer7::changeRef).remove(Consumer7::removeRef)));
+ component(m, c->c.impl(new Consumer8()).withSvc(Provider.class, srv->srv.add(Consumer8::bindRef).change(Consumer8::changeRef).remove(Consumer8::removeRef)));
+ component(m, c->c.impl(new Consumer9()).withSvc(Provider.class, srv->srv.add(Consumer9::bindRef).change(Consumer9::changeRef).remove(Consumer9::removeRef)));
m.add(provider);
m_ensure.waitForStep(9, 5000);
@@ -101,14 +101,6 @@
m.remove(provider);
m_ensure.waitForStep(26, 5000);
}
-
- private void declareConsumer(DependencyManager m, Object consumerImpl) {
- Component consumer = component(m)
- .impl(consumerImpl)
- .withSrv(Provider.class, srv->srv.cb("bind", "change", "change"))
- .build();
- m.add(consumer);
- }
public static interface Provider {
}
@@ -169,19 +161,33 @@
}
class Consumer4 {
- void bind(ServiceReference ref, Provider provider) {
+ void bindRef(Provider provider, ServiceReference ref) { // method ref callback
+ bind(ref, provider);
+ }
+
+ void bind(ServiceReference ref, Provider provider) { // reflection based callback
Assert.assertNotNull(ref);
Assert.assertNotNull(provider);
Assert.assertEquals("bar", ref.getProperty("foo"));
m_ensure.step();
}
- void change(ServiceReference ref, Provider provider) {
+
+ void changeRef(Provider provider, ServiceReference ref) { // method ref callback
+ change(ref, provider);
+ }
+
+ void change(ServiceReference ref, Provider provider) { // reflection based callback
Assert.assertNotNull(ref);
Assert.assertNotNull(provider);
Assert.assertEquals("zoo", ref.getProperty("foo"));
m_ensure.step();
}
- void remove(ServiceReference ref, Provider provider) {
+
+ void removeRef(Provider provider, ServiceReference ref) { // method ref callback
+ remove(ref, provider);
+ }
+
+ void remove(ServiceReference ref, Provider provider) { // reflection based callback
Assert.assertNotNull(ref);
Assert.assertNotNull(provider);
Assert.assertEquals("zoo", ref.getProperty("foo"));
@@ -190,40 +196,73 @@
}
class Consumer5 {
- void bind(ServiceReference ref) {
+ void bindRef(Provider provider, ServiceReference ref) { // method ref callback
+ bind(ref);
+ }
+
+ void bind(ServiceReference ref) { // reflection based callback
Assert.assertNotNull(ref);
Assert.assertEquals("bar", ref.getProperty("foo"));
m_ensure.step();
}
- void change(ServiceReference ref) {
+
+ void changeRef(Provider provider, ServiceReference ref) { // method ref callback
+ change(ref);
+ }
+
+ void change(ServiceReference ref) { // reflection based callback
Assert.assertNotNull(ref);
Assert.assertEquals("zoo", ref.getProperty("foo"));
m_ensure.step();
}
- void remove(ServiceReference ref) {
+
+ void removeRef(Provider provider, ServiceReference ref) { // method ref callback
+ remove(ref);
+ }
+
+ void remove(ServiceReference ref) { // reflection based callback
Assert.assertNotNull(ref);
Assert.assertEquals("zoo", ref.getProperty("foo"));
m_ensure.step();
}
}
- class Consumer6 {
- void bind(Component c) {
+ class Consumer6 {
+
+ void bindRef(Provider p, Component c) { // method ref callback
+ bind(c);
+ }
+
+ void bind(Component c) { // reflection based callback
Assert.assertNotNull(c);
m_ensure.step();
}
- void change(Component c) {
+
+ void changeRef(Provider p, Component c) { // method ref callback
+ change(c);
+ }
+
+ void change(Component c) { // reflection based callback
Assert.assertNotNull(c);
m_ensure.step();
}
- void remove(Component c) {
+
+ void removeRef(Provider p, Component c) { // method ref callback
+ remove(c);
+ }
+
+ void remove(Component c) { // reflection based callback
Assert.assertNotNull(c);
m_ensure.step();
}
}
class Consumer7 {
- void bind(Component c, ServiceReference ref) {
+ void bindRef(Provider p, Component c, ServiceReference ref) { // reflection callback
+ bind(c, ref);
+ }
+
+ void bind(Component c, ServiceReference ref) { // reflection callback
Assert.assertNotNull(c);
Assert.assertNotNull(ref);
Assert.assertEquals("bar", ref.getProperty("foo"));
@@ -231,7 +270,12 @@
Assert.assertEquals(context.getService(ref).getClass(), ProviderImpl.class);
m_ensure.step();
}
- void change(Component c, ServiceReference ref) {
+
+ void changeRef(Provider p, Component c, ServiceReference ref) { // reflection callback
+ change(c, ref);
+ }
+
+ void change(Component c, ServiceReference ref) { // reflection callback
Assert.assertNotNull(c);
Assert.assertNotNull(ref);
Assert.assertEquals("zoo", ref.getProperty("foo"));
@@ -239,7 +283,12 @@
Assert.assertEquals(context.getService(ref).getClass(), ProviderImpl.class);
m_ensure.step();
}
- void remove(Component c, ServiceReference ref) {
+
+ void removeRef(Provider p, Component c, ServiceReference ref) { // reflection callback
+ remove(c, ref);
+ }
+
+ void remove(Component c, ServiceReference ref) { // reflection callback
Assert.assertNotNull(c);
Assert.assertNotNull(ref);
Assert.assertEquals("zoo", ref.getProperty("foo"));
@@ -250,17 +299,31 @@
}
class Consumer8 {
- void bind(Component c, Provider provider) {
+ void bindRef(Provider p, Component c) { // method ref callback
+ bind(c, p);
+ }
+
+ void bind(Component c, Provider provider) { // reflection callback
Assert.assertNotNull(c);
Assert.assertNotNull(provider);
m_ensure.step();
}
- void change(Component c, Provider provider) {
+
+ void changeRef(Provider p, Component c) { // method ref callback
+ change(c, p);
+ }
+
+ void change(Component c, Provider provider) { // reflection callback
Assert.assertNotNull(c);
Assert.assertNotNull(provider);
m_ensure.step();
}
- void remove(Component c, Provider provider) {
+
+ void removeRef(Provider p, Component c) { // method ref callback
+ remove(c, p);
+ }
+
+ void remove(Component c, Provider provider) { // reflection callback
Assert.assertNotNull(c);
Assert.assertNotNull(provider);
m_ensure.step();
@@ -268,7 +331,11 @@
}
class Consumer9 {
- void bind(Component c, ServiceReference ref, Provider provider) {
+ void bindRef(Provider provider, Component c, ServiceReference ref) { // method ref callback
+ bind(c, ref, provider);
+ }
+
+ void bind(Component c, ServiceReference ref, Provider provider) { // reflection callback
Assert.assertNotNull(c);
Assert.assertNotNull(ref);
Assert.assertNotNull(provider);
@@ -276,7 +343,12 @@
Assert.assertEquals(context.getService(ref), provider);
m_ensure.step();
}
- void change(Component c, ServiceReference ref, Provider provider) {
+
+ void changeRef(Provider provider, Component c, ServiceReference ref) { // method ref callback
+ change(c, ref, provider);
+ }
+
+ void change(Component c, ServiceReference ref, Provider provider) { // reflection callback
Assert.assertNotNull(c);
Assert.assertNotNull(ref);
Assert.assertNotNull(provider);
@@ -284,7 +356,12 @@
Assert.assertEquals(context.getService(ref), provider);
m_ensure.step();
}
- void remove(Component c, ServiceReference ref, Provider provider) {
+
+ void removeRef(Provider provider, Component c, ServiceReference ref) { // method ref callback
+ remove(c, ref, provider);
+ }
+
+ void remove(Component c, ServiceReference ref, Provider provider) { // reflection callback
Assert.assertNotNull(c);
Assert.assertNotNull(ref);
Assert.assertNotNull(provider);
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ServiceDependencyInjectionTest.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ServiceDependencyInjectionTest.java
index 1dff100..7192423 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ServiceDependencyInjectionTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ServiceDependencyInjectionTest.java
@@ -34,20 +34,20 @@
// create a service provider and consumer
ServiceProvider provider = new ServiceProvider(e);
Component sp = component(m).impl(provider).provides(ServiceInterface2.class.getName()).build();
- Component sc = component(m).impl(new ServiceConsumer()).withSrv(ServiceInterface2.class).build();
+ Component sc = component(m).impl(new ServiceConsumer()).withSvc(ServiceInterface2.class).build();
Component sc2 = component(m) // all dependencies are optional
.impl(new ServiceConsumerNamedInjection(false, false))
- .withSrv(ServiceInterface2.class, s->s.optional().autoConfig("m_service"))
- .withSrv(ServiceInterface2.class, s->s.optional().autoConfig("m_service2"))
- .withSrv(ServiceInterface2.class, s->s.optional().autoConfig("m_service3"))
+ .withSvc(ServiceInterface2.class, s->s.optional().autoConfig("m_service"))
+ .withSvc(ServiceInterface2.class, s->s.optional().autoConfig("m_service2"))
+ .withSvc(ServiceInterface2.class, s->s.optional().autoConfig("m_service3"))
.build();
Component sc3 = component(m) // second dependency is required, first and third are optional
.impl(new ServiceConsumerNamedInjection(false, false))
- .withSrv(ServiceInterface2.class, s->s.optional().autoConfig("m_service"))
- .withSrv(ServiceInterface2.class, s->s.required().autoConfig("m_service2"))
- .withSrv(ServiceInterface2.class, s->s.optional().autoConfig("m_service3"))
+ .withSvc(ServiceInterface2.class, s->s.optional().autoConfig("m_service"))
+ .withSvc(ServiceInterface2.class, s->s.required().autoConfig("m_service2"))
+ .withSvc(ServiceInterface2.class, s->s.optional().autoConfig("m_service3"))
.build();
Component sc4 = component(m)
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ServiceDependencyPropagateTest.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ServiceDependencyPropagateTest.java
index 227a738..b71c8ec 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ServiceDependencyPropagateTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ServiceDependencyPropagateTest.java
@@ -45,12 +45,12 @@
Component c1 = component(m)
.impl(new C1(e))
- .withSrv(C2.class, s->s.cb("bind")).build();
+ .withSvc(C2.class, s->s.add("bind")).build();
Component c2 = component(m)
.provides(C2.class.getName(), new Hashtable() {{ put("foo", "bar"); }})
.impl(new C2())
- .withSrv(C3.class, s->s.propagate()).build();
+ .withSvc(C3.class, s->s.propagate()).build();
Component c3 = component(m)
.provides(C3.class.getName(), new Hashtable() {{ put("foo2", "bar2"); put("foo", "overriden");}})
@@ -78,13 +78,13 @@
Ensure e = new Ensure();
Component c1 = component(m)
.impl(new C1(e))
- .withSrv(C2.class, s->s.cb("bind")).build();
+ .withSvc(C2.class, s->s.add("bind")).build();
C2 c2Impl = new C2();
Component c2 = component(m)
.provides(C2.class.getName(), new Hashtable() {{ put("foo", "bar"); }})
.impl(c2Impl)
- .withSrv(C3.class, s->s.propagate(c2Impl, "getServiceProperties")).build();
+ .withSvc(C3.class, s->s.propagate(c2Impl, "getServiceProperties")).build();
Component c3 = component(m)
.provides(C3.class.getName())
@@ -104,13 +104,13 @@
Ensure e = new Ensure();
Component c1 = component(m)
.impl(new C1(e))
- .withSrv(C2.class, s->s.cb(C1::bind)).build();
+ .withSvc(C2.class, s->s.add(C1::bind)).build();
C2 c2Impl = new C2();
Component c2 = component(m)
.provides(C2.class.getName(), new Hashtable() {{ put("foo", "bar"); }})
.impl(c2Impl)
- .withSrv(C3.class, s->s.propagate(c2Impl::getServiceProperties)).build();
+ .withSvc(C3.class, s->s.propagate(c2Impl::getServiceProperties)).build();
Component c3 = component(m)
.provides(C3.class.getName())
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ServiceDependencyTest.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ServiceDependencyTest.java
index 6f4e35a..4b9e95a 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ServiceDependencyTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ServiceDependencyTest.java
@@ -33,10 +33,10 @@
Ensure e = new Ensure();
// create a service provider and consumer
Component sp = component(m).impl(new ServiceProvider(e)).provides(ServiceInterface.class).build();
- Component sc = component(m).impl(new ServiceConsumer(e)).withSrv(ServiceInterface.class).build();
+ Component sc = component(m).impl(new ServiceConsumer(e)).withSvc(ServiceInterface.class).build();
Component sc2 = component(m).impl(new ServiceConsumerCallbacks(e))
- .withSrv(ServiceInterface.class, srv -> srv.required(false).cb(ServiceConsumerCallbacks::add, ServiceConsumerCallbacks::remove))
+ .withSvc(ServiceInterface.class, srv -> srv.required(false).add(ServiceConsumerCallbacks::add).remove(ServiceConsumerCallbacks::remove))
.build();
m.add(sp);
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ServiceDependencyThroughCallbackInstanceTest.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ServiceDependencyThroughCallbackInstanceTest.java
index 31616f9..27b028e 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ServiceDependencyThroughCallbackInstanceTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ServiceDependencyThroughCallbackInstanceTest.java
@@ -52,7 +52,7 @@
CallbackInstance instance = new CallbackInstance();
component(m, comp -> comp
.impl(new SimpleService() {})
- .withSrv(Service.class, srv -> srv.cbi(instance::added, instance::removed)));
+ .withSvc(Service.class, srv -> srv.add(instance::added).remove(instance::removed)));
Assert.assertEquals(numberOfServices, instance.getCount());
m.clear();
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ServiceUpdateTest.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ServiceUpdateTest.java
index b181449..4e2ac90 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ServiceUpdateTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/ServiceUpdateTest.java
@@ -43,11 +43,11 @@
// activate it
component(m, comp -> comp
.impl(new ServiceProvider(e))
- .withSrv(ServiceInterface.class, srv -> srv
- .cb(ServiceProvider::add, ServiceProvider::change, ServiceProvider::remove)));
+ .withSvc(ServiceInterface.class, srv -> srv
+ .add(ServiceProvider::add).change(ServiceProvider::change).remove(ServiceProvider::remove)));
component(m, comp -> comp
.impl(provider)
- .withSrv(ResourceHandler.class, srv -> srv.cb(ResourceProvider::add, ResourceProvider::remove)));
+ .withSvc(ResourceHandler.class, srv -> srv.add(ResourceProvider::add).remove(ResourceProvider::remove)));
// TODO implement resource adapters in new builder API and use it for the following resource adapter.
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/TemporalServiceDependencyTest.java b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/TemporalServiceDependencyTest.java
index eaa4c6b..7b8aa03 100644
--- a/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/TemporalServiceDependencyTest.java
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda.itest/src/org/apache/felix/dm/lambda/itest/TemporalServiceDependencyTest.java
@@ -44,7 +44,7 @@
TemporalServiceProvider2 provider2 = new TemporalServiceProvider2(e);
Component sp2 = component(m).impl(provider2).provides(TemporalServiceInterface.class.getName()).build();
TemporalServiceConsumer consumer = new TemporalServiceConsumer(e);
- Component sc = component(m).impl(consumer).withSrv(TemporalServiceInterface.class, s->s.timeout(10000)).build();
+ Component sc = component(m).impl(consumer).withSvc(TemporalServiceInterface.class, s->s.timeout(10000)).build();
// add the service consumer
m.add(sc);
// now add the first provider
@@ -76,7 +76,7 @@
TemporalServiceProvider2 provider2 = new TemporalServiceProvider2(e);
Component sp2 = component(m).impl(provider2).provides(TemporalServiceInterface.class.getName()).build();
TemporalServiceConsumerWithCallback consumer = new TemporalServiceConsumerWithCallback(e);
- Component sc = component(m).impl(consumer).withSrv(TemporalServiceInterface.class, srv->srv.cb("add", "remove").timeout(10000)).build();
+ Component sc = component(m).impl(consumer).withSvc(TemporalServiceInterface.class, srv->srv.add("add").remove("remove").timeout(10000)).build();
// add the service consumer
m.add(sc);
@@ -114,7 +114,7 @@
Component sp2 = component(m).impl(provider2).provides(TemporalServiceInterface.class.getName()).build();
TemporalServiceConsumerAdapterWithCallback consumer = new TemporalServiceConsumerAdapterWithCallback(e);
Component sc = m.createAdapterService(Adaptee.class, null).setImplementation(consumer);
- ServiceDependency temporalDep = serviceDependency(sc, TemporalServiceInterface.class).timeout(10000).cb("add", "remove").build();
+ ServiceDependency temporalDep = serviceDependency(sc, TemporalServiceInterface.class).timeout(10000).add("add").remove("remove").build();
sc.add(temporalDep);
Component adaptee = component(m).impl(new Adaptee()).provides(Adaptee.class.getName()).build();
@@ -171,7 +171,7 @@
};
Component consumerComp = component(m)
.impl(consumer)
- .withSrv(Runnable.class, s->s.timeout(5000).filter("(target=" + getClass().getSimpleName() + ")")).build();
+ .withSvc(Runnable.class, s->s.timeout(5000).filter("(target=" + getClass().getSimpleName() + ")")).build();
m.add(consumerComp);
m.add(providerComp);
ensure.waitForStep(2, 5000);