1 /*******************************************************************************
2 * ============LICENSE_START=======================================================
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
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=========================================================
19 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
21 *******************************************************************************/
22 package org.onap.dmaap.dmf.mr.metabroker;
24 import com.att.nsa.configs.ConfigDbException;
25 import com.att.nsa.security.NsaAcl;
26 import com.att.nsa.security.NsaApiKey;
27 import com.att.nsa.security.ReadWriteSecuredResource;
30 * This is the interface for topic and all the topic related operations
31 * get topic name, owner, description, transactionEnabled etc.
32 * @author nilanjana.maity
35 public interface Topic extends ReadWriteSecuredResource
38 * User defined exception for access denied while access the topic for Publisher and consumer
39 * @author nilanjana.maity
42 public class AccessDeniedException extends Exception
45 * AccessDenied Description
49 * AccessDenied Exception for the user while authenticating the user request
53 private static final long serialVersionUID = 1L;
57 * Get this topic's name
63 * Get the API key of the owner of this topic.
69 * Get a description of the topic, as set by the owner at creation time.
72 String getDescription ();
75 * If the topic is transaction enabled
76 * @return boolean true/false
78 boolean isTransactionEnabled();
81 * Get the ACL for reading on this topic. Can be null.
84 NsaAcl getReaderAcl ();
87 * Get the ACL for writing on this topic. Can be null.
90 NsaAcl getWriterAcl ();
93 * Check if this user can read the topic. Throw otherwise. Note that
97 void checkUserRead ( NsaApiKey user ) throws AccessDeniedException;
100 * Check if this user can write to the topic. Throw otherwise. Note
101 * that user may be null.
104 void checkUserWrite ( NsaApiKey user ) throws AccessDeniedException;
107 * allow the given user to publish
111 void permitWritesFromUser ( String publisherId, NsaApiKey asUser ) throws AccessDeniedException, ConfigDbException;
114 * deny the given user from publishing
118 void denyWritesFromUser ( String publisherId, NsaApiKey asUser ) throws AccessDeniedException, ConfigDbException;
121 * allow the given user to read the topic
125 void permitReadsByUser ( String consumerId, NsaApiKey asUser ) throws AccessDeniedException, ConfigDbException;
128 * deny the given user from reading the topic
131 * @throws ConfigDbException
133 void denyReadsByUser ( String consumerId, NsaApiKey asUser ) throws AccessDeniedException, ConfigDbException;