public class PlatformComponent extends java.lang.Object implements IPlatformComponentAccess
Modifier and Type | Class and Description |
---|---|
protected class |
PlatformComponent.ExternalAccessInvocationHandler
Nested class for service annotation.
|
Modifier and Type | Field and Description |
---|---|
protected java.lang.Exception |
exception
The failure reason (if any).
|
protected java.util.Map<java.lang.Class<?>,IComponentFeature> |
features
The features.
|
protected IValueFetcher |
fetcher
The combined value fetcher (cached for speed).
|
protected IInternalAccess |
ia
The internal access.
|
protected java.util.List<IComponentFeature> |
ifeatures
The inited feature instances as list (for shutdown after failed init).
|
protected ComponentCreationInfo |
info
The creation info.
|
protected java.util.List<IComponentFeature> |
lfeatures
The feature instances as list (for reverse execution, cached for speed).
|
protected java.util.logging.Logger |
logger
The logger.
|
static java.lang.String |
PROPERTY_TERMINATION_TIMEOUT
Property name for timeout after which component long running cleanup is forcefully aborted.
|
protected boolean |
shutdown
The shutdown flag (set on start of shutdown).
|
static java.util.Set<java.lang.String> |
SUSPEND_METHOD_EXEMPTIONS
External access method exempt from component suspension.
|
Constructor and Description |
---|
PlatformComponent() |
Modifier and Type | Method and Description |
---|---|
IFuture<java.lang.Void> |
body()
Perform the main execution of the component (if any).
|
IFuture<java.lang.Void> |
childTerminated(IComponentDescription desc,
java.lang.Exception exception)
Called when a child had an exception and was terminated.
|
void |
create(ComponentCreationInfo info,
java.util.Collection<IComponentFeatureFactory> facs)
Create the component, i.e.
|
ITuple2Future<IComponentIdentifier,java.util.Map<java.lang.String,java.lang.Object>> |
createComponent(CreationInfo info)
Create a new component on the platform.
|
IFuture<IExternalAccess> |
createComponent(CreationInfo info,
IResultListener<java.util.Collection<Tuple2<java.lang.String,java.lang.Object>>> resultlistener)
Add a new component as subcomponent of this component.
|
ISubscriptionIntermediateFuture<CMSStatusEvent> |
createComponentWithResults(CreationInfo info)
Add a new component as subcomponent of this component.
|
protected IFuture<java.lang.Void> |
executeBodyOnFeatures(java.util.Iterator<IComponentFeature> features)
Execute feature bodies in parallel.
|
protected IFuture<java.lang.Void> |
executeInitOnFeatures(java.util.Iterator<IComponentFeature> features)
Recursively init the features.
|
protected void |
executeKillOnFeatures(java.util.List<IComponentFeature> features)
Kill the features in inverse order.
|
protected IFuture<java.lang.Void> |
executeShutdownOnFeatures(java.util.List<IComponentFeature> features)
Recursively shutdown the features in inverse order.
|
java.lang.Object |
getArgument(java.lang.String name)
Deprecated.
From 3.0. Use getComponentFeature(IArgumentsResultsFeature.class).getArguments()
Get an argument value per name.
|
IFuture<IComponentIdentifier[]> |
getChildren(java.lang.String type,
IComponentIdentifier parent)
Get the children (if any).
|
java.lang.ClassLoader |
getClassLoader()
Get the class loader of the component.
|
java.lang.String |
getComponentFilename(java.lang.String type)
Get the file name for a logical type name of a subcomponent of this application.
|
java.lang.String |
getConfiguration()
Get the start configuration or the default configuration if any.
|
IComponentDescription |
getDescription()
Get the component description.
|
IFuture<IComponentDescription> |
getDescription(IComponentIdentifier cid)
Get the component description.
|
int |
getEndstateStart()
Get the step number when endstate began.
|
java.lang.Exception |
getException()
Get the exception, if any.
|
IExternalAccess |
getExternalAccess()
Get the external access.
|
IExternalAccess |
getExternalAccess(IComponentIdentifier cid)
Get the external access for a component id.
|
static <T> T |
getExternalFeature(java.lang.Class<T> iface,
java.lang.ClassLoader cl,
java.lang.Object original)
Get external feature wrapper.
|
<T> T |
getFeature(java.lang.Class<? extends T> type)
Get a feature of the component.
|
<T> T |
getFeature0(java.lang.Class<? extends T> type)
Get a feature of the component.
|
IValueFetcher |
getFetcher()
Get the fetcher.
|
IComponentIdentifier |
getId()
Get the id of the component.
|
IInternalAccess |
getInternalAccess()
Get the user view of this platform component.
|
java.util.logging.Logger |
getLogger()
Get the logger.
|
static java.lang.String |
getLoggerName(IComponentIdentifier cid)
Get the logger name.
|
IModelInfo |
getModel()
Get the model of the component.
|
IFuture<IModelInfo> |
getModelAsync()
Get the model of the component.
|
IParameterGuesser |
getParameterGuesser()
Get the parameter guesser.
|
PlatformComponent |
getPlatformComponent()
Get the platform component.
|
IFuture<java.lang.Void> |
init()
Perform the initialization of the component.
|
protected void |
initLogger(java.util.logging.Logger logger)
Init the logger with capability settings.
|
IFuture<java.util.Map<java.lang.String,java.lang.Object>> |
killComponent()
Kill the component.
|
IFuture<java.util.Map<java.lang.String,java.lang.Object>> |
killComponent(java.lang.Exception e)
Kill the component.
|
IFuture<java.util.Map<java.lang.String,java.lang.Object>> |
killComponent(IComponentIdentifier cid)
Kill the component.
|
ISubscriptionIntermediateFuture<CMSStatusEvent> |
listenToComponent(IComponentIdentifier cid)
Add a component listener for a specific component.
|
CreationInfo |
prepare(CreationInfo info)
Helper method for preparing the creation info.
|
IFuture<java.lang.Void> |
resumeComponent(IComponentIdentifier componentid)
Resume the execution of an component.
|
IFuture<IComponentDescription[]> |
searchComponents(IComponentDescription adesc,
ISearchConstraints con)
Search for components matching the given description.
|
IFuture<java.lang.Void> |
setComponentBreakpoints(IComponentIdentifier cid,
java.lang.String[] breakpoints)
Set breakpoints for a component.
|
protected void |
setInternalAccess(IInternalAccess ia)
Set the internal access (proxy).
|
IFuture<java.lang.Void> |
shutdown()
Perform the shutdown of the component (if any).
|
IFuture<java.lang.Void> |
stepComponent(IComponentIdentifier cid,
java.lang.String stepinfo)
Execute a step of a suspended component.
|
IFuture<java.lang.Void> |
suspendComponent(IComponentIdentifier componentid)
Suspend the execution of an component.
|
java.lang.String |
toString()
Get a string representation.
|
public static final java.lang.String PROPERTY_TERMINATION_TIMEOUT
public static final java.util.Set<java.lang.String> SUSPEND_METHOD_EXEMPTIONS
protected IInternalAccess ia
protected ComponentCreationInfo info
protected java.util.Map<java.lang.Class<?>,IComponentFeature> features
protected java.util.List<IComponentFeature> lfeatures
protected java.util.List<IComponentFeature> ifeatures
protected java.util.logging.Logger logger
protected java.lang.Exception exception
protected IValueFetcher fetcher
protected boolean shutdown
public void create(ComponentCreationInfo info, java.util.Collection<IComponentFeatureFactory> facs)
create
in interface IPlatformComponentAccess
info
- The component creation info.platformdata
- The shared objects for all components of the same platform (registry etc.). See starter for available data.facs
- The factories for component features to be instantiated for this component.protected void setInternalAccess(IInternalAccess ia)
ia
- The internal access.public IFuture<java.lang.Void> init()
init
in interface IPlatformComponentAccess
public IFuture<java.lang.Void> body()
body
in interface IPlatformComponentAccess
public IFuture<java.lang.Void> shutdown()
shutdown
in interface IPlatformComponentAccess
public IFuture<java.lang.Void> childTerminated(IComponentDescription desc, java.lang.Exception exception)
childTerminated
in interface IPlatformComponentAccess
protected IFuture<java.lang.Void> executeInitOnFeatures(java.util.Iterator<IComponentFeature> features)
protected IFuture<java.lang.Void> executeBodyOnFeatures(java.util.Iterator<IComponentFeature> features)
protected IFuture<java.lang.Void> executeShutdownOnFeatures(java.util.List<IComponentFeature> features)
protected void executeKillOnFeatures(java.util.List<IComponentFeature> features)
public IInternalAccess getInternalAccess()
getInternalAccess
in interface IPlatformComponentAccess
public java.lang.Exception getException()
public java.lang.Object getArgument(java.lang.String name)
name
- The argument name.public IModelInfo getModel()
public IFuture<IModelInfo> getModelAsync()
public java.lang.String getConfiguration()
public IComponentIdentifier getId()
public IComponentDescription getDescription()
public IFuture<IComponentDescription> getDescription(IComponentIdentifier cid)
public <T> T getFeature(java.lang.Class<? extends T> type)
feature
- The type of the feature.public <T> T getFeature0(java.lang.Class<? extends T> type)
feature
- The type of the feature.public IFuture<java.util.Map<java.lang.String,java.lang.Object>> killComponent()
public IFuture<java.util.Map<java.lang.String,java.lang.Object>> killComponent(java.lang.Exception e)
e
- The failure reason, if any.public IFuture<java.util.Map<java.lang.String,java.lang.Object>> killComponent(IComponentIdentifier cid)
e
- The failure reason, if any.public IExternalAccess getExternalAccess()
public static <T> T getExternalFeature(java.lang.Class<T> iface, java.lang.ClassLoader cl, java.lang.Object original)
iface
- args
- public java.util.logging.Logger getLogger()
public static java.lang.String getLoggerName(IComponentIdentifier cid)
cid
- The component identifier.protected void initLogger(java.util.logging.Logger logger)
logger
- The logger.public IValueFetcher getFetcher()
public IParameterGuesser getParameterGuesser()
public java.lang.ClassLoader getClassLoader()
public IFuture<IComponentIdentifier[]> getChildren(java.lang.String type, IComponentIdentifier parent)
public java.lang.String getComponentFilename(java.lang.String type)
public int getEndstateStart()
public IExternalAccess getExternalAccess(IComponentIdentifier cid)
cid
- The component id.public IFuture<IExternalAccess> createComponent(CreationInfo info, IResultListener<java.util.Collection<Tuple2<java.lang.String,java.lang.Object>>> resultlistener)
component
- The model or pojo of the component.public ISubscriptionIntermediateFuture<CMSStatusEvent> createComponentWithResults(CreationInfo info)
component
- The model or pojo of the component.public ITuple2Future<IComponentIdentifier,java.util.Map<java.lang.String,java.lang.Object>> createComponent(CreationInfo info)
name
- The component name or null for automatic generation.model
- The model identifier (e.g. file name).info
- Additional start information such as parent component or arguments (optional).public CreationInfo prepare(CreationInfo info)
component
- The pojo or filenameinfo
- The creation info.public IFuture<java.lang.Void> suspendComponent(IComponentIdentifier componentid)
componentid
- The component identifier.public IFuture<java.lang.Void> resumeComponent(IComponentIdentifier componentid)
componentid
- The component identifier.public IFuture<java.lang.Void> stepComponent(IComponentIdentifier cid, java.lang.String stepinfo)
componentid
- The component identifier.listener
- Called when the step is finished (result will be the component description).public IFuture<java.lang.Void> setComponentBreakpoints(IComponentIdentifier cid, java.lang.String[] breakpoints)
componentid
- The component identifier.breakpoints
- The new breakpoints (if any).public ISubscriptionIntermediateFuture<CMSStatusEvent> listenToComponent(IComponentIdentifier cid)
cid
- The component to be listened.public IFuture<IComponentDescription[]> searchComponents(IComponentDescription adesc, ISearchConstraints con)
public PlatformComponent getPlatformComponent()
getPlatformComponent
in interface IPlatformComponentAccess
public java.lang.String toString()
toString
in class java.lang.Object