2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2021 Nordix Foundation.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.clamp.controlloop.participant.intermediary.api;
23 import java.util.List;
24 import java.util.UUID;
25 import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatistics;
26 import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
27 import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
28 import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
29 import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoops;
30 import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
31 import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
32 import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantStatistics;
33 import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
34 import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters;
35 import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
38 * This interface is used by participant implementations to use the participant intermediary.
40 public interface ParticipantIntermediaryApi {
42 * Initialise the participant intermediary.
44 * @param parameters the parameters for the intermediary
46 void init(ParticipantIntermediaryParameters parameters);
49 * Close the intermediary.
54 * Get participants loops from the intermediary API.
56 * @param name the participant name, null for all
57 * @param version the participant version, null for all
58 * @return the participants
60 List<Participant> getParticipants(String name, String version);
63 * Update the state of a participant.
65 * @param definition the definition of the participant to update the state on
66 * @param state the state of the participant
67 * @return the participant
69 Participant updateParticipantState(ToscaConceptIdentifier definition, ParticipantState state);
72 * Update the statistics of a participant.
74 * @param participantStatistics the statistics of the participant
76 void updateParticipantStatistics(ParticipantStatistics participantStatistics);
79 * Get control loops from the intermediary API.
81 * @param name the control loop element name, null for all
82 * @param version the control loop element version, null for all
83 * @return the control loop elements
85 ControlLoops getControlLoops(String name, String version);
88 * Get control loop elements from the intermediary API.
90 * @param name the control loop element name, null for all
91 * @param version the control loop element version, null for all
92 * @return the control loop elements
94 List<ControlLoopElement> getControlLoopElements(String name, String version);
97 * Update the state of a control loop.
99 * @param definition the ID of the control loop to update the state on
100 * @param state the state of the control loop
101 * @return ControlLoop updated control loop
103 ControlLoop updateControlLoopState(ToscaConceptIdentifier definition, ControlLoopOrderedState state);
106 * Update the state of a control loop element.
108 * @param id the ID of the control loop element to update the state on
109 * @param state the state of the control loop element
110 * @return ControlLoopElement updated control loop element
112 ControlLoopElement updateControlLoopElementState(UUID id, ControlLoopOrderedState state);
115 * Update the control loop element statistics.
117 * @param elementStatistics the updated statistics
119 void updateControlLoopElementStatistics(ClElementStatistics elementStatistics);
122 * Returns participantHandler, This will not be used in real world, but for junits,
123 * if participantHandler is not returned, there is no way to test state change messages
124 * without dmaap simulator.
126 * @return ParticipantHandler returns a participantHandler
128 ParticipantHandler getParticipantHandler();