public class SComponentManagementService
extends java.lang.Object
Constructor and Description |
---|
SComponentManagementService() |
Modifier and Type | Method and Description |
---|---|
protected static void |
addParentLocking(CreationInfo cinfo,
IInternalAccess agent,
Future<IComponentIdentifier> inited)
Add the locking of the parent while subcomponent is created.
|
protected static IFuture<java.lang.Void> |
addSubcomponent(IInternalAccess pad,
IComponentDescription ad,
IModelInfo lmodel,
IInternalAccess agent)
Add a new component to its parent.
|
protected static void |
cleanup(IComponentIdentifier cid,
java.lang.Exception exception) |
static ISubscriptionIntermediateFuture<CMSStatusEvent> |
createComponent(CreationInfo info,
java.lang.String name,
java.lang.String model,
IInternalAccess agent)
Create a new component on the platform.
|
static ITuple2Future<IComponentIdentifier,java.util.Map<java.lang.String,java.lang.Object>> |
createComponent(java.lang.String name,
java.lang.String model,
CreationInfo info,
IInternalAccess agent)
Create a new component on the platform.
|
static IFuture<IComponentIdentifier> |
createComponent(java.lang.String oname,
java.lang.String modelname,
CreationInfo info,
IResultListener<java.util.Collection<Tuple2<java.lang.String,java.lang.Object>>> resultlistener,
IInternalAccess agent)
Create a new component on the platform.
|
static IPlatformComponentAccess |
createPlatformComponent(java.lang.ClassLoader classloader)
Create a platform component.
|
protected static <T> IResultListener<T> |
createResultListener(IInternalAccess agent,
IResultListener<T> listener)
Create result listener that tolerates when agent is null at shutdown.
|
protected static void |
destroyComponent(IComponentIdentifier cid,
Future<java.util.Map<java.lang.String,java.lang.Object>> ret,
IInternalAccess agent)
This method is guaranteed to be called exactly ONCE and represents
the internal destroy method that performs the actual cleanup work.
|
static IFuture<java.util.Map<java.lang.String,java.lang.Object>> |
destroyComponent(IComponentIdentifier cid,
IInternalAccess agent)
Destroy (forcefully terminate) an component on the platform.
|
protected static IFuture<java.util.List<java.lang.Exception>> |
destroyComponentLoop(IComponentIdentifier cid,
IComponentIdentifier[] achildren,
int i,
IInternalAccess agent)
Loop for destroying subcomponents.
|
static void |
exitDestroy(IComponentIdentifier cid,
IComponentDescription desc,
java.lang.Exception ex,
java.util.Map<java.lang.String,java.lang.Object> results)
Exit the destroy method by setting description state and resetting maps.
|
static IComponentIdentifier |
generateComponentIdentifier(java.lang.String localname,
java.lang.String platformname,
IInternalAccess agent,
boolean uniqueids)
Create a component identifier that is allowed on the platform.
|
static IFuture<java.lang.Integer> |
getChildCount(IComponentIdentifier cid,
IInternalAccess agent)
Get the children count.
|
static IFuture<IComponentIdentifier[]> |
getChildren(IComponentIdentifier cid,
IInternalAccess agent)
Get the children components of a component.
|
static IFuture<IComponentDescription[]> |
getChildrenDescriptions(IComponentIdentifier cid,
IInternalAccess agent)
Get the children components of a component.
|
protected static IFuture<java.lang.ClassLoader> |
getClassLoader(ILibraryService libser,
IResourceIdentifier rid)
Gets the classloader from libservice.
|
protected static IPlatformComponentAccess |
getComponent(IComponentIdentifier cid)
Helper to get a component from components or init infos.
|
static IFuture<IComponentDescription> |
getComponentDescription(IComponentIdentifier cid)
Get the component description of a single component.
|
static IFuture<IComponentDescription[]> |
getComponentDescriptions(IInternalAccess agent)
Get the component descriptions.
|
static IComponentFactory |
getComponentFactory(IComponentIdentifier cid)
Get the bootstrap factory
|
protected static IFuture<IComponentFactory> |
getComponentFactory(java.lang.String model,
CreationInfo cinfo,
IResourceIdentifier rid,
boolean searched,
boolean cachemiss,
IInternalAccess agent)
Get a fitting component factory for a specific model.
|
static IFuture<IComponentIdentifier[]> |
getComponentIdentifiers(IInternalAccess agent)
Get the component identifiers.
|
static IComponentDescription |
getDescription(IComponentIdentifier cid)
Get the description for a component (if any).
|
static IExternalAccess |
getExternalAccess(IComponentIdentifier cid,
IInternalAccess agent)
Get the external access of a component.
|
static java.lang.ClassLoader |
getLocalClassLoader(IComponentIdentifier cid)
Gets the classloader of a local component.
|
static IExternalAccess |
getLocalExternalAccess(IComponentIdentifier cid)
Gets the external access of a local component.
|
protected static IInternalAccess |
getParentComponent(CreationInfo cinfo,
IInternalAccess agent)
Get the parent component.
|
static IComponentIdentifier |
getParentIdentifier(IInternalAccess agent)
Get the parent component of a component.
|
protected static InitInfo |
getParentInfo(CreationInfo cinfo,
IInternalAccess agent)
Get the info of the parent component.
|
static IFuture<IResourceIdentifier> |
getResourceIdentifier(java.lang.String filename,
IResourceIdentifier rid,
IInternalAccess agent)
Find the class loader for a new (local) component.
|
static CmsState |
getState(IComponentIdentifier cid)
Get the CMS state for the platform.
|
protected static IComponentIdentifier[] |
internalGetChildren(IComponentIdentifier cid)
Get the children of a component.
|
static IComponentDescription |
internalGetComponentDescription(IComponentIdentifier cid)
Get the component description of a single component.
|
protected static boolean |
isInitSuspend(CreationInfo cinfo,
IModelInfo lmodel,
IInternalAccess agent)
Test if a component should be suspended after init is done.
|
protected static boolean |
isMultiFactory(IComponentFactory fac)
Test if factory is a multi factory.
|
static boolean |
isRemoteComponent(IComponentIdentifier cid,
IInternalAccess agent)
Test if a component identifier is a remote component.
|
static boolean |
isSystemComponent(IModelInfo lmodel,
CreationInfo cinfo,
IComponentIdentifier pacid) |
static void |
linkResults(IResultListener<java.util.Collection<Tuple2<java.lang.String,java.lang.Object>>> resultlistener,
IPlatformComponentAccess component,
IInternalAccess agent) |
static ISubscriptionIntermediateFuture<CMSStatusEvent> |
listenToAll(IInternalAccess agent)
Add a component listener for all components.
|
static ISubscriptionIntermediateFuture<CMSStatusEvent> |
listenToComponent(IComponentIdentifier cid,
IInternalAccess agent)
Add a component listener for a specific component.
|
static IFuture<Tuple3<IModelInfo,java.lang.ClassLoader,java.util.Collection<IComponentFeatureFactory>>> |
loadModel(java.lang.String modelname,
CreationInfo cinfo,
IInternalAccess agent)
Load a model with the following steps:
- get the resource identifier for the model
- resolve the filename (local types of subcomponents -> filenames)
- get a suitable component factory
- load the model with that factory
- check if the model has errors and convert to exception
|
static void |
notifyListenersAdded(IComponentDescription desc)
Notify the cms listeners of an addition.
|
static void |
notifyListenersChanged(IComponentDescription desc)
Notify the cms listeners of a change.
|
static void |
notifyListenersRemoved(IComponentDescription desc,
java.lang.Exception ex,
java.util.Map<java.lang.String,java.lang.Object> results)
Notify the cms listeners of a removal.
|
static void |
removeComponentFactory(IComponentIdentifier cid)
Remove the bootstrap factory
|
protected static IFuture<Tuple2<java.lang.String,java.lang.ClassLoader>> |
resolveFilename(java.lang.String modelname,
CreationInfo cinfo,
IResourceIdentifier rid,
IInternalAccess agent)
Find the file name and local component type name
for a component to be started.
|
static IFuture<java.lang.Void> |
resumeComponent(IComponentIdentifier cid,
boolean initresume,
IInternalAccess agent)
Resume the execution of an component.
|
static <T> IFuture<T> |
scheduleStep(IComponentIdentifier cid,
IComponentStep<T> step)
Schedule a step without getting external access.
|
static IFuture<IComponentDescription[]> |
searchComponents(IComponentDescription adesc,
ISearchConstraints con,
IInternalAccess agent)
Search for components matching the given description.
|
static IFuture<java.lang.Void> |
setComponentBreakpoints(IComponentIdentifier cid,
java.lang.String[] breakpoints,
IInternalAccess agent)
Set breakpoints for a component.
|
void |
setComponentState(IComponentIdentifier comp,
java.lang.String state)
Set the state of a component (i.e.
|
static IFuture<java.lang.Void> |
stepComponent(IComponentIdentifier cid,
java.lang.String stepinfo,
IInternalAccess agent)
Execute a step of a suspended component.
|
static IFuture<java.lang.Void> |
suspendComponent(IComponentIdentifier cid,
IInternalAccess agent)
Suspend the execution of an component.
|
public static final IExternalAccess getLocalExternalAccess(IComponentIdentifier cid)
cid
- The component id.public static final java.lang.ClassLoader getLocalClassLoader(IComponentIdentifier cid)
cid
- The component id.public static final CmsState getState(IComponentIdentifier cid)
cid
- The platform id.public static IComponentFactory getComponentFactory(IComponentIdentifier cid)
cid
- The platform id.public static void removeComponentFactory(IComponentIdentifier cid)
cid
- The platform id.public static IComponentDescription getDescription(IComponentIdentifier cid)
public static void exitDestroy(IComponentIdentifier cid, IComponentDescription desc, java.lang.Exception ex, java.util.Map<java.lang.String,java.lang.Object> results)
public static ISubscriptionIntermediateFuture<CMSStatusEvent> listenToAll(IInternalAccess agent)
public static ISubscriptionIntermediateFuture<CMSStatusEvent> listenToComponent(IComponentIdentifier cid, IInternalAccess agent)
cid
- The component to be listened.public static void notifyListenersAdded(IComponentDescription desc)
public static void notifyListenersChanged(IComponentDescription desc)
public static void notifyListenersRemoved(IComponentDescription desc, java.lang.Exception ex, java.util.Map<java.lang.String,java.lang.Object> results)
protected static IFuture<Tuple2<java.lang.String,java.lang.ClassLoader>> resolveFilename(java.lang.String modelname, CreationInfo cinfo, IResourceIdentifier rid, IInternalAccess agent)
protected static IFuture<IComponentFactory> getComponentFactory(java.lang.String model, CreationInfo cinfo, IResourceIdentifier rid, boolean searched, boolean cachemiss, IInternalAccess agent)
model
- The model file name.cinfo
- The creaion info.rid
- The resource identifier.searched
- True, when a search has already been done.protected static boolean isMultiFactory(IComponentFactory fac)
protected static InitInfo getParentInfo(CreationInfo cinfo, IInternalAccess agent)
protected static IInternalAccess getParentComponent(CreationInfo cinfo, IInternalAccess agent)
public static boolean isRemoteComponent(IComponentIdentifier cid, IInternalAccess agent)
protected static <T> IResultListener<T> createResultListener(IInternalAccess agent, IResultListener<T> listener)
protected static boolean isInitSuspend(CreationInfo cinfo, IModelInfo lmodel, IInternalAccess agent)
cinfo
- The creation info.lmodel
- The model of the component.protected static IComponentIdentifier[] internalGetChildren(IComponentIdentifier cid)
public void setComponentState(IComponentIdentifier comp, java.lang.String state)
public static IComponentIdentifier generateComponentIdentifier(java.lang.String localname, java.lang.String platformname, IInternalAccess agent, boolean uniqueids)
name
- The base name.public static IFuture<IComponentDescription[]> searchComponents(IComponentDescription adesc, ISearchConstraints con, IInternalAccess agent)
public static IFuture<IComponentIdentifier[]> getComponentIdentifiers(IInternalAccess agent)
public static IFuture<IComponentDescription[]> getComponentDescriptions(IInternalAccess agent)
public static IFuture<IComponentDescription> getComponentDescription(IComponentIdentifier cid)
cid
- The component identifier.public static IComponentDescription internalGetComponentDescription(IComponentIdentifier cid)
cid
- The component identifier.public static IFuture<IComponentDescription[]> getChildrenDescriptions(IComponentIdentifier cid, IInternalAccess agent)
cid
- The component identifier.public static IFuture<java.lang.Integer> getChildCount(IComponentIdentifier cid, IInternalAccess agent)
cid
- The component identifier.public static IFuture<IComponentIdentifier[]> getChildren(IComponentIdentifier cid, IInternalAccess agent)
cid
- The component identifier.public static IComponentIdentifier getParentIdentifier(IInternalAccess agent)
platform
- The component identifier.public static IFuture<IResourceIdentifier> getResourceIdentifier(java.lang.String filename, IResourceIdentifier rid, IInternalAccess agent)
platform
- The component id.public static IExternalAccess getExternalAccess(IComponentIdentifier cid, IInternalAccess agent)
cid
- The component identifier.listener
- The result listener.public static IFuture<java.lang.Void> setComponentBreakpoints(IComponentIdentifier cid, java.lang.String[] breakpoints, IInternalAccess agent)
cid
- The component identifier.breakpoints
- The new breakpoints (if any).public static IFuture<java.lang.Void> stepComponent(IComponentIdentifier cid, java.lang.String stepinfo, IInternalAccess agent)
componentid
- The component identifier.protected static IFuture<java.lang.Void> addSubcomponent(IInternalAccess pad, IComponentDescription ad, IModelInfo lmodel, IInternalAccess agent)
public static IFuture<java.lang.Void> resumeComponent(IComponentIdentifier cid, boolean initresume, IInternalAccess agent)
componentid
- The component identifier.public static IFuture<java.lang.Void> suspendComponent(IComponentIdentifier cid, IInternalAccess agent)
cid
- The component identifier.protected static IFuture<java.util.List<java.lang.Exception>> destroyComponentLoop(IComponentIdentifier cid, IComponentIdentifier[] achildren, int i, IInternalAccess agent)
protected static void destroyComponent(IComponentIdentifier cid, Future<java.util.Map<java.lang.String,java.lang.Object>> ret, IInternalAccess agent)
cid
- The component to destroy.ret
- The future to be informed.public static IFuture<java.util.Map<java.lang.String,java.lang.Object>> destroyComponent(IComponentIdentifier cid, IInternalAccess agent)
cid
- The component to destroy.public static IFuture<Tuple3<IModelInfo,java.lang.ClassLoader,java.util.Collection<IComponentFeatureFactory>>> loadModel(java.lang.String modelname, CreationInfo cinfo, IInternalAccess agent)
public static boolean isSystemComponent(IModelInfo lmodel, CreationInfo cinfo, IComponentIdentifier pacid)
name
- protected static void addParentLocking(CreationInfo cinfo, IInternalAccess agent, Future<IComponentIdentifier> inited)
public static void linkResults(IResultListener<java.util.Collection<Tuple2<java.lang.String,java.lang.Object>>> resultlistener, IPlatformComponentAccess component, IInternalAccess agent)
public static IFuture<IComponentIdentifier> createComponent(java.lang.String oname, java.lang.String modelname, CreationInfo info, IResultListener<java.util.Collection<Tuple2<java.lang.String,java.lang.Object>>> resultlistener, IInternalAccess agent)
name
- The component name.model
- The model identifier (e.g. file name).info
- The creation info, if any.listener
- The result listener (if any). Will receive the id of the component as result, when the component has been created.resultlistener
- The kill listener (if any). Will receive the results of the component execution, after the component has terminated.public static IPlatformComponentAccess createPlatformComponent(java.lang.ClassLoader classloader)
public static ISubscriptionIntermediateFuture<CMSStatusEvent> createComponent(CreationInfo info, java.lang.String name, java.lang.String model, IInternalAccess agent)
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 static ITuple2Future<IComponentIdentifier,java.util.Map<java.lang.String,java.lang.Object>> createComponent(java.lang.String name, java.lang.String model, CreationInfo info, IInternalAccess agent)
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).protected static void cleanup(IComponentIdentifier cid, java.lang.Exception exception)
protected static IPlatformComponentAccess getComponent(IComponentIdentifier cid)
cid
- The component id.protected static final IFuture<java.lang.ClassLoader> getClassLoader(ILibraryService libser, IResourceIdentifier rid)
public static <T> IFuture<T> scheduleStep(IComponentIdentifier cid, IComponentStep<T> step)
cid
- The component id.step
- The step.