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;
25 import java.util.UUID;
26 import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatistics;
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.ControlLoopState;
30 import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoops;
31 import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant;
32 import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
33 import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantStatistics;
34 import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler;
35 import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters;
36 import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
39 * This interface is used by participant implementations to use the participant intermediary.
41 public interface ParticipantIntermediaryApi {
43 * Initialise the participant intermediary.
45 * @param parameters the parameters for the intermediary
47 void init(ParticipantIntermediaryParameters parameters);
50 * Close the intermediary.
55 * Register a listener for control loop elements that are mediated by the intermediary.
57 * @param controlLoopElementListener The control loop element listener to register
59 void registerControlLoopElementListener(ControlLoopElementListener controlLoopElementListener);
62 * Get participants loops from the intermediary API.
64 * @param name the participant name, null for all
65 * @param version the participant version, null for all
66 * @return the participants
68 List<Participant> getParticipants(String name, String version);
71 * Update the state of a participant.
73 * @param definition the definition of the participant to update the state on
74 * @param state the state of the participant
75 * @return the participant
77 Participant updateParticipantState(ToscaConceptIdentifier definition, ParticipantState state);
80 * Update the statistics of a participant.
82 * @param participantStatistics the statistics of the participant
84 void updateParticipantStatistics(ParticipantStatistics participantStatistics);
87 * Get control loops from the intermediary API.
89 * @param name the control loop element name, null for all
90 * @param version the control loop element version, null for all
91 * @return the control loop elements
93 ControlLoops getControlLoops(String name, String version);
96 * Get control loop elements from the intermediary API.
98 * @param name the control loop element name, null for all
99 * @param version the control loop element version, null for all
100 * @return the control loop elements
102 Map<UUID, ControlLoopElement> getControlLoopElements(String name, String version);
105 * Get control loop element from the intermediary API.
107 * @param id control loop element ID
108 * @return the control loop element
110 ControlLoopElement getControlLoopElement(UUID id);
113 * Update the state of a control loop element.
115 * @param id the ID of the control loop element to update the state on
116 * @param currentState the state of the control loop element
117 * @param newState the state of the control loop element
118 * @return ControlLoopElement updated control loop element
120 ControlLoopElement updateControlLoopElementState(UUID id, ControlLoopOrderedState currentState,
121 ControlLoopState newState);
124 * Update the control loop element statistics.
126 * @param id the ID of the control loop element to update the state on
127 * @param elementStatistics the updated statistics
129 void updateControlLoopElementStatistics(UUID id, ClElementStatistics elementStatistics);
132 * Return participantHandler, This will not be used in real world, but for junits,
133 * if participantHandler is not returned, there is no way to test state change messages
134 * without dmaap simulator.
136 * @return the participant handler
138 ParticipantHandler getParticipantHandler();