35a79bf1971842d069fcd658342f00f3d5141b9c
[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 Source Factory.
30  */
31 public interface DmaapTopicSourceFactory {
32     String DME2_READ_TIMEOUT_PROPERTY = "AFT_DME2_EP_READ_TIMEOUT_MS";
33     String DME2_EP_CONN_TIMEOUT_PROPERTY = "AFT_DME2_EP_CONN_TIMEOUT";
34     String DME2_ROUNDTRIP_TIMEOUT_PROPERTY = "AFT_DME2_ROUNDTRIP_TIMEOUT_MS";
35     String DME2_VERSION_PROPERTY = "Version";
36     String DME2_ROUTE_OFFER_PROPERTY = "routeOffer";
37     String DME2_SERVICE_NAME_PROPERTY = "ServiceName";
38     String DME2_SUBCONTEXT_PATH_PROPERTY = "SubContextPath";
39     String DME2_SESSION_STICKINESS_REQUIRED_PROPERTY = "sessionstickinessrequired";
40
41     /**
42      * Creates an DMAAP Topic Source based on properties files.
43      * 
44      * @param properties Properties containing initialization values
45      * 
46      * @return an DMAAP Topic Source
47      * @throws IllegalArgumentException if invalid parameters are present
48      */
49     List<DmaapTopicSource> build(Properties properties);
50
51     /**
52      * Instantiates a new DMAAP Topic Source.
53      * 
54      * @param busTopicParams parameters object
55      * @return a DMAAP Topic Source
56      */
57     DmaapTopicSource build(BusTopicParams busTopicParams);
58
59     /**
60      * Instantiates a new DMAAP Topic Source.
61      * 
62      * @param servers list of servers
63      * @param topic topic name
64      * @param apiKey API Key
65      * @param apiSecret API Secret
66      * 
67      * @return an DMAAP Topic Source
68      * @throws IllegalArgumentException if invalid parameters are present
69      */
70     DmaapTopicSource build(List<String> servers, String topic, String apiKey, String apiSecret);
71
72     /**
73      * Instantiates a new DMAAP Topic Source.
74      * 
75      * @param servers list of servers
76      * @param topic topic name
77      * 
78      * @return an DMAAP Topic Source
79      * @throws IllegalArgumentException if invalid parameters are present
80      */
81     DmaapTopicSource build(List<String> servers, String topic);
82
83     /**
84      * Destroys an DMAAP Topic Source based on a topic.
85      * 
86      * @param topic topic name
87      * @throws IllegalArgumentException if invalid parameters are present
88      */
89     void destroy(String topic);
90
91     /**
92      * Destroys all DMAAP Topic Sources.
93      */
94     void destroy();
95
96     /**
97      * Gets an DMAAP Topic Source based on topic name.
98      * 
99      * @param topic the topic name
100      * @return an DMAAP Topic Source with topic name
101      * @throws IllegalArgumentException if an invalid topic is provided
102      * @throws IllegalStateException if the DMAAP Topic Source is an incorrect state
103      */
104     DmaapTopicSource get(String topic);
105
106     /**
107      * Provides a snapshot of the DMAAP Topic Sources.
108      * 
109      * @return a list of the DMAAP Topic Sources
110      */
111     List<DmaapTopicSource> inventory();
112 }