From 96ebc03263c221b16dd713b30cd4d8667d7a6219 Mon Sep 17 00:00:00 2001 From: Dinh Danh Le Date: Tue, 14 Aug 2018 17:05:56 +0100 Subject: Fix checkstyle warnings in core-engine module Change-Id: Ie79c88e21a3d1f4cd53fd678a7afcffe1c6c202c Signed-off-by: Dinh Danh Le Issue-ID: POLICY-1034 --- .../policy/apex/core/engine/EngineParameters.java | 27 +++++++-------- .../apex/core/engine/ExecutorParameters.java | 22 ++++++++----- .../policy/apex/core/engine/engine/ApexEngine.java | 36 ++++++++++---------- .../core/engine/engine/impl/ApexEngineFactory.java | 4 +-- .../core/engine/engine/impl/ApexEngineImpl.java | 3 +- .../engine/engine/impl/StateMachineHandler.java | 19 ++++++----- .../apex/core/engine/engine/impl/package-info.java | 3 +- .../policy/apex/core/engine/event/EnEvent.java | 25 +++++++------- .../policy/apex/core/engine/event/EnException.java | 6 ++-- .../apex/core/engine/event/package-info.java | 4 +-- .../policy/apex/core/engine/executor/Executor.java | 22 ++++++++----- .../apex/core/engine/executor/ExecutorFactory.java | 3 +- .../apex/core/engine/executor/StateExecutor.java | 31 +++++++++++------- .../engine/executor/StateFinalizerExecutor.java | 30 +++++++++-------- .../core/engine/executor/StateMachineExecutor.java | 25 ++++++++------ .../apex/core/engine/executor/TaskExecutor.java | 38 +++++++++++++--------- .../core/engine/executor/TaskSelectExecutor.java | 26 ++++++++------- .../engine/executor/context/AxStateFacade.java | 4 +-- .../core/engine/executor/context/AxTaskFacade.java | 8 ++--- .../context/StateFinalizerExecutionContext.java | 37 ++++++++++++--------- .../executor/context/TaskExecutionContext.java | 28 +++++++++------- .../context/TaskSelectionExecutionContext.java | 28 +++++++++------- .../core/engine/executor/context/package-info.java | 13 ++++---- .../executor/exception/StateMachineException.java | 6 ++-- .../exception/StateMachineRuntimeException.java | 6 ++-- .../engine/executor/impl/ExecutorFactoryImpl.java | 3 +- .../apex/core/engine/monitoring/package-info.java | 4 +-- 27 files changed, 265 insertions(+), 196 deletions(-) (limited to 'core/core-engine') diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameters.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameters.java index ff616979d..62fe6a552 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameters.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameters.java @@ -28,18 +28,18 @@ import org.onap.policy.apex.model.basicmodel.service.AbstractParameters; import org.onap.policy.apex.model.basicmodel.service.ParameterService; /** - * This class holds the parameters for a single Apex engine. This parameter class holds parameters for context schemas - * and context albums for the engine and a map of the logic flavour executors defined for the engine and the parameters - * for each of those executors. - *

- * The context parameters for the engine are held in a {@link ContextParameters} instance. This instance holds the - * parameters for context schema handling that will be used by the engine as well as the context album distribution, - * locking, and persistence parameters. - *

- * In Apex, an engine can be configured to use many logic flavours. The executors for each logic flavour are identified - * by their name. Each logic flavour executor must have an instance of {@link ExecutorParameters} defined for it, which - * specifies the executor plugins to use for that logic flavour executor and specific parameters for those executor - * plugins. + * This class holds the parameters for a single Apex engine. This parameter class holds parameters + * for context schemas and context albums for the engine and a map of the logic flavour executors + * defined for the engine and the parameters for each of those executors. + * + *

The context parameters for the engine are held in a {@link ContextParameters} instance. This + * instance holds the parameters for context schema handling that will be used by the engine as well + * as the context album distribution, locking, and persistence parameters. + * + *

In Apex, an engine can be configured to use many logic flavours. The executors for each logic + * flavour are identified by their name. Each logic flavour executor must have an instance of + * {@link ExecutorParameters} defined for it, which specifies the executor plugins to use for that + * logic flavour executor and specific parameters for those executor plugins. * * @author Liam Fallon (liam.fallon@ericsson.com) */ @@ -50,7 +50,8 @@ public class EngineParameters extends AbstractParameters { private Map executorParameterMap = new TreeMap(); /** - * Constructor to create an engine parameters instance and register the instance with the parameter service. + * Constructor to create an engine parameters instance and register the instance with the + * parameter service. */ public EngineParameters() { super(EngineParameters.class.getCanonicalName()); diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/ExecutorParameters.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/ExecutorParameters.java index d3a8ed5ac..53cac399e 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/ExecutorParameters.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/ExecutorParameters.java @@ -24,10 +24,11 @@ import org.onap.policy.apex.model.basicmodel.service.AbstractParameters; import org.onap.policy.apex.model.basicmodel.service.ParameterService; /** - * This class provides the executors for a logic flavour. Plugin classes for execution of task logic, task selection - * logic, and state finalizer logic for the logic flavour must be specified. - *

- * Specializations of this class may provide extra parameters for their specific logic flavour executors. + * This class provides the executors for a logic flavour. Plugin classes for execution of task + * logic, task selection logic, and state finalizer logic for the logic flavour must be specified. + * + *

Specializations of this class may provide extra parameters for their specific logic flavour + * executors. * * @author Liam Fallon (liam.fallon@ericsson.com) */ @@ -38,7 +39,8 @@ public class ExecutorParameters extends AbstractParameters { private String stateFinalizerExecutorPluginClass; /** - * Constructor to create an executor parameters instance and register the instance with the parameter service. + * Constructor to create an executor parameters instance and register the instance with the + * parameter service. */ public ExecutorParameters() { super(ExecutorParameters.class.getCanonicalName()); @@ -46,8 +48,8 @@ public class ExecutorParameters extends AbstractParameters { } /** - * Constructor to create an executor parameters instance with the name of a sub class of this class and register the - * instance with the parameter service. + * Constructor to create an executor parameters instance with the name of a sub class of this + * class and register the instance with the parameter service. * * @param parameterClassName the class name of a sub class of this class */ @@ -85,7 +87,8 @@ public class ExecutorParameters extends AbstractParameters { /** * Sets the task selection executor plugin class for the executor. * - * @param taskSelectionExecutorPluginClass the task selection executor plugin class for the executor + * @param taskSelectionExecutorPluginClass the task selection executor plugin class for the + * executor */ public void setTaskSelectionExecutorPluginClass(final String taskSelectionExecutorPluginClass) { this.taskSelectionExecutorPluginClass = taskSelectionExecutorPluginClass; @@ -103,7 +106,8 @@ public class ExecutorParameters extends AbstractParameters { /** * Sets the state finalizer executor plugin class for the executor. * - * @param stateFinalizerExecutorPluginClass the state finalizer executor plugin class for the executor + * @param stateFinalizerExecutorPluginClass the state finalizer executor plugin class for the + * executor */ public void setStateFinalizerExecutorPluginClass(final String stateFinalizerExecutorPluginClass) { this.stateFinalizerExecutorPluginClass = stateFinalizerExecutorPluginClass; 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 9e27e5e86..b25192cd0 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 @@ -30,20 +30,21 @@ import org.onap.policy.apex.model.enginemodel.concepts.AxEngineState; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; /** - * The Interface ApexEngine is used to control the execution of a single Apex engine thread. This engine instance - * executes the policies in an {@link AxPolicyModel}, which defines the policies that are executed by the engine and the - * context in which they execute. Many instances of an Apex engine may run on the same Apex model, in which case they - * operate the same policy set in parallel over the same context. When the {@code handleEvent} method is passed to the - * Apex engine, the engine executes the policy triggered by that event. A single Apex engine instance does not executed - * multiple policies in parallel, it receives a trigger event and executes the policy for that event to completion - * before it is available to execute another policy. + * The Interface ApexEngine is used to control the execution of a single Apex engine thread. This + * engine instance executes the policies in an {@link AxPolicyModel}, which defines the policies + * that are executed by the engine and the context in which they execute. Many instances of an Apex + * engine may run on the same Apex model, in which case they operate the same policy set in parallel + * over the same context. When the {@code handleEvent} method is passed to the Apex engine, the + * engine executes the policy triggered by that event. A single Apex engine instance does not + * executed multiple policies in parallel, it receives a trigger event and executes the policy for + * that event to completion before it is available to execute another policy. * * @author Liam Fallon (liam.fallon@ericsson.com) */ 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. + * 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; @@ -51,10 +52,10 @@ public interface ApexEngine { int APEX_ENGINE_STOP_EXECUTION_WAIT_INCREMENT = 100; /** - * Update the Apex model to be used by the Apex engine. The engine must be in state "STOPPED" when the model is - * updated. The engine will replace the current model with the incoming model if the model of the engine was - * previously updated and the value of common context is transferred if there is common context in the old and new - * models. + * Update the Apex model to be used by the Apex engine. The engine must be in state "STOPPED" + * when the model is updated. The engine will replace the current model with the incoming model + * if the model of the engine was previously updated and the value of common context is + * transferred if there is common context in the old and new models. * * @param apexModel the apex model * @throws ApexException on model update errors @@ -83,7 +84,8 @@ public interface ApexEngine { void clear() throws ApexException; /** - * This method constructs an event with the correct event context so that it can later be sent to the Apex engine. + * This method constructs an event with the correct event context so that it can later be sent + * to the Apex engine. * * @param eventKey The key of the event in the Apex model * @return the created event @@ -91,11 +93,11 @@ public interface ApexEngine { EnEvent createEvent(AxArtifactKey eventKey); /** - * This method passes an event to the Apex model to invoke a policy. If the event matches a policy, then that policy - * is executed. + * This method passes an event to the Apex model to invoke a policy. If the event matches a + * policy, then that policy is executed. * - * @return return true if a policy was invoked without error, otherwise false. * @param incomingEvent the incoming event + * @return return true if a policy was invoked without error, otherwise false. */ boolean handleEvent(EnEvent incomingEvent); diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineFactory.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineFactory.java index 4920486de..754181485 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineFactory.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineFactory.java @@ -24,8 +24,8 @@ import org.onap.policy.apex.core.engine.engine.ApexEngine; import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; /** - * A factory class to create APEX engines of a given type. As there is only a single type of Apex engine in existence, - * this class is trivial. + * A factory class to create APEX engines of a given type. As there is only a single type of Apex + * engine in existence, this class is trivial. * * @author Liam Fallon */ 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 12ba76afb..235140863 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 @@ -428,7 +428,8 @@ public class ApexEngineImpl implements ApexEngine { * @return the exception event */ private EnEvent createExceptionEvent(final EnEvent incomingEvent, final Exception eventException) { - // The exception event is a clone of the incoming event with the exception suffix added to its name and an extra + // The exception event is a clone of the incoming event with the exception suffix added to + // its name and an extra // field "ExceptionMessage" added final EnEvent exceptionEvent = (EnEvent) incomingEvent.clone(); 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 856136bab..f17d7f825 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 @@ -38,12 +38,13 @@ import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; /** - * This handler holds and manages state machines for each policy in an Apex engine. When the class is instantiated, an - * executor {@link StateMachineExecutor} is created for each policy in the policy model the state machine handler will - * execute. The executors for each policy are held in a map indexed by event. - *

- * When an event is received on the policy, the state machine executor to execute that event is looked up on the - * executor map and the event is passed to the executor for execution. + * This handler holds and manages state machines for each policy in an Apex engine. When the class + * is instantiated, an executor {@link StateMachineExecutor} is created for each policy in the + * policy model the state machine handler will execute. The executors for each policy are held in a + * map indexed by event. + * + *

When an event is received on the policy, the state machine executor to execute that event is + * looked up on the executor map and the event is passed to the executor for execution. * * @author Liam Fallon * @@ -58,7 +59,8 @@ public class StateMachineHandler { // The state machines in this engine private final HashMap stateMachineExecutorMap = new HashMap<>(); - // The executor factory is used to get logic executors for the particular type of executor we need for task + // The executor factory is used to get logic executors for the particular type of executor we + // need for task // selection logic or task logic private final ExecutorFactory executorFactory; @@ -109,7 +111,8 @@ public class StateMachineHandler { } /** - * This constructor starts the state machines for each policy, carrying out whatever initialization executors need. + * This constructor starts the state machines for each policy, carrying out whatever + * initialization executors need. * * @throws StateMachineException On state machine initiation errors */ diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/package-info.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/package-info.java index ce86e2745..d8e1329e7 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/package-info.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/package-info.java @@ -19,7 +19,8 @@ */ /** - * Provides the implementation of the {@link org.onap.policy.apex.core.engine.engine.ApexEngine} interface. + * Provides the implementation of the {@link org.onap.policy.apex.core.engine.engine.ApexEngine} + * interface. * * @author Liam Fallon (liam.fallon@ericsson.com) */ 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 b072a89d0..6fbf647b4 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 @@ -40,8 +40,8 @@ import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; /** - * Instances of the Class EnEvent are events being passed through the Apex system. All events in the system are - * instances of this class. + * Instances of the Class EnEvent are events being passed through the Apex system. All events in the + * system are instances of this class. * * @author Liam Fallon (liam.fallon@ericsson.com) */ @@ -62,7 +62,8 @@ public class EnEvent extends HashMap { private static Random rand = new Random(System.nanoTime()); - // An identifier for the current event execution. The default value here will always be a random number, and should + // 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(); @@ -126,10 +127,11 @@ public class EnEvent extends HashMap { } /** - * Get the currently set value for the ExecutionID for this event. A ExecutionID in an EnEvent is used identify all - * EnEvents (input, internal and output events) used in a single Engine invocation. Therefore, a ExecutionID can be - * used to match which output event is the result of a particular input event. The default initialized value for the - * ExecutionID is always unique in a single JVM. + * Get the currently set value for the ExecutionID for this event. A ExecutionID in an EnEvent + * is used identify all EnEvents (input, internal and output events) used in a single Engine + * invocation. Therefore, a ExecutionID can be used to match which output event is the result of + * a particular input event. The default initialized value for the ExecutionID is always unique + * in a single JVM. * * @return the currently set value for the ExecutionID for this event. */ @@ -138,10 +140,11 @@ public class EnEvent extends HashMap { } /** - * Set the value for the ExecutionID for this event. A ExecutionID in an EnEvent is used identify all EnEvents - * (input, internal and output events) used in a single Engine invocation. Therefore, a ExecutionID can be used to - * match which output event is the result of a particular input event. The default initialised value for the - * ExecutionID is always unique in a single JVM. + * Set the value for the ExecutionID for this event. A ExecutionID in an EnEvent is used + * identify all EnEvents (input, internal and output events) used in a single Engine invocation. + * Therefore, a ExecutionID can be used to match which output event is the result of a + * 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. */ diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnException.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnException.java index 79a65cba4..d9520336b 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnException.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnException.java @@ -43,9 +43,9 @@ public class EnException extends ApexRuntimeException { * Instantiates a new engine event exception. * * @param message the message - * @param e the e + * @param ex the exception */ - public EnException(final String message, final Exception e) { - super(message, e); + public EnException(final String message, final Exception ex) { + super(message, ex); } } diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/package-info.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/package-info.java index e94362a75..23d51a41a 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/package-info.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/package-info.java @@ -19,8 +19,8 @@ */ /** - * Provides the event handling classes that an APEX engine uses and which uses use to send and receive events to and - * from an APEX engine. + * Provides the event handling classes that an APEX engine uses and which uses use to send and + * receive events to and from an APEX engine. * * @author Liam Fallon (liam.fallon@ericsson.com) */ 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 d659002b2..4c969f76e 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 @@ -26,11 +26,13 @@ import org.onap.policy.apex.core.engine.executor.exception.StateMachineException import org.onap.policy.apex.model.basicmodel.concepts.AxConcept; /** - * This interface defines what operations must be provided by an executing entity in Apex. It is implemented by classes - * that execute logic in a state machine. Each executor has an incoming entity {@code IN} that triggers execution, an - * outgoing entity {@code OUT} that is produced by execution, a subject {@code SUBJECT} that is being executed, and a - * context {@code CONTEXT} in which execution is being carried out. An executor can be part of a chain of executors and - * the {@code setNext} method is used to set the next executor to be executed after this executor has completed. + * This interface defines what operations must be provided by an executing entity in Apex. It is + * implemented by classes that execute logic in a state machine. Each executor has an incoming + * entity {@code IN} that triggers execution, an outgoing entity {@code OUT} that is produced by + * execution, a subject {@code SUBJECT} that is being executed, and a context {@code CONTEXT} in + * which execution is being carried out. An executor can be part of a chain of executors and the + * {@code setNext} method is used to set the next executor to be executed after this executor has + * completed. * * @author Sven van der Meer (sven.van.der.meer@ericsson.com) * @author Liam Fallon (liam.fallon@ericsson.com) @@ -45,7 +47,8 @@ public interface Executor { /** * Save the subject and context of the executor. * - * @param parent the parent executor of this executor or null if this executor is the top executor + * @param parent the parent executor of this executor or null if this executor is the top + * executor * @param executorSubject the executor subject, the subject of execution * @param executorContext the executor context, the context in which execution takes place */ @@ -80,10 +83,11 @@ public interface Executor { void executePre(long executionID, IN incomingEntity) throws StateMachineException, ContextException; /** - * Carry out the post work for execution, the returning entity should be set by the child execution object. + * Carry out the post work for execution, the returning entity should be set by the child + * execution object. * - * @param returnValue the return value indicates whether the execution was successful and, if it failed, how it - * failed + * @param returnValue the return value indicates whether the execution was successful and, if it + * failed, how it failed * @throws StateMachineException on an execution error * @throws ContextException On context errors */ diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/ExecutorFactory.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/ExecutorFactory.java index 1bb0b0578..f092ce716 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/ExecutorFactory.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/ExecutorFactory.java @@ -26,7 +26,8 @@ import org.onap.policy.apex.model.policymodel.concepts.AxStateFinalizerLogic; import org.onap.policy.apex.model.policymodel.concepts.AxTask; /** - * This class is used by the state machine to get implementations of task selection and task executors. + * This class is used by the state machine to get implementations of task selection and task + * executors. * * @author Liam Fallon */ 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 ab5b66969..cad83d6bc 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 @@ -84,7 +84,8 @@ public class StateExecutor implements Executor incomingParent, final AxState incomingAxState, @@ -167,7 +167,8 @@ public class StateExecutor implements Executor incomingNextExecutor) { @@ -373,8 +379,9 @@ public class StateExecutor implements Executor, String, AxStateFinalizerLogic, ApexInternalContext> nextExecutor = null; - // The execution context; contains the facades for events and context to be used by tasks executed by this task + // The execution context; contains the facades for events and context to be used by tasks + // executed by this task // executor private StateFinalizerExecutionContext executionContext = null; @@ -75,9 +76,8 @@ public abstract class StateFinalizerExecutor /* * (non-Javadoc) * - * @see - * org.onap.policy.apex.core.engine.executor.Executor#setContext(org.onap.policy.apex.core.engine.executor.Executor, - * java.lang.Object, java.lang.Object) + * @see org.onap.policy.apex.core.engine.executor.Executor#setContext(org.onap.policy.apex.core. + * engine.executor.Executor, java.lang.Object, java.lang.Object) */ @Override public void setContext(final Executor incomingParent, @@ -103,7 +103,8 @@ public abstract class StateFinalizerExecutor /* * (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 newIncomingFields) @@ -115,7 +116,8 @@ public abstract class StateFinalizerExecutor /* * (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 newIncomingFields) @@ -243,11 +245,12 @@ public abstract class StateFinalizerExecutor * (non-Javadoc) * * @see - * org.onap.policy.apex.core.engine.executor.Executor#setNext(org.onap.policy.apex.core.engine.executor.Executor) + * org.onap.policy.apex.core.engine.executor.Executor#setNext(org.onap.policy.apex.core.engine. + * executor.Executor) */ @Override - public void setNext( - final Executor, String, AxStateFinalizerLogic, ApexInternalContext> incomingNextExecutor) { + public void setNext(final Executor, String, AxStateFinalizerLogic, ApexInternalContext> + incomingNextExecutor) { this.nextExecutor = incomingNextExecutor; } @@ -264,8 +267,9 @@ 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) {} 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 05e1b3b4b..7a9594bf8 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 @@ -59,7 +59,8 @@ public class StateMachineExecutor implements Executor newParent, final AxPolicy newAxPolicy, @@ -124,7 +124,8 @@ public class StateMachineExecutor implements Executor newNextExecutor) { @@ -282,8 +286,9 @@ public class StateMachineExecutor implements Executor, Map, AxTask, ApexInternalContext> nextExecutor = null; - // The task execution context; contains the facades for events and context to be used by tasks executed by this task + // The task execution context; contains the facades for events and context to be used by tasks + // executed by this task // executor private TaskExecutionContext executionContext = null; @@ -80,9 +81,8 @@ public abstract class TaskExecutor /* * (non-Javadoc) * - * @see - * org.onap.policy.apex.core.engine.executor.Executor#setContext(org.onap.policy.apex.core.engine.executor.Executor, - * java.lang.Object, java.lang.Object) + * @see org.onap.policy.apex.core.engine.executor.Executor#setContext(org.onap.policy.apex.core. + * engine.executor.Executor, java.lang.Object, java.lang.Object) */ @Override public void setContext(final Executor newParent, final AxTask newAxTask, @@ -107,7 +107,8 @@ public abstract class TaskExecutor /* * (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 Map execute(final long executionID, final Map newIncomingFields) @@ -119,7 +120,8 @@ public abstract class TaskExecutor /* * (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 newIncomingFields) @@ -175,14 +177,16 @@ public abstract class TaskExecutor throw new StateMachineException(errorMessage); } - // Copy any unset fields from the input to the output if their data type and names are identical + // Copy any unset fields from the input to the output if their data type and names are + // identical for (final String field : axTask.getOutputFields().keySet()) { // Check if the field exists and is not set on the output if (!getOutgoing().containsKey(field) || getOutgoing().get(field) != null) { continue; } - // This field is not in the output, check if it's on the input and is the same type (Note here, the output + // This field is not in the output, check if it's on the input and is the same type + // (Note here, the output // field definition has to exist so it's not // null checked) final AxInputField inputFieldDef = axTask.getInputFields().get(field); @@ -195,7 +199,8 @@ public abstract class TaskExecutor getOutgoing().put(field, getIncoming().get(field)); } - // Finally, check that the outgoing fields have all the output fields defined for this state and, if not, output + // Finally, check that the outgoing fields have all the output fields defined for this state + // and, if not, output // a list of missing fields final Set missingTaskOutputFields = new TreeSet<>(axTask.getOutputFields().keySet()); missingTaskOutputFields.removeAll(outgoingFields.keySet()); @@ -213,7 +218,8 @@ public abstract class TaskExecutor + "\" are missing for task \"" + axTask.getKey().getID() + "\""); } - // Finally, check that the outgoing field map don't have any extra fields, if present, raise exception with the + // Finally, check that the outgoing field map don't have any extra fields, if present, raise + // exception with the // list of extra fields final Set extraTaskOutputFields = new TreeSet<>(outgoingFields.keySet()); extraTaskOutputFields.removeAll(axTask.getOutputFields().keySet()); @@ -299,7 +305,8 @@ public abstract class TaskExecutor * (non-Javadoc) * * @see - * org.onap.policy.apex.core.engine.executor.Executor#setNext(org.onap.policy.apex.core.engine.executor.Executor) + * org.onap.policy.apex.core.engine.executor.Executor#setNext(org.onap.policy.apex.core.engine. + * executor.Executor) */ @Override public void setNext( @@ -320,8 +327,9 @@ public abstract class TaskExecutor /* * (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) {} 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 1aaa5ccf5..f3ac1f6b0 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 @@ -35,8 +35,8 @@ import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; /** - * This abstract class executes a the task selection logic of a state of an Apex policy and is specialized by classes - * that implement execution of task selection logic. + * This abstract class executes a the task selection logic of a state of an Apex policy and is + * specialized by classes that implement execution of task selection logic. * * @author Sven van der Meer (sven.van.der.meer@ericsson.com) * @author Liam Fallon (liam.fallon@ericsson.com) @@ -57,7 +57,8 @@ public abstract class TaskSelectExecutor implements Executor nextExecutor = null; - // The task selection execution context; contains the facades for events and context to be used by tasks executed by + // The task selection execution context; contains the facades for events and context to be used + // by tasks executed by // this task selection executor private TaskSelectionExecutionContext executionContext; @@ -73,9 +74,8 @@ public abstract class TaskSelectExecutor implements Executor newParent, final AxState newAxState, @@ -100,7 +100,8 @@ public abstract class TaskSelectExecutor implements Executor newNextExecutor) { @@ -255,8 +258,9 @@ public abstract class TaskSelectExecutor implements Executor stateOutputNames; /** - * The fields of this state finalizer. A state finalizer receives this list of fields from a task and may use these - * fields to determine what state output to select. Once a state finalizer has selected a state output, it must - * marshal these fields so that they match the fields required for the event defined in the state output. + * The fields of this state finalizer. A state finalizer receives this list of fields from a + * task and may use these fields to determine what state output to select. Once a state + * finalizer has selected a state output, it must marshal these fields so that they match the + * fields required for the event defined in the state output. */ public final Map fields; @@ -76,13 +78,15 @@ public class StateFinalizerExecutionContext { private String message; /** - * The state output that the state finalizer logic has selected for a state. The state finalizer logic sets this - * field in its logic after executing and the Apex engine uses this state output for this state. + * The state output that the state finalizer logic has selected for a state. The state finalizer + * logic sets this field in its logic after executing and the Apex engine uses this state output + * for this state. */ private String selectedStateOutputName; /** - * Logger for state finalizer execution, state finalizer logic can use this field to access and log to Apex logging. + * Logger for state finalizer execution, state finalizer logic can use this field to access and + * log to Apex logging. */ public final XLogger logger = EXCEUTION_LOGGER; @@ -98,8 +102,10 @@ public class StateFinalizerExecutionContext { * @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 finalizer - * @param internalContext the execution context of the Apex engine in which the task is being executed + * @param stateOutputNames the state output names, one of which will be selected by the state + * finalizer + * @param internalContext the execution context of the Apex engine in which the task is being + * executed */ public StateFinalizerExecutionContext(final StateFinalizerExecutor stateFinalizerExecutor, final long executionID, final AxState axState, final Map fields, final Set stateOutputNames, @@ -141,7 +147,8 @@ public class StateFinalizerExecutionContext { * * @param contextAlbumName The context album name * @return The context album - * @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) throws ContextRuntimeException { // Find the context album 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 2251cf5c1..a9a157082 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 @@ -38,9 +38,9 @@ import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; /** - * Container class for the execution context for Task logic executions in a task being executed in an Apex engine. The - * task must have easy access to the task definition, the incoming and outgoing field contexts, as well as the policy, - * global, and external context. + * Container class for the execution context for Task logic executions in a task being executed in + * an Apex engine. The task must have easy access to the task definition, the incoming and outgoing + * field contexts, as well as the policy, global, and external context. * * @author Sven van der Meer (sven.van.der.meer@ericsson.com) */ @@ -54,7 +54,9 @@ public class TaskExecutionContext { /** A constant boolean true value available for reuse e.g., for the return value */ public final Boolean TRUE = true; - /** A constant boolean false value available for reuse e.g., for the return value */ + /** + * A constant boolean false value available for reuse e.g., for the return value + */ public final Boolean FALSE = false; /** A facade to the full task definition for the task logic being executed. */ @@ -64,18 +66,20 @@ public class TaskExecutionContext { public final Long executionID; /** - * The incoming fields from the trigger event for the task. The task logic can access these fields when executing - * its logic. + * The incoming fields from the trigger event for the task. The task logic can access these + * fields when executing its logic. */ public final Map inFields; /** - * The outgoing fields from the task. The task logic can access and set these fields with its logic. A task outputs - * its result using these fields. + * The outgoing fields from the task. The task logic can access and set these fields with its + * logic. A task outputs its result using these fields. */ public final Map outFields; - /** Logger for task execution, task logic can use this field to access and log to Apex logging. */ + /** + * Logger for task execution, task logic can use this field to access and log to Apex logging. + */ public final XLogger logger = EXECUTION_LOGGER; // CHECKSTYLE:ON: checkstyle:VisibilityModifier @@ -97,7 +101,8 @@ public class TaskExecutionContext { * @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 + * @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, final Map inFields, final Map outFields, @@ -139,7 +144,8 @@ public class TaskExecutionContext { * * @param contextAlbumName The context album name * @return The context album - * @throws ContextRuntimeException if the context album does not exist on the task for this executor + * @throws ContextRuntimeException if the context album does not exist on the task for this + * executor */ public ContextAlbum getContextAlbum(final String contextAlbumName) throws ContextRuntimeException { // Find the context album 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 a196e360e..3194e3fce 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 @@ -38,9 +38,9 @@ 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) */ @@ -54,7 +54,9 @@ public class TaskSelectionExecutionContext { /** A constant boolean true value available for reuse e.g., for the return value */ public final Boolean TRUE = true; - /** A constant boolean false value available for reuse e.g., for the return value */ + /** + * A constant boolean false value available for reuse e.g., for the return value + */ public final Boolean FALSE = false; /** A facade to the full state definition for the task selection logic being executed. */ @@ -64,19 +66,21 @@ 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 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; @@ -96,7 +100,8 @@ 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, @@ -145,7 +150,8 @@ 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) throws ContextRuntimeException { // Find the context album diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/package-info.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/package-info.java index 6dc555107..656ab49ce 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/package-info.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/package-info.java @@ -19,13 +19,14 @@ */ /** - * Provides context and facades for executing tasks, task selection logic, and state finalizer logic. The public fields - * and methods of {@link TaskExecutionContext}, {@link TaskSelectionExecutionContext} and - * {@link StateFinalizerExecutionContext} are available to task logic, task selection logic, and state finalizer logic - * respectively when that logic is executing in an executor plugin under the control of an APEX engine. + * Provides context and facades for executing tasks, task selection logic, and state finalizer + * logic. The public fields and methods of {@link TaskExecutionContext}, + * {@link TaskSelectionExecutionContext} and {@link StateFinalizerExecutionContext} are available to + * task logic, task selection logic, and state finalizer logic respectively when that logic is + * executing in an executor plugin under the control of an APEX engine. * - * The {@link AxStateFacade} and {@link AxTaskFacade} classes provide facades and convenience methods for state and task - * definition information for logic at execution time. + * The {@link AxStateFacade} and {@link AxTaskFacade} classes provide facades and convenience + * methods for state and task definition information for logic at execution time. * * @author Liam Fallon (liam.fallon@ericsson.com) */ diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/exception/StateMachineException.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/exception/StateMachineException.java index 9d6c55900..0b64eb481 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/exception/StateMachineException.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/exception/StateMachineException.java @@ -43,9 +43,9 @@ public class StateMachineException extends ApexException { * Instantiates a new state machine exception. * * @param message the message - * @param e the e + * @param ex the exception */ - public StateMachineException(final String message, final Exception e) { - super(message, e); + public StateMachineException(final String message, final Exception ex) { + super(message, ex); } } diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/exception/StateMachineRuntimeException.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/exception/StateMachineRuntimeException.java index 9ce2d7499..447c88bf9 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/exception/StateMachineRuntimeException.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/exception/StateMachineRuntimeException.java @@ -43,9 +43,9 @@ public class StateMachineRuntimeException extends ApexRuntimeException { * Instantiates a new state machine exception. * * @param message the message - * @param e the e + * @param ex the exception */ - public StateMachineRuntimeException(final String message, final Exception e) { - super(message, e); + public StateMachineRuntimeException(final String message, final Exception ex) { + super(message, ex); } } diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/impl/ExecutorFactoryImpl.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/impl/ExecutorFactoryImpl.java index 58ee4c6cc..ae1f551a4 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/impl/ExecutorFactoryImpl.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/impl/ExecutorFactoryImpl.java @@ -201,7 +201,8 @@ public class ExecutorFactoryImpl extends ExecutorFactory { private Executor createExecutor(final String logicFlavour, final Class> executorClass, final Class> executorSuperClass) { - // It's OK for an executor class not to be defined but it's not all right to try and create a non-defined + // It's OK for an executor class not to be defined but it's not all right to try and create + // a non-defined // executor class if (executorClass == null) { final String errorMessage = "Executor plugin class not defined for \"" + logicFlavour diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/monitoring/package-info.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/monitoring/package-info.java index 530041a23..38834687d 100644 --- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/monitoring/package-info.java +++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/monitoring/package-info.java @@ -19,8 +19,8 @@ */ /** - * Provides monitoring of APEX policy execution. It monitors events as they trigger Apex policies, pass between the - * various states of a policy, and are emitted by a policy. + * Provides monitoring of APEX policy execution. It monitors events as they trigger Apex policies, + * pass between the various states of a policy, and are emitted by a policy. * * @author Liam Fallon (liam.fallon@ericsson.com) */ -- cgit 1.2.3-korg