public interface BundleDependencyBuilder extends DependencyBuilder<BundleDependency>
Example of a Pojo Component which tracks a started bundle having a given bundle symbolic name:
public class Activator extends DependencyManagerActivator {
public void init(BundleContext ctx, DependencyManager dm) throws Exception {
String BSN = "org.apache.felix.dependencymanager";
component(comp -> comp
.impl(Pojo.class)
.withBundle(b -> b.mask(Bundle.ACTIVE).filter("(Bundle-SymbolicName=" + BSN + ")").add(Pojo::add).remove(Pojo::remove)));
}
}
Modifier and Type | Method and Description |
---|---|
<T> BundleDependencyBuilder |
add(CbBundle<T> add)
Sets a
callback method reference which is invoked when a bundle is added. |
<T> BundleDependencyBuilder |
add(CbBundleComponent<T> add)
Sets a
callback method reference which is invoked when a bundle is added. |
BundleDependencyBuilder |
add(InstanceCbBundle add)
Sets a method reference on an Object instance which is invoked when a bundle is added.
|
BundleDependencyBuilder |
add(InstanceCbBundleComponent add)
Sets a
callback instance method reference which is invoked when a bundle is added. |
BundleDependencyBuilder |
add(java.lang.String callback)
Sets a "add"
callback method to invoke on the component implementation instance(s). |
BundleDependencyBuilder |
autoConfig()
Enables auto configuration for this dependency.
|
BundleDependencyBuilder |
autoConfig(boolean autoConfig)
Enables auto configuration for this dependency.
|
BundleDependencyBuilder |
bundle(Bundle bundle)
Sets the bundle to depend on directly.
|
BundleDependencyBuilder |
callbackInstance(java.lang.Object callbackInstance)
Specifies a callback instance used to invoke the reflection based callbacks on it.
|
<T> BundleDependencyBuilder |
change(CbBundle<T> change)
Sets a
callback method reference which is invoked when a bundle is changed. |
<T> BundleDependencyBuilder |
change(CbBundleComponent<T> change)
Sets a
callback method reference which is invoked when a bundle is changed. |
BundleDependencyBuilder |
change(InstanceCbBundle change)
Sets a method reference on an Object instance which is invoked when a bundle is changed.
|
BundleDependencyBuilder |
change(InstanceCbBundleComponent change)
Sets a
callback instance method reference which is invoked when a bundle is changed. |
BundleDependencyBuilder |
change(java.lang.String callback)
Sets a "change"
callback method to invoke on the component implementation instance(s). |
BundleDependencyBuilder |
filter(java.lang.String filter)
Sets the filter condition to depend on.
|
BundleDependencyBuilder |
mask(int mask)
Sets the bundle state mask to depend on.
|
BundleDependencyBuilder |
optional()
Sets the dependency to be optional.
|
BundleDependencyBuilder |
propagate()
Sets property propagation.
|
BundleDependencyBuilder |
propagate(boolean propagate)
Sets property propagation.
|
BundleDependencyBuilder |
propagate(java.util.function.Function<Bundle,java.util.Dictionary<?,?>> propagate)
Sets a reference to a method on an Object instance used to propagate some bundle properties to the provided service properties.
|
BundleDependencyBuilder |
propagate(java.lang.Object instance,
java.lang.String method)
Sets an Object instance and a callback method used to propagate some properties to the provided service properties.
|
<T> BundleDependencyBuilder |
remove(CbBundle<T> remove)
Sets a
callback method reference which is invoked when a bundle is removed. |
<T> BundleDependencyBuilder |
remove(CbBundleComponent<T> remove)
Sets a
callback method reference which is invoked when a bundle is removed. |
BundleDependencyBuilder |
remove(InstanceCbBundle remove)
Sets a method reference on an Object instance which is invoked when a bundle is removed.
|
BundleDependencyBuilder |
remove(InstanceCbBundleComponent remove)
Sets a
callback instance method reference which is invoked when a bundle is removed. |
BundleDependencyBuilder |
remove(java.lang.String callback)
Sets a "remove"
callback method to invoke on the component implementation instance(s). |
BundleDependencyBuilder |
required()
Sets the dependency to be required.
|
BundleDependencyBuilder |
required(boolean required)
Sets the dependency to be required.
|
build
BundleDependencyBuilder autoConfig(boolean autoConfig)
autoConfig
- true
to enable auto configurationBundleDependencyBuilder autoConfig()
BundleDependencyBuilder required(boolean required)
required
- true
if this bundle dependency is required.BundleDependencyBuilder required()
BundleDependencyBuilder optional()
BundleDependencyBuilder bundle(Bundle bundle)
bundle
- the bundle to depend onBundleDependencyBuilder filter(java.lang.String filter)
filter
- the filter conditionBundleDependencyBuilder mask(int mask)
mask
- the mask to useBundleDependencyBuilder propagate(boolean propagate)
true
any bundle manifest properties will be added
to the service properties of the component that declares this dependency (if it provides a service).propagate
- true
to propagate the bundle manifest propertiesBundleDependencyBuilder propagate()
BundleDependencyBuilder propagate(java.lang.Object instance, java.lang.String method)
instance
- the Object instance which is used to retrieve propagated service propertiesmethod
- the method to invoke for retrieving the properties to be propagated to the service properties.BundleDependencyBuilder propagate(java.util.function.Function<Bundle,java.util.Dictionary<?,?>> propagate)
propagate
- a function which accepts a Bundle argument and which returns some properties that will be
propagated to the provided component service properties.BundleDependencyBuilder add(java.lang.String callback)
callback
method to invoke on the component implementation instance(s).
The callback is invoked when the bundle is added, and the following signatures are supported:
callback
- the add callbackBundleDependencyBuilder change(java.lang.String callback)
callback
method to invoke on the component implementation instance(s).
The callback is invoked when the bundle state has changed, and the following signatures are supported:
callback
- the change callbackBundleDependencyBuilder remove(java.lang.String callback)
callback
method to invoke on the component implementation instance(s).
The callback is invoked when the bundle is removed, and the following signatures are supported:
callback
- the remove callbackBundleDependencyBuilder callbackInstance(java.lang.Object callbackInstance)
callbackInstance
- the instance to invoke the reflection based callbacks onadd(String)
,
change(String)
,
remove(String)
<T> BundleDependencyBuilder add(CbBundle<T> add)
callback
method reference which is invoked when a bundle is added.
The method reference must point to a Component implementation class method, and takes as argument a Bundle.T
- the type of the component implementation class on which the callback is invoked on.add
- the method reference invoked when a bundle is added.<T> BundleDependencyBuilder change(CbBundle<T> change)
callback
method reference which is invoked when a bundle is changed.
The method reference must point to a Component implementation class method, and takes as argument a Bundle.T
- the type of the component implementation class on which the callback is invoked on.change
- the method reference invoked when a bundle has changed.<T> BundleDependencyBuilder remove(CbBundle<T> remove)
callback
method reference which is invoked when a bundle is removed.
The method reference must point to a Component implementation class method, and takes as argument a Bundle.T
- the type of the component implementation class on which the callback is invoked on.remove
- the method reference invoked when a bundle is removed.<T> BundleDependencyBuilder add(CbBundleComponent<T> add)
callback
method reference which is invoked when a bundle is added.
The method reference must point to a Component implementation class method, and takes as argument a Bundle and a Component.T
- the type of the component implementation class on which the callback is invoked on.add
- the method reference invoked when a bundle is added.<T> BundleDependencyBuilder change(CbBundleComponent<T> change)
callback
method reference which is invoked when a bundle is changed.
The method reference must point to a Component implementation class method, and takes as argument a Bundle and a Component.T
- the type of the component implementation class on which the callback is invoked on.change
- the method reference invoked when a bundle has changed.<T> BundleDependencyBuilder remove(CbBundleComponent<T> remove)
callback
method reference which is invoked when a bundle is removed.
The method reference must point to a Component implementation class method, and takes as argument a Bundle and a Component.T
- the type of the component implementation class on which the callback is invoked on.remove
- the method reference invoked when a bundle is removed.BundleDependencyBuilder add(InstanceCbBundle add)
add
- the method reference invoked when a bundle is added.BundleDependencyBuilder change(InstanceCbBundle change)
change
- the method reference invoked when a bundle is changed.BundleDependencyBuilder remove(InstanceCbBundle remove)
remove
- the method reference invoked when a bundle is removed.BundleDependencyBuilder add(InstanceCbBundleComponent add)
callback instance
method reference which is invoked when a bundle is added.
The method reference must point to an Object instance method, and takes as arguments a Bundle and a Component.add
- the method reference invoked when a bundle is added.BundleDependencyBuilder change(InstanceCbBundleComponent change)
callback instance
method reference which is invoked when a bundle is changed.
The method reference must point to an Object instance method, and takes as argument a Bundle and a Component.change
- the method reference invoked when a bundle is changed.BundleDependencyBuilder remove(InstanceCbBundleComponent remove)
callback instance
method reference which is invoked when a bundle is removed.
The method reference must point to an Object instance method, and takes as argument a Bundle and a Component.remove
- the method reference invoked when a bundle is removed.