e5fe8da3fea697e80e7a8fa63a0af2a5902d0c03
[dmaap/messagerouter/msgrtr.git] / src / main / java / com / att / dmf / mr / 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 com.att.dmf.mr.metabroker;
23
24 import java.util.List;
25
26 import com.att.dmf.mr.CambriaApiException;
27 import com.att.nsa.configs.ConfigDbException;
28 import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
29
30 /**
31  * A broker interface to manage metadata around topics, etc.
32  * 
33  * @author peter
34  *
35  */
36 public interface Broker {
37         /**
38          * 
39          * @author anowarul.islam
40          *
41          */
42         public class TopicExistsException extends Exception {
43                 /**
44                  * 
45                  * @param topicName
46                  */
47                 public TopicExistsException(String topicName) {
48                         super("Topic " + topicName + " exists.");
49                 }
50
51                 private static final long serialVersionUID = 1L;
52         }
53
54         /**
55          * Get all topics in the underlying broker.
56          * 
57          * @return
58          * @throws ConfigDbException
59          */
60         List<Topic> getAllTopics() throws ConfigDbException;
61
62         /**
63          * Get a specific topic from the underlying broker.
64          * 
65          * @param topic
66          * @return a topic, or null
67          */
68         Topic getTopic(String topic) throws ConfigDbException;
69
70         /**
71          * create a  topic
72          * 
73          * @param topic
74          * @param description
75          * @param ownerApiKey
76          * @param partitions
77          * @param replicas
78          * @param transactionEnabled
79          * @return
80          * @throws TopicExistsException
81          * @throws CambriaApiException
82          */
83         Topic createTopic(String topic, String description, String ownerApiKey, int partitions, int replicas,
84                         boolean transactionEnabled) throws TopicExistsException, CambriaApiException,ConfigDbException;
85
86         /**
87          * Delete a topic by name
88          * 
89          * @param topic
90          */
91         void deleteTopic(String topic) throws AccessDeniedException, CambriaApiException, TopicExistsException,ConfigDbException;
92 }