Package org.apache.felix.dm
Interface ResourceDependency
- All Superinterfaces:
ComponentDependencyDeclaration,Dependency,ResourceHandler
public interface ResourceDependency
extends Dependency, ComponentDependencyDeclaration, ResourceHandler
A resource dependency is a dependency on a resource. A resource in this context is an object that is
identified by a URL. Resources should somehow be provided by an external component, the resource
provider. These dependencies then react on them becoming available or not. Use cases for such dependencies
are resources that are embedded in bundles, in a workspace or some remote or local repository, etc.
When a resource is injected using callbacks, the following method signatures are supported:
(Component, URL, Dictionary)
(Component, URL)
(Component)
(URL, Dictionary)
(URL)
(Object)
- 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) Sets auto configuration for this service.setAutoConfig(String instanceName) Sets auto configuration for this service.setCallbacks(Object instance, String added, String removed) Sets the callbacks for this service.setCallbacks(Object instance, String added, String changed, String removed) Sets the callbacks for this service.setCallbacks(String added, String removed) Sets the callbacks for this service.setCallbacks(String added, String changed, String removed) Sets the callbacks for this service.Sets the filter condition for this resource dependency.setPropagate(boolean propagate) 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) Determines if this is a required dependency or not.setResource(URL resource) Sets the resource for this dependency.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 service. 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 service was addedremoved- the method to call when a service was removed- Returns:
- this service dependency
-
setCallbacks
Sets the callbacks for this service. 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 service was addedchanged- the method to call when a service was changedremoved- the method to call when a service was removed- Returns:
- this service dependency
-
setCallbacks
Sets the callbacks for this service. 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 service was addedremoved- the method to call when a service was removed- Returns:
- this service dependency
-
setCallbacks
Sets the callbacks for this service. 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 service was addedchanged- the method to call when a service was changedremoved- the method to call when a service was removed- Returns:
- this service dependency
-
setAutoConfig
Sets auto configuration for this service. Auto configuration allows the dependency to fill in any attributes in the service implementation that are of the same type as this dependency. Default is on.- Parameters:
autoConfig- the value of auto config- Returns:
- this service dependency
-
setAutoConfig
Sets auto configuration for this service. Auto configuration allows the dependency to fill in the attribute in the service implementation that has the same type and instance name.- Parameters:
instanceName- the name of attribute to auto config- Returns:
- this service dependency
-
setResource
Sets the resource for this dependency.- Parameters:
resource- the URL of the resource
-
setRequired
Determines if this is a required dependency or not.- Parameters:
required-trueif the dependency is required
-
setFilter
Sets the filter condition for this resource dependency.- Parameters:
resourceFilter- the filter condition
-
setPropagate
- See Also:
-
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.
-