diff options
author | Jim Hahn <jrh3@att.com> | 2021-06-29 15:17:11 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2021-06-29 15:17:11 +0000 |
commit | 77aa9bc1f763e4de8d0b46fefa211e6018303514 (patch) | |
tree | f0bca729dde4ac985285386c6139610aafa04199 /participant/participant-impl/participant-impl-kubernetes | |
parent | fef5b8c6cf7b5999d4ca9b3dbd65121b73076d01 (diff) | |
parent | 7f7f0c5790dc63e43a59c53154e796239ab34cbb (diff) |
Merge "Convert Intermediary Participant to Spring and refactor Participants"
Diffstat (limited to 'participant/participant-impl/participant-impl-kubernetes')
3 files changed, 11 insertions, 14 deletions
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/configurations/ParticipantIntermediaryConfig.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/configurations/ParticipantIntermediaryConfig.java index d8c39925b..bfbed66b7 100644 --- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/configurations/ParticipantIntermediaryConfig.java +++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/configurations/ParticipantIntermediaryConfig.java @@ -21,28 +21,23 @@ package org.onap.policy.clamp.controlloop.participant.kubernetes.configurations; import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi; -import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryFactory; import org.onap.policy.clamp.controlloop.participant.kubernetes.handler.ControlLoopElementHandler; -import org.onap.policy.clamp.controlloop.participant.kubernetes.parameters.ParticipantK8sParameters; -import org.springframework.context.annotation.Bean; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; @Configuration public class ParticipantIntermediaryConfig { /** - * Create ParticipantIntermediaryApi. + * Register ControlLoopElementListener. * - * @param parameters the K8s Participant Parameters + * @param intermediaryApi the ParticipantIntermediaryApi * @param clElementHandler the ControlLoop Element Handler - * @return ParticipantIntermediaryApi */ - @Bean - public ParticipantIntermediaryApi participantIntermediaryApi(ParticipantK8sParameters parameters, - ControlLoopElementHandler clElementHandler) { - ParticipantIntermediaryApi intermediaryApi = new ParticipantIntermediaryFactory().createApiImplementation(); - intermediaryApi.init(parameters.getIntermediaryParameters()); + @Autowired + public void registerControlLoopElementListener(ParticipantIntermediaryApi intermediaryApi, + ControlLoopElementHandler clElementHandler) { intermediaryApi.registerControlLoopElementListener(clElementHandler); - return intermediaryApi; + clElementHandler.setIntermediaryApi(intermediaryApi); } } diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/handler/ControlLoopElementHandler.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/handler/ControlLoopElementHandler.java index 5f1dcb8d4..6257c3d19 100644 --- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/handler/ControlLoopElementHandler.java +++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/handler/ControlLoopElementHandler.java @@ -26,6 +26,7 @@ import java.lang.invoke.MethodHandles; import java.util.HashMap; import java.util.Map; import java.util.UUID; +import lombok.Setter; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState; @@ -52,7 +53,7 @@ public class ControlLoopElementHandler implements ControlLoopElementListener { @Autowired private ChartService chartService; - @Autowired + @Setter private ParticipantIntermediaryApi intermediaryApi; // Map of CLElement Id and installed Helm charts diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/parameters/ParticipantK8sParameters.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/parameters/ParticipantK8sParameters.java index 54eb3b225..a5731da74 100644 --- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/parameters/ParticipantK8sParameters.java +++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/controlloop/participant/kubernetes/parameters/ParticipantK8sParameters.java @@ -25,6 +25,7 @@ import javax.validation.constraints.NotNull; import lombok.Getter; import lombok.Setter; import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters; +import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantParameters; import org.onap.policy.common.parameters.annotations.Valid; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.validation.annotation.Validated; @@ -37,7 +38,7 @@ import org.springframework.validation.annotation.Validated; @Getter @Setter @ConfigurationProperties(prefix = "participant") -public class ParticipantK8sParameters { +public class ParticipantK8sParameters implements ParticipantParameters { @NotNull @Valid |