public interface ComponentContext<T extends Component<T>> extends Component<T>
interfaceComponent.ServiceScope| Modifier and Type | Method and Description |
|---|---|
<U> U |
createConfigurationType(java.lang.Class<U> type,
java.util.Dictionary<?,?> config)
Creates a configuration for a given type backed by a given dictionary.
|
boolean |
getAutoConfig(java.lang.Class<?> clazz)
Indicates if an object of the given class can be injected in one field of the component
|
java.lang.String |
getAutoConfigInstance(java.lang.Class<?> clazz)
Returns the component instance field that is assignable to a given class type
|
Bundle |
getBundle()
Returns the Compoent's bundle.
|
BundleContext |
getBundleContext()
Returns the Component's bundle context
|
java.util.List<DependencyContext> |
getDependencies()
Returns the list of dependencies that has been registered on this component
|
Event |
getDependencyEvent(DependencyContext dc)
Returns the highest ranked dependency service instance for a given dependency
|
java.util.Set<Event> |
getDependencyEvents(DependencyContext dc)
Returns all the available dependency services for a given dependency
|
java.util.concurrent.Executor |
getExecutor()
Returns the Component Executor gate that can be used to ensure proper component event serialization.
|
java.lang.Object[] |
getInstances()
Returns the component instances
|
Logger |
getLogger()
Returns the logger which can be used by the DependencyManager Dependencies implementations.
|
void |
handleEvent(DependencyContext dc,
EventType type,
Event... event)
Notifies the Component about a dependency event.
|
boolean |
injectionDisabled()
Indicates if the component fields and methods injections are disabled.
|
ComponentContext |
instantiateComponent()
Instantiates the component instances.
|
void |
invokeCallback(java.lang.Object[] instances,
java.lang.String methodName,
java.lang.Class<?>[][] signatures,
java.util.function.Supplier<?>[][] paramsSupplier,
boolean logIfNotFound)
Invokes a callback method on a given set of objects.
|
void |
invokeCallbackMethod(java.lang.Object[] instances,
java.lang.String methodName,
java.lang.Class<?>[][] signatures,
java.lang.Object[][] parameters)
Invokes a callback method on a given set of objects.
|
void |
invokeCallbackMethod(java.lang.Object[] instances,
java.lang.String methodName,
java.lang.Class<?>[][] signatures,
java.lang.Object[][] parameters,
boolean logIfNotFound)
Invokes a callback method on a given set of objects.
|
boolean |
isActive()
Is this component already started ?
|
boolean |
isAvailable()
Is this component available (all required dependencies are available) ?
|
void |
setThreadPool(java.util.concurrent.Executor threadPool)
Sets a threadpool that the component will use when handling external events
|
void |
start()
Starts the component.
|
void |
stop()
Stops the component.
|
add, add, getServiceRegistration, remove, remove, setAutoConfig, setAutoConfig, setCallbacks, setCallbacks, setComposition, setComposition, setDebug, setFactory, setFactory, setImplementation, setInterface, setInterface, setInterface, setInterface, setScope, setServicePropertiesgetComponentDeclaration, getDependencyManager, getInstance, getServicePropertiesjava.util.concurrent.Executor getExecutor()
Logger getLogger()
BundleContext getBundleContext()
Bundle getBundle()
void setThreadPool(java.util.concurrent.Executor threadPool)
threadPool - a threadpool used to handle component events and invoke the component's lifecycle callbacksvoid start()
void stop()
boolean isActive()
boolean isAvailable()
void handleEvent(DependencyContext dc, EventType type, Event... event)
EventType.ADDED)
EventType.CHANGED)
EventType.REMOVED)
EventType.SWAPPED)
dc - the dependencytype - the dependency event typee - the dependency eventEventTypejava.util.List<DependencyContext> getDependencies()
void invokeCallbackMethod(java.lang.Object[] instances,
java.lang.String methodName,
java.lang.Class<?>[][] signatures,
java.lang.Object[][] parameters)
instances - the component instancesmethodName - the method namesignatures - the method signatures (types)parameters - the method parametersvoid invokeCallbackMethod(java.lang.Object[] instances,
java.lang.String methodName,
java.lang.Class<?>[][] signatures,
java.lang.Object[][] parameters,
boolean logIfNotFound)
instances - the component instancesmethodName - the method namesignatures - the method signatures (types)parameters - the method parameterslogIfNotFound - true if a warning message should be logged in case the callback is not found in any of the object instances.void invokeCallback(java.lang.Object[] instances,
java.lang.String methodName,
java.lang.Class<?>[][] signatures,
java.util.function.Supplier<?>[][] paramsSupplier,
boolean logIfNotFound)
instances - the component instancesmethodName - the method namesignatures - the method signatures (types)paramsSupplier - the supplier for the method parameterslogIfNotFound - true if a warning message should be logged in case the callback is not found in any of the object instances.java.lang.Object[] getInstances()
getInstances in interface AbstractComponentjava.lang.String getAutoConfigInstance(java.lang.Class<?> clazz)
clazz - the type of an object that has to be injected in the component instance fieldboolean getAutoConfig(java.lang.Class<?> clazz)
clazz - the class of an object that has to be injected in one of the component fieldsEvent getDependencyEvent(DependencyContext dc)
dc - the dependencyjava.util.Set<Event> getDependencyEvents(DependencyContext dc)
dc - the dependency<U> U createConfigurationType(java.lang.Class<U> type,
java.util.Dictionary<?,?> config)
type - the configuration class, cannot be null;config - the configuration to wrap, cannot be null.ComponentContext instantiateComponent()
boolean injectionDisabled()