summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorArundathi Patil <arundpil@in.ibm.com>2018-09-07 22:49:33 +0530
committerIBM602-PC0F1E3C\Arundathi <arundpil@in.ibm.com>2018-09-07 22:49:47 +0530
commitc3f7f7b9d33477187157847aa7f159c178c2e70b (patch)
treee259f6c369cf06d94190f0cf92a86e211f3f7488 /src
parent12635b7ef13b0a1b4954ace5f6df5ee3a742f555 (diff)
MemoryMetaBroker.java: Fixed sonar issues
Sonar Link : https://sonar.onap.org/project/issues?id=org.onap.dmaap.messagerouter.msgrtr%3Amsgrtr&open=AV4-Vabv32hFUzlqc5oG&resolved=false&types=CODE_SMELL Issue-ID: DMAAP-752 Change-Id: I54df6fc0fc73252bba1e3a2a453138d79e23adff Signed-off-by: Arundathi Patil <arundpil@in.ibm.com>
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/att/dmf/mr/backends/memory/MemoryMetaBroker.java31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/main/java/com/att/dmf/mr/backends/memory/MemoryMetaBroker.java b/src/main/java/com/att/dmf/mr/backends/memory/MemoryMetaBroker.java
index 8c841d4..e0c80bd 100644
--- a/src/main/java/com/att/dmf/mr/backends/memory/MemoryMetaBroker.java
+++ b/src/main/java/com/att/dmf/mr/backends/memory/MemoryMetaBroker.java
@@ -39,6 +39,10 @@ import com.att.nsa.security.NsaApiKey;
*
*/
public class MemoryMetaBroker implements Broker {
+
+ private final MemoryQueue fQueue;
+ private final HashMap<String, MemTopic> fTopics;
+
/**
*
* @param mq
@@ -78,10 +82,16 @@ public class MemoryMetaBroker implements Broker {
fQueue.removeTopic(topic);
}
- private final MemoryQueue fQueue;
- private final HashMap<String, MemTopic> fTopics;
-
private static class MemTopic implements Topic {
+
+ private final String fName;
+ private final String fDesc;
+ private final String fOwner;
+ private NsaAcl fReaders;
+ private NsaAcl fWriters;
+ private boolean ftransactionEnabled;
+ private String accessDenied = "User does not own this topic ";
+
/**
* constructor initialization
*
@@ -141,7 +151,7 @@ public class MemoryMetaBroker implements Broker {
@Override
public void permitWritesFromUser(String publisherId, NsaApiKey asUser) throws AccessDeniedException {
if (!fOwner.equals(asUser.getKey())) {
- throw new AccessDeniedException("User does not own this topic " + fName);
+ throw new AccessDeniedException(accessDenied + fName);
}
if (fWriters == null) {
fWriters = new NsaAcl();
@@ -152,7 +162,7 @@ public class MemoryMetaBroker implements Broker {
@Override
public void denyWritesFromUser(String publisherId, NsaApiKey asUser) throws AccessDeniedException {
if (!fOwner.equals(asUser.getKey())) {
- throw new AccessDeniedException("User does not own this topic " + fName);
+ throw new AccessDeniedException(accessDenied + fName);
}
fWriters.remove(publisherId);
}
@@ -160,7 +170,7 @@ public class MemoryMetaBroker implements Broker {
@Override
public void permitReadsByUser(String consumerId, NsaApiKey asUser) throws AccessDeniedException {
if (!fOwner.equals(asUser.getKey())) {
- throw new AccessDeniedException("User does not own this topic " + fName);
+ throw new AccessDeniedException(accessDenied + fName);
}
if (fReaders == null) {
fReaders = new NsaAcl();
@@ -171,18 +181,11 @@ public class MemoryMetaBroker implements Broker {
@Override
public void denyReadsByUser(String consumerId, NsaApiKey asUser) throws AccessDeniedException {
if (!fOwner.equals(asUser.getKey())) {
- throw new AccessDeniedException("User does not own this topic " + fName);
+ throw new AccessDeniedException(accessDenied + fName);
}
fReaders.remove(consumerId);
}
- private final String fName;
- private final String fDesc;
- private final String fOwner;
- private NsaAcl fReaders;
- private NsaAcl fWriters;
- private boolean ftransactionEnabled;
-
@Override
public boolean isTransactionEnabled() {
return ftransactionEnabled;