summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/com/att/dmf/mr/CambriaApiException.java10
-rw-r--r--src/main/java/com/att/dmf/mr/backends/Consumer.java1
-rw-r--r--src/main/java/com/att/dmf/mr/backends/memory/MemoryConsumerFactory.java18
-rw-r--r--src/main/java/com/att/dmf/mr/listener/CambriaServletContextListener.java2
-rw-r--r--src/main/java/com/att/dmf/mr/security/impl/DMaaPOriginalUebAuthenticator.java58
-rw-r--r--src/main/java/com/att/dmf/mr/service/impl/EventsServiceImpl.java14
-rw-r--r--src/main/java/com/att/dmf/mr/service/impl/MetricsServiceImpl.java2
-rw-r--r--src/main/java/com/att/dmf/mr/utils/DMaaPResponseBuilder.java8
8 files changed, 57 insertions, 56 deletions
diff --git a/src/main/java/com/att/dmf/mr/CambriaApiException.java b/src/main/java/com/att/dmf/mr/CambriaApiException.java
index 84dd32c..cdf95ab 100644
--- a/src/main/java/com/att/dmf/mr/CambriaApiException.java
+++ b/src/main/java/com/att/dmf/mr/CambriaApiException.java
@@ -28,8 +28,12 @@ import com.att.nsa.apiServer.NsaAppException;
public class CambriaApiException extends NsaAppException
{
+ /*
+ * defined long type constant serialVersionUID
+ */
+ private static final long serialVersionUID = 1L;
- private ErrorResponse errRes;
+ private transient ErrorResponse errRes;
/**
* Implements constructor CambriaApiException
* @param jsonObject
@@ -66,10 +70,6 @@ public class CambriaApiException extends NsaAppException
this.errRes = errRes;
}
- /*
- * defined long type constant serialVersionUID
- */
- private static final long serialVersionUID = 1L;
public ErrorResponse getErrRes() {
return errRes;
}
diff --git a/src/main/java/com/att/dmf/mr/backends/Consumer.java b/src/main/java/com/att/dmf/mr/backends/Consumer.java
index 2743fc3..f4a9a80 100644
--- a/src/main/java/com/att/dmf/mr/backends/Consumer.java
+++ b/src/main/java/com/att/dmf/mr/backends/Consumer.java
@@ -21,7 +21,6 @@
*******************************************************************************/
package com.att.dmf.mr.backends;
-import java.util.ArrayList;
/**
* A consumer interface. Consumers pull the next message from a given topic.
diff --git a/src/main/java/com/att/dmf/mr/backends/memory/MemoryConsumerFactory.java b/src/main/java/com/att/dmf/mr/backends/memory/MemoryConsumerFactory.java
index 0c34bfd..237cac8 100644
--- a/src/main/java/com/att/dmf/mr/backends/memory/MemoryConsumerFactory.java
+++ b/src/main/java/com/att/dmf/mr/backends/memory/MemoryConsumerFactory.java
@@ -35,6 +35,9 @@ import com.att.dmf.mr.backends.ConsumerFactory;
*/
public class MemoryConsumerFactory implements ConsumerFactory
{
+
+ private final MemoryQueue fQueue;
+
/**
*
* Initializing constructor
@@ -59,8 +62,6 @@ public class MemoryConsumerFactory implements ConsumerFactory
return new MemoryConsumer ( topic, consumerGroupId );
}
- private final MemoryQueue fQueue;
-
/**
*
* Define nested inner class
@@ -68,6 +69,12 @@ public class MemoryConsumerFactory implements ConsumerFactory
*/
private class MemoryConsumer implements Consumer
{
+
+ private final String fTopic;
+ private final String fConsumer;
+ private final long fCreateMs;
+ private long fLastAccessMs;
+
/**
*
* Initializing MemoryConsumer constructor
@@ -93,11 +100,6 @@ public class MemoryConsumerFactory implements ConsumerFactory
return fQueue.get ( fTopic, fConsumer );
}
- private final String fTopic;
- private final String fConsumer;
- private final long fCreateMs;
- private long fLastAccessMs;
-
@Override
public boolean close() {
//Nothing to close/clean up.
@@ -168,7 +170,7 @@ public class MemoryConsumerFactory implements ConsumerFactory
*/
public Collection<? extends Consumer> getConsumers ()
{
- return new ArrayList<MemoryConsumer> ();
+ return new ArrayList<> ();
}
@Override
diff --git a/src/main/java/com/att/dmf/mr/listener/CambriaServletContextListener.java b/src/main/java/com/att/dmf/mr/listener/CambriaServletContextListener.java
index 6022b91..64b20e8 100644
--- a/src/main/java/com/att/dmf/mr/listener/CambriaServletContextListener.java
+++ b/src/main/java/com/att/dmf/mr/listener/CambriaServletContextListener.java
@@ -35,7 +35,7 @@ import com.att.eelf.configuration.EELFManager;
public class CambriaServletContextListener implements ServletContextListener {
DME2EndPointLoader loader = DME2EndPointLoader.getInstance();
-// private static Logger log = Logger.getLogger(CambriaServletContextListener.class);
+
private static final EELFLogger log = EELFManager.getInstance().getLogger(CambriaServletContextListener.class);
diff --git a/src/main/java/com/att/dmf/mr/security/impl/DMaaPOriginalUebAuthenticator.java b/src/main/java/com/att/dmf/mr/security/impl/DMaaPOriginalUebAuthenticator.java
index a26c9e7..b1e28e7 100644
--- a/src/main/java/com/att/dmf/mr/security/impl/DMaaPOriginalUebAuthenticator.java
+++ b/src/main/java/com/att/dmf/mr/security/impl/DMaaPOriginalUebAuthenticator.java
@@ -54,9 +54,9 @@ public class DMaaPOriginalUebAuthenticator<K extends NsaApiKey> implements DMaaP
public DMaaPOriginalUebAuthenticator(NsaApiDb<K> db, long requestTimeWindowMs) {
fDb = db;
fRequestTimeWindowMs = requestTimeWindowMs;
- //fAuthenticators = new LinkedList<DMaaPAuthenticator<K>>();
+
- //fAuthenticators.add(new DMaaPOriginalUebAuthenticator<K>(db, requestTimeWindowMs));
+
}
@@ -243,51 +243,51 @@ public class DMaaPOriginalUebAuthenticator<K extends NsaApiKey> implements DMaaP
"EEEE, dd-MMM-yy HH:mm:ss zzz",
};
- /*private static final String kDateFormats[] = {
- // W3C date format (RFC 3339).
- "yyyy-MM-dd'T'HH:mm:ssz",
+
+
+
- // Preferred HTTP date format (RFC 1123).
- "EEE, dd MMM yyyy HH:mm:ss zzz",
+
+
- // simple unix command line 'date' format
- "EEE MMM dd HH:mm:ss z yyyy",
+
+
- // Common date format (RFC 822).
- "EEE, dd MMM yy HH:mm:ss z", "EEE, dd MMM yy HH:mm z", "dd MMM yy HH:mm:ss z", "dd MMM yy HH:mm z",
+
+
- // Obsoleted HTTP date format (ANSI C asctime() format).
- "EEE MMM dd HH:mm:ss yyyy",
+
+
- // Obsoleted HTTP date format (RFC 1036).
- "EEEE, dd-MMM-yy HH:mm:ss zzz", }; */
+
+
// logger declaration
- //private static final Logger log = Logger.getLogger(DMaaPOriginalUebAuthenticator.class.toString());
+
private static final EELFLogger log = EELFManager.getInstance().getLogger(DMaaPOriginalUebAuthenticator.class);
@Override
-// public K authenticate(DMaaPContext ctx) {
+
// TODO Auto-generated method stub
- //return null;
+
//}
public K authenticate(DMaaPContext ctx) {
- /*final HttpServletRequest req = ctx.getRequest();
- for (DMaaPAuthenticator<K> a : fAuthenticators) {
- if (a.qualify(req)) {
- final K k = a.isAuthentic(req);
- if (k != null)
- return k;
- }
- // else: this request doesn't look right to the authenticator
- }*/
+
+
+
+
+
+
+
+
+
return null;
}
public void addAuthenticator ( DMaaPAuthenticator<K> a )
{
- //this.fAuthenticators.add(a);
+
}
- //private final LinkedList<DMaaPAuthenticator<K>> fAuthenticators;
+
} \ No newline at end of file
diff --git a/src/main/java/com/att/dmf/mr/service/impl/EventsServiceImpl.java b/src/main/java/com/att/dmf/mr/service/impl/EventsServiceImpl.java
index e9671ce..22b60fe 100644
--- a/src/main/java/com/att/dmf/mr/service/impl/EventsServiceImpl.java
+++ b/src/main/java/com/att/dmf/mr/service/impl/EventsServiceImpl.java
@@ -94,7 +94,7 @@ import com.att.nsa.util.rrConvertor;
@Service
public class EventsServiceImpl implements EventsService {
// private static final Logger LOG =
- // Logger.getLogger(EventsServiceImpl.class);
+
private static final EELFLogger LOG = EELFManager.getInstance().getLogger(EventsServiceImpl.class);
private static final String BATCH_LENGTH = "event.batch.length";
@@ -103,10 +103,10 @@ public class EventsServiceImpl implements EventsService {
private DMaaPErrorMessages errorMessages;
//@Autowired
- //KafkaLiveLockAvoider2 kafkaLiveLockAvoider;
+
// @Value("${metrics.send.cambria.topic}")
- // private String metricsTopic;
+
public DMaaPErrorMessages getErrorMessages() {
return errorMessages;
@@ -133,7 +133,7 @@ public class EventsServiceImpl implements EventsService {
CambriaApiException, IOException, DMaaPAccessDeniedException {
final long startTime = System.currentTimeMillis();
final HttpServletRequest req = ctx.getRequest();
- //System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"+kafkaLiveLockAvoider);
+
boolean isAAFTopic = false;
// was this host blacklisted?
final String remoteAddr = Utils.getRemoteAddress(ctx);
@@ -158,7 +158,7 @@ public class EventsServiceImpl implements EventsService {
if (strtimeoutMS != null)
timeoutMs = Integer.parseInt(strtimeoutMS);
// int timeoutMs = ctx.getConfigReader().getSettings().getInt("timeout",
- // CambriaConstants.kNoTimeout);
+
if (req.getParameter("timeout") != null) {
timeoutMs = Integer.parseInt(req.getParameter("timeout"));
}
@@ -214,7 +214,7 @@ public class EventsServiceImpl implements EventsService {
// if headers are not provided then user will be null
if (user == null && null != ctx.getRequest().getHeader("Authorization")) {
// the topic name will be sent by the client
- // String permission = "com.att.dmaap.mr.topic"+"|"+topic+"|"+"sub";
+
DMaaPAAFAuthenticator aaf = new DMaaPAAFAuthenticatorImpl();
String permission = aaf.aafPermissionString(topic, "sub");
if (!aaf.aafAuthentication(ctx.getRequest(), permission)) {
@@ -234,7 +234,7 @@ public class EventsServiceImpl implements EventsService {
logger.info("Time taken in getEvents Authorization " + elapsedMs1 + " ms for " + topic + " " + consumerGroup
+ " " + clientId);
Consumer c = null;
- // String localclientId = clientId;
+
String lhostId = com.att.ajsc.filemonitor.AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop,
"clusterhostid");
if (null == lhostId) {
diff --git a/src/main/java/com/att/dmf/mr/service/impl/MetricsServiceImpl.java b/src/main/java/com/att/dmf/mr/service/impl/MetricsServiceImpl.java
index 83b3770..d867ea8 100644
--- a/src/main/java/com/att/dmf/mr/service/impl/MetricsServiceImpl.java
+++ b/src/main/java/com/att/dmf/mr/service/impl/MetricsServiceImpl.java
@@ -49,7 +49,7 @@ import com.att.nsa.metrics.CdmMeasuredItem;
@Component
public class MetricsServiceImpl implements MetricsService {
- //private static final Logger LOG = Logger.getLogger(MetricsService.class.toString());
+
private static final EELFLogger LOG = EELFManager.getInstance().getLogger(MetricsService.class);
/**
*
diff --git a/src/main/java/com/att/dmf/mr/utils/DMaaPResponseBuilder.java b/src/main/java/com/att/dmf/mr/utils/DMaaPResponseBuilder.java
index ddd834c..214aac8 100644
--- a/src/main/java/com/att/dmf/mr/utils/DMaaPResponseBuilder.java
+++ b/src/main/java/com/att/dmf/mr/utils/DMaaPResponseBuilder.java
@@ -130,10 +130,10 @@ public class DMaaPResponseBuilder {
*/
public static void respondOkWithStream(DMaaPContext ctx, String mediaType, StreamWriter writer) throws IOException {
ctx.getResponse().setStatus(200);
- OutputStream os = getStreamForBinaryResponse(ctx, mediaType);
- writer.write(os);
- os.close();
-
+ try(OutputStream os = getStreamForBinaryResponse(ctx, mediaType)) {
+ writer.write(os);
+ }
+
}