From 7c15a8d7c5ec4ef3b8f07900f6f8d6e635cfaefc Mon Sep 17 00:00:00 2001 From: Robert von Burg Date: Fri, 27 Oct 2017 09:20:32 +0200 Subject: [PATCH] [New] Added ExecutionHandler.archiveActivity() --- .../execution/EventBasedExecutionHandler.java | 3 +- .../strolch/execution/ExecutionHandler.java | 66 +++++++++++-------- 2 files changed, 40 insertions(+), 29 deletions(-) diff --git a/li.strolch.service/src/main/java/li/strolch/execution/EventBasedExecutionHandler.java b/li.strolch.service/src/main/java/li/strolch/execution/EventBasedExecutionHandler.java index 9964b4e2c..816c511b5 100644 --- a/li.strolch.service/src/main/java/li/strolch/execution/EventBasedExecutionHandler.java +++ b/li.strolch.service/src/main/java/li/strolch/execution/EventBasedExecutionHandler.java @@ -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 -> { diff --git a/li.strolch.service/src/main/java/li/strolch/execution/ExecutionHandler.java b/li.strolch.service/src/main/java/li/strolch/execution/ExecutionHandler.java index 0159c2533..247e75764 100644 --- a/li.strolch.service/src/main/java/li/strolch/execution/ExecutionHandler.java +++ b/li.strolch.service/src/main/java/li/strolch/execution/ExecutionHandler.java @@ -14,18 +14,18 @@ import li.strolch.model.activity.TimeOrdering; *

* The ExecutionHandler enables the automated execution of {@link Activity} and {@link Action} elements. *

- * + * *

* 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. *

- * + * *

* Execution of Actions is done either in series or in parallel, depending on the {@link TimeOrdering} on the relevant * {@link Activity} *

- * + * * @author Robert von Burg */ 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); + /** *

* Returns the {@link DelayedExecutionTimer} *

- * + * *

* The {@link DelayedExecutionTimer} allows to delay the {@link #toExecuted(String, Locator)} call by a given time. * See the {@link DurationExecution} policy *

- * + * * @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);