9634cc28198f7c436592a7766bb7cbcca667fadd
[dmaap/messagerouter/msgrtr.git] / src / main / java / org / onap / dmaap / messagerouter / msgrtr / nsa / cambria / metabroker / Broker.java
1 /*******************************************************************************
2  *  ============LICENSE_START=======================================================
3  *  org.onap.dmaap
4  *  ================================================================================
5  *  Copyright © 2017 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  *        http://www.apache.org/licenses/LICENSE-2.0
11  *  
12  *  Unless required by applicable law or agreed to in writing, software
13  *  distributed under the License is distributed on an "AS IS" BASIS,
14  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  *  See the License for the specific language governing permissions and
16  *  limitations under the License.
17  *  ============LICENSE_END=========================================================
18  *
19  *  ECOMP is a trademark and service mark of AT&T Intellectual Property.
20  *  
21  *******************************************************************************/
22 package org.onap.dmaap.messagerouter.msgrtr.nsa.cambria.metabroker;
23
24 import java.util.List;
25
26 import org.onap.dmaap.messagerouter.msgrtr.nsa.cambria.CambriaApiException;
27
28 import com.att.nsa.configs.ConfigDbException;
29 import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
30
31 /**
32  * A broker interface to manage metadata around topics, etc.
33  * 
34  * @author author
35  *
36  */
37 public interface Broker {
38         /**
39          * 
40          * @author author
41          *
42          */
43         public class TopicExistsException extends Exception {
44                 /**
45                  * 
46                  * @param topicName
47                  */
48                 public TopicExistsException(String topicName) {
49                         super("Topic " + topicName + " exists.");
50                 }
51
52                 private static final long serialVersionUID = 1L;
53         }
54
55         /**
56          * Get all topics in the underlying broker.
57          * 
58          * @return
59          * @throws ConfigDbException
60          */
61         List<Topic> getAllTopics() throws ConfigDbException;
62
63         /**
64          * Get a specific topic from the underlying broker.
65          * 
66          * @param topic
67          * @return a topic, or null
68          */
69         Topic getTopic(String topic) throws ConfigDbException;
70
71         /**
72          * create a  topic
73          * 
74          * @param topic
75          * @param description
76          * @param ownerApiKey
77          * @param partitions
78          * @param replicas
79          * @param transactionEnabled
80          * @return
81          * @throws TopicExistsException
82          * @throws CambriaApiException
83          */
84         Topic createTopic(String topic, String description, String ownerApiKey, int partitions, int replicas,
85                         boolean transactionEnabled) throws TopicExistsException, CambriaApiException;
86
87         /**
88          * Delete a topic by name
89          * 
90          * @param topic
91          */
92         void deleteTopic(String topic) throws AccessDeniedException, CambriaApiException, TopicExistsException;
93 }