367215a29bac1c60bf5b62d5cae9899b37b3bebc
[policy/clamp.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2021-2022 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.AutomationCompositionElement;
28 import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
29 import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
30 import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
31 import org.onap.policy.clamp.models.acm.concepts.Participant;
32 import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
33 import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
34 import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
35 import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty;
36
37 /**
38  * This interface is used by participant implementations to use the participant intermediary.
39  */
40 public interface ParticipantIntermediaryApi {
41
42     /**
43      * Register a listener for automation composition elements that are mediated by the intermediary.
44      *
45      * @param automationCompositionElementListener The automation composition element listener to register
46      */
47     void registerAutomationCompositionElementListener(
48         AutomationCompositionElementListener automationCompositionElementListener);
49
50     /**
51      * Get participants loops from the intermediary API.
52      *
53      * @param name the participant name, null for all
54      * @param version the participant version, null for all
55      * @return the participants
56      */
57     List<Participant> getParticipants(String name, String version);
58
59     /**
60      * Get common properties of a automation composition element.
61      *
62      * @param acElementDef the automation composition element definition
63      * @return the common properties
64      */
65     Map<String, ToscaProperty> getAcElementDefinitionCommonProperties(ToscaConceptIdentifier acElementDef);
66
67     /**
68      * Update the state of a participant.
69      *
70      * @param definition the definition of the participant to update the state on
71      * @param state the state of the participant
72      * @return the participant
73      */
74     Participant updateParticipantState(ToscaConceptIdentifier definition, ParticipantState state);
75
76     /**
77      * Get automation compositions from the intermediary API.
78      *
79      * @param name the automation composition element name, null for all
80      * @param version the automation composition element version, null for all
81      * @return the automation composition elements
82      */
83     AutomationCompositions getAutomationCompositions(String name, String version);
84
85     /**
86      * Get automation composition elements 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     Map<UUID, AutomationCompositionElement> getAutomationCompositionElements(String name, String version);
93
94     /**
95      * Get automation composition element from the intermediary API.
96      *
97      * @param id automation composition element ID
98      * @return the automation composition element
99      */
100     AutomationCompositionElement getAutomationCompositionElement(UUID id);
101
102     /**
103      * Update the state of a automation composition element.
104      *
105      * @param id the ID of the automation composition element to update the state on
106      * @param currentState the state of the automation composition element
107      * @param newState the state of the automation composition element
108      * @return AutomationCompositionElement updated automation composition element
109      */
110     AutomationCompositionElement updateAutomationCompositionElementState(UUID automationCompositionId,
111         UUID id, AutomationCompositionOrderedState currentState, AutomationCompositionState newState,
112         ParticipantMessageType messageType);
113 }