aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@ericsson.com>2018-09-16 02:03:12 +0100
committerliamfallon <liam.fallon@ericsson.com>2018-09-16 02:04:11 +0100
commit952d4f5aab9913f961e77fa0457da5d38f31d94f (patch)
treed482ebae10ff11b3096dd85d927eca75825574d6 /core
parenta65e4772f4557a109917532b2d9c49680ce3bb15 (diff)
Fix Sonar issues in apex
Fixing various Sonar issues in apex. Issue-ID: POLICY-1034 Change-Id: Ie693637d75bd7e38c71b7ba04886fb75636276ed Signed-off-by: liamfallon <liam.fallon@ericsson.com>
Diffstat (limited to 'core')
-rw-r--r--core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/BatchDeployer.java2
-rw-r--r--core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/PeriodicEventManager.java66
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/EnEventListener.java1
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java4
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnField.java4
5 files changed, 39 insertions, 38 deletions
diff --git a/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/BatchDeployer.java b/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/BatchDeployer.java
index 8bfb15025..b275c72ab 100644
--- a/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/BatchDeployer.java
+++ b/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/BatchDeployer.java
@@ -127,7 +127,7 @@ public class BatchDeployer {
* @throws IOException on IO exceptions from the operating system
*/
public void deployModel(final AxPolicyModel policyModel, final boolean ignoreConflicts, final boolean force)
- throws ApexException, IOException {
+ throws ApexException {
engineServiceFacade.deployModel(policyModel, ignoreConflicts, force);
}
diff --git a/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/PeriodicEventManager.java b/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/PeriodicEventManager.java
index a1db5ef07..5f0752aa0 100644
--- a/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/PeriodicEventManager.java
+++ b/core/core-deployment/src/main/java/org/onap/policy/apex/core/deployment/PeriodicEventManager.java
@@ -41,39 +41,6 @@ public class PeriodicEventManager {
private EngineServiceFacade engineServiceFacade = null;
/**
- * The main method, reads the Apex server host address, port and location of the Apex model XML file from the
- * command line arguments.
- *
- * @param args the arguments that specify the Apex engine and the Apex model file
- */
- public static void main(final String[] args) {
- if (args.length != NUM_ARGUMENTS) {
- String message = "invalid arguments: " + Arrays.toString(args)
- + "\nusage: Deployer <server address> <port address> <start/stop> <periods in ms>";
- LOGGER.error(message);
- return;
- }
-
- PeriodicEventManager deployer = null;
- try {
- // Use a Deployer object to handle model deployment
- deployer = new PeriodicEventManager(args[0], Integer.parseInt(args[1]));
- deployer.init();
- if (args[2].equalsIgnoreCase("start")) {
- deployer.startPerioidicEvents(Long.parseLong(args[PERIODIC_EVENT_INTERVAL]));
- } else {
- deployer.stopPerioidicEvents();
- }
- } catch (final ApexException e) {
- LOGGER.error("model deployment failed on parameters {}", args, e);
- } finally {
- if (deployer != null) {
- deployer.close();
- }
- }
- }
-
- /**
* Instantiates a new deployer.
*
* @param hostName the host name of the host running the Apex Engine
@@ -121,4 +88,37 @@ public class PeriodicEventManager {
engineServiceFacade.stopPerioidicEvents(engineKey);
}
}
+
+ /**
+ * The main method, reads the Apex server host address, port and location of the Apex model XML file from the
+ * command line arguments.
+ *
+ * @param args the arguments that specify the Apex engine and the Apex model file
+ */
+ public static void main(final String[] args) {
+ if (args.length != NUM_ARGUMENTS) {
+ String message = "invalid arguments: " + Arrays.toString(args)
+ + "\nusage: Deployer <server address> <port address> <start/stop> <periods in ms>";
+ LOGGER.error(message);
+ return;
+ }
+
+ PeriodicEventManager deployer = null;
+ try {
+ // Use a Deployer object to handle model deployment
+ deployer = new PeriodicEventManager(args[0], Integer.parseInt(args[1]));
+ deployer.init();
+ if ("start".equalsIgnoreCase(args[2])) {
+ deployer.startPerioidicEvents(Long.parseLong(args[PERIODIC_EVENT_INTERVAL]));
+ } else {
+ deployer.stopPerioidicEvents();
+ }
+ } catch (final ApexException e) {
+ LOGGER.error("model deployment failed on parameters {}", args, e);
+ } finally {
+ if (deployer != null) {
+ deployer.close();
+ }
+ }
+ }
}
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/EnEventListener.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/EnEventListener.java
index 32d638aef..12ba12665 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/EnEventListener.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/EnEventListener.java
@@ -29,6 +29,7 @@ import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
* @author Liam Fallon
*
*/
+@FunctionalInterface
public interface EnEventListener {
/**
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 7c49af965..58bee8238 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
@@ -58,7 +58,7 @@ public class EnEvent extends HashMap<String, Object> {
private final AxEvent axEvent;
// The event monitor for this event
- private final EventMonitor eventMonitor = new EventMonitor();
+ private final transient EventMonitor eventMonitor = new EventMonitor();
// The stack of execution of this event, used for monitoring
private AxConcept[] userArtifactStack;
@@ -289,7 +289,7 @@ public class EnEvent extends HashMap<String, Object> {
@Override
public void putAll(final Map<? extends String, ? extends Object> incomingMap) {
// Override the generic "putAll()" call as we want to monitor the puts
- for (final java.util.Map.Entry<? extends String, ? extends Object> incomingEntry : incomingMap.entrySet()) {
+ for (final Map.Entry<? extends String, ? extends Object> incomingEntry : incomingMap.entrySet()) {
put(incomingEntry.getKey(), incomingEntry.getValue());
}
}
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnField.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnField.java
index 15fbacf45..a4b221897 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnField.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnField.java
@@ -45,10 +45,10 @@ public class EnField implements Serializable {
private final AxField axField;
// The schema helper for this field
- private SchemaHelper schemaHelper;
+ private transient SchemaHelper schemaHelper;
// The value of this field
- private final Object value;
+ private final transient Object value;
/**
* Instantiates a new EnField, an Engine Field.