X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=datarouter-prov%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fdmaap%2Fdatarouter%2Fprovisioning%2FSubscriptionServlet.java;h=b3bb679b63aaec06d9984fff124806de3541820d;hb=0ad65c47b4fbddd5d1b653c5e38dcdf84884de9f;hp=715c5e140421e2e95d5daf2527f2a8edb347dbb5;hpb=0645ccf674f388cc989ef43d2ce24f359915e453;p=dmaap%2Fdatarouter.git diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscriptionServlet.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscriptionServlet.java index 715c5e14..b3bb679b 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscriptionServlet.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SubscriptionServlet.java @@ -42,6 +42,7 @@ import org.onap.dmaap.datarouter.authz.AuthorizationResponse; import org.onap.dmaap.datarouter.provisioning.beans.EventLogRecord; import org.onap.dmaap.datarouter.provisioning.beans.Subscription; import org.onap.dmaap.datarouter.provisioning.eelf.EelfMsgs; +import org.onap.dmaap.datarouter.provisioning.utils.SynchronizerTask; /** * This servlet handles provisioning for the <subscriptionURL> which is generated by the provisioning server to @@ -73,7 +74,8 @@ public class SubscriptionServlet extends ProxyServlet { setIpFqdnRequestIDandInvocationIDForEelf("doDelete", req); eelfLogger.info(EelfMsgs.ENTRY); try { - eelfLogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_SUBID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + ""); + eelfLogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_SUBID, + req.getHeader(BEHALF_HEADER), getIdFromPath(req) + ""); EventLogRecord elr = new EventLogRecord(req); String message = isAuthorizedForProvisioning(req); if (message != null) { @@ -174,7 +176,8 @@ public class SubscriptionServlet extends ProxyServlet { setIpFqdnRequestIDandInvocationIDForEelf("doGet", req); eelfLogger.info(EelfMsgs.ENTRY); try { - eelfLogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_SUBID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + ""); + eelfLogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_SUBID, + req.getHeader(BEHALF_HEADER), getIdFromPath(req) + ""); EventLogRecord elr = new EventLogRecord(req); String message = isAuthorizedForProvisioning(req); if (message != null) { @@ -250,7 +253,8 @@ public class SubscriptionServlet extends ProxyServlet { setIpFqdnRequestIDandInvocationIDForEelf("doPut", req); eelfLogger.info(EelfMsgs.ENTRY); try { - eelfLogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_SUBID, req.getHeader(BEHALF_HEADER), getIdFromPath(req) + ""); + eelfLogger.info(EelfMsgs.MESSAGE_WITH_BEHALF_AND_SUBID, + req.getHeader(BEHALF_HEADER), getIdFromPath(req) + ""); EventLogRecord elr = new EventLogRecord(req); String message = isAuthorizedForProvisioning(req); if (message != null) { @@ -311,10 +315,7 @@ public class SubscriptionServlet extends ProxyServlet { sendResponseError(resp, HttpServletResponse.SC_BAD_REQUEST, message, eventlogger); return; } - if (intlogger.isDebugEnabled()) { - intlogger.debug(jo.toString()); - } - Subscription sub = null; + Subscription sub; try { sub = new Subscription(jo); } catch (InvalidObjectException e) { @@ -360,8 +361,8 @@ public class SubscriptionServlet extends ProxyServlet { sub.setSubid(oldsub.getSubid()); sub.setFeedid(oldsub.getFeedid()); sub.setSubscriber(bhdr); // set from X-DMAAP-DR-ON-BEHALF-OF header - - String subjectgroup = (req.getHeader("X-DMAAP-DR-ON-BEHALF-OF-GROUP")); //Adding for group feature:Rally US708115 + //Adding for group feature:Rally US708115 + String subjectgroup = (req.getHeader("X-DMAAP-DR-ON-BEHALF-OF-GROUP")); if (!oldsub.getSubscriber().equals(sub.getSubscriber()) && subjectgroup == null) { message = "This subscriber must be modified by the same subscriber that created it."; elr.setMessage(message); @@ -384,7 +385,7 @@ public class SubscriptionServlet extends ProxyServlet { eventlogger.error("PROV0192 SubscriptionServlet.doPut: " + ioe.getMessage(), ioe); } - /**Change Owner ship of Subscriber Adding for group feature:Rally US708115*/ + /**Change Owner ship of Subscriber. Adding for group feature:Rally US708115*/ if (jo.has("changeowner") && subjectgroup != null) { try { Boolean changeowner = (Boolean) jo.get("changeowner"); @@ -396,7 +397,7 @@ public class SubscriptionServlet extends ProxyServlet { eventlogger.error("PROV0193 SubscriptionServlet.doPut: " + je.getMessage(), je); } } - /***End of change ownership*/ + /***End of change ownership.*/ provisioningDataChanged(); } else { @@ -485,12 +486,12 @@ public class SubscriptionServlet extends ProxyServlet { try { // Only the active POD sends notifications boolean active = SynchronizerTask.getSynchronizer().isActive(); - boolean b = jo.getBoolean("failed"); - if (active && !b) { + boolean bool = jo.getBoolean("failed"); + if (active && !bool) { // Notify all nodes to reset the subscription - SubscriberNotifyThread t = new SubscriberNotifyThread(); - t.resetSubscription(subid); - t.start(); + SubscriberNotifyThread thread = new SubscriberNotifyThread(); + thread.resetSubscription(subid); + thread.start(); } // send response elr.setResult(HttpServletResponse.SC_ACCEPTED); @@ -523,8 +524,8 @@ public class SubscriptionServlet extends ProxyServlet { void resetSubscription(int subid) { for (String nodename : BaseServlet.getNodes()) { - String u = String.format(URL_TEMPLATE, nodename, subid); - urls.add(u); + String url = String.format(URL_TEMPLATE, nodename, subid); + urls.add(url); } }