4409e827ec590148cb1a29c18e0083c52c44b1fd
[policy/common.git] /
1 /*
2  * ============LICENSE_START=======================================================
3  * policy-endpoints
4  * ================================================================================
5  * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
6  * Modified Copyright (C) 2018 Samsung Electronics Co., Ltd.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  */
21
22 package org.onap.policy.common.endpoints.event.comm.bus;
23
24 import java.util.List;
25 import java.util.Properties;
26 import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams;
27
28 /**
29  * DMAAP Topic Sink Factory.
30  */
31 public interface DmaapTopicSinkFactory {
32
33     /**
34      * <pre>
35      * Instantiate a new DMAAP Topic Sink, with following params.
36      * servers         list of servers
37      * topic           topic name
38      * apiKey          API Key
39      * apiSecret       API Secret
40      * userName        AAF user name
41      * password        AAF password
42      * partitionKey    Consumer Group
43      * environment     DME2 environment
44      * aftEnvironment  DME2 AFT environment
45      * partner         DME2 Partner
46      * latitude        DME2 latitude
47      * longitude       DME2 longitude
48      * additionalProps additional properties to pass to DME2
49      * managed         is this sink endpoint managed?
50      * </pre>
51      * @param busTopicParams parameter object
52      * @return DmaapTopicSink object
53      * @throws IllegalArgumentException if invalid parameters are present
54      */
55     DmaapTopicSink build(BusTopicParams busTopicParams);
56
57     /**
58      * Creates an DMAAP Topic Sink based on properties files.
59      *
60      * @param properties Properties containing initialization values
61      * @return an DMAAP Topic Sink
62      * @throws IllegalArgumentException if invalid parameters are present
63      */
64     List<DmaapTopicSink> build(Properties properties);
65
66     /**
67      * Instantiates a new DMAAP Topic Sink.
68      *
69      * @param servers list of servers
70      * @param topic topic name
71      * @return an DMAAP Topic Sink
72      * @throws IllegalArgumentException if invalid parameters are present
73      */
74     DmaapTopicSink build(List<String> servers, String topic);
75
76     /**
77      * Destroys an DMAAP Topic Sink based on a topic.
78      *
79      * @param topic topic name
80      * @throws IllegalArgumentException if invalid parameters are present
81      */
82     void destroy(String topic);
83
84     /**
85      * Destroys all DMAAP Topic Sinks.
86      */
87     void destroy();
88
89     /**
90      * Gets an DMAAP Topic Sink based on topic name.
91      *
92      * @param topic the topic name
93      * @return an DMAAP Topic Sink with topic name
94      * @throws IllegalArgumentException if an invalid topic is provided
95      * @throws IllegalStateException if the DMAAP Topic Reader is an incorrect state
96      */
97     DmaapTopicSink get(String topic);
98
99     /**
100      * Provides a snapshot of the DMAAP Topic Sinks.
101      *
102      * @return a list of the DMAAP Topic Sinks
103      */
104     List<DmaapTopicSink> inventory();
105 }