Changes for checkstyle 8.32
[policy/apex-pdp.git] / services / services-engine / src / main / java / org / onap / policy / apex / service / engine / event / ApexEventProducer.java
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
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.apex.service.engine.event;
22
23 import java.util.Properties;
24 import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters;
25 import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMode;
26
27 /**
28  * This interface is used by technology specific producers and publishers that are handling events
29  * output by Apex. Users specify the producer technology to use in the Apex configuration and Apex
30  * uses a factory to start the appropriate producer plugin that implements this interface for its
31  * output. The technology specific implementation details are hidden behind this interface.
32  *
33  * @author Liam Fallon (liam.fallon@ericsson.com)
34  */
35 public interface ApexEventProducer {
36
37     /**
38      * Initialize the producer.
39      *
40      * @param name a name for this producer
41      * @param producerParameters the parameters to initialise this producer
42      * @throws ApexEventException exception on errors initializing an event producer
43      */
44     void init(String name, EventHandlerParameters producerParameters) throws ApexEventException;
45
46     /**
47      * Get the peered reference object for this producer.
48      *
49      * @param peeredMode the peered mode for which to return the reference
50      * @return the peered reference object for this producer
51      */
52     PeeredReference getPeeredReference(EventHandlerPeeredMode peeredMode);
53
54     /**
55      * Set the peered reference object for this producer.
56      *
57      * @param peeredMode the peered mode for which to return the reference
58      * @param peeredReference the peered reference object for this producer
59      */
60     void setPeeredReference(EventHandlerPeeredMode peeredMode, PeeredReference peeredReference);
61
62     /**
63      * Send an event to the producer.
64      *
65      * @param executionId the unique ID that produced this event
66      * @param executionProperties properties used during processing of this event
67      * @param eventName The name of the event
68      * @param event The converted event as an object
69      */
70     void sendEvent(long executionId, Properties executionProperties, String eventName, Object event);
71
72     /**
73      * Get the name of this event producer.
74      *
75      * @return the event producer name
76      */
77     String getName();
78
79     /**
80      * Stop the event producer.
81      */
82     void stop();
83 }