summaryrefslogtreecommitdiffstats
path: root/core/core-engine
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@ericsson.com>2018-09-12 23:29:25 +0100
committerliamfallon <liam.fallon@ericsson.com>2018-09-12 23:54:51 +0100
commit0e23f7634e1e1fb31454c516974613335fcea1a4 (patch)
treebedf0e52104e62599dd091eb6292de5dc7d57f49 /core/core-engine
parent3ccc3d9ecd4bcd8960a2da6ecbdc7f3ac806fc67 (diff)
Sonar/Checkstyle in model/context/core
Checkstyle and sonar changes in the model, contexot and core modules. Issue-ID: POLICY-1034 Change-Id: I2d40bc877f3a548844470fc290fc89d63fa465ae Signed-off-by: liamfallon <liam.fallon@ericsson.com>
Diffstat (limited to 'core/core-engine')
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameterConstants.java2
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/context/ApexInternalContext.java2
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/ApexEngine.java2
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java99
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/StateMachineHandler.java13
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java41
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/Executor.java32
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateExecutor.java20
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java76
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutor.java10
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateOutput.java33
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java12
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutor.java6
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java10
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskExecutionContext.java14
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskSelectionExecutionContext.java14
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/monitoring/EventMonitor.java9
17 files changed, 203 insertions, 192 deletions
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameterConstants.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameterConstants.java
index 1678f57c7..96a83f3a6 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameterConstants.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameterConstants.java
@@ -28,7 +28,7 @@ public abstract class EngineParameterConstants {
public static final String EXECUTOR_GROUP_NAME = "EXECUTOR_PARAMETERS";
/**
- * Private default constructor to prevent subclassing
+ * Private default constructor to prevent subclassing.
*/
private EngineParameterConstants() {
// Prevents subclassing
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/context/ApexInternalContext.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/context/ApexInternalContext.java
index 85e45f718..8bbb333b5 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/context/ApexInternalContext.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/context/ApexInternalContext.java
@@ -63,7 +63,7 @@ public final class ApexInternalContext implements AxConceptGetter<ContextAlbum>
private Distributor contextDistributor = null;
// The key of the current policy, used to return the correct policy context album to the user
- private final AxArtifactKey currentPolicyKey = null;
+ private AxArtifactKey currentPolicyKey = null;
/**
* Constructor, instantiate the context object from the Apex model.
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/ApexEngine.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/ApexEngine.java
index b25192cd0..b2978a0c0 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/ApexEngine.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/ApexEngine.java
@@ -46,7 +46,7 @@ public interface ApexEngine {
* The amount of milliseconds to wait for the current Apex engine to timeout on engine stop
* requests. If the timeout is exceeded, the stop aborts.
*/
- int APEX_ENGINE_STOP_EXECUTION_WAIT_TIMEOUT = 3000;
+ int STOP_EXECUTION_WAIT_TIMEOUT = 3000;
/** The wait increment (or pause time) when waiting for the Apex engine to stop. */
int APEX_ENGINE_STOP_EXECUTION_WAIT_INCREMENT = 100;
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java
index 3497ed660..6f2bab0b9 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java
@@ -56,6 +56,11 @@ public class ApexEngineImpl implements ApexEngine {
// Logger for this class
private static final XLogger LOGGER = XLoggerFactory.getXLogger(ApexEngineImpl.class);
+ // Recurring string constants
+ private static final String UPDATE_MODEL = "updateModel()<-";
+ private static final String START = "start()<-";
+ private static final String STOP = "stop()<-";
+
// The artifact key of this engine
private final AxArtifactKey key;
@@ -63,7 +68,7 @@ public class ApexEngineImpl implements ApexEngine {
private AxEngineState state = AxEngineState.STOPPED;
// call back listeners
- private final Map<String, EnEventListener> eventListeners = new LinkedHashMap<String, EnEventListener>();
+ private final Map<String, EnEventListener> eventListeners = new LinkedHashMap<>();
// The context of this engine
private ApexInternalContext internalContext = null;
@@ -105,15 +110,14 @@ public class ApexEngineImpl implements ApexEngine {
if (apexModel != null) {
LOGGER.entry("updateModel()->" + key.getId() + ", apexPolicyModel=" + apexModel.getKey().getId());
} else {
- LOGGER.warn("updateModel()<-" + key.getId() + ", Apex model not set");
- throw new ApexException(
- "updateModel()<-" + key.getId() + ", Apex model is not defined, it has a null value");
+ LOGGER.warn(UPDATE_MODEL + key.getId() + ", Apex model not set");
+ throw new ApexException(UPDATE_MODEL + key.getId() + ", Apex model is not defined, it has a null value");
}
// The engine must be stopped in order to do a model update
if (!state.equals(AxEngineState.STOPPED)) {
- throw new ApexException("updateModel()<-" + key.getId()
- + ", cannot update model, engine should be stopped but is in state " + state);
+ throw new ApexException(UPDATE_MODEL + key.getId()
+ + ", cannot update model, engine should be stopped but is in state " + state);
}
// Create new internal context or update the existing one
@@ -126,12 +130,10 @@ public class ApexEngineImpl implements ApexEngine {
internalContext.update(apexModel);
}
} catch (final ContextException e) {
- LOGGER.warn(
- "updateModel()<-" + key.getId() + ", error setting the context for engine \"" + key.getId() + "\"",
- e);
- throw new ApexException(
- "updateModel()<-" + key.getId() + ", error setting the context for engine \"" + key.getId() + "\"",
- e);
+ LOGGER.warn(UPDATE_MODEL + key.getId() + ", error setting the context for engine \"" + key.getId() + "\"",
+ e);
+ throw new ApexException(UPDATE_MODEL + key.getId() + ", error setting the context for engine \""
+ + key.getId() + "\"", e);
}
// Set up the state machines
@@ -140,13 +142,13 @@ public class ApexEngineImpl implements ApexEngine {
// always set up as new
stateMachineHandler = new StateMachineHandler(internalContext);
} catch (final StateMachineException e) {
- LOGGER.warn("updateModel()<-" + key.getId() + ", error setting up the engine state machines \""
- + key.getId() + "\"", e);
- throw new ApexException("updateModel()<-" + key.getId() + ", error setting up the engine state machines \""
- + key.getId() + "\"", e);
+ LOGGER.warn(UPDATE_MODEL + key.getId() + ", error setting up the engine state machines \"" + key.getId()
+ + "\"", e);
+ throw new ApexException(UPDATE_MODEL + key.getId() + ", error setting up the engine state machines \""
+ + key.getId() + "\"", e);
}
- LOGGER.exit("updateModel()<-" + key.getId());
+ LOGGER.exit(UPDATE_MODEL + key.getId());
}
/*
@@ -159,16 +161,18 @@ public class ApexEngineImpl implements ApexEngine {
LOGGER.entry("start()" + key);
if (state != AxEngineState.STOPPED) {
- LOGGER.warn("start()<-" + key.getId() + "," + state + ", cannot start engine, engine not in state STOPPED");
- throw new ApexException(
- "start()<-" + key.getId() + "," + state + ", cannot start engine, engine not in state STOPPED");
+ String message = START + key.getId() + "," + state
+ + ", cannot start engine, engine not in state STOPPED";
+ LOGGER.warn(message);
+ throw new ApexException(message);
}
if (stateMachineHandler == null || internalContext == null) {
- LOGGER.warn("start()<-" + key.getId() + "," + state
- + ", cannot start engine, engine has not been initialized, its model is not loaded");
- throw new ApexException("start()<-" + key.getId() + "," + state
- + ", cannot start engine, engine has not been initialized, its model is not loaded");
+ String message = START + key.getId() + "," + state
+ + ", cannot start engine, engine has not been initialized, its model is not loaded";
+ LOGGER.warn(message);
+ throw new ApexException(START + key.getId() + "," + state
+ + ", cannot start engine, engine has not been initialized, its model is not loaded");
}
// Set up the state machines
@@ -177,10 +181,10 @@ public class ApexEngineImpl implements ApexEngine {
stateMachineHandler.start();
engineStats.engineStart();
} catch (final StateMachineException e) {
- LOGGER.warn("updateModel()<-" + key.getId() + ", error starting the engine state machines \"" + key.getId()
- + "\"", e);
- throw new ApexException("updateModel()<-" + key.getId() + ", error starting the engine state machines \""
- + key.getId() + "\"", e);
+ String message = UPDATE_MODEL + key.getId() + ", error starting the engine state machines \"" + key.getId()
+ + "\"";
+ LOGGER.warn(message, e);
+ throw new ApexException(message, e);
}
// OK, we are good to go
@@ -199,15 +203,14 @@ public class ApexEngineImpl implements ApexEngine {
LOGGER.entry("stop()->" + key);
// Stop the engine if it is in state READY, if it is in state EXECUTING, wait for execution to finish
- for (int increment = APEX_ENGINE_STOP_EXECUTION_WAIT_TIMEOUT; increment > 0; increment =
- APEX_ENGINE_STOP_EXECUTION_WAIT_INCREMENT) {
+ for (int increment = STOP_EXECUTION_WAIT_TIMEOUT; increment > 0; increment = STOP_EXECUTION_WAIT_TIMEOUT) {
synchronized (state) {
switch (state) {
// Already stopped
case STOPPED:
- throw new ApexException("stop()<-" + key.getId() + "," + state
- + ", cannot stop engine, engine is already stopped");
+ throw new ApexException(STOP + key.getId() + "," + state
+ + ", cannot stop engine, engine is already stopped");
// The normal case, the engine wasn't doing anything or it was executing
case READY:
case STOPPING:
@@ -222,13 +225,13 @@ public class ApexEngineImpl implements ApexEngine {
state = AxEngineState.STOPPING;
break;
default:
- throw new ApexException("stop()<-" + key.getId() + "," + state
- + ", cannot stop engine, engine is in an undefined state");
+ throw new ApexException(STOP + key.getId() + "," + state
+ + ", cannot stop engine, engine is in an undefined state");
}
}
}
- throw new ApexException("stop()<-" + key.getId() + "," + state + ", cannot stop engine, engine stop timed out");
+ throw new ApexException(STOP + key.getId() + "," + state + ", cannot stop engine, engine stop timed out");
}
/*
@@ -240,8 +243,8 @@ public class ApexEngineImpl implements ApexEngine {
public void clear() throws ApexException {
LOGGER.entry("clear()->" + key);
if (state != AxEngineState.STOPPED) {
- throw new ApexException(
- "clear" + "()<-" + key.getId() + "," + state + ", cannot clear engine, engine is not stopped");
+ throw new ApexException("clear" + "()<-" + key.getId() + "," + state
+ + ", cannot clear engine, engine is not stopped");
}
// Clear everything
@@ -263,8 +266,7 @@ public class ApexEngineImpl implements ApexEngine {
@Override
public EnEvent createEvent(final AxArtifactKey eventKey) {
if (state != AxEngineState.READY && state != AxEngineState.EXECUTING) {
- LOGGER.warn(
- "createEvent()<-" + key.getId() + "," + state + ", cannot create event, engine not in state READY");
+ LOGGER.warn("createEvent()<-{},{}, cannot create event, engine not in state READY", key.getId(), state);
return null;
}
@@ -287,21 +289,21 @@ public class ApexEngineImpl implements ApexEngine {
public boolean handleEvent(final EnEvent incomingEvent) {
boolean ret = false;
if (incomingEvent == null) {
- LOGGER.warn("handleEvent()<-" + key.getId() + "," + state + ", cannot run engine, incoming event is null");
+ LOGGER.warn("handleEvent()<-{},{}, cannot run engine, incoming event is null", key.getId(), state);
return ret;
}
synchronized (state) {
if (state != AxEngineState.READY) {
- LOGGER.warn("handleEvent()<-" + key.getId() + "," + state
- + ", cannot run engine, engine not in state READY");
+ LOGGER.warn("handleEvent()<-{},{}, cannot run engine, engine not in state READY", key.getId(), state);
return ret;
}
state = AxEngineState.EXECUTING;
}
- LOGGER.debug("execute(): triggered by event " + incomingEvent.toString());
+ String message = "execute(): triggered by event " + incomingEvent.toString();
+ LOGGER.debug(message);
// By default we return a null event on errors
EnEvent outgoingEvent = null;
@@ -311,7 +313,7 @@ public class ApexEngineImpl implements ApexEngine {
engineStats.executionExit();
ret = true;
} catch (final StateMachineException e) {
- LOGGER.warn("handleEvent()<-" + key.getId() + "," + state + ", engine execution error: ", e);
+ LOGGER.warn("handleEvent()<-{},{}, engine execution error: ", key.getId(), state, e);
// Create an exception return event
outgoingEvent = createExceptionEvent(incomingEvent, e);
@@ -321,8 +323,8 @@ public class ApexEngineImpl implements ApexEngine {
try {
synchronized (eventListeners) {
if (eventListeners.isEmpty()) {
- LOGGER.debug("handleEvent()<-" + key.getId() + "," + state
- + ", There is no listener registered to recieve outgoing event: " + outgoingEvent);
+ LOGGER.debug("handleEvent()<-{},{}, There is no listener registered to recieve outgoing event: {}",
+ key.getId(), state, outgoingEvent);
}
for (final EnEventListener axEventListener : eventListeners.values()) {
axEventListener.onEnEvent(outgoingEvent);
@@ -403,11 +405,10 @@ public class ApexEngineImpl implements ApexEngine {
*/
@Override
public Map<AxArtifactKey, Map<String, Object>> getEngineContext() {
- final Map<AxArtifactKey, Map<String, Object>> currentContext =
- new LinkedHashMap<AxArtifactKey, Map<String, Object>>();
+ final Map<AxArtifactKey, Map<String, Object>> currentContext = new LinkedHashMap<>();
for (final Entry<AxArtifactKey, ContextAlbum> contextAlbumEntry : internalContext.getContextAlbums()
- .entrySet()) {
+ .entrySet()) {
currentContext.put(contextAlbumEntry.getKey(), contextAlbumEntry.getValue());
}
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/StateMachineHandler.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/StateMachineHandler.java
index 5ade06537..636f87af3 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/StateMachineHandler.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/StateMachineHandler.java
@@ -124,10 +124,11 @@ public class StateMachineHandler {
try {
smExecutor.prepare();
} catch (final StateMachineException e) {
- final String stateMachineID = smExecutor.getContext().getKey().getId();
- LOGGER.warn("start()<-" + key.getId() + ", start failed, state machine \"" + stateMachineID + "\"", e);
+ final String stateMachineId = smExecutor.getContext().getKey().getId();
+ String message = "start()<-" + key.getId() + ", start failed, state machine \"" + stateMachineId + "\"";
+ LOGGER.warn(message, e);
throw new StateMachineException(
- "start()<-" + key.getId() + ", start failed, state machine \"" + stateMachineID + "\"", e);
+ message, e);
}
}
@@ -158,7 +159,7 @@ public class StateMachineHandler {
// Run the state machine
try {
LOGGER.debug("execute(): state machine \"{}\" execution starting . . .", stateMachineExecutor);
- final EnEvent outputObject = stateMachineExecutor.execute(event.getExecutionID(), event);
+ final EnEvent outputObject = stateMachineExecutor.execute(event.getExecutionId(), event);
LOGGER.debug("execute()<-: state machine \"{}\" execution completed", stateMachineExecutor);
return outputObject;
@@ -180,8 +181,8 @@ public class StateMachineHandler {
try {
smExecutor.cleanUp();
} catch (final StateMachineException e) {
- final String smID = smExecutor.getContext().getKey().getId();
- LOGGER.warn("stop()<-clean up failed, state machine \"" + smID + "\" cleanup failed", e);
+ final String smId = smExecutor.getContext().getKey().getId();
+ LOGGER.warn("stop()<-clean up failed, state machine \"" + smId + "\" cleanup failed", e);
}
}
LOGGER.exit("stop()<-");
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java
index 109240c0d..7c49af965 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java
@@ -51,6 +51,9 @@ public class EnEvent extends HashMap<String, Object> {
// Logger for this class
private static final XLogger LOGGER = XLoggerFactory.getXLogger(EnEvent.class);
+ // Repeasted string constants
+ private static final String NULL_KEYS_ILLEGAL = "null keys are illegal on method parameter \"key\"";
+
// The definition of this event in the Apex model
private final AxEvent axEvent;
@@ -65,7 +68,7 @@ public class EnEvent extends HashMap<String, Object> {
// An identifier for the current event execution. The default value here will always be a random
// number, and should
// be reset
- private long executionID = rand.nextLong();
+ private long executionId = rand.nextLong();
// A string holding a message that indicates why processing of this event threw an exception
private String exceptionMessage;
@@ -122,7 +125,7 @@ public class EnEvent extends HashMap<String, Object> {
*
* @return the event key
*/
- public String getID() {
+ public String getId() {
return axEvent.getKey().getId();
}
@@ -135,8 +138,8 @@ public class EnEvent extends HashMap<String, Object> {
*
* @return the currently set value for the ExecutionID for this event.
*/
- public long getExecutionID() {
- return executionID;
+ public long getExecutionId() {
+ return executionId;
}
/**
@@ -146,10 +149,10 @@ public class EnEvent extends HashMap<String, Object> {
* particular input event. The default initialised value for the ExecutionID is always unique in
* a single JVM.
*
- * @param executionID the new value for the ExecutionID for this event.
+ * @param executionId the new value for the ExecutionID for this event.
*/
- public void setExecutionID(final long executionID) {
- this.executionID = executionID;
+ public void setExecutionId(final long executionId) {
+ this.executionId = executionId;
}
/**
@@ -194,8 +197,9 @@ public class EnEvent extends HashMap<String, Object> {
// Check if this key is a parameter on our event
final AxField eventParameter = axEvent.getParameterMap().get(key);
if (eventParameter == null) {
- LOGGER.warn("parameter with key " + key + " not defined on this event");
- throw new EnException("parameter with key " + key + " not defined on this event");
+ String message = "parameter with key " + key + " not defined on this event";
+ LOGGER.warn(message);
+ throw new EnException(message);
}
// Get the item
@@ -250,15 +254,17 @@ public class EnEvent extends HashMap<String, Object> {
@Override
public Object put(final String key, final Object incomingValue) {
if (key == null) {
- LOGGER.warn("null keys are illegal on method parameter \"key\"");
- throw new EnException("null keys are illegal on method parameter \"key\"");
+ String message = NULL_KEYS_ILLEGAL;
+ LOGGER.warn(message);
+ throw new EnException(message);
}
// Check if this key is a parameter on our event
final AxField eventParameter = axEvent.getParameterMap().get(key);
if (eventParameter == null) {
- LOGGER.warn("parameter with key \"" + key + "\" not defined on event \"" + getName() + "\"");
- throw new EnException("parameter with key \"" + key + "\" not defined on event \"" + getName() + "\"");
+ String message = "parameter with key \"" + key + "\" not defined on event \"" + getName() + "\"";
+ LOGGER.warn(message);
+ throw new EnException(message);
}
// We allow null values
@@ -296,15 +302,16 @@ public class EnEvent extends HashMap<String, Object> {
@Override
public Object remove(final Object key) {
if (key == null) {
- LOGGER.warn("null keys are illegal on method parameter \"key\"");
- throw new EnException("null keys are illegal on method parameter \"key\"");
+ LOGGER.warn(NULL_KEYS_ILLEGAL);
+ throw new EnException(NULL_KEYS_ILLEGAL);
}
// Check if this key is a parameter on our event
final AxField eventParameter = axEvent.getParameterMap().get(key);
if (eventParameter == null) {
- LOGGER.warn("parameter with key " + key + " not defined on this event");
- throw new EnException("parameter with key " + key + " not defined on this event");
+ String message = "parameter with key " + key + " not defined on this event";
+ LOGGER.warn(message);
+ throw new EnException(message);
}
final Object removedValue = super.remove(key);
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/Executor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/Executor.java
index 4c969f76e..9941c6de8 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/Executor.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/Executor.java
@@ -37,13 +37,13 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
* @author Sven van der Meer (sven.van.der.meer@ericsson.com)
* @author Liam Fallon (liam.fallon@ericsson.com)
*
- * @param <IN> type of the incoming entity
- * @param <OUT> type of the outgoing entity
- * @param <SUBJECT> type that is the subject of execution
- * @param <CONTEXT> context holding the context of execution
+ * @param <I> type of the incoming entity
+ * @param <O> type of the outgoing entity
+ * @param <S> type that is the subject of execution
+ * @param <C> context holding the context of execution
*/
-public interface Executor<IN, OUT, SUBJECT, CONTEXT> {
+public interface Executor<I, O, S, C> {
/**
* Save the subject and context of the executor.
*
@@ -52,7 +52,7 @@ public interface Executor<IN, OUT, SUBJECT, CONTEXT> {
* @param executorSubject the executor subject, the subject of execution
* @param executorContext the executor context, the context in which execution takes place
*/
- void setContext(Executor<?, ?, ?, ?> parent, SUBJECT executorSubject, CONTEXT executorContext);
+ void setContext(Executor<?, ?, ?, ?> parent, S executorSubject, C executorContext);
/**
* Prepares the processing.
@@ -64,23 +64,23 @@ public interface Executor<IN, OUT, SUBJECT, CONTEXT> {
/**
* Executes the executor, running through its context in its natural order.
*
- * @param executionID the execution ID of the current APEX execution policy thread
+ * @param executionId the execution ID of the current APEX execution policy thread
* @param incomingEntity the incoming entity that triggers execution
* @return The outgoing entity that is the result of execution
* @throws StateMachineException on an execution error
* @throws ContextException on context errors
*/
- OUT execute(long executionID, IN incomingEntity) throws StateMachineException, ContextException;
+ O execute(long executionId, I incomingEntity) throws StateMachineException, ContextException;
/**
* Carry out the preparatory work for execution.
*
- * @param executionID the execution ID of the current APEX execution policy thread
+ * @param executionId the execution ID of the current APEX execution policy thread
* @param incomingEntity the incoming entity that triggers execution
* @throws StateMachineException on an execution error
* @throws ContextException on context errors
*/
- void executePre(long executionID, IN incomingEntity) throws StateMachineException, ContextException;
+ void executePre(long executionId, I incomingEntity) throws StateMachineException, ContextException;
/**
* Carry out the post work for execution, the returning entity should be set by the child
@@ -119,42 +119,42 @@ public interface Executor<IN, OUT, SUBJECT, CONTEXT> {
*
* @return The subject for the executor
*/
- SUBJECT getSubject();
+ S getSubject();
/**
* Get the context of the executor.
*
* @return The context for the executor
*/
- CONTEXT getContext();
+ C getContext();
/**
* Get the incoming object of the executor.
*
* @return The incoming object for the executor
*/
- IN getIncoming();
+ I getIncoming();
/**
* Get the outgoing object of the executor.
*
* @return The outgoing object for the executor
*/
- OUT getOutgoing();
+ O getOutgoing();
/**
* Save the next executor for this executor.
*
* @param nextExecutor the next executor
*/
- void setNext(Executor<IN, OUT, SUBJECT, CONTEXT> nextExecutor);
+ void setNext(Executor<I, O, S, C> nextExecutor);
/**
* Get the next executor to be run after this executor completes its execution.
*
* @return The next executor
*/
- Executor<IN, OUT, SUBJECT, CONTEXT> getNext();
+ Executor<I, O, S, C> getNext();
/**
* Set parameters for this executor, overloaded by executors that use parameters.
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateExecutor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateExecutor.java
index 9cf7d90e3..28ea13ea7 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateExecutor.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateExecutor.java
@@ -171,13 +171,13 @@ public class StateExecutor implements Executor<EnEvent, StateOutput, AxState, Ap
* java.lang.Object)
*/
@Override
- public StateOutput execute(final long executionID, final EnEvent incomingEvent)
+ public StateOutput execute(final long executionId, final EnEvent incomingEvent)
throws StateMachineException, ContextException {
this.lastIncomingEvent = incomingEvent;
// Check that the incoming event matches the trigger for this state
if (!incomingEvent.getAxEvent().getKey().equals(axState.getTrigger())) {
- throw new StateMachineException("incoming event \"" + incomingEvent.getID() + "\" does not match trigger \""
+ throw new StateMachineException("incoming event \"" + incomingEvent.getId() + "\" does not match trigger \""
+ axState.getTrigger().getId() + "\" of state \"" + axState.getId() + "\"");
}
@@ -188,7 +188,7 @@ public class StateExecutor implements Executor<EnEvent, StateOutput, AxState, Ap
// There may be no task selection logic, in which case just return the default task
if (taskSelectExecutor != null) {
// Fire the task selector to find the task to run
- taskKey = taskSelectExecutor.execute(executionID, incomingEvent);
+ taskKey = taskSelectExecutor.execute(executionId, incomingEvent);
}
// If there's no task selection logic or the TSL returned no task, just use the default
@@ -201,7 +201,7 @@ public class StateExecutor implements Executor<EnEvent, StateOutput, AxState, Ap
final TreeMap<String, Object> incomingValues = new TreeMap<>();
incomingValues.putAll(incomingEvent);
final Map<String, Object> taskExecutionResultMap =
- taskExecutorMap.get(taskKey).execute(executionID, incomingValues);
+ taskExecutorMap.get(taskKey).execute(executionId, incomingValues);
final AxTask task = taskExecutorMap.get(taskKey).getSubject();
// Check if this task has direct output
@@ -220,7 +220,7 @@ public class StateExecutor implements Executor<EnEvent, StateOutput, AxState, Ap
// Execute the state finalizer logic to select a state output and to adjust the
// taskExecutionResultMap
stateOutputName =
- finalizerLogicExecutor.execute(incomingEvent.getExecutionID(), taskExecutionResultMap);
+ finalizerLogicExecutor.execute(incomingEvent.getExecutionId(), taskExecutionResultMap);
}
// Now look up the the actual state output
@@ -240,8 +240,8 @@ public class StateExecutor implements Executor<EnEvent, StateOutput, AxState, Ap
stateOutput.copyUnsetFields(incomingEvent);
// Set the ExecutionID for the outgoing event to the value in the incoming event.
- if (stateOutput != null && stateOutput.getOutputEvent() != null) {
- stateOutput.getOutputEvent().setExecutionID(incomingEvent.getExecutionID());
+ if (stateOutput.getOutputEvent() != null) {
+ stateOutput.getOutputEvent().setExecutionId(incomingEvent.getExecutionId());
}
// That's it, the state execution is complete
@@ -262,7 +262,7 @@ public class StateExecutor implements Executor<EnEvent, StateOutput, AxState, Ap
* java.lang.Object)
*/
@Override
- public final void executePre(final long executionID, final EnEvent incomingEntity) throws StateMachineException {
+ public final void executePre(final long executionId, final EnEvent incomingEntity) throws StateMachineException {
throw new StateMachineException("execution pre work not implemented on class");
}
@@ -384,5 +384,7 @@ public class StateExecutor implements Executor<EnEvent, StateOutput, AxState, Ap
* engine. ExecutorParameters)
*/
@Override
- public void setParameters(final ExecutorParameters parameters) {}
+ public void setParameters(final ExecutorParameters parameters) {
+ // Not implemented in this class
+ }
}
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java
index 687c3b305..1c225f7b8 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java
@@ -36,17 +36,20 @@ import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
/**
- * This abstract class executes state finalizer logic in a state of an Apex policy and is
- * specialized by classes that implement execution of state finalizer logic.
+ * This abstract class executes state finalizer logic in a state of an Apex policy and is specialized by classes that
+ * implement execution of state finalizer logic.
*
* @author Sven van der Meer (sven.van.der.meer@ericsson.com)
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public abstract class StateFinalizerExecutor
- implements Executor<Map<String, Object>, String, AxStateFinalizerLogic, ApexInternalContext> {
+ implements Executor<Map<String, Object>, String, AxStateFinalizerLogic, ApexInternalContext> {
// Logger for this class
private static final XLogger LOGGER = XLoggerFactory.getXLogger(StateFinalizerExecutor.class);
+ // Repeated string constants
+ private static final String EXECUTE_POST_SFL = "execute-post: state finalizer logic \"";
+
// Hold the state and context definitions
private Executor<?, ?, ?, ?> parent = null;
private AxState axState = null;
@@ -81,7 +84,8 @@ public abstract class StateFinalizerExecutor
*/
@Override
public void setContext(final Executor<?, ?, ?, ?> incomingParent,
- final AxStateFinalizerLogic incomingFinalizerLogic, final ApexInternalContext incomingInternalContext) {
+ final AxStateFinalizerLogic incomingFinalizerLogic,
+ final ApexInternalContext incomingInternalContext) {
this.parent = incomingParent;
axState = (AxState) parent.getSubject();
this.finalizerLogic = incomingFinalizerLogic;
@@ -96,41 +100,39 @@ public abstract class StateFinalizerExecutor
@Override
public void prepare() throws StateMachineException {
LOGGER.debug("prepare:" + finalizerLogic.getId() + "," + finalizerLogic.getLogicFlavour() + ","
- + finalizerLogic.getLogic());
+ + finalizerLogic.getLogic());
argumentOfClassNotNull(finalizerLogic.getLogic(), StateMachineException.class, "task logic cannot be null.");
}
/*
* (non-Javadoc)
*
- * @see org.onap.policy.apex.core.engine.executor.Executor#execute(java.lang.long,
- * java.lang.Object)
+ * @see org.onap.policy.apex.core.engine.executor.Executor#execute(java.lang.long, java.lang.Object)
*/
@Override
- public String execute(final long executionID, final Map<String, Object> newIncomingFields)
- throws StateMachineException, ContextException {
- throw new StateMachineException(
- "execute() not implemented on abstract StateFinalizerExecutionContext class, only on its subclasses");
+ public String execute(final long executionId, final Map<String, Object> newIncomingFields)
+ throws StateMachineException, ContextException {
+ throw new StateMachineException("execute() not implemented on abstract StateFinalizerExecutionContext class, "
+ + "only on its subclasses");
}
/*
* (non-Javadoc)
*
- * @see org.onap.policy.apex.core.engine.executor.Executor#executePre(java.lang.long,
- * java.lang.Object)
+ * @see org.onap.policy.apex.core.engine.executor.Executor#executePre(java.lang.long, java.lang.Object)
*/
@Override
- public final void executePre(final long executionID, final Map<String, Object> newIncomingFields)
- throws StateMachineException, ContextException {
+ public final void executePre(final long executionId, final Map<String, Object> newIncomingFields)
+ throws StateMachineException, ContextException {
LOGGER.debug("execute-pre:" + finalizerLogic.getLogicFlavour() + "," + getSubject().getId() + ","
- + finalizerLogic.getLogic());
+ + finalizerLogic.getLogic());
// Record the incoming fields
this.incomingFields = newIncomingFields;
// Get state finalizer context object
- executionContext = new StateFinalizerExecutionContext(this, executionID, axState, getIncoming(),
- axState.getStateOutputs().keySet(), getContext());
+ executionContext = new StateFinalizerExecutionContext(this, executionId, axState, getIncoming(),
+ axState.getStateOutputs().keySet(), getContext());
}
/*
@@ -142,7 +144,7 @@ public abstract class StateFinalizerExecutor
public final void executePost(final boolean returnValue) throws StateMachineException, ContextException {
if (!returnValue) {
String errorMessage = "execute-post: state finalizer logic execution failure on state \"" + axState.getId()
- + "\" on finalizer logic " + finalizerLogic.getId();
+ + "\" on finalizer logic " + finalizerLogic.getId();
if (executionContext.getMessage() != null) {
errorMessage += ", user message: " + executionContext.getMessage();
}
@@ -152,23 +154,20 @@ public abstract class StateFinalizerExecutor
// Check a state output has been selected
if (getOutgoing() == null) {
- LOGGER.warn("execute-post: state finalizer logic \"" + finalizerLogic.getId()
- + "\" did not select an output state");
- throw new StateMachineException("execute-post: state finalizer logic \"" + finalizerLogic.getId()
- + "\" did not select an output state");
+ String message = EXECUTE_POST_SFL + finalizerLogic.getId() + "\" did not select an output state";
+ LOGGER.warn(message);
+ throw new StateMachineException(message);
}
if (!axState.getStateOutputs().keySet().contains(getOutgoing())) {
- LOGGER.warn(
- "execute-post: state finalizer logic \"" + finalizerLogic.getId() + "\" selected output state \""
- + getOutgoing() + "\" that does not exsist on state \"" + axState.getId() + "\"");
- throw new StateMachineException(
- "execute-post: state finalizer logic \"" + finalizerLogic.getId() + "\" selected output state \""
+ LOGGER.warn(EXECUTE_POST_SFL + finalizerLogic.getId() + "\" selected output state \"" + getOutgoing()
+ + "\" that does not exsist on state \"" + axState.getId() + "\"");
+ throw new StateMachineException(EXECUTE_POST_SFL + finalizerLogic.getId() + "\" selected output state \""
+ getOutgoing() + "\" that does not exsist on state \"" + axState.getId() + "\"");
}
- LOGGER.debug("execute-post:" + finalizerLogic.getId() + ", returning state output \"" + getOutgoing()
- + " and fields " + incomingFields);
+ LOGGER.debug("execute-post:{}, returning state output \"{}\" and fields {}", finalizerLogic.getId(),
+ getOutgoing(), incomingFields);
}
/*
@@ -244,14 +243,13 @@ public abstract class StateFinalizerExecutor
/*
* (non-Javadoc)
*
- * @see
- * org.onap.policy.apex.core.engine.executor.Executor#setNext(org.onap.policy.apex.core.engine.
+ * @see org.onap.policy.apex.core.engine.executor.Executor#setNext(org.onap.policy.apex.core.engine.
* executor.Executor)
*/
@Override
- public void setNext(final Executor<Map<String, Object>, String, AxStateFinalizerLogic, ApexInternalContext>
- incomingNextExecutor) {
- this.nextExecutor = incomingNextExecutor;
+ public void setNext(
+ final Executor<Map<String, Object>, String, AxStateFinalizerLogic, ApexInternalContext> inNextEx) {
+ this.nextExecutor = inNextEx;
}
/*
@@ -267,10 +265,10 @@ public abstract class StateFinalizerExecutor
/*
* (non-Javadoc)
*
- * @see
- * org.onap.policy.apex.core.engine.executor.Executor#setParameters(org.onap.policy.apex.core.
- * engine. ExecutorParameters)
+ * @see org.onap.policy.apex.core.engine.executor.Executor#setParameters(org.onap.policy.apex.core. engine.
+ * ExecutorParameters)
*/
@Override
- public void setParameters(final ExecutorParameters parameters) {}
+ public void setParameters(final ExecutorParameters parameters) {
+ }
}
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutor.java
index 07ef8d6d6..97d51bf78 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutor.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutor.java
@@ -128,7 +128,7 @@ public class StateMachineExecutor implements Executor<EnEvent, EnEvent, AxPolicy
* java.lang.Object)
*/
@Override
- public EnEvent execute(final long executionID, final EnEvent incomingEvent)
+ public EnEvent execute(final long executionId, final EnEvent incomingEvent)
throws StateMachineException, ContextException {
// Check if there are any states on the state machine
if (stateExecutorMap.size() == 0) {
@@ -147,7 +147,7 @@ public class StateMachineExecutor implements Executor<EnEvent, EnEvent, AxPolicy
incomingEvent.getKey(), firstExecutor.getSubject().getKey()), incomingEvent);
while (true) {
// Execute the state
- stateOutput = stateExecutor.execute(executionID, stateOutput.getOutputEvent());
+ stateOutput = stateExecutor.execute(executionId, stateOutput.getOutputEvent());
if (stateOutput == null) {
throw new StateMachineException("state execution failed, invalid state output returned");
}
@@ -175,7 +175,7 @@ public class StateMachineExecutor implements Executor<EnEvent, EnEvent, AxPolicy
* java.lang.Object)
*/
@Override
- public final void executePre(final long executionID, final EnEvent incomingEntity) throws StateMachineException {
+ public final void executePre(final long executionId, final EnEvent incomingEntity) throws StateMachineException {
throw new StateMachineException("execution pre work not implemented on class");
}
@@ -291,5 +291,7 @@ public class StateMachineExecutor implements Executor<EnEvent, EnEvent, AxPolicy
* engine. ExecutorParameters)
*/
@Override
- public void setParameters(final ExecutorParameters parameters) {}
+ public void setParameters(final ExecutorParameters parameters) {
+ // Not implemented in this class
+ }
}
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateOutput.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateOutput.java
index 65cb0d2b8..837347174 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateOutput.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateOutput.java
@@ -34,8 +34,7 @@ import org.onap.policy.apex.model.policymodel.concepts.AxStateOutput;
import org.onap.policy.apex.model.utilities.Assertions;
/**
- * This class is the output of a state, and is used by the engine to decide what the next state for
- * execution is.
+ * This class is the output of a state, and is used by the engine to decide what the next state for execution is.
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
@@ -104,14 +103,14 @@ public class StateOutput {
* @throws StateMachineException on errors populating the event fields
*/
public void setEventFields(final Map<String, AxField> incomingFieldDefinitionMap,
- final Map<String, Object> eventFieldMap) throws StateMachineException {
+ final Map<String, Object> eventFieldMap) throws StateMachineException {
Assertions.argumentNotNull(incomingFieldDefinitionMap, "incomingFieldDefinitionMap may not be null");
Assertions.argumentNotNull(eventFieldMap, "eventFieldMap may not be null");
if (!incomingFieldDefinitionMap.keySet().equals(eventFieldMap.keySet())) {
throw new StateMachineException(
- "field definitions and values do not match for event " + outputEventDef.getId() + '\n'
- + incomingFieldDefinitionMap.keySet() + '\n' + eventFieldMap.keySet());
+ "field definitions and values do not match for event " + outputEventDef.getId() + '\n'
+ + incomingFieldDefinitionMap.keySet() + '\n' + eventFieldMap.keySet());
}
for (final Entry<String, Object> incomingFieldEntry : eventFieldMap.entrySet()) {
final String fieldName = incomingFieldEntry.getKey();
@@ -119,8 +118,8 @@ public class StateOutput {
// Check if this field is a field in the event
if (!outputEventDef.getFields().contains(fieldDef)) {
- throw new StateMachineException(
- "field \"" + fieldName + "\" does not exist on event \"" + outputEventDef.getId() + "\"");
+ throw new StateMachineException("field \"" + fieldName + "\" does not exist on event \""
+ + outputEventDef.getId() + "\"");
}
// Set the value in the output event
@@ -129,8 +128,8 @@ public class StateOutput {
}
/**
- * This method copies any fields that exist on the input event that also exist on the output
- * event if they are not set on the output event.
+ * This method copies any fields that exist on the input event that also exist on the output event if they are not
+ * set on the output event.
*
* @param incomingEvent The incoming event to copy from
*/
@@ -141,18 +140,14 @@ public class StateOutput {
final String fieldName = incomingField.getKey();
// Check if the field exists on the outgoing event
- if (!outputEventDef.getParameterMap().containsKey(fieldName)) {
- continue;
- }
+ if ((!outputEventDef.getParameterMap().containsKey(fieldName))
- // Check if the field is set on the outgoing event
- if (outputEvent.containsKey(fieldName)) {
- continue;
- }
+ // Check if the field is set on the outgoing event
+ || (outputEvent.containsKey(fieldName))
- // Now, check the fields have the same type
- if (!incomingEvent.getAxEvent().getParameterMap().get(fieldName)
- .equals(outputEvent.getAxEvent().getParameterMap().get(fieldName))) {
+ // Now, check the fields have the same type
+ || (!incomingEvent.getAxEvent().getParameterMap().get(fieldName)
+ .equals(outputEvent.getAxEvent().getParameterMap().get(fieldName)))) {
continue;
}
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java
index de2f7b821..814f257f7 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java
@@ -101,7 +101,8 @@ public abstract class TaskExecutor
public void prepare() throws StateMachineException {
LOGGER.debug("prepare:" + axTask.getKey().getId() + "," + axTask.getTaskLogic().getLogicFlavour() + ","
+ axTask.getTaskLogic().getLogic());
- argumentOfClassNotNull(axTask.getTaskLogic().getLogic(), StateMachineException.class, "task logic cannot be null.");
+ argumentOfClassNotNull(axTask.getTaskLogic().getLogic(), StateMachineException.class,
+ "task logic cannot be null.");
}
/*
@@ -111,7 +112,7 @@ public abstract class TaskExecutor
* java.lang.Object)
*/
@Override
- public Map<String, Object> execute(final long executionID, final Map<String, Object> newIncomingFields)
+ public Map<String, Object> execute(final long executionId, final Map<String, Object> newIncomingFields)
throws StateMachineException, ContextException {
throw new StateMachineException(
"execute() not implemented on abstract TaskExecutor class, only on its subclasses");
@@ -124,7 +125,7 @@ public abstract class TaskExecutor
* java.lang.Object)
*/
@Override
- public final void executePre(final long executionID, final Map<String, Object> newIncomingFields)
+ public final void executePre(final long executionId, final Map<String, Object> newIncomingFields)
throws StateMachineException, ContextException {
LOGGER.debug("execute-pre:" + getSubject().getTaskLogic().getLogicFlavour() + ","
+ getSubject().getKey().getId() + "," + getSubject().getTaskLogic().getLogic());
@@ -157,7 +158,7 @@ public abstract class TaskExecutor
// Get task context object
executionContext =
- new TaskExecutionContext(this, executionID, getSubject(), getIncoming(), getOutgoing(), getContext());
+ new TaskExecutionContext(this, executionId, getSubject(), getIncoming(), getOutgoing(), getContext());
}
/*
@@ -228,7 +229,8 @@ public abstract class TaskExecutor
+ "\" are unwanted for task \"" + axTask.getKey().getId() + "\"");
}
- LOGGER.debug("execute-post:" + axTask.getKey().getId() + ", returning fields " + outgoingFields.toString());
+ String message = "execute-post:" + axTask.getKey().getId() + ", returning fields " + outgoingFields.toString();
+ LOGGER.debug(message);
}
/*
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutor.java
index cda0ac549..5d24f0d4a 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutor.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutor.java
@@ -104,7 +104,7 @@ public abstract class TaskSelectExecutor implements Executor<EnEvent, AxArtifact
* java.lang.Object)
*/
@Override
- public AxArtifactKey execute(final long executionID, final EnEvent newIncomingEvent)
+ public AxArtifactKey execute(final long executionId, final EnEvent newIncomingEvent)
throws StateMachineException, ContextException {
throw new StateMachineException("execute() not implemented on class");
}
@@ -116,7 +116,7 @@ public abstract class TaskSelectExecutor implements Executor<EnEvent, AxArtifact
* java.lang.Object)
*/
@Override
- public final void executePre(final long executionID, final EnEvent newIncomingEvent) throws StateMachineException {
+ public final void executePre(final long executionId, final EnEvent newIncomingEvent) throws StateMachineException {
LOGGER.debug("execute-pre:" + axState.getKey().getId() + "," + axState.getTaskSelectionLogic().getLogicFlavour()
+ "," + axState.getTaskSelectionLogic().getLogic());
@@ -126,7 +126,7 @@ public abstract class TaskSelectExecutor implements Executor<EnEvent, AxArtifact
outgoingTaskKey = new AxArtifactKey();
// Get task selection context object
- executionContext = new TaskSelectionExecutionContext(this, executionID, getSubject(), getIncoming(),
+ executionContext = new TaskSelectionExecutionContext(this, executionId, getSubject(), getIncoming(),
getOutgoing(), getContext());
}
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 be1b311c2..460639b90 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
@@ -58,7 +58,7 @@ public class StateFinalizerExecutionContext {
public final AxStateFacade subject;
/** the execution ID for the current APEX policy execution instance. */
- public final Long executionID;
+ public final Long executionId;
/**
* The list of state outputs for this state finalizer. The purpose of a state finalizer is to
@@ -99,7 +99,7 @@ public class StateFinalizerExecutionContext {
* Instantiates a new state finalizer execution context.
*
* @param stateFinalizerExecutor the state finalizer executor that requires context
- * @param executionID the execution ID for the current APEX policy execution instance
+ * @param executionId the execution ID for the current APEX policy execution instance
* @param axState the state definition that is the subject of execution
* @param fields the fields to be manipulated by the state finalizer
* @param stateOutputNames the state output names, one of which will be selected by the state
@@ -107,13 +107,13 @@ public class StateFinalizerExecutionContext {
* @param internalContext the execution context of the Apex engine in which the task is being
* executed
*/
- public StateFinalizerExecutionContext(final StateFinalizerExecutor stateFinalizerExecutor, final long executionID,
+ public StateFinalizerExecutionContext(final StateFinalizerExecutor stateFinalizerExecutor, final long executionId,
final AxState axState, final Map<String, Object> fields, final Set<String> stateOutputNames,
final ApexInternalContext internalContext) {
subject = new AxStateFacade(axState);
// Execution ID is the current policy execution instance
- this.executionID = executionID;
+ this.executionId = executionId;
this.fields = fields;
this.stateOutputNames = stateOutputNames;
@@ -150,7 +150,7 @@ public class StateFinalizerExecutionContext {
* @throws ContextRuntimeException if the context album does not exist on the state for this
* executor
*/
- public ContextAlbum getContextAlbum(final String contextAlbumName) throws ContextRuntimeException {
+ public ContextAlbum getContextAlbum(final String contextAlbumName) {
// Find the context album
final ContextAlbum foundContextAlbum = context.get(contextAlbumName);
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 a9a157082..4a9e83063 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
@@ -52,18 +52,18 @@ public class TaskExecutionContext {
// CHECKSTYLE:OFF: checkstyle:VisibilityModifier Logic has access to these field
/** A constant <code>boolean true</code> value available for reuse e.g., for the return value */
- public final Boolean TRUE = true;
+ public final Boolean isTrue = true;
/**
* A constant <code>boolean false</code> value available for reuse e.g., for the return value
*/
- public final Boolean FALSE = false;
+ public final Boolean isFalse = false;
/** A facade to the full task definition for the task logic being executed. */
public final AxTaskFacade subject;
/** the execution ID for the current APEX policy execution instance. */
- public final Long executionID;
+ public final Long executionId;
/**
* The incoming fields from the trigger event for the task. The task logic can access these
@@ -97,21 +97,21 @@ public class TaskExecutionContext {
* Instantiates a new task execution context.
*
* @param taskExecutor the task executor that requires context
- * @param executionID the execution ID for the current APEX policy execution instance
+ * @param executionId the execution ID for the current APEX policy execution instance
* @param axTask the task definition that is the subject of execution
* @param inFields the in fields
* @param outFields the out fields
* @param internalContext the execution context of the Apex engine in which the task is being
* executed
*/
- public TaskExecutionContext(final TaskExecutor taskExecutor, final long executionID, final AxTask axTask,
+ public TaskExecutionContext(final TaskExecutor taskExecutor, final long executionId, final AxTask axTask,
final Map<String, Object> inFields, final Map<String, Object> outFields,
final ApexInternalContext internalContext) {
// The subject is the task definition
subject = new AxTaskFacade(axTask);
// Execution ID is the current policy execution instance
- this.executionID = executionID;
+ this.executionId = executionId;
// The input and output fields
this.inFields = Collections.unmodifiableMap(inFields);
@@ -147,7 +147,7 @@ public class TaskExecutionContext {
* @throws ContextRuntimeException if the context album does not exist on the task for this
* executor
*/
- public ContextAlbum getContextAlbum(final String contextAlbumName) throws ContextRuntimeException {
+ public ContextAlbum getContextAlbum(final String contextAlbumName) {
// Find the context album
final ContextAlbum foundContextAlbum = context.get(contextAlbumName);
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 3194e3fce..63052348a 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
@@ -52,18 +52,18 @@ public class TaskSelectionExecutionContext {
// CHECKSTYLE:OFF: checkstyle:VisibilityModifier Logic has access to these field
/** A constant <code>boolean true</code> value available for reuse e.g., for the return value */
- public final Boolean TRUE = true;
+ public final Boolean isTrue = true;
/**
* A constant <code>boolean false</code> value available for reuse e.g., for the return value
*/
- public final Boolean FALSE = false;
+ public final Boolean isFalse = false;
/** A facade to the full state definition for the task selection logic being executed. */
public final AxStateFacade subject;
/** the execution ID for the current APEX policy execution instance. */
- public final Long executionID;
+ public final Long executionId;
/**
* The incoming fields from the trigger event for the state. The task selection logic can access
@@ -96,21 +96,21 @@ public class TaskSelectionExecutionContext {
* Instantiates a new task selection execution context.
*
* @param taskSelectExecutor the task selection executor that requires context
- * @param executionID the execution identifier
+ * @param executionId the execution identifier
* @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
*/
- public TaskSelectionExecutionContext(final TaskSelectExecutor taskSelectExecutor, final long executionID,
+ public TaskSelectionExecutionContext(final TaskSelectExecutor taskSelectExecutor, final long executionId,
final AxState axState, final EnEvent incomingEvent, final AxArtifactKey outgoingKey,
final ApexInternalContext internalContext) {
// The subject is the state definition
subject = new AxStateFacade(axState);
// Execution ID is the current policy execution instance
- this.executionID = executionID;
+ this.executionId = executionId;
// The events
inFields = incomingEvent;
@@ -153,7 +153,7 @@ public class TaskSelectionExecutionContext {
* @throws ContextRuntimeException if the context album does not exist on the state for this
* executor
*/
- public ContextAlbum getContextAlbum(final String contextAlbumName) throws ContextRuntimeException {
+ public ContextAlbum getContextAlbum(final String contextAlbumName) {
// Find the context album
final ContextAlbum foundContextAlbum = context.get(contextAlbumName);
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/monitoring/EventMonitor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/monitoring/EventMonitor.java
index c1c9ce949..de2639dcb 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/monitoring/EventMonitor.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/monitoring/EventMonitor.java
@@ -44,7 +44,8 @@ public class EventMonitor {
* @param userArtifactStack the keys of the artifacts using the event at the moment
*/
public void monitorGet(final AxField eventParameter, final Object value, final AxConcept[] userArtifactStack) {
- LOGGER.trace(monitor("GET", userArtifactStack, eventParameter, value));
+ String monitorGetString = monitor("GET", userArtifactStack, eventParameter, value);
+ LOGGER.trace(monitorGetString);
}
/**
@@ -55,7 +56,8 @@ public class EventMonitor {
* @param userArtifactStack the keys of the artifacts using the event at the moment
*/
public void monitorSet(final AxField eventParameter, final Object value, final AxConcept[] userArtifactStack) {
- LOGGER.trace(monitor("SET", userArtifactStack, eventParameter, value));
+ String monitorSetString = monitor("SET", userArtifactStack, eventParameter, value);
+ LOGGER.trace(monitorSetString);
}
/**
@@ -67,7 +69,8 @@ public class EventMonitor {
*/
public void monitorRemove(final AxField eventParameter, final Object removedValue,
final AxConcept[] userArtifactStack) {
- LOGGER.trace(monitor("REMOVE", userArtifactStack, eventParameter, removedValue));
+ String monitorRemoveString = monitor("REMOVE", userArtifactStack, eventParameter, removedValue);
+ LOGGER.trace(monitorRemoveString);
}
/**