From ce9d82d2c0e863597d84cc8909955e398405f45a Mon Sep 17 00:00:00 2001 From: liamfallon Date: Wed, 26 Jun 2019 15:40:41 +0000 Subject: Add passthrough properties for APEX engine APEX event receiver and sender plugins sometimes need to exchange information with tasks, especially in the case of REST communication. This change enables passthrough of Properties from the event carrier technology plugins to APEX task, task selection, and state finalizer logics. Apologies for the size of the review but this change involves passinng the properties through all the APEX components, hence the large number of small changes. Issue-ID: POLICY-1742 Change-Id: I219fd69550f06702ef64adbb165fe7baac422e96 Signed-off-by: liamfallon --- .../apex/plugins/executor/mvel/MvelStateFinalizerExecutor.java | 8 +++++--- .../onap/policy/apex/plugins/executor/mvel/MvelTaskExecutor.java | 8 +++++--- .../policy/apex/plugins/executor/mvel/MvelTaskSelectExecutor.java | 8 +++++--- 3 files changed, 15 insertions(+), 9 deletions(-) (limited to 'plugins/plugins-executor/plugins-executor-mvel/src/main') diff --git a/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelStateFinalizerExecutor.java b/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelStateFinalizerExecutor.java index 9b941a39a..ab62ca4bf 100644 --- a/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelStateFinalizerExecutor.java +++ b/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelStateFinalizerExecutor.java @@ -26,6 +26,7 @@ import static org.onap.policy.common.utils.validation.Assertions.argumentNotNull import java.io.Serializable; import java.util.HashMap; import java.util.Map; +import java.util.Properties; import org.mvel2.MVEL; import org.onap.policy.apex.context.ContextException; @@ -70,16 +71,17 @@ public class MvelStateFinalizerExecutor 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 incomingFields) - throws StateMachineException, ContextException { + public String execute(final long executionId, final Properties executionProperties, + final Map incomingFields) throws StateMachineException, ContextException { // Do execution pre work - executePre(executionId, incomingFields); + executePre(executionId, executionProperties, incomingFields); // Check and execute the MVEL logic argumentNotNull(compiled, "MVEL state finalizer logic not compiled."); diff --git a/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskExecutor.java b/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskExecutor.java index 69a53a26b..3fa753bec 100644 --- a/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskExecutor.java +++ b/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskExecutor.java @@ -26,6 +26,7 @@ import static org.onap.policy.common.utils.validation.Assertions.argumentNotNull import java.io.Serializable; import java.util.HashMap; import java.util.Map; +import java.util.Properties; import org.mvel2.MVEL; import org.onap.policy.apex.context.ContextException; @@ -70,16 +71,17 @@ public class MvelTaskExecutor 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 execute(final long executionId, final Map incomingFields) - throws StateMachineException, ContextException { + public Map execute(final long executionId, final Properties executionProperties, + final Map incomingFields) throws StateMachineException, ContextException { // Do execution pre work - executePre(executionId, incomingFields); + executePre(executionId, executionProperties, incomingFields); // Check and execute the MVEL logic argumentNotNull(compiled, "MVEL task not compiled."); diff --git a/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskSelectExecutor.java b/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskSelectExecutor.java index eefc50d0d..1ba79ceec 100644 --- a/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskSelectExecutor.java +++ b/plugins/plugins-executor/plugins-executor-mvel/src/main/java/org/onap/policy/apex/plugins/executor/mvel/MvelTaskSelectExecutor.java @@ -25,6 +25,7 @@ import static org.onap.policy.common.utils.validation.Assertions.argumentNotNull import java.io.Serializable; import java.util.HashMap; +import java.util.Properties; import org.mvel2.MVEL; import org.onap.policy.apex.context.ContextException; @@ -71,16 +72,17 @@ public class MvelTaskSelectExecutor 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 MVEL logic argumentNotNull(compiled, "MVEL task not compiled."); -- cgit 1.2.3-korg