private static final String DEFAULT_PROVSRVR_NAME = "dmaap-dr-prov";
private static final String STATIC_ROUTING_NODES = ""; //Adding new param for static Routing - Rally:US664862-1610
+ //Common Errors
+ public static final String MISSING_ON_BEHALF = "Missing X-DMAAP-DR-ON-BEHALF-OF header.";
+ public static final String MISSING_FEED = "Missing or bad feed number.";
+ public static final String POLICY_ENGINE = "Policy Engine disallows access.";
+ public static final String UNAUTHORIZED = "Unauthorized.";
+ public static final String BAD_SUB = "Missing or bad subscription number.";
+ public static final String BAD_JSON = "Badly formed JSON";
+ public static final String BAD_URL = "Bad URL.";
+
+ public static final String API = "/api/";
+ public static final String LOGS = "/logs/";
+ public static final String TEXT_CT = "text/plain";
+ public static final String INGRESS = "/ingress/";
+ public static final String EGRESS = "/egress/";
+ public static final String NETWORK = "/network/";
+ public static final String GROUPID = "groupid";
+ public static final String FEEDID = "feedid";
+ public static final String FEEDIDS = "feedids";
+ public static final String SUBID = "subid";
+ public static final String EVENT_TYPE = "eventType";
+ public static final String OUTPUT_TYPE = "output_type";
+ public static final String START_TIME = "start_time";
+ public static final String END_TIME = "end_time";
+ public static final String REASON_SQL = "reasonSQL";
+
+
/**
* A boolean to trigger one time "provisioning changed" event on startup
*/
try {
thishost = InetAddress.getLocalHost();
loopback = InetAddress.getLoopbackAddress();
- //checkHttpsRelaxation(); //Data Router Subscriber HTTPS Relaxation feature USERSTORYID:US674047.
} catch (UnknownHostException e) {
- // ignore
+ intlogger.info("BaseServlet.init: " + e.getMessage(), e);
}
}
return "Unauthorized address: " + remote;
}
} catch (UnknownHostException e) {
- intlogger.error("PROV0051 BaseServlet.isAuthorizedForProvisioning: ", e.getMessage());
+ intlogger.error("PROV0051 BaseServlet.isAuthorizedForProvisioning: " + e.getMessage(), e);
return "Unauthorized address: " + remote;
}
// Does remote have a valid certificate?
return true;
}
} catch (UnknownHostException e) {
- intlogger.error("PROV0052 BaseServlet.isAuthorizedForInternal: ", e.getMessage());
+ intlogger.error("PROV0052 BaseServlet.isAuthorizedForInternal: " + e.getMessage(), e);
}
return false;
}
}
}
} catch (UnknownHostException e) {
- intlogger.error("PROV0053 BaseServlet.addressMatchesNetwork: ", e.getMessage());
+ intlogger.error("PROV0053 BaseServlet.addressMatchesNetwork: " + e.getMessage(), e);
return false;
}
return true;
thisPod = InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException e) {
thisPod = "";
- intlogger.warn("PROV0014 Cannot determine the name of this provisioning server.");
+ intlogger.warn("PROV0014 Cannot determine the name of this provisioning server.", e);
}
// Normalize the nodes, and fill in nodeAddresses
intlogger.debug("PROV0003 DNS lookup: " + nodes[i] + " => " + na[i].toString());
} catch (UnknownHostException e) {
na[i] = null;
- intlogger.warn("PROV0004 Cannot lookup " + nodes[i] + ": " + e.getMessage());
+ intlogger.warn("PROV0004 Cannot lookup " + nodes[i] + ": " + e.getMessage(), e);
}
}
intlogger.debug("PROV0003 DNS lookup: " + pods[i] + " => " + na[i].toString());
} catch (UnknownHostException e) {
na[i] = null;
- intlogger.warn("PROV0004 Cannot lookup " + pods[i] + ": " + e.getMessage());
+ intlogger.warn("PROV0004 Cannot lookup " + pods[i] + ": " + e.getMessage(), e);
}
}
podAddresses = na;
try (InputStream inStream = getClass().getClassLoader().getResourceAsStream(MAILCONFIG_FILE)) {
mailprops.load(inStream);
} catch (IOException e) {
- intlogger.error("PROV9003 Opening properties: " + e.getMessage());
+ intlogger.error("PROV9003 Opening properties: " + e.getMessage(), e);
System.exit(1);
}
}
}
- /**
- * Data Router Subscriber HTTPS Relaxation feature USERSTORYID:US674047. Check if HTTPS Relexaction is enabled
- *
- * @author vs215k
- **/
- private void checkHttpsRelaxation() {
- if (!mailSendFlag) {
- Properties p = (new DB()).getProperties();
- intlogger.info("HTTPS relaxation: " + p.get("org.onap.dmaap.datarouter.provserver.https.relaxation"));
-
- if (p.get("org.onap.dmaap.datarouter.provserver.https.relaxation").equals("true")) {
- try {
- notifyPSTeam(p.get("org.onap.dmaap.datarouter.provserver.https.relax.notify").toString());
- } catch (Exception e) {
- intlogger.warn("Exception: " + e.getMessage());
- }
- }
- mailSendFlag = true;
- }
- }
/**
* Data Router Subscriber HTTPS Relaxation feature USERSTORYID:US674047.
* @param email - list of email ids to notify if HTTP relexcation is enabled.
* @author vs215k
**/
- private void notifyPSTeam(String email) throws Exception {
+ private void notifyPSTeam(String email) {
loadMailProperties(); //Load HTTPS Relex mail properties.
String[] emails = email.split(Pattern.quote("|"));
mp.addBodyPart(htmlPart);
msg.setContent(mp);
- System.out.println(mailprops.get("com.att.dmaap.datarouter.mail.body").toString()
+ intlogger.info(mailprops.get("com.att.dmaap.datarouter.mail.body").toString()
.replace("[SERVER]", InetAddress.getLocalHost().getHostName()));
Transport.send(msg);
intlogger.info("HTTPS relaxation mail is sent to - : " + email);
} catch (MessagingException e) {
- intlogger.error("Invalid email address, unable to send https relaxation mail to - : " + email);
+ intlogger.error("Invalid email address, unable to send https relaxation mail to - : " + email, e);
+ } catch (UnknownHostException uhe) {
+ intlogger.error("UnknownHostException", uhe);
}
}
rv = bean.doInsert(conn);
} catch (SQLException e) {
rv = false;
- intlogger.warn("PROV0005 doInsert: " + e.getMessage());
+ intlogger.warn("PROV0005 doInsert: " + e.getMessage(), e);
} finally {
if (conn != null) {
db.release(conn);
rv = bean.doUpdate(conn);
} catch (SQLException e) {
rv = false;
- intlogger.warn("PROV0006 doUpdate: " + e.getMessage());
+ intlogger.warn("PROV0006 doUpdate: " + e.getMessage(), e);
} finally {
if (conn != null) {
db.release(conn);
rv = bean.doDelete(conn);
} catch (SQLException e) {
rv = false;
- intlogger.warn("PROV0007 doDelete: " + e.getMessage());
+ intlogger.warn("PROV0007 doDelete: " + e.getMessage(), e);
} finally {
if (conn != null) {
db.release(conn);
private static boolean getBoolean(Map<String, String> map, String name) {
String s = map.get(name);
- return (s != null) && s.equalsIgnoreCase("true");
+ return (s != null) && "true".equalsIgnoreCase(s);
}
private static String getString(Map<String, String> map, String name, String dflt) {
return true;
}
} catch (JSONException e) {
- intlogger.error("JSONException: " + e.getMessage());
+ intlogger.error("JSONException: " + e.getMessage(), e);
}
}
return false;
MDC.put(MDC_SERVER_FQDN, InetAddress.getLocalHost().getHostName());
MDC.put(MDC_SERVER_IP_ADDRESS, InetAddress.getLocalHost().getHostAddress());
} catch (Exception e) {
- intlogger.error("Exception: " + e.getMessage());
+ intlogger.error("Exception: " + e.getMessage(), e);
}
}
default:
action = "*";
}
- if (aafInstance == null || aafInstance.equals("")) {
+ if (aafInstance == null || "".equals(aafInstance)) {
aafInstance = props.getProperty(AAF_INSTANCE, "org.onap.dmaap-dr.NoInstanceDefined");
}
return type + "|" + aafInstance + "|" + action;
} catch (Exception e) {
- intlogger.error("PROV7005 BaseServlet.getFeedPermission: ", e.getMessage());
+ intlogger.error("PROV7005 BaseServlet.getFeedPermission: " + e.getMessage(), e);
}
return null;
}
default:
action = "*";
}
- if (aafInstance == null || aafInstance.equals("")) {
+ if (aafInstance == null || "".equals(aafInstance)) {
aafInstance = props.getProperty(AAF_INSTANCE, "org.onap.dmaap-dr.NoInstanceDefined");
}
return type + "|" + aafInstance + "|" + action;
} catch (Exception e) {
- intlogger.error("PROV7005 BaseServlet.getSubscriberPermission: ", e.getMessage());
+ intlogger.error("PROV7005 BaseServlet.getSubscriberPermission: " + e.getMessage(), e);
}
return null;
}