Package org.apache.felix.dm.context
Interface DependencyContext
- All Superinterfaces:
Dependency
- All Known Implementing Classes:
AbstractDependency
Every DependencyManager Dependency implementations must implement this interface.
- Author:
- Felix Project Team
-
Method Summary
Modifier and TypeMethodDescriptionvoidcopyToCollection(Collection<Object> coll) Copies all the dependency service instances to the given collection.voidcopyToMap(Map<Object, Dictionary<?, ?>> map) Copies all the dependency service instances to the given map (key = dependency service, value = dependency servie properties).Creates a clone of this dependency.Class<?> Returns the type of the field which can be injected with the dependency service.Returns the Component implementation context associated to this Dependency context.Returns the highest ranked available dependency service instance, or null if the dependency is unavailable.voidinvokeCallback(EventType type, Event... events) The Component implementation asks this dependency to invoke a component dependency callback.booleanIs this dependency instance bound ?booleanReturns true if the dependency has been started, false if notbooleanDoes this dependency need the component instances to determine if the dependency is available or not.voidsetAvailable(boolean available) Sets this dependency as available, meaning that at least one dependency service is available.voidsetComponentContext(ComponentContext component) Stores the Component implementation context in the Dependency Implementation.voidsetInstanceBound(boolean instanceBound) Sets this dependency as "instance bound".voidstart()Invoked by the component context when the dependency should start working.voidstop()Invoked by the component context when the dependency should stop working.Methods inherited from interface org.apache.felix.dm.Dependency
getAutoConfigName, getProperties, isAutoConfig, isAvailable, isPropagated, isRequired, overrideServiceProperties
-
Method Details
-
setComponentContext
Stores the Component implementation context in the Dependency Implementation. This object is the entry point to the Component implementation.- Parameters:
component- the Component implementation context
-
getComponentContext
ComponentContext getComponentContext()Returns the Component implementation context associated to this Dependency context. -
invokeCallback
The Component implementation asks this dependency to invoke a component dependency callback.- Parameters:
type- the type of the callback to invoke (add/change/remove/swap ...)events- the dependency service event(s) that has previously been submitted to the component implementation using the ComponentContext.handleEvent method. The number of events depends on the event type: one event for ADDED/CHANGED/REMOVED, and two events for the SWAPPED event.- See Also:
-
start
void start()Invoked by the component context when the dependency should start working. -
stop
void stop()Invoked by the component context when the dependency should stop working. -
isStarted
boolean isStarted()Returns true if the dependency has been started, false if not- Returns:
- true if the dependency has been started, false if not
-
setAvailable
void setAvailable(boolean available) Sets this dependency as available, meaning that at least one dependency service is available.- Parameters:
available- true to mark this dependency as available, false to mark it as unavailable
-
setInstanceBound
void setInstanceBound(boolean instanceBound) Sets this dependency as "instance bound". A dependency is "instance bound" if it is defined from the component's init method.- Parameters:
true- if the dependency has to be marked as "intance bound", false if not.
-
isInstanceBound
boolean isInstanceBound()Is this dependency instance bound ?- Returns:
- true if this dependency is instance bound, false if not
-
needsInstance
boolean needsInstance()Does this dependency need the component instances to determine if the dependency is available or not.- Returns:
- true if the dependency need the component instances before it can be started, false if not.
-
getAutoConfigType
Class<?> getAutoConfigType()Returns the type of the field which can be injected with the dependency service.- Returns:
- the type of the field which can be injected with the dependency service, or null if the dependency does not support auto config mode.
-
getService
Event getService()Returns the highest ranked available dependency service instance, or null if the dependency is unavailable.- Returns:
- the highest ranked available dependency service instance, or null
-
copyToCollection
Copies all the dependency service instances to the given collection.- Parameters:
coll- the collection where the dependency service instances will be copied
-
copyToMap
Copies all the dependency service instances to the given map (key = dependency service, value = dependency servie properties).- Parameters:
map- the map where the dependency service instances (with the corresponding service properties)
-
createCopy
DependencyContext createCopy()Creates a clone of this dependency.- Returns:
- a clone of this dependency.
-