summaryrefslogtreecommitdiffstats
path: root/participant/participant-intermediary/src/main
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2023-01-30 13:43:10 +0000
committerFrancescoFioraEst <francesco.fiora@est.tech>2023-01-31 10:20:02 +0000
commit7f762dfa19f673241f8ea1b2ff3d56d2d58bdcdb (patch)
tree591b04b568efed20c76f7d67973163d075d27162 /participant/participant-intermediary/src/main
parent934f7bd443225a6945b0542fa5cb7c043deac426 (diff)
Refactor ACM Update message to ACM Deploy message in ACM
Refactor ACM Update message to ACM Deploy message in ACM and add AcElementDeploy in Deploy message. AutomationCompositionElement will be removed from the message after POLICY-4506 and POLICY-4507. Issue-ID: POLICY-4543 Change-Id: I8444e15b3b4cb1209ffd083fb965e0707fbd9625 Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'participant/participant-intermediary/src/main')
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/AutomationCompositionDeployListener.java (renamed from participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/AutomationCompositionUpdateListener.java)16
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantMessagePublisher.java4
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java30
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java6
4 files changed, 28 insertions, 28 deletions
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/AutomationCompositionUpdateListener.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/AutomationCompositionDeployListener.java
index 6c5dc127d..412d26e2e 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/AutomationCompositionUpdateListener.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/AutomationCompositionDeployListener.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,28 +21,28 @@
package org.onap.policy.clamp.acm.participant.intermediary.comm;
import org.onap.policy.clamp.acm.participant.intermediary.handler.ParticipantHandler;
-import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionUpdate;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionDeploy;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
import org.springframework.stereotype.Component;
/**
- * Listener for Automation Composition Update messages sent by ACM.
+ * Listener for Automation Composition Deploy messages sent by ACM.
*/
@Component
-public class AutomationCompositionUpdateListener extends ParticipantListener<AutomationCompositionUpdate> {
+public class AutomationCompositionDeployListener extends ParticipantListener<AutomationCompositionDeploy> {
/**
* Constructs the object.
*
* @param participantHandler the handler for managing the state of the participant
*/
- public AutomationCompositionUpdateListener(final ParticipantHandler participantHandler) {
- super(AutomationCompositionUpdate.class, participantHandler,
- participantHandler::handleAutomationCompositionUpdate);
+ public AutomationCompositionDeployListener(final ParticipantHandler participantHandler) {
+ super(AutomationCompositionDeploy.class, participantHandler,
+ participantHandler::handleAutomationCompositionDeploy);
}
@Override
public String getType() {
- return ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE.name();
+ return ParticipantMessageType.AUTOMATION_COMPOSITION_DEPLOY.name();
}
}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantMessagePublisher.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantMessagePublisher.java
index 9023d9460..b18875813 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantMessagePublisher.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantMessagePublisher.java
@@ -26,7 +26,7 @@ import java.util.List;
import javax.ws.rs.core.Response.Status;
import org.onap.policy.clamp.acm.participant.intermediary.handler.Publisher;
import org.onap.policy.clamp.common.acm.exception.AutomationCompositionRuntimeException;
-import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionAck;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionDeployAck;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregister;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegister;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatus;
@@ -118,7 +118,7 @@ public class ParticipantMessagePublisher implements Publisher {
*/
@Timed(value = "publisher.automation_composition_update_ack",
description = "AUTOMATION_COMPOSITION_UPDATE_ACK/AUTOMATION_COMPOSITION_STATECHANGE_ACK messages published")
- public void sendAutomationCompositionAck(final AutomationCompositionAck automationCompositionAck) {
+ public void sendAutomationCompositionAck(final AutomationCompositionDeployAck automationCompositionAck) {
validate();
topicSinkClient.send(automationCompositionAck);
LOGGER.debug("Sent AutomationComposition Update/StateChange Ack to runtime - {}", automationCompositionAck);
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java
index 422fc3e23..f2fd636e9 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java
@@ -32,17 +32,17 @@ import lombok.Getter;
import org.onap.policy.clamp.acm.participant.intermediary.api.AutomationCompositionElementListener;
import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantMessagePublisher;
import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantParameters;
+import org.onap.policy.clamp.models.acm.concepts.AcElementDeployAck;
import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
-import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementAck;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementDefinition;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
-import org.onap.policy.clamp.models.acm.concepts.ParticipantUpdates;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantDeploy;
import org.onap.policy.clamp.models.acm.concepts.ParticipantUtils;
-import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionAck;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionDeploy;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionDeployAck;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionStateChange;
-import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionUpdate;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@@ -121,13 +121,13 @@ public class AutomationCompositionHandler {
var acElement = elementsOnThisParticipant.get(id);
if (acElement != null) {
var automationCompositionStateChangeAck =
- new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK);
+ new AutomationCompositionDeployAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK);
automationCompositionStateChangeAck.setParticipantId(participantId);
automationCompositionStateChangeAck.setAutomationCompositionId(automationCompositionId);
acElement.setOrderedState(orderedState);
acElement.setState(newState);
automationCompositionStateChangeAck.getAutomationCompositionResultMap().put(acElement.getId(),
- new AutomationCompositionElementAck(newState, true,
+ new AcElementDeployAck(newState, null, true,
"Automation composition element {} state changed to {}\", id, newState)"));
LOGGER.debug("Automation composition element {} state changed to {}", id, newState);
automationCompositionStateChangeAck
@@ -155,7 +155,7 @@ public class AutomationCompositionHandler {
if (automationComposition == null) {
var automationCompositionAck =
- new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK);
+ new AutomationCompositionDeployAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK);
automationCompositionAck.setParticipantId(participantId);
automationCompositionAck.setMessage("Automation composition " + stateChangeMsg.getAutomationCompositionId()
+ " does not use this participant " + participantId);
@@ -200,12 +200,12 @@ public class AutomationCompositionHandler {
}
/**
- * Handle a automation composition update message.
+ * Handle a automation composition Deploy message.
*
- * @param updateMsg the update message
+ * @param updateMsg the Deploy message
* @param acElementDefinitions the list of AutomationCompositionElementDefinition
*/
- public void handleAutomationCompositionUpdate(AutomationCompositionUpdate updateMsg,
+ public void handleAutomationCompositionDeploy(AutomationCompositionDeploy updateMsg,
List<AutomationCompositionElementDefinition> acElementDefinitions) {
if (!updateMsg.appliesTo(participantId)) {
@@ -219,7 +219,7 @@ public class AutomationCompositionHandler {
}
}
- private void handleAcUpdatePhase0(AutomationCompositionUpdate updateMsg,
+ private void handleAcUpdatePhase0(AutomationCompositionDeploy updateMsg,
List<AutomationCompositionElementDefinition> acElementDefinitions) {
var automationComposition = automationCompositionMap.get(updateMsg.getAutomationCompositionId());
@@ -228,7 +228,7 @@ public class AutomationCompositionHandler {
// elements to existing AutomationComposition has to be supported).
if (automationComposition != null) {
var automationCompositionUpdateAck =
- new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE_ACK);
+ new AutomationCompositionDeployAck(ParticipantMessageType.AUTOMATION_COMPOSITION_DEPLOY_ACK);
automationCompositionUpdateAck.setParticipantId(participantId);
automationCompositionUpdateAck.setMessage("Automation composition " + updateMsg.getAutomationCompositionId()
@@ -257,7 +257,7 @@ public class AutomationCompositionHandler {
updateMsg.getAutomationCompositionId());
}
- private void handleAcUpdatePhaseN(AutomationCompositionUpdate updateMsg,
+ private void handleAcUpdatePhaseN(AutomationCompositionDeploy updateMsg,
List<AutomationCompositionElementDefinition> acElementDefinitions) {
var acElementList = updateMsg.getParticipantUpdatesList().stream()
@@ -303,7 +303,7 @@ public class AutomationCompositionHandler {
}
private List<AutomationCompositionElement> storeElementsOnThisParticipant(
- List<ParticipantUpdates> participantUpdates) {
+ List<ParticipantDeploy> participantUpdates) {
var acElementList = participantUpdates.stream()
.flatMap(participantUpdate -> participantUpdate.getAutomationCompositionElementList().stream())
.filter(element -> participantId.equals(element.getParticipantId())).collect(Collectors.toList());
@@ -386,7 +386,7 @@ public class AutomationCompositionHandler {
if (orderedState.equals(automationComposition.getOrderedState())) {
var automationCompositionAck =
- new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK);
+ new AutomationCompositionDeployAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK);
automationCompositionAck.setParticipantId(participantId);
automationCompositionAck.setMessage("Automation composition is already in state " + orderedState);
automationCompositionAck.setResult(false);
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java
index 75f2d81ab..050d66d0b 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java
@@ -36,8 +36,8 @@ import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionInfo;
import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
import org.onap.policy.clamp.models.acm.concepts.ParticipantSupportedElementType;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionDeploy;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionStateChange;
-import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionUpdate;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantAckMessage;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregister;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregisterAck;
@@ -103,8 +103,8 @@ public class ParticipantHandler {
@Timed(
value = "listener.automation_composition_update",
description = "AUTOMATION_COMPOSITION_UPDATE messages received")
- public void handleAutomationCompositionUpdate(AutomationCompositionUpdate updateMsg) {
- automationCompositionHandler.handleAutomationCompositionUpdate(updateMsg,
+ public void handleAutomationCompositionDeploy(AutomationCompositionDeploy updateMsg) {
+ automationCompositionHandler.handleAutomationCompositionDeploy(updateMsg,
acElementDefsMap.get(updateMsg.getCompositionId()));
}