update the package name
[dmaap/messagerouter/msgrtr.git] / src / main / java / org / onap / dmaap / dmf / mr / metabroker / Broker1.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.dmf.mr.metabroker;
23
24 import java.util.List;
25
26 import org.onap.dmaap.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  * alternate for Broker1 to avoid this error  in spring boot
33  *org.springframework.beans.factory.NoUniqueBeanDefinitionException:
34  * No qualifying bean of type [com.att.dmf.mr.metabroker.Broker] is defined: 
35  * expected single matching bean but found 2: mmb,dMaaPKafkaMetaBroker
36
37  *
38  */
39 public interface Broker1 {
40         /**
41          * 
42          * @author Ramkumar
43          *
44          */
45         public class TopicExistsException extends Exception {
46                 /**
47                  * 
48                  * @param topicName
49                  */
50                 public TopicExistsException(String topicName) {
51                         super("Topic " + topicName + " exists.");
52                 }
53
54                 private static final long serialVersionUID = 1L;
55         }
56
57         /**
58          * Get all topics in the underlying broker.
59          * 
60          * @return
61          * @throws ConfigDbException
62          */
63         List<Topic> getAllTopics() throws ConfigDbException;
64
65         /**
66          * Get a specific topic from the underlying broker.
67          * 
68          * @param topic
69          * @return a topic, or null
70          */
71         Topic getTopic(String topic) throws ConfigDbException;
72
73         /**
74          * create a  topic
75          * 
76          * @param topic
77          * @param description
78          * @param ownerApiKey
79          * @param partitions
80          * @param replicas
81          * @param transactionEnabled
82          * @return
83          * @throws TopicExistsException
84          * @throws CambriaApiException
85          */
86         Topic createTopic(String topic, String description, String ownerApiKey, int partitions, int replicas,
87                         boolean transactionEnabled) throws TopicExistsException, CambriaApiException,ConfigDbException;
88
89         /**
90          * Delete a topic by name
91          * 
92          * @param topic
93          */
94         void deleteTopic(String topic) throws AccessDeniedException, CambriaApiException, TopicExistsException,ConfigDbException;
95 }