public interface DependencyContext extends Dependency
AbstractDependency} which already implements most of the methods from this interface.
Modifier and Type | Method and Description |
---|---|
void |
copyToCollection(java.util.Collection<java.lang.Object> coll)
Copies all the dependency service instances to the given collection.
|
void |
copyToMap(java.util.Map<java.lang.Object,java.util.Dictionary<?,?>> map)
Copies all the dependency service instances to the given map (key = dependency service, value = dependency servie properties).
|
DependencyContext |
createCopy()
Creates a clone of this dependency.
|
java.lang.Class<?> |
getAutoConfigType()
Returns the type of the field which can be injected with the dependency service.
|
ComponentContext |
getComponentContext()
Returns the Component implementation context associated to this Dependency context.
|
Event |
getService()
Returns the highest ranked available dependency service instance, or null if the dependency is unavailable.
|
void |
invokeCallback(EventType type,
Event... events)
The Component implementation asks this dependency to invoke a component dependency callback.
|
boolean |
isInstanceBound()
Is this dependency instance bound ?
|
boolean |
isStarted()
Returns true if the dependency has been started, false if not
|
boolean |
needsInstance()
Does this dependency need the component instances to determine if the dependency is available or not.
|
void |
setAvailable(boolean available)
Sets this dependency as available, meaning that at least one dependency service is available.
|
void |
setComponentContext(ComponentContext component)
Stores the Component implementation context in the Dependency Implementation.
|
void |
setInstanceBound(boolean instanceBound)
Sets this dependency as "instance bound".
|
void |
start()
Invoked by the component context when the dependency should start working.
|
void |
stop()
Invoked by the component context when the dependency should stop working.
|
getAutoConfigName, getProperties, isAutoConfig, isAvailable, isPropagated, isRequired, overrideServiceProperties
void setComponentContext(ComponentContext component)
component
- the Component implementation contextComponentContext getComponentContext()
void invokeCallback(EventType type, Event... events)
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.ComponentContext.handleEvent(DependencyContext, EventType, Event...)
,
EventType
void start()
void stop()
boolean isStarted()
void setAvailable(boolean available)
available
- true to mark this dependency as available, false to mark it as unavailablevoid setInstanceBound(boolean instanceBound)
true
- if the dependency has to be marked as "intance bound", false if not.boolean isInstanceBound()
boolean needsInstance()
java.lang.Class<?> getAutoConfigType()
Event getService()
void copyToCollection(java.util.Collection<java.lang.Object> coll)
coll
- the collection where the dependency service instances will be copiedvoid copyToMap(java.util.Map<java.lang.Object,java.util.Dictionary<?,?>> map)
map
- the map where the dependency service instances (with the corresponding service properties)DependencyContext createCopy()