0cf095fd3e196e25d9888a944758d0fe6db55e95
[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  * UEB Topic Sink Factory.
30  */
31 public interface UebTopicSinkFactory {
32
33     /**
34      * Instantiates a new UEB Topic Writer.
35      * 
36      * @param busTopicParams parameters object
37      * @return an UEB Topic Sink
38      */
39     UebTopicSink build(BusTopicParams busTopicParams);
40
41     /**
42      * Creates an UEB Topic Writer based on properties files.
43      * 
44      * @param properties Properties containing initialization values
45      * 
46      * @return an UEB Topic Writer
47      * @throws IllegalArgumentException if invalid parameters are present
48      */
49     List<UebTopicSink> build(Properties properties);
50
51     /**
52      * Instantiates a new UEB Topic Writer.
53      * 
54      * @param servers list of servers
55      * @param topic topic name
56      * 
57      * @return an UEB Topic Writer
58      * @throws IllegalArgumentException if invalid parameters are present
59      */
60     UebTopicSink build(List<String> servers, String topic);
61
62     /**
63      * Destroys an UEB Topic Writer based on a topic.
64      * 
65      * @param topic topic name
66      * @throws IllegalArgumentException if invalid parameters are present
67      */
68     void destroy(String topic);
69
70     /**
71      * Destroys all UEB Topic Writers.
72      */
73     void destroy();
74
75     /**
76      * gets an UEB Topic Writer based on topic name.
77      * 
78      * @param topic the topic name
79      * 
80      * @return an UEB Topic Writer with topic name
81      * @throws IllegalArgumentException if an invalid topic is provided
82      * @throws IllegalStateException if the UEB Topic Reader is an incorrect state
83      */
84     UebTopicSink get(String topic);
85
86     /**
87      * Provides a snapshot of the UEB Topic Writers.
88      * 
89      * @return a list of the UEB Topic Writers
90      */
91     List<UebTopicSink> inventory();
92 }