summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/att/dmf/mr/service/impl
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/att/dmf/mr/service/impl')
-rw-r--r--src/main/java/com/att/dmf/mr/service/impl/AdminServiceImpl.java2
-rw-r--r--src/main/java/com/att/dmf/mr/service/impl/ApiKeysServiceImpl.java10
-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/service/impl/TopicServiceImpl.java123
-rw-r--r--src/main/java/com/att/dmf/mr/service/impl/TransactionServiceImpl.java4
-rw-r--r--src/main/java/com/att/dmf/mr/service/impl/UIServiceImpl.java4
7 files changed, 78 insertions, 81 deletions
diff --git a/src/main/java/com/att/dmf/mr/service/impl/AdminServiceImpl.java b/src/main/java/com/att/dmf/mr/service/impl/AdminServiceImpl.java
index 110970f..f7c48de 100644
--- a/src/main/java/com/att/dmf/mr/service/impl/AdminServiceImpl.java
+++ b/src/main/java/com/att/dmf/mr/service/impl/AdminServiceImpl.java
@@ -42,7 +42,7 @@ import com.att.nsa.configs.ConfigDbException;
import com.att.nsa.limits.Blacklist;
import com.att.nsa.security.NsaApiKey;
import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
-//import com.att.sa.highlandPark.util.HpJsonUtil;
+
/**
* @author muzainulhaque.qazi
diff --git a/src/main/java/com/att/dmf/mr/service/impl/ApiKeysServiceImpl.java b/src/main/java/com/att/dmf/mr/service/impl/ApiKeysServiceImpl.java
index c818f88..b0e8a86 100644
--- a/src/main/java/com/att/dmf/mr/service/impl/ApiKeysServiceImpl.java
+++ b/src/main/java/com/att/dmf/mr/service/impl/ApiKeysServiceImpl.java
@@ -54,7 +54,7 @@ import com.att.nsa.security.db.simple.NsaSimpleApiKey;
@Service
public class ApiKeysServiceImpl implements ApiKeysService {
- //private Logger log = Logger.getLogger(ApiKeysServiceImpl.class.toString());
+
private static final EELFLogger log = EELFManager.getInstance().getLogger(ApiKeysServiceImpl.class.toString());
/**
* This method will provide all the ApiKeys present in kafka server.
@@ -139,7 +139,7 @@ public class ApiKeysServiceImpl implements ApiKeysService {
String kSetting_AllowAnonymousKeys= com.att.ajsc.filemonitor.AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop,"apiKeys.allowAnonymous");
if(null==kSetting_AllowAnonymousKeys) kSetting_AllowAnonymousKeys ="false";
- // if ((contactEmail == null) || (contactEmail.length() == 0))
+
if ( kSetting_AllowAnonymousKeys.equalsIgnoreCase("true") && !emailProvided )
{
DMaaPResponseBuilder.respondWithErrorInJson(dmaapContext, 400, "You must provide an email address.");
@@ -165,7 +165,7 @@ public class ApiKeysServiceImpl implements ApiKeysService {
log.debug("=======ApiKeysServiceImpl: createApiKey : saving api key : "
+ key.toString() + "=====");
apiKeyDb.saveApiKey(key);
- // System.out.println("here4");
+
// email out the secret to validate the email address
if ( emailProvided )
{
@@ -196,9 +196,7 @@ public class ApiKeysServiceImpl implements ApiKeysService {
);
DMaaPResponseBuilder.respondOk(dmaapContext,
o);
- /*o.put("secret", "Emailed to " + contactEmail + ".");
- DMaaPResponseBuilder.respondOk(dmaapContext,
- o); */
+
return;
} else {
log.debug("=======ApiKeysServiceImpl: createApiKey : Error in creating API Key.=====");
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/service/impl/TopicServiceImpl.java b/src/main/java/com/att/dmf/mr/service/impl/TopicServiceImpl.java
index 9918024..7e9d783 100644
--- a/src/main/java/com/att/dmf/mr/service/impl/TopicServiceImpl.java
+++ b/src/main/java/com/att/dmf/mr/service/impl/TopicServiceImpl.java
@@ -45,7 +45,7 @@ import com.att.dmf.mr.exception.DMaaPResponseCode;
import com.att.dmf.mr.exception.ErrorResponse;
import com.att.dmf.mr.metabroker.Broker.TopicExistsException;
import com.att.dmf.mr.metabroker.Broker1;
-//import com.att.dmf.mr.metabroker.Broker1;
+
import com.att.dmf.mr.metabroker.Topic;
import com.att.dmf.mr.security.DMaaPAAFAuthenticator;
import com.att.dmf.mr.security.DMaaPAAFAuthenticatorImpl;
@@ -67,13 +67,13 @@ import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
public class TopicServiceImpl implements TopicService {
// private static final Logger LOGGER =
- // Logger.getLogger(TopicServiceImpl.class);
+
private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(TopicServiceImpl.class);
@Autowired
private DMaaPErrorMessages errorMessages;
// @Value("${msgRtr.topicfactory.aaf}")
- // private String mrFactory;
+
public DMaaPErrorMessages getErrorMessages() {
return errorMessages;
@@ -125,7 +125,7 @@ public class TopicServiceImpl implements TopicService {
for (Topic topic : getMetaBroker(dmaapContext).getAllTopics()) {
JSONObject obj = new JSONObject();
obj.put("topicName", topic.getName());
- // obj.put("description", topic.getDescription());
+
obj.put("owner", topic.getOwner());
obj.put("txenabled", topic.isTransactionEnabled());
topicsList.put(obj);
@@ -193,7 +193,7 @@ public class TopicServiceImpl implements TopicService {
final NsaApiKey user = DMaaPAuthenticatorImpl.getAuthenticatedUser(dmaapContext);
String key = null;
- //String appName = dmaapContext.getRequest().getHeader("AppName");
+
String enfTopicName = com.att.ajsc.beans.PropertiesMapBean.getProperty(CambriaConstants.msgRtr_prop,
"enforced.topic.name.AAF");
@@ -209,55 +209,55 @@ public class TopicServiceImpl implements TopicService {
"Failed to create topic: Access Denied.User does not have permission to perform create topic");
LOGGER.info(errRes.toString());
- // throw new DMaaPAccessDeniedException(errRes);
+
}
}
- // else if (user==null &&
+
// (null==dmaapContext.getRequest().getHeader("Authorization") && null
- // == dmaapContext.getRequest().getHeader("cookie")) ) {
- /*else if (user == null && null == dmaapContext.getRequest().getHeader("Authorization")
- ) {
- LOGGER.error("Failed to create topic" + topicBean.getTopicName() + ", Authentication failed.");
+
+
+
+
- ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_UNAUTHORIZED,
- DMaaPResponseCode.ACCESS_NOT_PERMITTED.getResponseCode(),
- "Failed to create topic: Access Denied.User does not have permission to perform create topic");
+
+
+
- LOGGER.info(errRes.toString());
- // throw new DMaaPAccessDeniedException(errRes);
- }*/
+
+
+
if (user == null /*&& (null != dmaapContext.getRequest().getHeader("Authorization")
)*/) {
- // if (user == null &&
+
// (null!=dmaapContext.getRequest().getHeader("Authorization") ||
- // null != dmaapContext.getRequest().getHeader("cookie"))) {
+
// ACL authentication is not provided so we will use the aaf
// authentication
- /*LOGGER.info("Authorization the topic");
+
- String permission = "";
- String nameSpace = "";
- if (topicBean.getTopicName().indexOf(".") > 1)
- nameSpace = topicBean.getTopicName().substring(0, topicBean.getTopicName().lastIndexOf("."));
+
+
+
+
- String mrFactoryVal = AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop,
- "msgRtr.topicfactory.aaf");
+
+
- // AJSCPropertiesMap.getProperty(CambriaConstants.msgRtr_prop,kSettings_KafkaZookeeper);
+
- permission = mrFactoryVal + nameSpace + "|create";
- DMaaPAAFAuthenticator aaf = new DMaaPAAFAuthenticatorImpl();*/
+
+
- //if (!aaf.aafAuthentication(dmaapContext.getRequest(), permission)) {
+
if (false) {
LOGGER.error("Failed to create topic" + topicBean.getTopicName() + ", Authentication failed.");
ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_UNAUTHORIZED,
DMaaPResponseCode.ACCESS_NOT_PERMITTED.getResponseCode(),
"Failed to create topic: Access Denied.User does not have permission to create topic with perm "
- //+ permission);
+
+ "permission");
@@ -267,13 +267,13 @@ public class TopicServiceImpl implements TopicService {
} else {
// if user is null and aaf authentication is ok then key should
// be ""
- // key = "";
+
/**
* Added as part of AAF user it should return username
*/
- //key = dmaapContext.getRequest().getUserPrincipal().getName().toString();
- //key="admin";
+
+
//LOGGER.info("key ==================== " + key);
}
@@ -283,7 +283,7 @@ public class TopicServiceImpl implements TopicService {
final String topicName = topicBean.getTopicName();
final String desc = topicBean.getTopicDescription();
int partition = topicBean.getPartitionCount();
- // int replica = topicBean.getReplicationCount();
+
if (partition == 0) {
partition = 8;
}
@@ -291,7 +291,7 @@ public class TopicServiceImpl implements TopicService {
int replica = topicBean.getReplicationCount();
if (replica == 0) {
- //replica = 3;
+
replica = 1;
}
final int replicas = replica;
@@ -503,25 +503,25 @@ public class TopicServiceImpl implements TopicService {
LOGGER.info("Granting write access to producer [" + producerId + "] for topic " + topicName);
final NsaApiKey user = DMaaPAuthenticatorImpl.getAuthenticatedUser(dmaapContext);
- // if (user == null) {
+
//
// LOGGER.info("Authenticating the user, as ACL authentication is not
- // provided");
+
//// String permission =
- // "com.att.dmaap.mr.topic"+"|"+topicName+"|"+"manage";
+
//
- // DMaaPAAFAuthenticator aaf = new DMaaPAAFAuthenticatorImpl();
- // String permission = aaf.aafPermissionString(topicName, "manage");
+
+
// if(!aaf.aafAuthentication(dmaapContext.getRequest(), permission))
// {
// LOGGER.error("Failed to permit write access to producer [" +
// producerId + "] for topic " + topicName
- // + ". Authentication failed.");
+
// ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_FORBIDDEN,
// DMaaPResponseCode.ACCESS_NOT_PERMITTED.getResponseCode(),
// errorMessages.getNotPermitted1()+" <Grant publish permissions>
- // "+errorMessages.getNotPermitted2()+ topicName);
- // LOGGER.info(errRes);
+
+
// throw new DMaaPAccessDeniedException(errRes);
// }
// }
@@ -561,25 +561,25 @@ public class TopicServiceImpl implements TopicService {
LOGGER.info("Revoking write access to producer [" + producerId + "] for topic " + topicName);
final NsaApiKey user = DMaaPAuthenticatorImpl.getAuthenticatedUser(dmaapContext);
- // if (user == null) {
+
//
//// String permission =
- // "com.att.dmaap.mr.topic"+"|"+topicName+"|"+"manage";
+
// DMaaPAAFAuthenticator aaf = new DMaaPAAFAuthenticatorImpl();
// String permission = aaf.aafPermissionString(topicName, "manage");
// if(!aaf.aafAuthentication(dmaapContext.getRequest(), permission))
// {
// LOGGER.error("Failed to revoke write access to producer [" +
// producerId + "] for topic " + topicName
- // + ". Authentication failed.");
+
// ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_FORBIDDEN,
// DMaaPResponseCode.ACCESS_NOT_PERMITTED.getResponseCode(),
// errorMessages.getNotPermitted1()+" <Revoke publish permissions>
- // "+errorMessages.getNotPermitted2()+ topicName);
- // LOGGER.info(errRes);
+
+
// throw new DMaaPAccessDeniedException(errRes);
//
- // }
+
// }
Topic topic = getMetaBroker(dmaapContext).getTopic(topicName);
@@ -612,22 +612,22 @@ public class TopicServiceImpl implements TopicService {
LOGGER.info("Granting read access to consumer [" + consumerId + "] for topic " + topicName);
final NsaApiKey user = DMaaPAuthenticatorImpl.getAuthenticatedUser(dmaapContext);
- // if (user == null) {
+
//
//// String permission =
- // "com.att.dmaap.mr.topic"+"|"+topicName+"|"+"manage";
- // DMaaPAAFAuthenticator aaf = new DMaaPAAFAuthenticatorImpl();
+
+
// String permission = aaf.aafPermissionString(topicName, "manage");
// if(!aaf.aafAuthentication(dmaapContext.getRequest(), permission))
// {
// LOGGER.error("Failed to permit read access to consumer [" +
// consumerId + "] for topic " + topicName
- // + ". Authentication failed.");
+
// ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_FORBIDDEN,
// DMaaPResponseCode.ACCESS_NOT_PERMITTED.getResponseCode(),
// errorMessages.getNotPermitted1()+" <Grant consume permissions>
- // "+errorMessages.getNotPermitted2()+ topicName);
- // LOGGER.info(errRes);
+
+
// throw new DMaaPAccessDeniedException(errRes);
// }
// }
@@ -662,27 +662,26 @@ public class TopicServiceImpl implements TopicService {
LOGGER.info("Revoking read access to consumer [" + consumerId + "] for topic " + topicName);
final NsaApiKey user = DMaaPAuthenticatorImpl.getAuthenticatedUser(dmaapContext);
- // if (user == null) {
+
//// String permission =
- // "com.att.dmaap.mr.topic"+"|"+topicName+"|"+"manage";
+
// DMaaPAAFAuthenticator aaf = new DMaaPAAFAuthenticatorImpl();
// String permission = aaf.aafPermissionString(topicName, "manage");
// if(!aaf.aafAuthentication(dmaapContext.getRequest(), permission))
// {
// LOGGER.error("Failed to revoke read access to consumer [" +
// consumerId + "] for topic " + topicName
- // + ". Authentication failed.");
+
// ErrorResponse errRes = new ErrorResponse(HttpStatus.SC_FORBIDDEN,
// DMaaPResponseCode.ACCESS_NOT_PERMITTED.getResponseCode(),
// errorMessages.getNotPermitted1()+" <Grant consume permissions>
- // "+errorMessages.getNotPermitted2()+ topicName);
+
// LOGGER.info(errRes);
// throw new DMaaPAccessDeniedException(errRes);
// }
//
//
- // }
-
+
Topic topic = getMetaBroker(dmaapContext).getTopic(topicName);
if (null == topic) {
diff --git a/src/main/java/com/att/dmf/mr/service/impl/TransactionServiceImpl.java b/src/main/java/com/att/dmf/mr/service/impl/TransactionServiceImpl.java
index ae2d863..3065928 100644
--- a/src/main/java/com/att/dmf/mr/service/impl/TransactionServiceImpl.java
+++ b/src/main/java/com/att/dmf/mr/service/impl/TransactionServiceImpl.java
@@ -52,7 +52,7 @@ public class TransactionServiceImpl implements TransactionService {
throws ConfigDbException, IOException {
/*
- * ConfigurationReader configReader = dmaapContext.getConfigReader();
+
*
* LOG.info("configReader : "+configReader.toString());
*
@@ -77,7 +77,7 @@ public class TransactionServiceImpl implements TransactionService {
IOException {
/*
- * if (null != transactionId) {
+
*
* ConfigurationReader configReader = dmaapContext.getConfigReader();
*
diff --git a/src/main/java/com/att/dmf/mr/service/impl/UIServiceImpl.java b/src/main/java/com/att/dmf/mr/service/impl/UIServiceImpl.java
index 33bc2f4..c8bb073 100644
--- a/src/main/java/com/att/dmf/mr/service/impl/UIServiceImpl.java
+++ b/src/main/java/com/att/dmf/mr/service/impl/UIServiceImpl.java
@@ -27,7 +27,7 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
-//import kafka.common.TopicExistsException;
+
import org.apache.kafka.common.errors.TopicExistsException;
import org.json.JSONArray;
import org.json.JSONObject;
@@ -50,7 +50,7 @@ import com.att.nsa.security.db.simple.NsaSimpleApiKey;
@Service
public class UIServiceImpl implements UIService {
- //private static final Logger LOGGER = Logger.getLogger(UIServiceImpl.class);
+
private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(UIServiceImpl.class);
/**
* Returning template of hello page