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