public abstract class ConfigurableComponentHolder<S> extends Object implements ComponentHolder<S>, ComponentContainer<S>
ConfigurableComponentHolder
class is a
ComponentHolder
for automatically configured components instances
that may or may not be configured through Config Admin.
The holder copes with three situations:
service.pid
or
service.factoryPid
equals the component name.service.pid
equals the component name.service.factoryPid
equals the component name.Constructor and Description |
---|
ConfigurableComponentHolder(ComponentActivator activator,
ComponentMetadata metadata,
ComponentLogger logger) |
Modifier and Type | Method and Description |
---|---|
void |
configurationDeleted(TargetedPID pid,
TargetedPID factoryPid)
The configuration with the given
pid
(service.pid of the configuration object) is deleted. |
boolean |
configurationUpdated(TargetedPID pid,
TargetedPID factoryPid,
Dictionary<String,Object> props,
long changeCount)
Configures a component with the given configuration.
|
protected static void |
copyTo(Map<String,Object> target,
Dictionary<String,?> source) |
protected AbstractComponentManager<S> |
createComponentManager(boolean factoryConfiguration) |
protected abstract ComponentMethods<S> |
createComponentMethods() |
org.osgi.util.promise.Promise<Void> |
disableComponents(boolean async)
Disables all components of this holder.
|
void |
disposeComponents(int reason)
Disposes off all components of this holder.
|
void |
disposed(SingleComponentManager<S> component)
Informs the holder that the component has been disposed as a result of
calling the dispose method.
|
org.osgi.util.promise.Promise<Void> |
enableComponents(boolean async)
Enables all components of this holder and if satisfied activates
them.
|
boolean |
equals(Object object)
Compares this
ImmediateComponentHolder object to another object. |
ComponentActivator |
getActivator()
Returns the
ComponentActivator owning this component
holder. |
ComponentMetadata |
getComponentMetadata()
Returns the
ComponentMetadata describing and declaring this
component. |
protected ComponentMethods<S> |
getComponentMethods() |
List<? extends ComponentManager<?>> |
getComponents()
Returns all
Component instances held by this holder. |
TargetedPID |
getConfigurationTargetedPID(TargetedPID pid,
TargetedPID factoryPid)
Returns the targeted PID used to configure this component
|
ComponentLogger |
getLogger() |
int |
hashCode()
Returns a hash code value for the object.
|
boolean |
isEnabled()
whether the component is currently enabled
|
String |
toString() |
public ConfigurableComponentHolder(ComponentActivator activator, ComponentMetadata metadata, ComponentLogger logger)
protected abstract ComponentMethods<S> createComponentMethods()
protected ComponentMethods<S> getComponentMethods()
protected AbstractComponentManager<S> createComponentManager(boolean factoryConfiguration)
public final ComponentActivator getActivator()
ComponentHolder
ComponentActivator
owning this component
holder. (overlaps ComponentContaienr)getActivator
in interface ComponentContainer<S>
getActivator
in interface ComponentHolder<S>
public final ComponentMetadata getComponentMetadata()
ComponentHolder
ComponentMetadata
describing and declaring this
component. (overlaps ComponentContaienr)getComponentMetadata
in interface ComponentContainer<S>
getComponentMetadata
in interface ComponentHolder<S>
public void configurationDeleted(TargetedPID pid, TargetedPID factoryPid)
pid
(service.pid
of the configuration object) is deleted.
The following situations are supported:
configurationDeleted
in interface ComponentHolder<S>
pid
- The PID of the deleted configurationfactoryPid
- The factory PID of the deleted configurationpublic boolean configurationUpdated(TargetedPID pid, TargetedPID factoryPid, Dictionary<String,Object> props, long changeCount)
pid
equals the component name. Hence we have a
singleton configuration for the single component held by this holderconfigurationUpdated
in interface ComponentHolder<S>
pid
- Targeted PID for the configurationfactoryPid
- the (targeted) factory pid or null for a singleton pidprops
- the property dictionary from the configuration.changeCount
- change count of the configuration, or R4 imitation.protected static void copyTo(Map<String,Object> target, Dictionary<String,?> source)
public List<? extends ComponentManager<?>> getComponents()
ComponentHolder
Component
instances held by this holder.getComponents
in interface ComponentHolder<S>
public boolean isEnabled()
ComponentHolder
isEnabled
in interface ComponentHolder<S>
public org.osgi.util.promise.Promise<Void> enableComponents(boolean async)
ComponentHolder
enableComponents
in interface ComponentHolder<S>
async
- Whether the actual activation should take place
asynchronously or not.public org.osgi.util.promise.Promise<Void> disableComponents(boolean async)
ComponentHolder
disableComponents
in interface ComponentHolder<S>
async
- Whether the actual deactivation should take place
asynchronously or not.public void disposeComponents(int reason)
ComponentHolder
disposeComponents
in interface ComponentHolder<S>
public void disposed(SingleComponentManager<S> component)
ComponentContainer
disposed
in interface ComponentContainer<S>
public boolean equals(Object object)
ImmediateComponentHolder
object to another object.
A ImmediateComponentHolder is considered to be equal to another
ImmediateComponentHolder if the component names are equal(using
String.equals
) and they have the same bundle activator
public int hashCode()
public ComponentLogger getLogger()
getLogger
in interface ComponentContainer<S>
public TargetedPID getConfigurationTargetedPID(TargetedPID pid, TargetedPID factoryPid)
ComponentHolder
getConfigurationTargetedPID
in interface ComponentHolder<S>
pid
- a targetedPID containing the service pid for the component desired (the rest of the targeted pid is ignored)factoryPid
- a targetedPID containing the factory pid for the component desired.Copyright © 2006–2020 The Apache Software Foundation. All rights reserved.