|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.kuka.roboticsAPI.executionModel.ExecutionContainer
public abstract class ExecutionContainer
A container serves as execution context for a command.
It contains a execution state and has methods to synchronize the container with it's execution. Provides methods to access runtime data for the associated command.
| Field Summary | |
|---|---|
protected String |
_containerTypeName
String describing the type of the execution container. |
| Constructor Summary | |
|---|---|
protected |
ExecutionContainer(IControllerCommand command,
ExecutorService eventWorker,
IContainerStateListener stateListener)
Creates a new container for the execution of a command and prepares it. |
| Method Summary | |
|---|---|
void |
acquireResources()
Acquires the resources of the command which is encapsulated in the container. |
void |
addStateListener(IContainerStateListener stateListener)
Adds a state listener for the container. |
protected void |
appendErrorMessage(String additionalMessage)
Appends the current error message with the specified string. |
void |
await()
Blocks the calling thread until the container has finished it's execution. |
void |
await(long timeout,
TimeUnit unit)
Blocks the calling thread until the container has finished it's execution. |
void |
cancel()
Cancels the command in this container. |
IControllerCommand |
getCommand()
Gets the command which was executed within this container. |
RoboticsAPIContext |
getContext()
Gets the context in which this container was created. |
com.kuka.common.params.IParameterSet |
getDefaultParams()
Returns the default parameters that will be used for the command. |
String |
getErrorMessage()
Gets the error message for the container. |
IFiredConditionInfo |
getFiredBreakConditionInfo()
Gets the stop condition that has fired. |
ICommandRuntimeData |
getRuntimeData()
Gets the custom runtime data associated with this container. |
ExecutionState |
getState()
Gets the current ExecutionState of the container. |
boolean |
hasError()
Checks if this container is in an error state. |
boolean |
hasFired(ICondition condition)
Tests whether the given condition has fired for this container. this is equivalent to {@code getFiredConditionInfo() ! |
boolean |
isFinished()
Checks if the container has finished it's execution either with a successful execution or with an error. |
void |
removeStateListener(IContainerStateListener stateListener)
Removes the specified state listener from the container. |
void |
setDefaultParams(com.kuka.common.params.IParameterSet defaultParams)
Set default parameters that will be used for the command. |
protected void |
setErrorMessage(String errorMessage)
Sets an error message for the container which describes the error when the state is invalid. |
protected void |
setFiredStopCondition(IFiredConditionInfo stopCondition)
Sets the fired stop condition for this container. |
protected void |
setState(ExecutionState state)
Changes the state of the container to the given state. |
protected void |
throwContainerException(ExecutionContainer executionContainer,
ExecutionException ex,
boolean b)
awrg. |
String |
toString()
|
void |
validate()
Validates this container and throws an exception if the container is invalid. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final String _containerTypeName
| Constructor Detail |
|---|
protected ExecutionContainer(IControllerCommand command,
ExecutorService eventWorker,
IContainerStateListener stateListener)
An execution container should not be created manually. The framework will do this for the user.
command - The command which should be executed. null is not
allowed.eventWorker - event worker that is used to send container state events. May
be null, in this case no events will be fired.stateListener - A state listener which will be called when the state of the
container changes. May be null.
IllegalArgumentException - if command is null or container is not set for the command.| Method Detail |
|---|
public final String toString()
toString in class Objectprotected void setState(ExecutionState state)
state - The new state of the container.public void cancel()
cancel in interface IExecutionContainerpublic void await()
await in interface com.kuka.common.concurrent.IWaitTokenawait in interface IExecutionContainer
public void await(long timeout,
TimeUnit unit)
throws TimeoutException
await in interface com.kuka.common.concurrent.IWaitTokenawait in interface IExecutionContainertimeout - The timeout.unit - The unit of the timeout.
TimeoutException - the wait timed outpublic void validate()
validate in interface IExecutionContainerCommandInvalidException - if container command goes into invalid state (controller
error).
ExternalStopException - if command was stopped because of some external signal.
ApplicationExitException - if application was asked to exit during execution of the
container command
protected void throwContainerException(ExecutionContainer executionContainer,
ExecutionException ex,
boolean b)
executionContainer - ex - b - public RoboticsAPIContext getContext()
public boolean isFinished()
isFinished in interface com.kuka.common.concurrent.IWaitTokenisFinished in interface IExecutionContainerpublic boolean hasError()
hasError in interface IExecutionContainerpublic ExecutionState getState()
ExecutionState of the container.
getState in interface ICommandContainerpublic void addStateListener(IContainerStateListener stateListener)
stateListener - The state listener.public void removeStateListener(IContainerStateListener stateListener)
stateListener - listener to removepublic IControllerCommand getCommand()
getCommand in interface ICommandContainerprotected void setErrorMessage(String errorMessage)
errorMessage - The error message.protected void appendErrorMessage(String additionalMessage)
additionalMessage - additional error message to append to the existing one.public String getErrorMessage()
getErrorMessage in interface IExecutionContainerprotected void setFiredStopCondition(IFiredConditionInfo stopCondition)
Not intended to be called manually.
stopCondition - The fired stop condition.public boolean hasFired(ICondition condition)
getFiredConditionInfo() != null && getFiredConditionInfo().getFiredCondition() == condition
hasFired in interface IExecutionContainercondition - the condition to test if it has fired.
true if the condition has fired, false
otherwise.public IFiredConditionInfo getFiredBreakConditionInfo()
getFiredBreakConditionInfo in interface IExecutionContainernull.public void acquireResources()
Do not call this method directly. This is done during the creation process of the container.
public com.kuka.common.params.IParameterSet getDefaultParams()
null.public void setDefaultParams(com.kuka.common.params.IParameterSet defaultParams)
defaultParams - a parameter set. Can be null.public ICommandRuntimeData getRuntimeData()
getRuntimeData in interface IExecutionContainernull.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||