[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(() -> { this.executorService.execute(() -> {
try { try {
runAsAgent(ctx -> { runAsAgent(ctx -> {

View File

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