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 18c1ddc61..808883eaa 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 @@ -45,6 +45,14 @@ public class EventBasedExecutionHandler extends ExecutionHandler { super(container, componentName); } + @Override + public Collection getControllers(String realm) { + Map controllersByRealm = this.controllers.getMap(realm); + if (controllersByRealm == null) + return Collections.emptyList(); + return controllersByRealm.values(); + } + @Override public Controller getController(String realm, Activity activity) { return this.controllers.getElement(realm, activity.getLocator()); @@ -294,8 +302,8 @@ public class EventBasedExecutionHandler extends ExecutionHandler { if (getContainer().hasComponent(OperationsLog.class)) { getComponent(OperationsLog.class).addMessage( new LogMessage(realm, SYSTEM_USER_AGENT, controller.getLocator(), LogSeverity.Exception, - LogMessageState.Information, ResourceBundle.getBundle("strolch-service"), "execution.handler.failed.execution") - .withException(e).value("reason", e)); + LogMessageState.Information, ResourceBundle.getBundle("strolch-service"), + "execution.handler.failed.execution").withException(e).value("reason", e)); } } }); @@ -316,8 +324,8 @@ public class EventBasedExecutionHandler extends ExecutionHandler { if (getContainer().hasComponent(OperationsLog.class)) { getComponent(OperationsLog.class).addMessage( new LogMessage(realm, SYSTEM_USER_AGENT, locator, LogSeverity.Exception, - LogMessageState.Information, ResourceBundle.getBundle("strolch-service"), "execution.handler.failed.executed") - .withException(e).value("reason", e)); + LogMessageState.Information, ResourceBundle.getBundle("strolch-service"), + "execution.handler.failed.executed").withException(e).value("reason", e)); } } }); @@ -338,8 +346,8 @@ public class EventBasedExecutionHandler extends ExecutionHandler { if (getContainer().hasComponent(OperationsLog.class)) { getComponent(OperationsLog.class).addMessage( new LogMessage(realm, SYSTEM_USER_AGENT, locator, LogSeverity.Exception, - LogMessageState.Information, ResourceBundle.getBundle("strolch-service"), "execution.handler.failed.stopped") - .withException(e).value("reason", e)); + LogMessageState.Information, ResourceBundle.getBundle("strolch-service"), + "execution.handler.failed.stopped").withException(e).value("reason", e)); } } }); @@ -360,8 +368,8 @@ public class EventBasedExecutionHandler extends ExecutionHandler { if (getContainer().hasComponent(OperationsLog.class)) { getComponent(OperationsLog.class).addMessage( new LogMessage(realm, SYSTEM_USER_AGENT, locator, LogSeverity.Exception, - LogMessageState.Information, ResourceBundle.getBundle("strolch-service"), "execution.handler.failed.error") - .withException(e).value("reason", e)); + LogMessageState.Information, ResourceBundle.getBundle("strolch-service"), + "execution.handler.failed.error").withException(e).value("reason", e)); } } }); @@ -382,8 +390,8 @@ public class EventBasedExecutionHandler extends ExecutionHandler { if (getContainer().hasComponent(OperationsLog.class)) { getComponent(OperationsLog.class).addMessage( new LogMessage(realm, SYSTEM_USER_AGENT, locator, LogSeverity.Exception, - LogMessageState.Information, ResourceBundle.getBundle("strolch-service"), "execution.handler.failed.warning") - .withException(e).value("reason", e)); + LogMessageState.Information, ResourceBundle.getBundle("strolch-service"), + "execution.handler.failed.warning").withException(e).value("reason", e)); } } }); @@ -408,8 +416,8 @@ public class EventBasedExecutionHandler extends ExecutionHandler { if (getContainer().hasComponent(OperationsLog.class)) { getComponent(OperationsLog.class).addMessage( new LogMessage(realm, SYSTEM_USER_AGENT, activity.getLocator(), LogSeverity.Exception, - LogMessageState.Information, ResourceBundle.getBundle("strolch-service"), "execution.handler.failed.archive") - .withException(e).value("reason", e)); + LogMessageState.Information, ResourceBundle.getBundle("strolch-service"), + "execution.handler.failed.archive").withException(e).value("reason", e)); } } }); 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 093a15ebc..d5f1bd49c 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 @@ -1,5 +1,6 @@ package li.strolch.execution; +import java.util.Collection; import java.util.Set; import java.util.concurrent.ExecutorService; @@ -57,6 +58,16 @@ public abstract class ExecutionHandler extends StrolchComponent { return getExecutorService("ExecutionHandler"); } + /** + * Returns the controllers for the given realm + * + * @param realm + * the realm for which to get the controller + * + * @return the controllers + */ + public abstract Collection getControllers(String realm); + /** * Returns the controller for the given realm and activity, null if it does not exist *