[New] Added ExecutionHandler.archiveActivity()

This commit is contained in:
Robert von Burg 2017-10-27 09:20:32 +02:00
parent 49d5e41fe5
commit 7c15a8d7c5
2 changed files with 40 additions and 29 deletions

View File

@ -262,7 +262,8 @@ public class EventBasedExecutionHandler extends ExecutionHandler {
});
}
private void archiveActivity(String realm, Locator activityLoc) {
@Override
public void archiveActivity(String realm, Locator activityLoc) {
this.executorService.execute(() -> {
try {
runAsAgent(ctx -> {

View File

@ -14,18 +14,18 @@ import li.strolch.model.activity.TimeOrdering;
* <p>
* The ExecutionHandler enables the automated execution of {@link Activity} and {@link Action} elements.
* </p>
*
*
* <p>
* To start the execution of an {@link Activity} add it to the {@link ExecutionHandler} by calling
* {@link #addForExecution(String, Locator)}. Actual execution is asynchronously performed and the
* {@link ExecutionPolicy} of the resources of the {@link Action Actions} will perform the actual execution.
* </p>
*
*
* <p>
* Execution of Actions is done either in series or in parallel, depending on the {@link TimeOrdering} on the relevant
* {@link Activity}
* </p>
*
*
* @author Robert von Burg <eitch@eitchnet.ch>
*/
public abstract class ExecutionHandler extends StrolchComponent {
@ -37,93 +37,103 @@ public abstract class ExecutionHandler extends StrolchComponent {
/**
* Registers the given {@link Locator} of an {@link Activity} for execution, and submits it for execution
* immediately in an asynchronous manner
*
*
* @param realm
* the realm where the {@link Activity} resides
* the realm where the {@link Activity} resides
* @param activityLoc
* the {@link Locator} of the {@link Activity}
* the {@link Locator} of the {@link Activity}
*/
public abstract void addForExecution(String realm, Locator activityLoc);
/**
* Removes the given {@link Locator} for an {@link Activity} from execution, so it is not executed further
*
*
* @param realm
* the realm where the {@link Activity} resides
* the realm where the {@link Activity} resides
* @param activityLoc
* the {@link Locator} of the {@link Activity}
* the {@link Locator} of the {@link Activity}
*/
public abstract void removeFromExecution(String realm, Locator activityLoc);
/**
* Triggers a to execution for all registered activities in the given realm
*
*
* @param realm
* the realm to trigger execution for
* the realm to trigger execution for
*/
public abstract void triggerExecution(String realm);
/**
* Archives the given {@link Activity}
*
* @param realm
* the realm where the activity resides
* @param activityLoc
* the {@link Locator} of the {@link Activity}
*/
public abstract void archiveActivity(String realm, Locator activityLoc);
/**
* <p>
* Returns the {@link DelayedExecutionTimer}
* </p>
*
*
* <p>
* The {@link DelayedExecutionTimer} allows to delay the {@link #toExecuted(String, Locator)} call by a given time.
* See the {@link DurationExecution} policy
* </p>
*
*
* @return the {@link DelayedExecutionTimer}
*/
public abstract DelayedExecutionTimer getDelayedExecutionTimer();
/**
* Starts the execution of the given {@link Activity} with the given {@link Locator}
*
*
* @param realm
* the realm where the {@link Activity} resides
* the realm where the {@link Activity} resides
* @param activityLoc
* the {@link Locator} of the {@link Activity}
* the {@link Locator} of the {@link Activity}
*/
public abstract void toExecution(String realm, Locator activityLoc);
/**
* Completes the execution of the given {@link Action} with the given {@link Locator}
*
*
* @param realm
* the realm where the {@link Action} resides
* the realm where the {@link Action} resides
* @param actionLoc
* the {@link Locator} of the {@link Action}
* the {@link Locator} of the {@link Action}
*/
public abstract void toExecuted(String realm, Locator actionLoc);
/**
* Sets the state of the {@link Action} with the given {@link Locator} to {@link State#STOPPED}
*
*
* @param realm
* the realm where the {@link Action} resides
* the realm where the {@link Action} resides
* @param actionLoc
* the {@link Locator} of the {@link Action}
* the {@link Locator} of the {@link Action}
*/
public abstract void toStopped(String realm, Locator actionLoc);
/**
* Sets the state of the {@link Action} with the given {@link Locator} to {@link State#WARNING}
*
*
* @param realm
* the realm where the {@link Action} resides
* the realm where the {@link Action} resides
* @param actionLoc
* the {@link Locator} of the {@link Action}
* the {@link Locator} of the {@link Action}
*/
public abstract void toWarning(String realm, Locator actionLoc);
/**
* Sets the state of the {@link Action} with the given {@link Locator} to {@link State#ERROR}
*
*
* @param realm
* the realm where the {@link Action} resides
* the realm where the {@link Action} resides
* @param actionLoc
* the {@link Locator} of the {@link Action}
* the {@link Locator} of the {@link Action}
*/
public abstract void toError(String realm, Locator actionLoc);