summaryrefslogtreecommitdiffstats
path: root/participant/participant-intermediary
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2021-06-15 16:01:31 +0100
committerFrancescoFioraEst <francesco.fiora@est.tech>2021-06-23 17:07:17 +0100
commitdbc13c78875a3d5493054a7252a7804daae8cf1f (patch)
tree635e3600320c38a44a9f0f54db471fcf5e3995ed /participant/participant-intermediary
parentdf2d3298e9881410dff5547e0ba9850135d63d5c (diff)
Move parameters from config Json file to application.yaml
Issue-ID: POLICY-3343 Change-Id: Id78c00a5a241337f684a70feeee543f3a88fc01c Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'participant/participant-intermediary')
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java20
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java8
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/parameters/ParticipantIntermediaryParameters.java32
3 files changed, 29 insertions, 31 deletions
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java
index 18ee29f08..3eebd177f 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java
@@ -95,7 +95,7 @@ public class ControlLoopHandler implements Closeable {
* @return controlLoopElement the updated controlloop element
*/
public ControlLoopElement updateControlLoopElementState(UUID id, ControlLoopOrderedState orderedState,
- ControlLoopState newState) {
+ ControlLoopState newState) {
if (id == null) {
return null;
@@ -161,7 +161,7 @@ public class ControlLoopHandler implements Closeable {
* @param orderedState controlloop ordered state
*/
private void handleState(final ControlLoop controlLoop, final ParticipantResponseDetails response,
- ControlLoopOrderedState orderedState) {
+ ControlLoopOrderedState orderedState) {
switch (orderedState) {
case UNINITIALISED:
handleUninitialisedState(controlLoop, orderedState, response);
@@ -197,8 +197,8 @@ public class ControlLoopHandler implements Closeable {
// elements to existing ControlLoop has to be supported).
if (controlLoop != null) {
response.setResponseStatus(ParticipantResponseStatus.FAIL);
- response.setResponseMessage(
- "Control loop " + updateMsg.getControlLoopId() + " already defined on participant " + participantId);
+ response.setResponseMessage("Control loop " + updateMsg.getControlLoopId()
+ + " already defined on participant " + participantId);
messageSender.sendResponse(response);
return;
@@ -226,7 +226,7 @@ public class ControlLoopHandler implements Closeable {
response.setResponseStatus(ParticipantResponseStatus.SUCCESS);
response.setResponseMessage(
- "Control loop " + updateMsg.getControlLoopId() + " defined on participant " + participantId);
+ "Control loop " + updateMsg.getControlLoopId() + " defined on participant " + participantId);
messageSender.sendResponse(response);
}
@@ -239,7 +239,7 @@ public class ControlLoopHandler implements Closeable {
* @param response participant response
*/
private void handleUninitialisedState(final ControlLoop controlLoop, final ControlLoopOrderedState orderedState,
- final ParticipantResponseDetails response) {
+ final ParticipantResponseDetails response) {
handleStateChange(controlLoop, orderedState, ControlLoopState.UNINITIALISED, response);
controlLoopMap.remove(controlLoop.getKey().asIdentifier());
@@ -262,7 +262,7 @@ public class ControlLoopHandler implements Closeable {
* @param response participant response
*/
private void handlePassiveState(final ControlLoop controlLoop, final ControlLoopOrderedState orderedState,
- final ParticipantResponseDetails response) {
+ final ParticipantResponseDetails response) {
handleStateChange(controlLoop, orderedState, ControlLoopState.PASSIVE, response);
}
@@ -274,7 +274,7 @@ public class ControlLoopHandler implements Closeable {
* @param response participant response
*/
private void handleRunningState(final ControlLoop controlLoop, final ControlLoopOrderedState orderedState,
- final ParticipantResponseDetails response) {
+ final ParticipantResponseDetails response) {
handleStateChange(controlLoop, orderedState, ControlLoopState.RUNNING, response);
}
@@ -287,7 +287,7 @@ public class ControlLoopHandler implements Closeable {
* @param response the response to the state change request
*/
private void handleStateChange(ControlLoop controlLoop, final ControlLoopOrderedState orderedState,
- ControlLoopState newState, ParticipantResponseDetails response) {
+ ControlLoopState newState, ParticipantResponseDetails response) {
if (orderedState.equals(controlLoop.getOrderedState())) {
response.setResponseStatus(ParticipantResponseStatus.SUCCESS);
@@ -304,7 +304,7 @@ public class ControlLoopHandler implements Closeable {
response.setResponseStatus(ParticipantResponseStatus.SUCCESS);
response.setResponseMessage(
- "ControlLoop state changed from " + controlLoop.getOrderedState() + " to " + orderedState);
+ "ControlLoop state changed from " + controlLoop.getOrderedState() + " to " + orderedState);
controlLoop.setOrderedState(orderedState);
}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java
index 913c050e3..5e414b175 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java
@@ -111,15 +111,14 @@ public class ParticipantHandler implements Closeable {
default:
LOGGER.debug("StateChange message has no state, state is null {}", stateChangeMsg.getParticipantId());
response.setResponseStatus(ParticipantResponseStatus.FAIL);
- response.setResponseMessage("StateChange message has invalid state for participantId "
- + stateChangeMsg.getParticipantId());
+ response.setResponseMessage(
+ "StateChange message has invalid state for participantId " + stateChangeMsg.getParticipantId());
break;
}
sender.sendResponse(response);
}
-
/**
* Method which handles a participant health check event from clamp.
*
@@ -196,8 +195,7 @@ public class ParticipantHandler implements Closeable {
* @param participantState participant state
* @return the participant
*/
- public Participant updateParticipantState(ToscaConceptIdentifier definition,
- ParticipantState participantState) {
+ public Participant updateParticipantState(ToscaConceptIdentifier definition, ParticipantState participantState) {
if (!Objects.equals(definition, participantId)) {
LOGGER.debug("No participant with this ID {}", definition.getName());
return null;
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/parameters/ParticipantIntermediaryParameters.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/parameters/ParticipantIntermediaryParameters.java
index 8e3440e42..5627abfe6 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/parameters/ParticipantIntermediaryParameters.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/parameters/ParticipantIntermediaryParameters.java
@@ -20,39 +20,39 @@
package org.onap.policy.clamp.controlloop.participant.intermediary.parameters;
+import javax.validation.Valid;
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
import lombok.Getter;
+import lombok.Setter;
import org.onap.policy.common.endpoints.parameters.TopicParameterGroup;
-import org.onap.policy.common.parameters.ParameterGroupImpl;
-import org.onap.policy.common.parameters.annotations.NotBlank;
-import org.onap.policy.common.parameters.annotations.NotNull;
+import org.onap.policy.common.parameters.validation.ParameterGroupConstraint;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
* Class to hold all parameters needed for participant component.
*/
-@NotNull
-@NotBlank
@Getter
-public class ParticipantIntermediaryParameters extends ParameterGroupImpl {
+@Setter
+public class ParticipantIntermediaryParameters {
+
// The ID and description of this participant
+ @NotNull
+ @Valid
private ToscaConceptIdentifier participantId;
+
+ @NotBlank
private String description;
// The participant type of this participant
+ @NotNull
+ @Valid
private ToscaConceptIdentifier participantType;
// The time interval for periodic reporting of status to the CLAMP control loop server
private long reportingTimeInterval;
- // DMaaP topics for communicating with the CLAMP control loop server
+ @NotNull
+ @ParameterGroupConstraint
private TopicParameterGroup clampControlLoopTopics;
-
- /**
- * Create the participant parameter group.
- *
- * @param instanceId instance id of the event.
- */
- public ParticipantIntermediaryParameters(final String instanceId) {
- super(instanceId);
- }
}