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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 * SPDX-License-Identifier: Apache-2.0
19 * ============LICENSE_END=========================================================
22 package org.onap.policy.clamp.acm.participant.intermediary.api;
24 import java.util.List;
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;
40 * This interface is used by participant implementations to use the participant intermediary.
42 public interface ParticipantIntermediaryApi {
45 * Register a listener for automation composition elements that are mediated by the intermediary.
47 * @param automationCompositionElementListener The automation composition element listener to register
49 void registerAutomationCompositionElementListener(
50 AutomationCompositionElementListener automationCompositionElementListener);
53 * Get participants loops from the intermediary API.
55 * @param name the participant name, null for all
56 * @param version the participant version, null for all
57 * @return the participants
59 List<Participant> getParticipants(String name, String version);
62 * Get common properties of a automation composition element.
64 * @param acElementDef the automation composition element definition
65 * @return the common properties
67 Map<String, ToscaProperty> getAcElementDefinitionCommonProperties(ToscaConceptIdentifier acElementDef);
70 * Update the state of a participant.
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
76 Participant updateParticipantState(ToscaConceptIdentifier definition, ParticipantState state);
79 * Update the statistics of a participant.
81 * @param participantStatistics the statistics of the participant
83 void updateParticipantStatistics(ParticipantStatistics participantStatistics);
86 * Get automation compositions from the intermediary API.
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
92 AutomationCompositions getAutomationCompositions(String name, String version);
95 * Get automation composition elements from the intermediary API.
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
101 Map<UUID, AutomationCompositionElement> getAutomationCompositionElements(String name, String version);
104 * Get automation composition element from the intermediary API.
106 * @param id automation composition element ID
107 * @return the automation composition element
109 AutomationCompositionElement getAutomationCompositionElement(UUID id);
112 * Update the state of a automation composition element.
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
119 AutomationCompositionElement updateAutomationCompositionElementState(ToscaConceptIdentifier automationCompositionId,
120 UUID id, AutomationCompositionOrderedState currentState, AutomationCompositionState newState,
121 ParticipantMessageType messageType);
124 * Update the automation composition element statistics.
126 * @param id the ID of the automation composition element to update the state on
127 * @param elementStatistics the updated statistics
129 void updateAutomationCompositionElementStatistics(UUID id, AcElementStatistics elementStatistics);