summaryrefslogtreecommitdiffstats
path: root/models-sim/policy-models-sim-pdp
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-06-17 16:29:33 -0400
committerAjith Sreekumar <ajith.sreekumar@bell.ca>2021-06-21 09:22:35 +0000
commitbf430888dbb1c514d10e5cc3fd25496712a86730 (patch)
treeba9288d233aaf74a29a8e634089e586fc16aae93 /models-sim/policy-models-sim-pdp
parent1ada3a6368f340df653886c4229b192ce7a5fc35 (diff)
Use lombok for errors pap, pdp, sim-dmaap, sim-pdp
Issue-ID: POLICY-3396 Change-Id: Ib2c9bc5dc199e15ae9ca077031c0f2cfbc5b6a81 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-sim/policy-models-sim-pdp')
-rw-r--r--models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorConstants.java11
-rw-r--r--models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorMain.java19
-rw-r--r--models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/comm/PdpStatusPublisher.java11
3 files changed, 14 insertions, 27 deletions
diff --git a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorConstants.java b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorConstants.java
index 22dbc4610..62ea09209 100644
--- a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorConstants.java
+++ b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorConstants.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,18 +21,18 @@
package org.onap.policy.models.sim.pdp;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+
/**
* Names of various items contained in the Registry.
*/
-public class PdpSimulatorConstants {
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class PdpSimulatorConstants {
// Registry keys
public static final String REG_PDP_SIMULATOR_ACTIVATOR = "object:activator/pdp_simulator";
public static final String REG_PDP_STATUS_OBJECT = "object:pdp/status";
public static final String REG_PDP_TOSCA_POLICY_LIST = "object:pdp/tosca/policy/list";
public static final String REG_PDP_STATUS_PUBLISHER = "object:pdp/status/publisher";
public static final String REG_PDP_TOPIC_SINKS = "object:pdp/topic/sinks";
-
- private PdpSimulatorConstants() {
- super();
- }
}
diff --git a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorMain.java b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorMain.java
index 57fc8a146..1441ba37f 100644
--- a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorMain.java
+++ b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorMain.java
@@ -22,6 +22,7 @@
package org.onap.policy.models.sim.pdp;
import java.util.Arrays;
+import lombok.Getter;
import org.onap.policy.common.utils.cmd.CommandLineException;
import org.onap.policy.common.utils.services.Registry;
import org.onap.policy.models.sim.pdp.exception.PdpSimulatorException;
@@ -43,7 +44,8 @@ public class PdpSimulatorMain {
private static final Logger LOGGER = LoggerFactory.getLogger(PdpSimulatorMain.class);
private PdpSimulatorActivator activator;
- private PdpSimulatorParameterGroup parameterGroup;
+ @Getter
+ private PdpSimulatorParameterGroup parameters;
/**
* Instantiates the PdpSimulator.
@@ -73,14 +75,14 @@ public class PdpSimulatorMain {
// Read the parameters
try {
- parameterGroup = new PdpSimulatorParameterHandler().getParameters(arguments);
+ parameters = new PdpSimulatorParameterHandler().getParameters(arguments);
} catch (final Exception e) {
LOGGER.error(PDP_SIMULATOR_FAIL_MSG, e);
return;
}
// create the activator
- activator = new PdpSimulatorActivator(parameterGroup);
+ activator = new PdpSimulatorActivator(parameters);
Registry.register(PdpSimulatorConstants.REG_PDP_SIMULATOR_ACTIVATOR, activator);
// Start the activator
try {
@@ -97,15 +99,6 @@ public class PdpSimulatorMain {
LOGGER.info("Started PdpSimulator service");
}
- /**
- * Get the parameters specified in JSON.
- *
- * @return parameterGroup the parameters
- */
- public PdpSimulatorParameterGroup getParameters() {
- return parameterGroup;
- }
-
/**
* Shut down Execution.
@@ -114,7 +107,7 @@ public class PdpSimulatorMain {
*/
public void shutdown() throws PdpSimulatorException {
// clear the parameterGroup variable
- parameterGroup = null;
+ parameters = null;
// clear the pdp simulator activator
if (activator != null && activator.isAlive()) {
diff --git a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/comm/PdpStatusPublisher.java b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/comm/PdpStatusPublisher.java
index e490fe76a..6be59b100 100644
--- a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/comm/PdpStatusPublisher.java
+++ b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/comm/PdpStatusPublisher.java
@@ -24,6 +24,7 @@ package org.onap.policy.models.sim.pdp.comm;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
+import lombok.Getter;
import org.onap.policy.common.endpoints.event.comm.TopicSink;
import org.onap.policy.common.endpoints.event.comm.client.TopicSinkClient;
import org.onap.policy.models.pdp.concepts.PdpStatus;
@@ -42,6 +43,7 @@ public class PdpStatusPublisher extends TimerTask {
private TopicSinkClient topicSinkClient;
private Timer timer;
+ @Getter
private long interval;
/**
@@ -73,15 +75,6 @@ public class PdpStatusPublisher extends TimerTask {
}
/**
- * Get the current time interval used by the timer task.
- *
- * @return interval the current time interval
- */
- public long getInterval() {
- return interval;
- }
-
- /**
* Method to send pdp status message to pap on demand.
*
* @param pdpStatus the pdp status