Package org.apache.felix.dm
Interface BundleDependency
- All Superinterfaces:
ComponentDependencyDeclaration,Dependency
- Author:
- Felix Project Team
-
Field Summary
Fields inherited from interface org.apache.felix.dm.ComponentDependencyDeclaration
STATE_AVAILABLE_OPTIONAL, STATE_AVAILABLE_REQUIRED, STATE_NAMES, STATE_OPTIONAL, STATE_REQUIRED, STATE_UNAVAILABLE_OPTIONAL, STATE_UNAVAILABLE_REQUIRED -
Method Summary
Modifier and TypeMethodDescriptionsetAutoConfig(boolean autoConfig) Enables auto configuration for this dependency.setBundle(org.osgi.framework.Bundle bundle) Sets the bundle to depend on directly.setCallbacks(Object instance, String added, String removed) Sets the callbacks for this dependency.setCallbacks(Object instance, String added, String changed, String removed) Sets the callbacks for this dependency.setCallbacks(String added, String removed) Sets the callbacks for this dependency.setCallbacks(String added, String changed, String removed) Sets the callbacks for this dependency.Sets the filter condition to depend on.setPropagate(boolean propagate) Sets property propagation.setPropagate(Object instance, String method) Sets an Object instance and a callback method used to propagate some properties to the provided service properties.setRequired(boolean required) Sets the dependency to be required.setStateMask(int mask) Sets the bundle state mask to depend on.Methods inherited from interface org.apache.felix.dm.ComponentDependencyDeclaration
getFilter, getName, getSimpleName, getState, getTypeMethods inherited from interface org.apache.felix.dm.Dependency
getAutoConfigName, getProperties, isAutoConfig, isAvailable, isPropagated, isRequired, overrideServiceProperties
-
Method Details
-
setCallbacks
Sets the callbacks for this dependency. These callbacks can be used as hooks whenever a dependency is added or removed. When you specify callbacks, the auto configuration feature is automatically turned off, because we're assuming you don't need it in this case.- Parameters:
added- the method to call when a bundle was addedremoved- the method to call when a bundle was removed- Returns:
- the bundle dependency
-
setCallbacks
Sets the callbacks for this dependency. These callbacks can be used as hooks whenever a dependency is added, changed or removed. When you specify callbacks, the auto configuration feature is automatically turned off, because we're assuming you don't need it in this case.- Parameters:
added- the method to call when a bundle was addedchanged- the method to call when a bundle was changedremoved- the method to call when a bundle was removed- Returns:
- the bundle dependency
-
setCallbacks
Sets the callbacks for this dependency. These callbacks can be used as hooks whenever a dependency is added or removed. They are called on the instance you provide. When you specify callbacks, the auto configuration feature is automatically turned off, because we're assuming you don't need it in this case.- Parameters:
instance- the instance to call the callbacks onadded- the method to call when a bundle was addedremoved- the method to call when a bundle was removed- Returns:
- the bundle dependency
-
setCallbacks
Sets the callbacks for this dependency. These callbacks can be used as hooks whenever a dependency is added, changed or removed. They are called on the instance you provide. When you specify callbacks, the auto configuration feature is automatically turned off, because we're assuming you don't need it in this case.- Parameters:
instance- the instance to call the callbacks onadded- the method to call when a bundle was addedchanged- the method to call when a bundle was changedremoved- the method to call when a bundle was removed- Returns:
- the bundle dependency
-
setAutoConfig
Enables auto configuration for this dependency. This means the component implementation (composition) will be injected with this bundle dependency automatically.- Parameters:
autoConfig-trueto enable auto configuration- Returns:
- the bundle dependency
-
setRequired
Sets the dependency to be required.- Parameters:
required-trueif this bundle dependency is required- Returns:
- the bundle dependency
-
setBundle
Sets the bundle to depend on directly.- Parameters:
bundle- the bundle to depend on- Returns:
- the bundle dependency
-
setFilter
Sets the filter condition to depend on. Filters are matched against the full manifest of a bundle.- Parameters:
filter- the filter condition- Returns:
- the bundle dependency
- Throws:
IllegalArgumentException- if the filter is invalid
-
setStateMask
Sets the bundle state mask to depend on. The OSGi BundleTracker explains this mask in more detail, but it is basically a mask with flags for each potential state a bundle can be in.- Parameters:
mask- the mask to use- Returns:
- the bundle dependency
-
setPropagate
Sets property propagation. If set totrueany bundle manifest properties will be added to the service properties of the component that has this dependency (if it registers as a service). The provided service properties take precedence over the propagated bundle manifest headers. It means a bundle manifest header won't override a component service property having the same name.- Parameters:
propagate-trueto propagate the bundle manifest properties- Returns:
- the bundle dependency
-
setPropagate
Sets an Object instance and a callback method used to propagate some properties to the provided service properties. The method will be invoked on the specified object instance and must have one of the following signatures:- Dictionary callback(ServiceReference, Object service)
- Dictionary callback(ServiceReference)
- Parameters:
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.- Returns:
- this service dependency.
-