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.
- * <p>
- * 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.
- * <p>
- * 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.
+ *
+ * <p>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.
+ *
+ * <p>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)
*/
private Map<String, ExecutorParameters> executorParameterMap = new TreeMap<String, ExecutorParameters>();
/**
- * 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());
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.
- * <p>
- * 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.
+ *
+ * <p>Specializations of this class may provide extra parameters for their specific logic flavour
+ * executors.
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
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());
}
/**
- * 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
*/
/**
* 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;
/**
* 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;
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;
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
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
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);
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
*/
* @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();
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.
- * <p>
- * 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.
+ *
+ * <p>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
*
// The state machines in this engine
private final HashMap<AxEvent, StateMachineExecutor> 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;
}
/**
- * 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
*/
*/
/**
- * 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)
*/
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)
*/
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();
}
/**
- * 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.
*/
}
/**
- * 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.
*/
* 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);
}
}
*/
/**
- * 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)
*/
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)
/**
* 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
*/
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
*/
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
*/
/**
* Constructor, save the executor factory.
*
- * @param executorFactory the executor factory to use for getting executors for task selection logic
+ * @param executorFactory the executor factory to use for getting executors for task selection
+ * logic
*/
public StateExecutor(final ExecutorFactory executorFactory) {
this.executorFactory = executorFactory;
/*
* (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, final AxState incomingAxState,
/*
* (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 StateOutput execute(final long executionID, final EnEvent incomingEvent)
taskKey = taskSelectExecutor.execute(executionID, incomingEvent);
}
- // If there's no task selection logic or the TSL returned no task, just use the default task
+ // If there's no task selection logic or the TSL returned no task, just use the default
+ // task
if (taskKey == null) {
taskKey = axState.getDefaultTask();
}
// Check if this task has direct output
String stateOutputName = directStateOutputMap.get(taskKey);
- // If a direct state output name was not found, state finalizer logic should be defined for the task
+ // If a direct state output name was not found, state finalizer logic should be defined
+ // for the task
if (stateOutputName == null) {
// State finalizer logic should exist for the task
final StateFinalizerExecutor finalizerLogicExecutor = task2StateFinalizerMap.get(taskKey);
+ "\" not found for state \"" + axState.getID() + "\"");
}
- // Execute the state finalizer logic to select a state output and to adjust the taskExecutionResultMap
+ // Execute the state finalizer logic to select a state output and to adjust the
+ // taskExecutionResultMap
stateOutputName =
finalizerLogicExecutor.execute(incomingEvent.getExecutionID(), taskExecutionResultMap);
}
/*
* (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 EnEvent incomingEntity) throws StateMachineException {
* (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 final void setNext(final Executor<EnEvent, StateOutput, AxState, ApexInternalContext> incomingNextExecutor) {
/*
* (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) {}
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)
// The next state finalizer executor
private Executor<Map<String, Object>, 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;
/*
* (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,
/*
* (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)
/*
* (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)
* (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<Map<String, Object>, String, AxStateFinalizerLogic, ApexInternalContext> incomingNextExecutor) {
+ public void setNext(final Executor<Map<String, Object>, String, AxStateFinalizerLogic, ApexInternalContext>
+ incomingNextExecutor) {
this.nextExecutor = incomingNextExecutor;
}
/*
* (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) {}
private ExecutorFactory executorFactory = null;
/**
- * Constructor, save the executor factory that will give us executors for task selection logic and task logic.
+ * Constructor, save the executor factory that will give us executors for task selection logic
+ * and task logic.
*
* @param executorFactory the executor factory
* @param owner the artifact key of the owner of this state machine
/*
* (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 AxPolicy newAxPolicy,
/*
* (non-Javadoc)
*
- * @see org.onap.policy.apex.core.engine.executor.Executor#executeDirected(java.lang.long, java.lang.Object)
+ * @see org.onap.policy.apex.core.engine.executor.Executor#executeDirected(java.lang.long,
+ * java.lang.Object)
*/
@Override
public EnEvent execute(final long executionID, final EnEvent incomingEvent)
throw new StateMachineException("first state not defined on state machine");
}
- // Get the first state of the state machine and define a state output that starts state execution
+ // Get the first state of the state machine and define a state output that starts state
+ // execution
StateExecutor stateExecutor = firstExecutor;
StateOutput stateOutput = new StateOutput(new AxStateOutput(firstExecutor.getSubject().getKey(),
incomingEvent.getKey(), firstExecutor.getSubject().getKey()), incomingEvent);
/*
* (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 EnEvent incomingEntity) throws StateMachineException {
* (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 final void setNext(final Executor<EnEvent, EnEvent, AxPolicy, ApexInternalContext> newNextExecutor) {
/*
* (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) {}
import org.slf4j.ext.XLoggerFactory;
/**
- * This abstract class executes a task in a state of an Apex policy and is specialized by classes that implement
- * execution of task logic.
+ * This abstract class executes a task in a state of an Apex policy and is specialized by classes
+ * that implement execution of task logic.
*
* @author Sven van der Meer (sven.van.der.meer@ericsson.com)
* @author Liam Fallon (liam.fallon@ericsson.com)
// The next task executor
private Executor<Map<String, Object>, Map<String, Object>, 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;
/*
* (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,
/*
* (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<String, Object> execute(final long executionID, final Map<String, Object> newIncomingFields)
/*
* (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)
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);
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<String> missingTaskOutputFields = new TreeSet<>(axTask.getOutputFields().keySet());
missingTaskOutputFields.removeAll(outgoingFields.keySet());
+ "\" 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<String> extraTaskOutputFields = new TreeSet<>(outgoingFields.keySet());
extraTaskOutputFields.removeAll(axTask.getOutputFields().keySet());
* (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(
/*
* (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) {}
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)
// The next task selection executor
private Executor<EnEvent, AxArtifactKey, AxState, ApexInternalContext> 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;
/*
* (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 AxState newAxState,
/*
* (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 AxArtifactKey execute(final long executionID, final EnEvent newIncomingEvent)
/*
* (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 EnEvent newIncomingEvent) throws StateMachineException {
* (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<EnEvent, AxArtifactKey, AxState, ApexInternalContext> newNextExecutor) {
/*
* (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) {}
import org.onap.policy.apex.model.policymodel.concepts.AxTasks;
/**
- * The Class AxStateFacade acts as a facade into the AxState class so that task logic can easily access information in
- * an AxState instance.
+ * The Class AxStateFacade acts as a facade into the AxState class so that task logic can easily
+ * access information in an AxState instance.
*
* @author Sven van der Meer (sven.van.der.meer@ericsson.com)
*/
import org.slf4j.ext.XLoggerFactory;
/**
- * The Class AxTaskFacade acts as a facade into the AxTask class so that task logic can easily access information in an
- * AxTask instance.
+ * The Class AxTaskFacade acts as a facade into the AxTask class so that task logic can easily
+ * access information in an AxTask instance.
*
* @author Sven van der Meer (sven.van.der.meer@ericsson.com)
*/
// CHECKSTYLE:OFF: checkstyle:visibilityModifier Logic has access to this field
/**
- * The full definition of the task we are presenting a facade to, executing logic has full access to the task
- * definition.
+ * The full definition of the task we are presenting a facade to, executing logic has full
+ * access to the task definition.
*/
public final AxTask task;
import org.slf4j.ext.XLoggerFactory;
/**
- * Container class for the execution context for state finalizer logic executions in a state being executed in an Apex
- * engine. The state finalizer must have easy access to the state definition, the fields, as well as the policy, global,
- * and external context.
+ * Container class for the execution context for state finalizer logic executions in a state being
+ * executed in an Apex engine. The state finalizer must have easy access to the state definition,
+ * the fields, as well as the policy, global, and external context.
*
* @author Sven van der Meer (sven.van.der.meer@ericsson.com)
*/
public class StateFinalizerExecutionContext {
/**
- * 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.
*/
private static final XLogger EXCEUTION_LOGGER =
XLoggerFactory.getXLogger("org.onap.policy.apex.executionlogging.StateFinalizerExecutionLogging");
public final Long executionID;
/**
- * The list of state outputs for this state finalizer. The purpose of a state finalizer is to select a state output
- * for a state from this list of state output names.
+ * The list of state outputs for this state finalizer. The purpose of a state finalizer is to
+ * select a state output for a state from this list of state output names.
*/
public final Set<String> 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<String, Object> fields;
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;
* @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<String, Object> fields, final Set<String> stateOutputNames,
*
* @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
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)
*/
/** A constant <code>boolean true</code> value available for reuse e.g., for the return value */
public final Boolean TRUE = true;
- /** A constant <code>boolean false</code> value available for reuse e.g., for the return value */
+ /**
+ * A constant <code>boolean false</code> 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. */
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<String, Object> 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<String, Object> 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
* @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<String, Object> inFields, final Map<String, Object> outFields,
*
* @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
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)
*/
/** A constant <code>boolean true</code> value available for reuse e.g., for the return value */
public final Boolean TRUE = true;
- /** A constant <code>boolean false</code> value available for reuse e.g., for the return value */
+ /**
+ * A constant <code>boolean false</code> 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. */
public final Long executionID;
/**
- * The incoming fields from the trigger event for the state. The task selection logic can access these fields to
- * decide what task to select for the state.
+ * The incoming fields from the trigger event for the state. The task selection logic can access
+ * these fields to decide what task to select for the state.
*/
public final Map<String, Object> inFields;
/**
- * The task that the task selection logic has selected for a state. The task selection logic sets this field in its
- * logic prior to executing and the Apex engine executes this task as the task for this state.
+ * The task that the task selection logic has selected for a state. The task selection logic
+ * sets this field in its logic prior to executing and the Apex engine executes this task as the
+ * task for this state.
*/
public final AxArtifactKey selectedTask;
/**
- * Logger for task selection execution, task selection logic can use this field to access and log to Apex logging.
+ * Logger for task selection execution, task selection logic can use this field to access and
+ * log to Apex logging.
*/
public final XLogger logger = EXECUTION_LOGGER;
* @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,
*
* @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
*/
/**
- * 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)
*/
* 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);
}
}
* 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);
}
}
private Executor<?, ?, ?, ?> createExecutor(final String logicFlavour,
final Class<Executor<?, ?, ?, ?>> executorClass,
final Class<? extends Executor<?, ?, ?, ?>> 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
*/
/**
- * 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)
*/