summaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--models-errors/src/main/java/org/onap/policy/models/errors/concepts/ErrorResponseUtils.java9
-rw-r--r--models-pap/src/main/java/org/onap/policy/models/pap/concepts/PdpGroupDeployResponse.java15
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentSubGroup.java9
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpSubGroup.java9
-rw-r--r--models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/startstop/Main.java19
-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
8 files changed, 30 insertions, 72 deletions
diff --git a/models-errors/src/main/java/org/onap/policy/models/errors/concepts/ErrorResponseUtils.java b/models-errors/src/main/java/org/onap/policy/models/errors/concepts/ErrorResponseUtils.java
index eb5212eb0..749651310 100644
--- a/models-errors/src/main/java/org/onap/policy/models/errors/concepts/ErrorResponseUtils.java
+++ b/models-errors/src/main/java/org/onap/policy/models/errors/concepts/ErrorResponseUtils.java
@@ -23,19 +23,16 @@ package org.onap.policy.models.errors.concepts;
import java.util.ArrayList;
import java.util.List;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
/**
* Utility class for managing {@link ErrorResponse objects}.
*
* @author Liam Fallon (liam.fallon@est.tech)
*/
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class ErrorResponseUtils {
- /**
- * Private constructor used to prevent sub class instantiation.
- */
- private ErrorResponseUtils() {
- // Default constructor
- }
/**
* Store the cascaded messages from an exception and all its nested exceptions in an ErrorResponse object.
diff --git a/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PdpGroupDeployResponse.java b/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PdpGroupDeployResponse.java
index 6d94d7110..43485cc2e 100644
--- a/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PdpGroupDeployResponse.java
+++ b/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PdpGroupDeployResponse.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP Policy Models
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,6 +21,7 @@
package org.onap.policy.models.pap.concepts;
+import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@@ -33,6 +34,7 @@ import lombok.ToString;
@Setter
@ToString(callSuper = true)
@NoArgsConstructor
+@AllArgsConstructor
public class PdpGroupDeployResponse extends SimpleResponse {
/**
@@ -44,15 +46,4 @@ public class PdpGroupDeployResponse extends SimpleResponse {
* URI to fetch the deployment status.
*/
private String uri;
-
- /**
- * Constructs the object.
- *
- * @param message the message
- * @param uri the uri to get actual deployment status
- */
- public PdpGroupDeployResponse(String message, String uri) {
- this.message = message;
- this.uri = uri;
- }
}
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentSubGroup.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentSubGroup.java
index 361f7daa9..2bf816a11 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentSubGroup.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentSubGroup.java
@@ -24,6 +24,7 @@ package org.onap.policy.models.pdp.concepts;
import java.util.ArrayList;
import java.util.List;
import lombok.Data;
+import lombok.NoArgsConstructor;
import lombok.NonNull;
import org.onap.policy.common.parameters.BeanValidationResult;
import org.onap.policy.common.parameters.ValidationResult;
@@ -35,6 +36,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
* particular domain.
*/
@Data
+@NoArgsConstructor
public class DeploymentSubGroup {
public enum Action {
@@ -48,13 +50,6 @@ public class DeploymentSubGroup {
private List<ToscaConceptIdentifier> policies;
/**
- * Constructs the object.
- */
- public DeploymentSubGroup() {
- super();
- }
-
- /**
* Constructs the object, making a deep copy from the source.
*
* @param source source from which to copy fields
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpSubGroup.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpSubGroup.java
index 3cf8b9b05..e35e4a397 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpSubGroup.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpSubGroup.java
@@ -26,6 +26,7 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import lombok.Data;
+import lombok.NoArgsConstructor;
import lombok.NonNull;
import org.onap.policy.common.parameters.BeanValidationResult;
import org.onap.policy.common.parameters.ValidationResult;
@@ -40,6 +41,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
* @author Ram Krishna Verma (ram.krishna.verma@est.tech)
*/
@Data
+@NoArgsConstructor
public class PdpSubGroup {
private String pdpType;
private List<ToscaConceptIdentifier> supportedPolicyTypes;
@@ -50,13 +52,6 @@ public class PdpSubGroup {
private List<Pdp> pdpInstances;
/**
- * Constructs the object.
- */
- public PdpSubGroup() {
- super();
- }
-
- /**
* Constructs the object, making a deep copy from the source.
*
* @param source source from which to copy fields
diff --git a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/startstop/Main.java b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/startstop/Main.java
index e136509c9..9c368e044 100644
--- a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/startstop/Main.java
+++ b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/startstop/Main.java
@@ -22,6 +22,7 @@
package org.onap.policy.models.sim.dmaap.startstop;
import java.util.Arrays;
+import lombok.Getter;
import org.onap.policy.common.utils.cmd.CommandLineException;
import org.onap.policy.models.sim.dmaap.DmaapSimException;
import org.onap.policy.models.sim.dmaap.DmaapSimRuntimeException;
@@ -38,7 +39,8 @@ public class Main {
private static final Logger LOGGER = LoggerFactory.getLogger(Main.class);
private DmaapSimActivator activator;
- private DmaapSimParameterGroup parameterGroup;
+ @Getter
+ private DmaapSimParameterGroup parameters;
/**
* Instantiates the DMaap Simulator service.
@@ -67,14 +69,14 @@ public class Main {
// Read the parameters
try {
- parameterGroup = new DmaapSimParameterHandler().getParameters(arguments);
+ parameters = new DmaapSimParameterHandler().getParameters(arguments);
} catch (final Exception e) {
LOGGER.error("start of DMaaP simulator service failed", e);
return;
}
// Now, create the activator for the DMaaP Simulator service
- activator = new DmaapSimActivator(parameterGroup);
+ activator = new DmaapSimActivator(parameters);
// Start the activator
try {
@@ -90,22 +92,13 @@ public class Main {
}
/**
- * Get the parameters specified in JSON.
- *
- * @return the parameters
- */
- public DmaapSimParameterGroup getParameters() {
- return parameterGroup;
- }
-
- /**
* Shut down Execution.
*
* @throws DmaapSimException on shutdown errors
*/
public void shutdown() throws DmaapSimException {
// clear the parameterGroup variable
- parameterGroup = null;
+ parameters = null;
// clear the DMaaP 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/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