diff options
Diffstat (limited to 'plugins/plugins-executor/plugins-executor-java/src/main')
3 files changed, 28 insertions, 22 deletions
diff --git a/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaStateFinalizerExecutor.java b/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaStateFinalizerExecutor.java index ef0a8d178..ce242bafb 100644 --- a/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaStateFinalizerExecutor.java +++ b/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaStateFinalizerExecutor.java @@ -22,6 +22,7 @@ package org.onap.policy.apex.plugins.executor.java; import java.lang.reflect.Method; import java.util.Map; +import java.util.Properties; import org.onap.policy.apex.context.ContextException; import org.onap.policy.apex.core.engine.executor.StateFinalizerExecutor; @@ -66,16 +67,17 @@ public class JavaStateFinalizerExecutor extends StateFinalizerExecutor { * Executes the executor for the state finalizer logic in a sequential manner. * * @param executionId the execution ID for the current APEX policy execution + * @param executionProperties properties for the current APEX policy execution * @param incomingFields the incoming fields for finalisation * @return The state output for the state * @throws StateMachineException on an execution error * @throws ContextException on context errors */ @Override - public String execute(final long executionId, final Map<String, Object> incomingFields) - throws StateMachineException, ContextException { + public String execute(final long executionId, final Properties executionProperties, + final Map<String, Object> incomingFields) throws StateMachineException, ContextException { // Do execution pre work - executePre(executionId, incomingFields); + executePre(executionId, executionProperties, incomingFields); // Check and execute the Java logic boolean returnValue = false; @@ -84,7 +86,7 @@ public class JavaStateFinalizerExecutor extends StateFinalizerExecutor { // StateFinalizerExecutionContext executor) throws ApexException" // to invoke the // task logic in the Java class - final Method method = stateFinalizerLogicObject.getClass().getDeclaredMethod("getStateOutput", (Class[]) + final Method method = stateFinalizerLogicObject.getClass().getDeclaredMethod("getStateOutput", new Class[] { StateFinalizerExecutionContext.class }); returnValue = (boolean) method.invoke(stateFinalizerLogicObject, getExecutionContext()); } catch (final Exception e) { diff --git a/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskExecutor.java b/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskExecutor.java index e9bf45305..1ceeba3b1 100644 --- a/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskExecutor.java +++ b/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskExecutor.java @@ -22,6 +22,7 @@ package org.onap.policy.apex.plugins.executor.java; import java.lang.reflect.Method; import java.util.Map; +import java.util.Properties; import org.onap.policy.apex.context.ContextException; import org.onap.policy.apex.core.engine.executor.TaskExecutor; @@ -67,16 +68,17 @@ public class JavaTaskExecutor extends TaskExecutor { * Executes the executor for the task in a sequential manner. * * @param executionId the execution ID for the current APEX policy execution + * @param executionProperties properties for the current APEX policy execution * @param incomingFields the incoming fields * @return The outgoing fields * @throws StateMachineException on an execution error * @throws ContextException on context errors */ @Override - public Map<String, Object> execute(final long executionId, final Map<String, Object> incomingFields) - throws StateMachineException, ContextException { + public Map<String, Object> execute(final long executionId, final Properties executionProperties, + final Map<String, Object> incomingFields) throws StateMachineException, ContextException { // Do execution pre work - executePre(executionId, incomingFields); + executePre(executionId, executionProperties, incomingFields); // Check and execute the Java logic boolean returnValue = false; @@ -84,7 +86,7 @@ public class JavaTaskExecutor extends TaskExecutor { // Find and call the method with the signature "public boolean getEvent(final TaskExecutionContext executor) // throws ApexException" to invoke the // task logic in the Java class - final Method method = taskLogicObject.getClass().getDeclaredMethod("getEvent", (Class[]) + final Method method = taskLogicObject.getClass().getDeclaredMethod("getEvent", new Class[] { TaskExecutionContext.class }); returnValue = (boolean) method.invoke(taskLogicObject, getExecutionContext()); } catch (final Exception e) { diff --git a/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskSelectExecutor.java b/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskSelectExecutor.java index 02794cdf6..17758b19e 100644 --- a/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskSelectExecutor.java +++ b/plugins/plugins-executor/plugins-executor-java/src/main/java/org/onap/policy/apex/plugins/executor/java/JavaTaskSelectExecutor.java @@ -21,6 +21,7 @@ package org.onap.policy.apex.plugins.executor.java; import java.lang.reflect.Method; +import java.util.Properties; import org.onap.policy.apex.context.ContextException; import org.onap.policy.apex.core.engine.event.EnEvent; @@ -58,10 +59,10 @@ public class JavaTaskSelectExecutor extends TaskSelectExecutor { // Create the task logic object from the byte code of the class taskSelectionLogicObject = Class.forName(getSubject().getTaskSelectionLogic().getLogic()).newInstance(); } catch (final Exception e) { - LOGGER.error("instantiation error on Java class \"" + getSubject().getTaskSelectionLogic().getLogic() - + "\"", e); - throw new StateMachineException("instantiation error on Java class \"" - + getSubject().getTaskSelectionLogic().getLogic() + "\"", e); + LOGGER.error( + "instantiation error on Java class \"" + getSubject().getTaskSelectionLogic().getLogic() + "\"", e); + throw new StateMachineException( + "instantiation error on Java class \"" + getSubject().getTaskSelectionLogic().getLogic() + "\"", e); } } @@ -69,16 +70,17 @@ public class JavaTaskSelectExecutor extends TaskSelectExecutor { * Executes the executor for the task in a sequential manner. * * @param executionId the execution ID for the current APEX policy execution + * @param executionProperties properties for the current APEX policy execution * @param incomingEvent the incoming event * @return The outgoing event * @throws StateMachineException on an execution error * @throws ContextException on context errors */ @Override - public AxArtifactKey execute(final long executionId, final EnEvent incomingEvent) - throws StateMachineException, ContextException { + public AxArtifactKey execute(final long executionId, final Properties executionProperties, + final EnEvent incomingEvent) throws StateMachineException, ContextException { // Do execution pre work - executePre(executionId, incomingEvent); + executePre(executionId, executionProperties, incomingEvent); // Check and execute the Java logic boolean returnValue = false; @@ -87,14 +89,14 @@ public class JavaTaskSelectExecutor extends TaskSelectExecutor { // executor)" to invoke the task selection // logic in the Java class final Method method = taskSelectionLogicObject.getClass().getDeclaredMethod("getTask", - (Class[]) new Class[] { TaskSelectionExecutionContext.class }); + new Class[] { TaskSelectionExecutionContext.class }); returnValue = (boolean) method.invoke(taskSelectionLogicObject, getExecutionContext()); } catch (final Exception e) { - LOGGER.error("execute: task selection logic failed to run for state \"" + getSubject().getKey().getId() - + "\"", e); + LOGGER.error( + "execute: task selection logic failed to run for state \"" + getSubject().getKey().getId() + "\"", + e); throw new StateMachineException( - "task selection logic failed to run for state \"" + getSubject().getKey().getId() + "\"", - e); + "task selection logic failed to run for state \"" + getSubject().getKey().getId() + "\"", e); } // Do the execution post work @@ -112,7 +114,7 @@ public class JavaTaskSelectExecutor extends TaskSelectExecutor { @Override public void cleanUp() throws StateMachineException { LOGGER.debug("cleanUp:" + getSubject().getKey().getId() + "," - + getSubject().getTaskSelectionLogic().getLogicFlavour() + "," - + getSubject().getTaskSelectionLogic().getLogic()); + + getSubject().getTaskSelectionLogic().getLogicFlavour() + "," + + getSubject().getTaskSelectionLogic().getLogic()); } } |