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;
29 * This is the interface for topic and all the topic related operations
30 * get topic name, owner, description, transactionEnabled etc.
31 * @author nilanjana.maity
34 public interface Topic extends ReadWriteSecuredResource
37 * User defined exception for access denied while access the topic for Publisher and consumer
38 * @author nilanjana.maity
41 public class AccessDeniedException extends Exception
44 * AccessDenied Description
48 * AccessDenied Exception for the user while authenticating the user request
52 private static final long serialVersionUID = 1L;
56 * Get this topic's name
62 * Get the API key of the owner of this topic.
68 * Get a description of the topic, as set by the owner at creation time.
71 String getDescription ();
74 * If the topic is transaction enabled
75 * @return boolean true/false
77 boolean isTransactionEnabled();
80 * Get the ACL for reading on this topic. Can be null.
83 NsaAcl getReaderAcl ();
86 * Get the ACL for writing on this topic. Can be null.
89 NsaAcl getWriterAcl ();
92 * Check if this user can read the topic. Throw otherwise. Note that
96 void checkUserRead ( NsaApiKey user ) throws AccessDeniedException;
99 * Check if this user can write to the topic. Throw otherwise. Note
100 * that user may be null.
103 void checkUserWrite ( NsaApiKey user ) throws AccessDeniedException;
106 * allow the given user to publish
110 void permitWritesFromUser ( String publisherId, NsaApiKey asUser ) throws AccessDeniedException, ConfigDbException;
113 * deny the given user from publishing
117 void denyWritesFromUser ( String publisherId, NsaApiKey asUser ) throws AccessDeniedException, ConfigDbException;
120 * allow the given user to read the topic
124 void permitReadsByUser ( String consumerId, NsaApiKey asUser ) throws AccessDeniedException, ConfigDbException;
127 * deny the given user from reading the topic
130 * @throws ConfigDbException
132 void denyReadsByUser ( String consumerId, NsaApiKey asUser ) throws AccessDeniedException, ConfigDbException;