6c3e029fe19b496f17c28abb5502fe560d2d8e73
[policy/clamp.git] /
1 /*-
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
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
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.
16  *
17  * SPDX-License-Identifier: Apache-2.0
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.policy.clamp.controlloop.participant.intermediary.api;
22
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.parameters.ParticipantIntermediaryParameters;
34 import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
35
36 /**
37  * This interface is used by participant implementations to use the participant intermediary.
38  */
39 public interface ParticipantIntermediaryApi {
40     /**
41      * Initialise the participant intermediary.
42      *
43      * @param parameters the parameters for the intermediary
44      */
45     public void init(ParticipantIntermediaryParameters parameters);
46
47     /**
48      * Close the intermediary.
49      */
50     public void close();
51
52     /**
53      * Get participants loops from the intermediary API.
54      *
55      * @param name the participant name, null for all
56      * @param version the participant version, null for all
57      * @return the participants
58      */
59     public List<Participant> getParticipants(String name, String version);
60
61     /**
62      * Update the state of a participant.
63      *
64      * @param definition the definition of the participant to update the state on
65      * @param state the state of the participant
66      * @return updated participant
67      */
68     public Participant updateParticipantState(ToscaConceptIdentifier definition, ParticipantState state);
69
70     /**
71      * Update the statistics of a participant.
72      *
73      * @param participantStatistics the statistics of the participant
74      */
75     public void updateParticipantStatistics(ParticipantStatistics participantStatistics);
76
77     /**
78      * Get control loops from the intermediary API.
79      *
80      * @param name the control loop element name, null for all
81      * @param version the control loop element version, null for all
82      * @return the control loop elements
83      */
84     public ControlLoops getControlLoops(String name, String version);
85
86     /**
87      * Get control loop elements from the intermediary API.
88      *
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
92      */
93     public List<ControlLoopElement> getControlLoopElements(String name, String version);
94
95     /**
96      * Update the state of a control loop.
97      *
98      * @param definition the ID of the control loop to update the state on
99      * @param state the state of the control loop
100      * @return ControlLoop updated control loop
101      */
102     public ControlLoop updateControlLoopState(ToscaConceptIdentifier definition, ControlLoopOrderedState state);
103
104     /**
105      * Update the state of a control loop element.
106      *
107      * @param id the ID of the control loop element to update the state on
108      * @param state the state of the control loop element
109      * @return ControlLoopElement updated control loop element
110      */
111     public ControlLoopElement updateControlLoopElementState(UUID id, ControlLoopOrderedState state);
112
113     /**
114      * Update the control loop element statistics.
115      *
116      * @param elementStatistics the updated statistics
117      */
118     public void updateControlLoopElementStatistics(ClElementStatistics elementStatistics);
119 }