79f5259bf7a0887ea7d09b38b2259cd6a893a786
[policy/clamp.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2021 Nordix Foundation.
4  *  Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
5  * ================================================================================
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  * SPDX-License-Identifier: Apache-2.0
19  * ============LICENSE_END=========================================================
20  */
21
22 package org.onap.policy.clamp.acm.participant.intermediary.api;
23
24 import java.util.List;
25 import java.util.Map;
26 import java.util.UUID;
27 import org.onap.policy.clamp.models.acm.concepts.AcElementStatistics;
28 import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
29 import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
30 import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
31 import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
32 import org.onap.policy.clamp.models.acm.concepts.Participant;
33 import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
34 import org.onap.policy.clamp.models.acm.concepts.ParticipantStatistics;
35 import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
36 import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
37 import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty;
38
39 /**
40  * This interface is used by participant implementations to use the participant intermediary.
41  */
42 public interface ParticipantIntermediaryApi {
43
44     /**
45      * Register a listener for automation composition elements that are mediated by the intermediary.
46      *
47      * @param automationCompositionElementListener The automation composition element listener to register
48      */
49     void registerAutomationCompositionElementListener(
50         AutomationCompositionElementListener automationCompositionElementListener);
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     List<Participant> getParticipants(String name, String version);
60
61     /**
62      * Get common properties of a automation composition element.
63      *
64      * @param acElementDef the automation composition element definition
65      * @return the common properties
66      */
67     Map<String, ToscaProperty> getAcElementDefinitionCommonProperties(ToscaConceptIdentifier acElementDef);
68
69     /**
70      * Update the state of a participant.
71      *
72      * @param definition the definition of the participant to update the state on
73      * @param state the state of the participant
74      * @return the participant
75      */
76     Participant updateParticipantState(ToscaConceptIdentifier definition, ParticipantState state);
77
78     /**
79      * Update the statistics of a participant.
80      *
81      * @param participantStatistics the statistics of the participant
82      */
83     void updateParticipantStatistics(ParticipantStatistics participantStatistics);
84
85     /**
86      * Get automation compositions from the intermediary API.
87      *
88      * @param name the automation composition element name, null for all
89      * @param version the automation composition element version, null for all
90      * @return the automation composition elements
91      */
92     AutomationCompositions getAutomationCompositions(String name, String version);
93
94     /**
95      * Get automation composition elements from the intermediary API.
96      *
97      * @param name the automation composition element name, null for all
98      * @param version the automation composition element version, null for all
99      * @return the automation composition elements
100      */
101     Map<UUID, AutomationCompositionElement> getAutomationCompositionElements(String name, String version);
102
103     /**
104      * Get automation composition element from the intermediary API.
105      *
106      * @param id automation composition element ID
107      * @return the automation composition element
108      */
109     AutomationCompositionElement getAutomationCompositionElement(UUID id);
110
111     /**
112      * Update the state of a automation composition element.
113      *
114      * @param id the ID of the automation composition element to update the state on
115      * @param currentState the state of the automation composition element
116      * @param newState the state of the automation composition element
117      * @return AutomationCompositionElement updated automation composition element
118      */
119     AutomationCompositionElement updateAutomationCompositionElementState(ToscaConceptIdentifier automationCompositionId,
120         UUID id, AutomationCompositionOrderedState currentState, AutomationCompositionState newState,
121         ParticipantMessageType messageType);
122
123     /**
124      * Update the automation composition element statistics.
125      *
126      * @param id the ID of the automation composition element to update the state on
127      * @param elementStatistics the updated statistics
128      */
129     void updateAutomationCompositionElementStatistics(UUID id, AcElementStatistics elementStatistics);
130 }