aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2020-02-28 16:54:48 +0000
committerliamfallon <liam.fallon@est.tech>2020-03-01 15:37:44 +0000
commit1b43df37f166ce758ad22cef567fe120ad853705 (patch)
tree70adaec671f8257c4342aa6a2abc8deebc9525a3 /core
parentd1a3d4f7fc8f754937f10e320389825316662b2d (diff)
Switch apex to Graal javascript engine
This is the main review to switch out the Nashorn Javascript interpreter and switch in the Graal javascript interpreter for apex Javascript tasks. The Graal Javascript dialect differs slightly from Nashorn in the way it accesses information passed over from the Java world so Javascript tasks need to be converted. Subsequent reviews will convert the JUnit tests marked @Ignore in previous reviews to this one and will convert the Javascript tasks into a format Graal can handle. Subsequent reviews will also convert the examples over to Graal format. Issue-ID: POLICY-2106 Change-Id: Ief582a36539e8a87724c17fb7e56864d5e471c07 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'core')
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java2
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskExecutionContext.java5
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskSelectionExecutionContext.java26
3 files changed, 18 insertions, 15 deletions
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java
index e27c62f9a..26753a821 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -48,6 +49,7 @@ import org.slf4j.ext.XLoggerFactory;
*
* @author Sven van der Meer (sven.van.der.meer@ericsson.com)
*/
+@Getter
public class StateFinalizerExecutionContext {
/**
* Logger for state finalizer execution, state finalizer logic can use this field to access and log to Apex logging.
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskExecutionContext.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskExecutionContext.java
index 6c670b9d8..0b99c4356 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskExecutionContext.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskExecutionContext.java
@@ -28,8 +28,10 @@ import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.TreeMap;
+
import lombok.Getter;
import lombok.Setter;
+
import org.onap.policy.apex.context.ContextAlbum;
import org.onap.policy.apex.context.ContextRuntimeException;
import org.onap.policy.apex.core.engine.context.ApexInternalContext;
@@ -49,6 +51,7 @@ import org.slf4j.ext.XLoggerFactory;
*
* @author Sven van der Meer (sven.van.der.meer@ericsson.com)
*/
+@Getter
public class TaskExecutionContext {
// Logger for task execution
private static final XLogger EXECUTION_LOGGER =
@@ -165,7 +168,7 @@ public class TaskExecutionContext {
*/
private void populateParameters(Map<String, AxTaskParameter> taskParameters) {
taskParameters.entrySet().forEach(taskParamEntry -> parameters.put(taskParamEntry.getKey(),
- taskParamEntry.getValue().getTaskParameterValue()));
+ taskParamEntry.getValue().getTaskParameterValue()));
}
/**
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskSelectionExecutionContext.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskSelectionExecutionContext.java
index 8d83e7645..7cfb6348e 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskSelectionExecutionContext.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskSelectionExecutionContext.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,12 +43,13 @@ import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
/**
- * Container class for the execution context for Task Selection logic executions in a task being
- * executed in an Apex engine. The task must have easy access to the state definition, the incoming
- * and outgoing event contexts, as well as the policy, global, and external context.
+ * Container class for the execution context for Task Selection logic executions in a task being executed in an Apex
+ * engine. The task must have easy access to the state definition, the incoming and outgoing event contexts, as well as
+ * the policy, global, and external context.
*
* @author Sven van der Meer (sven.van.der.meer@ericsson.com)
*/
+@Getter
public class TaskSelectionExecutionContext {
// Logger for task execution
private static final XLogger EXECUTION_LOGGER =
@@ -70,21 +72,19 @@ public class TaskSelectionExecutionContext {
public final Long executionId;
/**
- * The incoming fields from the trigger event for the state. The task selection logic can access
- * these fields to decide what task to select for the state.
+ * The incoming fields from the trigger event for the state. The task selection logic can access these fields to
+ * decide what task to select for the state.
*/
public final Map<String, Object> inFields;
/**
- * The task that the task selection logic has selected for a state. The task selection logic
- * sets this field in its logic prior to executing and the Apex engine executes this task as the
- * task for this state.
+ * The task that the task selection logic has selected for a state. The task selection logic sets this field in its
+ * logic prior to executing and the Apex engine executes this task as the task for this state.
*/
public final AxArtifactKey selectedTask;
/**
- * Logger for task selection execution, task selection logic can use this field to access and
- * log to Apex logging.
+ * Logger for task selection execution, task selection logic can use this field to access and log to Apex logging.
*/
public final XLogger logger = EXECUTION_LOGGER;
@@ -110,8 +110,7 @@ public class TaskSelectionExecutionContext {
* @param axState the state definition that is the subject of execution
* @param incomingEvent the incoming event for the state
* @param outgoingKey the outgoing key for the task to execute in this state
- * @param internalContext the execution context of the Apex engine in which the task is being
- * executed
+ * @param internalContext the execution context of the Apex engine in which the task is being executed
*/
public TaskSelectionExecutionContext(final TaskSelectExecutor taskSelectExecutor, final long executionId,
final AxState axState, final EnEvent incomingEvent, final AxArtifactKey outgoingKey,
@@ -161,8 +160,7 @@ public class TaskSelectionExecutionContext {
*
* @param contextAlbumName The context album name
* @return The context albumxxxxxx
- * @throws ContextRuntimeException if the context album does not exist on the state for this
- * executor
+ * @throws ContextRuntimeException if the context album does not exist on the state for this executor
*/
public ContextAlbum getContextAlbum(final String contextAlbumName) {
// Find the context album