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
 
  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.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;
 
  38  * This interface is used by participant implementations to use the participant intermediary.
 
  40 public interface ParticipantIntermediaryApi {
 
  43      * Register a listener for automation composition elements that are mediated by the intermediary.
 
  45      * @param automationCompositionElementListener The automation composition element listener to register
 
  47     void registerAutomationCompositionElementListener(
 
  48         AutomationCompositionElementListener automationCompositionElementListener);
 
  51      * Get participants loops from the intermediary API.
 
  53      * @param name the participant name, null for all
 
  54      * @param version the participant version, null for all
 
  55      * @return the participants
 
  57     List<Participant> getParticipants(String name, String version);
 
  60      * Get common properties of a automation composition element.
 
  62      * @param acElementDef the automation composition element definition
 
  63      * @return the common properties
 
  65     Map<String, ToscaProperty> getAcElementDefinitionCommonProperties(ToscaConceptIdentifier acElementDef);
 
  68      * Update the state of a participant.
 
  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
 
  74     Participant updateParticipantState(ToscaConceptIdentifier definition, ParticipantState state);
 
  77      * Get automation compositions from the intermediary API.
 
  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
 
  83     AutomationCompositions getAutomationCompositions(String name, String version);
 
  86      * Get automation composition elements 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     Map<UUID, AutomationCompositionElement> getAutomationCompositionElements(String name, String version);
 
  95      * Get automation composition element from the intermediary API.
 
  97      * @param id automation composition element ID
 
  98      * @return the automation composition element
 
 100     AutomationCompositionElement getAutomationCompositionElement(UUID id);
 
 103      * Update the state of a automation composition element.
 
 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
 
 110     AutomationCompositionElement updateAutomationCompositionElementState(UUID automationCompositionId,
 
 111         UUID id, AutomationCompositionOrderedState currentState, AutomationCompositionState newState,
 
 112         ParticipantMessageType messageType);