aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2019-01-09 14:30:23 +0100
committerLiam Fallon <liam.fallon@est.tech>2019-01-10 06:48:07 +0000
commitf702224c07abd43d72ab0198cf760537d3d35d8a (patch)
treeab48142d86c0134f24ded3110926188371f1fbb0
parent0b83f6124f068583df43eb9b587b9d46b22e9843 (diff)
Fix context clearing on model upgrade3.0.1-ONAP2.0.52.0.4
Existing context is cleared when a model upgrade is carried out on an Apex PDP. The clear() method is called in error on the Apex engine during the upgrade. This change also has some small updates to the DecisionMaker example, which is used to test this feature. Issue-ID: POLICY-1395 Change-Id: I547a3a60712d1572d9daadf5eab4afcae2a5c321 Signed-off-by: liamfallon <liam.fallon@est.tech> (cherry picked from commit cff079a8dc3eeaf4e88c0e89a828fe4244a1b3c8)
-rw-r--r--examples/examples-decisionmaker/pom.xml34
-rw-r--r--examples/examples-decisionmaker/src/main/resources/examples/config/DecisionMaker/ApexConfigRESTServerNoModel.json60
-rw-r--r--examples/examples-decisionmaker/src/test/java/org/onap/policy/apex/examples/decisionmaker/DecisionMakerRunner.java68
-rw-r--r--examples/examples-onap-vcpe/pom.xml2
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EngineWorker.java150
5 files changed, 230 insertions, 84 deletions
diff --git a/examples/examples-decisionmaker/pom.xml b/examples/examples-decisionmaker/pom.xml
index baa0c833b..ab392eadc 100644
--- a/examples/examples-decisionmaker/pom.xml
+++ b/examples/examples-decisionmaker/pom.xml
@@ -1,6 +1,7 @@
<!--
============LICENSE_START=======================================================
Copyright (C) 2018 Ericsson. All rights reserved.
+ Copyright (C) 2019 Nordix Foundation.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -41,6 +42,39 @@
<artifactId>cli-editor</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.onap.policy.apex-pdp.services</groupId>
+ <artifactId>services-engine</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.containers</groupId>
+ <artifactId>jersey-container-grizzly2-http</artifactId>
+ <version>${version.jersey}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.inject</groupId>
+ <artifactId>jersey-hk2</artifactId>
+ <version>${version.jersey}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.apex-pdp.plugins.plugins-context.plugins-context-schema</groupId>
+ <artifactId>plugins-context-schema-avro</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.apex-pdp.plugins.plugins-executor</groupId>
+ <artifactId>plugins-executor-javascript</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-carrier</groupId>
+ <artifactId>plugins-event-carrier-restserver</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
<build>
diff --git a/examples/examples-decisionmaker/src/main/resources/examples/config/DecisionMaker/ApexConfigRESTServerNoModel.json b/examples/examples-decisionmaker/src/main/resources/examples/config/DecisionMaker/ApexConfigRESTServerNoModel.json
new file mode 100644
index 000000000..85bb65e78
--- /dev/null
+++ b/examples/examples-decisionmaker/src/main/resources/examples/config/DecisionMaker/ApexConfigRESTServerNoModel.json
@@ -0,0 +1,60 @@
+{
+ "engineServiceParameters": {
+ "name": "MyApexEngine",
+ "version": "0.0.1",
+ "id": 45,
+ "instanceCount": 4,
+ "deploymentPort": 12345,
+ "engineParameters": {
+ "executorParameters": {
+ "JAVASCRIPT": {
+ "parameterClassName": "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters"
+ }
+ }
+ }
+ },
+ "eventInputParameters": {
+ "RESTConsumer": {
+ "carrierTechnologyParameters": {
+ "carrierTechnology": "RESTSERVER",
+ "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.restserver.RestServerCarrierTechnologyParameters",
+ "parameters": {
+ "standalone": true,
+ "host": "0.0.0.0",
+ "port": 23324
+ }
+ },
+ "eventProtocolParameters": {
+ "eventProtocol": "JSON"
+ },
+ "synchronousMode": true,
+ "synchronousPeer": "RESTProducer",
+ "synchronousTimeout": 500
+ }
+ },
+ "eventOutputParameters": {
+ "logProducer": {
+ "carrierTechnologyParameters": {
+ "carrierTechnology": "FILE",
+ "parameters": {
+ "fileName": "/tmp/EventsOut.json"
+ }
+ },
+ "eventProtocolParameters": {
+ "eventProtocol": "JSON"
+ }
+ },
+ "RESTProducer": {
+ "carrierTechnologyParameters":{
+ "carrierTechnology" : "RESTSERVER",
+ "parameterClassName" : "org.onap.policy.apex.plugins.event.carrier.restserver.RestServerCarrierTechnologyParameters"
+ },
+ "eventProtocolParameters":{
+ "eventProtocol" : "JSON"
+ },
+ "synchronousMode" : true,
+ "synchronousPeer" : "RESTConsumer",
+ "synchronousTimeout" : 500
+ }
+ }
+}
diff --git a/examples/examples-decisionmaker/src/test/java/org/onap/policy/apex/examples/decisionmaker/DecisionMakerRunner.java b/examples/examples-decisionmaker/src/test/java/org/onap/policy/apex/examples/decisionmaker/DecisionMakerRunner.java
new file mode 100644
index 000000000..1e264ab2c
--- /dev/null
+++ b/examples/examples-decisionmaker/src/test/java/org/onap/policy/apex/examples/decisionmaker/DecisionMakerRunner.java
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.apex.examples.decisionmaker;
+
+import org.onap.policy.apex.auth.clieditor.ApexCommandLineEditorMain;
+import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
+import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
+import org.onap.policy.apex.service.engine.main.ApexMain;
+
+/**
+ * Main method to run the decision maker example.
+ */
+public class DecisionMakerRunner {
+
+ private DecisionMakerRunner() throws ApexException {
+
+ // @formatter:off
+ final String[] cliArgs = new String[] {
+ "-c",
+ "src/main/resources/policy/DecisionMakerPolicyModel.apex",
+ "-l",
+ "target/DecisionMakerPolicyModel.log",
+ "-o",
+ "target/classes/DecisionMakerPolicyModel.json"
+ };
+ // @formatter:on
+
+ new ApexCommandLineEditorMain(cliArgs);
+
+ // @formatter:off
+ final String[] apexArgs = {
+ "-rfr",
+ "target/classes",
+ "-c",
+ "src/main/resources/examples/config/DecisionMaker/ApexConfigRESTServerNoModel.json",
+ "-m",
+ "target/classes/DecisionMakerPolicyModel.json"
+ };
+ // @formatter:on
+
+ final ApexMain apexMain = new ApexMain(apexArgs);
+
+ ThreadUtilities.sleep(1000000);
+ apexMain.shutdown();
+ }
+
+ public static void main(String[] args) throws ApexException {
+ new DecisionMakerRunner();
+ }
+}
diff --git a/examples/examples-onap-vcpe/pom.xml b/examples/examples-onap-vcpe/pom.xml
index de8c277d2..2e1048c19 100644
--- a/examples/examples-onap-vcpe/pom.xml
+++ b/examples/examples-onap-vcpe/pom.xml
@@ -1,6 +1,7 @@
<!--
============LICENSE_START=======================================================
Copyright (C) 2018 Ericsson. All rights reserved.
+ Copyright (C) 2019 Nordix Foundation.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -44,6 +45,7 @@
<groupId>org.onap.policy.apex-pdp.services</groupId>
<artifactId>services-engine</artifactId>
<version>${project.version}</version>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EngineWorker.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EngineWorker.java
index a5de624d1..0ca7fe837 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EngineWorker.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/runtime/impl/EngineWorker.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -61,13 +62,12 @@ import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
/**
- * The Class EngineWorker encapsulates a core {@link ApexEngine} instance, which runs policies
- * defined in the {@link org.onap.policy.apex.model.basicmodel.concepts.AxModelAxModel}. Each policy
- * is triggered by an Apex event, and when the policy is triggered it runs through to completion in
- * the ApexEngine.
+ * The Class EngineWorker encapsulates a core {@link ApexEngine} instance, which runs policies defined in the
+ * {@link org.onap.policy.apex.model.basicmodel.concepts.AxModelAxModel}. Each policy is triggered by an Apex event, and
+ * when the policy is triggered it runs through to completion in the ApexEngine.
*
- * <p>This class acts as a container for an {@link ApexEngine}, running it in a thread, sending it
- * events, and receiving events from it.
+ * <p>This class acts as a container for an {@link ApexEngine}, running it in a thread, sending it events, and receiving
+ * events from it.
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
@@ -99,8 +99,8 @@ final class EngineWorker implements EngineService {
private ApexEvent2EnEventConverter apexEnEventConverter = null;
/**
- * Constructor that creates an Apex engine, an event processor for events to be sent to that
- * engine, and an {@link ApexModelReader} instance to read Apex models using JAXB.
+ * Constructor that creates an Apex engine, an event processor for events to be sent to that engine, and an
+ * {@link ApexModelReader} instance to read Apex models using JAXB.
*
* @param engineWorkerKey the engine worker key
* @param queue the queue on which events for this Apex worker will come
@@ -108,7 +108,7 @@ final class EngineWorker implements EngineService {
* @throws ApexException thrown on errors on worker instantiation
*/
protected EngineWorker(final AxArtifactKey engineWorkerKey, final BlockingQueue<ApexEvent> queue,
- final ApplicationThreadFactory threadFactory) {
+ final ApplicationThreadFactory threadFactory) {
LOGGER.entry(engineWorkerKey);
this.engineWorkerKey = engineWorkerKey;
@@ -129,9 +129,8 @@ final class EngineWorker implements EngineService {
/*
* (non-Javadoc)
*
- * @see
- * org.onap.policy.apex.service.engine.runtime.EngineService#registerActionListener(java.lang.
- * String, org.onap.policy.apex.service.engine.runtime.ApexEventListener)
+ * @see org.onap.policy.apex.service.engine.runtime.EngineService#registerActionListener(java.lang. String,
+ * org.onap.policy.apex.service.engine.runtime.ApexEventListener)
*/
@Override
public void registerActionListener(final String listenerName, final ApexEventListener apexEventListener) {
@@ -141,9 +140,7 @@ final class EngineWorker implements EngineService {
/*
* (non-Javadoc)
*
- * @see
- * org.onap.policy.apex.service.engine.runtime.EngineService#deregisterActionListener(java.lang.
- * String)
+ * @see org.onap.policy.apex.service.engine.runtime.EngineService#deregisterActionListener(java.lang. String)
*/
@Override
public void deregisterActionListener(final String listenerName) {
@@ -153,13 +150,12 @@ final class EngineWorker implements EngineService {
/*
* (non-Javadoc)
*
- * @see
- * org.onap.policy.apex.service.engine.runtime.EngineService#getEngineServiceEventInterface()
+ * @see org.onap.policy.apex.service.engine.runtime.EngineService#getEngineServiceEventInterface()
*/
@Override
public EngineServiceEventInterface getEngineServiceEventInterface() {
throw new UnsupportedOperationException(
- "getEngineServiceEventInterface() call is not allowed on an Apex Engine Worker");
+ "getEngineServiceEventInterface() call is not allowed on an Apex Engine Worker");
}
/*
@@ -199,13 +195,12 @@ final class EngineWorker implements EngineService {
/*
* (non-Javadoc)
*
- * @see
- * org.onap.policy.apex.service.engine.runtime.EngineService#updateModel(org.onap.policy.apex.
- * model. basicmodel.concepts.AxArtifactKey, java.lang.String, boolean)
+ * @see org.onap.policy.apex.service.engine.runtime.EngineService#updateModel(org.onap.policy.apex. model.
+ * basicmodel.concepts.AxArtifactKey, java.lang.String, boolean)
*/
@Override
public void updateModel(final AxArtifactKey engineKey, final String engineModel, final boolean forceFlag)
- throws ApexException {
+ throws ApexException {
LOGGER.entry(engineKey);
// Read the Apex model into memory using the Apex Model Reader
@@ -227,20 +222,18 @@ final class EngineWorker implements EngineService {
/*
* (non-Javadoc)
*
- * @see
- * org.onap.policy.apex.service.engine.runtime.EngineService#updateModel(org.onap.policy.apex.
- * model. basicmodel.concepts.AxArtifactKey,
- * org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel, boolean)
+ * @see org.onap.policy.apex.service.engine.runtime.EngineService#updateModel(org.onap.policy.apex. model.
+ * basicmodel.concepts.AxArtifactKey, org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel, boolean)
*/
@Override
public void updateModel(final AxArtifactKey engineKey, final AxPolicyModel apexModel, final boolean forceFlag)
- throws ApexException {
+ throws ApexException {
LOGGER.entry(engineKey);
// Check if the key on the update request is correct
if (!engineWorkerKey.equals(engineKey)) {
String message = ENGINE_KEY_PREFIX + engineKey.getId() + BAD_KEY_MATCH_TAG + engineWorkerKey.getId()
- + ENGINE_SUFFIX;
+ + ENGINE_SUFFIX;
LOGGER.warn(message);
throw new ApexException(message);
}
@@ -252,19 +245,18 @@ final class EngineWorker implements EngineService {
if (!currentModel.getKey().isCompatible(apexModel.getKey())) {
if (forceFlag) {
LOGGER.warn("apex model update forced, supplied model with key \"" + apexModel.getKey().getId()
- + "\" is not a compatible model update from the existing engine model with key \""
- + currentModel.getKey().getId() + "\"");
+ + "\" is not a compatible model update from the existing engine model with key \""
+ + currentModel.getKey().getId() + "\"");
} else {
throw new ContextException(
- "apex model update failed, supplied model with key \"" + apexModel.getKey().getId()
- + "\" is not a compatible model update from the existing engine model with key \""
- + currentModel.getKey().getId() + "\"");
+ "apex model update failed, supplied model with key \"" + apexModel.getKey().getId()
+ + "\" is not a compatible model update from the existing engine model with key \""
+ + currentModel.getKey().getId() + "\"");
}
}
}
// Update the Apex model in the Apex engine
- engine.clear();
engine.updateModel(apexModel);
LOGGER.debug("engine model {} added to the engine-{}", apexModel.getKey().getId(), engineWorkerKey);
@@ -294,9 +286,8 @@ final class EngineWorker implements EngineService {
/*
* (non-Javadoc)
*
- * @see
- * org.onap.policy.apex.service.engine.runtime.EngineService#start(org.onap.policy.apex.core.
- * model. concepts.AxArtifactKey)
+ * @see org.onap.policy.apex.service.engine.runtime.EngineService#start(org.onap.policy.apex.core. model.
+ * concepts.AxArtifactKey)
*/
@Override
public void start(final AxArtifactKey engineKey) throws ApexException {
@@ -304,16 +295,16 @@ final class EngineWorker implements EngineService {
// Check if the key on the start request is correct
if (!engineWorkerKey.equals(engineKey)) {
- LOGGER.warn(ENGINE_KEY_PREFIX + engineKey.getId() + BAD_KEY_MATCH_TAG + engineWorkerKey.getId()
- + ENGINE_SUFFIX);
- throw new ApexException(ENGINE_KEY_PREFIX + engineKey.getId() + BAD_KEY_MATCH_TAG
- + engineWorkerKey.getId() + ENGINE_SUFFIX);
+ LOGGER.warn(
+ ENGINE_KEY_PREFIX + engineKey.getId() + BAD_KEY_MATCH_TAG + engineWorkerKey.getId() + ENGINE_SUFFIX);
+ throw new ApexException(
+ ENGINE_KEY_PREFIX + engineKey.getId() + BAD_KEY_MATCH_TAG + engineWorkerKey.getId() + ENGINE_SUFFIX);
}
// Starts the event processing thread that handles incoming events
if (processorThread != null && processorThread.isAlive()) {
String message = ENGINE_FOR_KEY_PREFIX + engineWorkerKey.getId() + " is already running with state "
- + getState();
+ + getState();
LOGGER.error(message);
throw new ApexException(message);
}
@@ -341,26 +332,25 @@ final class EngineWorker implements EngineService {
/*
* (non-Javadoc)
*
- * @see
- * org.onap.policy.apex.service.engine.runtime.EngineService#stop(org.onap.policy.apex.core.
- * model. concepts.AxArtifactKey)
+ * @see org.onap.policy.apex.service.engine.runtime.EngineService#stop(org.onap.policy.apex.core. model.
+ * concepts.AxArtifactKey)
*/
@Override
public void stop(final AxArtifactKey engineKey) throws ApexException {
// Check if the key on the start request is correct
if (!engineWorkerKey.equals(engineKey)) {
- LOGGER.warn(ENGINE_KEY_PREFIX + engineKey.getId() + BAD_KEY_MATCH_TAG + engineWorkerKey.getId()
- + ENGINE_SUFFIX);
- throw new ApexException(ENGINE_KEY_PREFIX + engineKey.getId() + BAD_KEY_MATCH_TAG
- + engineWorkerKey.getId() + ENGINE_SUFFIX);
+ LOGGER.warn(
+ ENGINE_KEY_PREFIX + engineKey.getId() + BAD_KEY_MATCH_TAG + engineWorkerKey.getId() + ENGINE_SUFFIX);
+ throw new ApexException(
+ ENGINE_KEY_PREFIX + engineKey.getId() + BAD_KEY_MATCH_TAG + engineWorkerKey.getId() + ENGINE_SUFFIX);
}
// Interrupt the worker to stop its thread
if (processorThread == null || !processorThread.isAlive()) {
processorThread = null;
- LOGGER.warn(ENGINE_FOR_KEY_PREFIX + engineWorkerKey.getId() + " is already stopped with state "
- + getState());
+ LOGGER
+ .warn(ENGINE_FOR_KEY_PREFIX + engineWorkerKey.getId() + " is already stopped with state " + getState());
return;
}
@@ -387,24 +377,22 @@ final class EngineWorker implements EngineService {
/*
* (non-Javadoc)
*
- * @see
- * org.onap.policy.apex.service.engine.runtime.EngineService#clear(org.onap.policy.apex.core.
- * model. concepts.AxArtifactKey)
+ * @see org.onap.policy.apex.service.engine.runtime.EngineService#clear(org.onap.policy.apex.core. model.
+ * concepts.AxArtifactKey)
*/
@Override
public void clear(final AxArtifactKey engineKey) throws ApexException {
// Check if the key on the start request is correct
if (!engineWorkerKey.equals(engineKey)) {
- LOGGER.warn(ENGINE_KEY_PREFIX + engineKey.getId() + BAD_KEY_MATCH_TAG + engineWorkerKey.getId()
- + ENGINE_SUFFIX);
- throw new ApexException(ENGINE_KEY_PREFIX + engineKey.getId() + BAD_KEY_MATCH_TAG
- + engineWorkerKey.getId() + ENGINE_SUFFIX);
+ LOGGER.warn(
+ ENGINE_KEY_PREFIX + engineKey.getId() + BAD_KEY_MATCH_TAG + engineWorkerKey.getId() + ENGINE_SUFFIX);
+ throw new ApexException(
+ ENGINE_KEY_PREFIX + engineKey.getId() + BAD_KEY_MATCH_TAG + engineWorkerKey.getId() + ENGINE_SUFFIX);
}
// Interrupt the worker to stop its thread
if (processorThread != null && !processorThread.isAlive()) {
- LOGGER.warn(ENGINE_FOR_KEY_PREFIX + engineWorkerKey.getId() + " is not stopped with state "
- + getState());
+ LOGGER.warn(ENGINE_FOR_KEY_PREFIX + engineWorkerKey.getId() + " is not stopped with state " + getState());
return;
}
@@ -427,9 +415,8 @@ final class EngineWorker implements EngineService {
/*
* (non-Javadoc)
*
- * @see
- * org.onap.policy.apex.service.engine.runtime.EngineService#isStarted(org.onap.policy.apex.
- * model. basicmodel.concepts.AxArtifactKey)
+ * @see org.onap.policy.apex.service.engine.runtime.EngineService#isStarted(org.onap.policy.apex. model.
+ * basicmodel.concepts.AxArtifactKey)
*/
@Override
public boolean isStarted(final AxArtifactKey engineKey) {
@@ -461,9 +448,8 @@ final class EngineWorker implements EngineService {
/*
* (non-Javadoc)
*
- * @see
- * org.onap.policy.apex.service.engine.runtime.EngineService#isStopped(org.onap.policy.apex.
- * model. basicmodel.concepts.AxArtifactKey)
+ * @see org.onap.policy.apex.service.engine.runtime.EngineService#isStopped(org.onap.policy.apex. model.
+ * basicmodel.concepts.AxArtifactKey)
*/
@Override
public boolean isStopped(final AxArtifactKey engineKey) {
@@ -505,9 +491,8 @@ final class EngineWorker implements EngineService {
/*
* (non-Javadoc)
*
- * @see
- * org.onap.policy.apex.service.engine.runtime.EngineService#getStatus(org.onap.policy.apex.core
- * .model .concepts.AxArtifactKey)
+ * @see org.onap.policy.apex.service.engine.runtime.EngineService#getStatus(org.onap.policy.apex.core .model
+ * .concepts.AxArtifactKey)
*/
@Override
public String getStatus(final AxArtifactKey engineKey) {
@@ -531,8 +516,7 @@ final class EngineWorker implements EngineService {
/*
* (non-Javadoc)
*
- * @see
- * org.onap.policy.apex.service.engine.runtime.EngineService#getRuntimeInfo(org.onap.policy.apex
+ * @see org.onap.policy.apex.service.engine.runtime.EngineService#getRuntimeInfo(org.onap.policy.apex
* .core.model.concepts.AxArtifactKey)
*/
@Override
@@ -570,20 +554,19 @@ final class EngineWorker implements EngineService {
runtimeJsonStringBuilder.append(gson.toJson(contextAlbumEntry.getKey()));
runtimeJsonStringBuilder.append(",\"AlbumContent\":[");
-
// Get the schema helper to use to marshal context album objects to JSON
- final AxContextAlbum axContextAlbum =
- ModelService.getModel(AxContextAlbums.class).get(contextAlbumEntry.getKey());
+ final AxContextAlbum axContextAlbum = ModelService.getModel(AxContextAlbums.class)
+ .get(contextAlbumEntry.getKey());
SchemaHelper schemaHelper = null;
try {
// Get a schema helper to manage the translations between objects on the album map
// for this album
schemaHelper = new SchemaHelperFactory().createSchemaHelper(axContextAlbum.getKey(),
- axContextAlbum.getItemSchema());
+ axContextAlbum.getItemSchema());
} catch (final ContextRuntimeException e) {
- final String resultString =
- "could not find schema helper to marshal context album \"" + axContextAlbum + "\" to JSON";
+ final String resultString = "could not find schema helper to marshal context album \"" + axContextAlbum
+ + "\" to JSON";
LOGGER.warn(resultString, e);
// End of context album entry
@@ -626,9 +609,9 @@ final class EngineWorker implements EngineService {
}
/**
- * This is an event processor thread, this class decouples the events handling logic from core
- * business logic. This class runs its own thread and continuously querying the blocking queue
- * for the events that have been sent to the worker for processing by the Apex engine.
+ * This is an event processor thread, this class decouples the events handling logic from core business logic. This
+ * class runs its own thread and continuously querying the blocking queue for the events that have been sent to the
+ * worker for processing by the Apex engine.
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
@@ -640,8 +623,7 @@ final class EngineWorker implements EngineService {
/**
* Constructor accepts {@link ApexEngine} and {@link BlockingQueue} type objects.
*
- * @param eventProcessingQueue is reference of {@link BlockingQueue} which contains trigger
- * events.
+ * @param eventProcessingQueue is reference of {@link BlockingQueue} which contains trigger events.
*/
EventProcessor(final BlockingQueue<ApexEvent> eventProcessingQueue) {
this.eventProcessingQueue = eventProcessingQueue;
@@ -659,7 +641,7 @@ final class EngineWorker implements EngineService {
// Take events from the event processing queue of the worker and pass them to the engine
// for processing
boolean stopFlag = false;
- while (processorThread != null && !processorThread.isInterrupted() && ! stopFlag) {
+ while (processorThread != null && !processorThread.isInterrupted() && !stopFlag) {
ApexEvent event = null;
try {
event = eventProcessingQueue.take();
@@ -673,7 +655,7 @@ final class EngineWorker implements EngineService {
try {
if (event != null) {
debugEventIfDebugEnabled(event);
-
+
final EnEvent enevent = apexEnEventConverter.fromApexEvent(event);
engine.handleEvent(enevent);
}