|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjadex.application.runtime.impl.ApplicationInterpreter
public class ApplicationInterpreter
The application interpreter provides a closed environment for components. If components spawn other components, these will automatically be added to the context. When the context is deleted all components will be destroyed. An component must only be in one application context.
| Field Summary | |
|---|---|
protected IComponentAdapter |
adapter
The component adapter. |
protected Map |
arguments
The arguments. |
protected List |
componentlisteners
The component listeners. |
protected MApplicationInstance |
config
The application configuration. |
protected IServiceContainer |
container
The service container. |
protected Map |
ctypes
Component type mapping (cid -> modelname) and (modelname->application component type). |
protected IValueFetcher |
fetcher
The value fetcher. |
protected MultiCollection |
instances
|
protected MApplicationType |
model
The application type. |
protected IExternalAccess |
parent
The parent component. |
protected Map |
properties
The properties. |
protected Map |
results
The arguments. |
protected Map |
spaces
The contained spaces. |
protected static String |
STATE_INITFUTURES
Application state, while waiting for initial futures. |
protected static String |
STATE_INITREADY
Application state, when ready to init. |
protected static String |
STATE_STARTED
Application state, when already started. |
protected List |
steps
The scheduled steps of the component. |
protected boolean |
terminating
Flag to indicate that the context is about to be deleted (no more components can be added). |
protected boolean |
willdostep
Flag indicating an added step will be executed without the need for calling wakeup(). |
| Constructor Summary | |
|---|---|
ApplicationInterpreter(IComponentDescription desc,
MApplicationType model,
MApplicationInstance config,
IComponentAdapterFactory factory,
IExternalAccess parent,
Map arguments,
Future inited)
Create a new context. |
|
| Method Summary | |
|---|---|
void |
addComponentListener(IComponentListener listener)
Add an component listener. |
void |
addSpace(String name,
ISpace space)
Add a space to the context. |
IFuture |
cleanupComponent()
Can be called concurrently (also during executeAction()). |
IFuture |
componentCreated(IComponentDescription desc,
IModelInfo model)
Called when a component has been created as a subcomponent of this component. |
IFuture |
componentDestroyed(IComponentDescription desc)
Called when a subcomponent of this component has been destroyed. |
protected void |
createComponent(List components,
IComponentManagementService ces,
int i,
Future inited)
Create subcomponents. |
IResultListener |
createResultListener(IResultListener listener)
Create a result listener which is executed as an component step. |
void |
deleteContext()
Delete a context. |
boolean |
executeStep()
Can be called on the component thread only. |
protected void |
findComponentType(int i,
List componenttypes,
ILibraryService ls,
Class servicetype,
Future ret)
Find component type that provided a specific service. |
String[] |
getAllImports()
Get the imports. |
MApplicationType |
getApplicationType()
Get the application type. |
Map |
getArguments()
Get the arguments. |
Map |
getArguments(MComponentInstance component)
Get the arguments. |
IFuture |
getChildren()
Get the children (if any). |
Collection |
getChildren(String type)
Get the children (if any). |
ClassLoader |
getClassLoader()
Get the class loader of the component. |
IComponentAdapter |
getComponentAdapter()
Get the component adapter. |
String |
getComponentFilename(String type)
Get the file name for a logical type name of a subcomponent of this application. |
IComponentIdentifier |
getComponentIdentifier()
Get the component identifier. |
String |
getComponentType(IComponentIdentifier cid)
Get the logical component type for a given component id. |
IExternalAccess |
getExternalAccess()
Can be called concurrently (also during executeAction()). |
String |
getFileName(String ctype)
Get the file name of a component type. |
Logger |
getLogger()
Get the logger. |
IModelInfo |
getModel()
Get the model. |
String |
getName()
Get the name. |
int |
getNumber(MComponentInstance component)
Get the number of components to start. |
IExternalAccess |
getParent()
Get the parent. |
Map |
getResults()
Get the results of the component (considering it as a functionality). |
IServiceContainer |
getServiceContainer()
Create the service container. |
IServiceProvider |
getServiceProvider()
Get the service provider. |
ISpace |
getSpace(String name)
Get a space by name. |
boolean |
isAtBreakpoint(String[] breakpoints)
Test if the component's execution is currently at one of the given breakpoints. |
boolean |
isTerminating()
Get the flag indicating if the context is about to be deleted (no more components can be added). |
IFuture |
killComponent()
Kill the component. |
void |
messageArrived(IMessageAdapter message)
Can be called concurrently (also during executeAction()). |
void |
removeComponentListener(IComponentListener listener)
Remove a component listener. |
void |
removeSpace(String name)
Add a space to the context. |
IFuture |
scheduleStep(IComponentStep step)
Schedule a step of the component. |
void |
setResultValue(String name,
Object value)
Set a result value. |
protected void |
setTerminating(boolean terminating)
Set the flag indicating if the context is about to be deleted (no more components can be added). |
String |
toString()
Get a string representation of the context. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final String STATE_INITFUTURES
protected static final String STATE_INITREADY
protected static final String STATE_STARTED
protected MApplicationInstance config
protected Map spaces
protected Map properties
protected IComponentAdapter adapter
protected MApplicationType model
protected IExternalAccess parent
protected boolean terminating
protected Map ctypes
protected MultiCollection instances
protected Map arguments
protected Map results
protected IValueFetcher fetcher
protected IServiceContainer container
protected List steps
protected boolean willdostep
protected List componentlisteners
| Constructor Detail |
|---|
public ApplicationInterpreter(IComponentDescription desc,
MApplicationType model,
MApplicationInstance config,
IComponentAdapterFactory factory,
IExternalAccess parent,
Map arguments,
Future inited)
| Method Detail |
|---|
protected void findComponentType(int i,
List componenttypes,
ILibraryService ls,
Class servicetype,
Future ret)
public IFuture scheduleStep(IComponentStep step)
scheduleStep in interface IApplicationstep - Code to be executed as a step of the component.
public void addSpace(String name,
ISpace space)
space - The space.public void removeSpace(String name)
name - The space name.public ISpace getSpace(String name)
name - The name.
public Logger getLogger()
public void deleteContext()
application - The context to be deleted.listener - The listener to be notified when deletion is finished (if any).
public IFuture componentCreated(IComponentDescription desc,
IModelInfo model)
componentCreated in interface IComponentInstancecomp - The newly created component.public IFuture componentDestroyed(IComponentDescription desc)
componentDestroyed in interface IComponentInstancecomp - The destroyed component.public IComponentAdapter getComponentAdapter()
public String getName()
public String toString()
toString in class Objectpublic IModelInfo getModel()
getModel in interface IInternalAccesspublic IComponentIdentifier getComponentIdentifier()
getComponentIdentifier in interface IApplicationgetComponentIdentifier in interface IInternalAccesspublic MApplicationType getApplicationType()
getApplicationType in interface IApplicationpublic boolean isTerminating()
protected void setTerminating(boolean terminating)
public String[] getAllImports()
getAllImports in interface IApplicationpublic boolean executeStep()
executeStep in interface IComponentInstancepublic void messageArrived(IMessageAdapter message)
messageArrived in interface IComponentInstancemessage - The message that arrived.public IFuture cleanupComponent()
cleanupComponent in interface IComponentInstancelistener - When cleanup of the component is finished, the listener must be notified.public IFuture killComponent()
killComponent in interface IInternalAccesspublic IExternalAccess getExternalAccess()
getExternalAccess in interface IComponentInstancegetExternalAccess in interface IInternalAccesslistener - External access is delivered via result listener.public ClassLoader getClassLoader()
getClassLoader in interface IComponentInstancepublic boolean isAtBreakpoint(String[] breakpoints)
isAtBreakpoint in interface IComponentInstancebreakpoints - An array of breakpoints.
public Map getArguments()
getArguments in interface IApplication
public void setResultValue(String name,
Object value)
name - The result name.value - The result value.public Map getResults()
getResults in interface IApplicationgetResults in interface IComponentInstancepublic String getComponentType(IComponentIdentifier cid)
getComponentType in interface IApplicationcid - The component id.
public String getComponentFilename(String type)
getComponentFilename in interface IApplicationtype - The logical type name of the component
as defined in the application descriptor.
public IExternalAccess getParent()
getParent in interface IInternalAccesspublic IResultListener createResultListener(IResultListener listener)
createResultListener in interface IInternalAccessThe - original listener to be called.
protected void createComponent(List components,
IComponentManagementService ces,
int i,
Future inited)
public String getFileName(String ctype)
ctype - The component type.
public Map getArguments(MComponentInstance component)
public int getNumber(MComponentInstance component)
public IServiceProvider getServiceProvider()
getServiceProvider in interface IApplicationgetServiceProvider in interface IInternalAccesspublic IServiceContainer getServiceContainer()
getServiceContainer in interface IComponentInstancepublic Collection getChildren(String type)
public IFuture getChildren()
getChildren in interface IInternalAccesspublic void addComponentListener(IComponentListener listener)
addComponentListener in interface IInternalAccesslistener - The listener.public void removeComponentListener(IComponentListener listener)
removeComponentListener in interface IInternalAccesslistener - The listener.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||