a3eb4df6e6a22d716de44a13916035247b41a30b
[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     String DME2_READ_TIMEOUT_PROPERTY = "AFT_DME2_EP_READ_TIMEOUT_MS";
34     String DME2_EP_CONN_TIMEOUT_PROPERTY = "AFT_DME2_EP_CONN_TIMEOUT";
35     String DME2_ROUNDTRIP_TIMEOUT_PROPERTY = "AFT_DME2_ROUNDTRIP_TIMEOUT_MS";
36     String DME2_VERSION_PROPERTY = "Version";
37     String DME2_ROUTE_OFFER_PROPERTY = "routeOffer";
38     String DME2_SERVICE_NAME_PROPERTY = "ServiceName";
39     String DME2_SUBCONTEXT_PATH_PROPERTY = "SubContextPath";
40     String DME2_SESSION_STICKINESS_REQUIRED_PROPERTY = "sessionstickinessrequired";
41
42     /**
43      * <pre>
44      * Instantiate a new DMAAP Topic Sink, with following params.
45      * servers         list of servers
46      * topic           topic name
47      * apiKey          API Key
48      * apiSecret       API Secret
49      * userName        AAF user name
50      * password        AAF password
51      * partitionKey    Consumer Group
52      * environment     DME2 environment
53      * aftEnvironment  DME2 AFT environment
54      * partner         DME2 Partner
55      * latitude        DME2 latitude
56      * longitude       DME2 longitude
57      * additionalProps additional properties to pass to DME2
58      * managed         is this sink endpoint managed?
59      * </pre>
60      * @param busTopicParams parameter object
61      * @return DmaapTopicSink object
62      * @throws IllegalArgumentException if invalid parameters are present
63      */
64     DmaapTopicSink build(BusTopicParams busTopicParams);
65
66     /**
67      * Creates an DMAAP Topic Sink based on properties files.
68      *
69      * @param properties Properties containing initialization values
70      * @return an DMAAP Topic Sink
71      * @throws IllegalArgumentException if invalid parameters are present
72      */
73     List<DmaapTopicSink> build(Properties properties);
74
75     /**
76      * Instantiates a new DMAAP Topic Sink.
77      *
78      * @param servers list of servers
79      * @param topic topic name
80      * @return an DMAAP Topic Sink
81      * @throws IllegalArgumentException if invalid parameters are present
82      */
83     DmaapTopicSink build(List<String> servers, String topic);
84
85     /**
86      * Destroys an DMAAP Topic Sink based on a topic.
87      *
88      * @param topic topic name
89      * @throws IllegalArgumentException if invalid parameters are present
90      */
91     void destroy(String topic);
92
93     /**
94      * Destroys all DMAAP Topic Sinks.
95      */
96     void destroy();
97
98     /**
99      * Gets an DMAAP Topic Sink based on topic name.
100      *
101      * @param topic the topic name
102      * @return an DMAAP Topic Sink with topic name
103      * @throws IllegalArgumentException if an invalid topic is provided
104      * @throws IllegalStateException if the DMAAP Topic Reader is an incorrect state
105      */
106     DmaapTopicSink get(String topic);
107
108     /**
109      * Provides a snapshot of the DMAAP Topic Sinks.
110      *
111      * @return a list of the DMAAP Topic Sinks
112      */
113     List<DmaapTopicSink> inventory();
114 }