aboutsummaryrefslogtreecommitdiffstats
path: root/cxf-logging/src
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2019-04-08 14:14:34 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-04-08 14:24:59 -0400
commitf47919f1fe367b612fa9c96d34c59f01a541e882 (patch)
tree5b6aa2fc36747d868897e68ccbec0c6db0aee81c /cxf-logging/src
parent54452b80a1cf4d22ef750bc1377f8c1b05431d57 (diff)
Replaced all tabs with spaces in java and pom.xml
Added in maven plugins to enforce coding style rules Added in eclipse java formatting xml Change-Id: I3727bbf4ce8dc66abfd8ad21b6cfd0890c5d3ff0 Issue-ID: SO-1765 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'cxf-logging/src')
-rw-r--r--cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java38
-rw-r--r--cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java15
-rw-r--r--cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPMDCSetup.java25
3 files changed, 41 insertions, 37 deletions
diff --git a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java
index 08499cfd22..a6cce27f91 100644
--- a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java
+++ b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java
@@ -37,7 +37,7 @@ import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
-public class SOAPLoggingInInterceptor extends AbstractSoapInterceptor{
+public class SOAPLoggingInInterceptor extends AbstractSoapInterceptor {
protected static Logger logger = LoggerFactory.getLogger(SOAPLoggingInInterceptor.class);
@@ -49,10 +49,10 @@ public class SOAPLoggingInInterceptor extends AbstractSoapInterceptor{
public void handleMessage(SoapMessage message) throws Fault {
try {
SOAPMDCSetup mdcSetup = new SOAPMDCSetup();
- Map<String, List<String>> headers = (Map<String,List<String>>) message.get(Message.PROTOCOL_HEADERS);
- HttpServletRequest request = (HttpServletRequest)message.get(AbstractHTTPDestination.HTTP_REQUEST);
+ Map<String, List<String>> headers = (Map<String, List<String>>) message.get(Message.PROTOCOL_HEADERS);
+ HttpServletRequest request = (HttpServletRequest) message.get(AbstractHTTPDestination.HTTP_REQUEST);
request.getRemoteAddr();
-
+
setRequestId(headers);
setInvocationId(headers);
setServiceName(message);
@@ -67,36 +67,38 @@ public class SOAPLoggingInInterceptor extends AbstractSoapInterceptor{
logger.warn("Error in incoming SOAP Message Inteceptor", e);
}
}
-
+
private void setServiceName(SoapMessage message) {
String requestURI = (String) message.get(Message.REQUEST_URI);
MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, requestURI);
}
- //CXF Appears to flatten headers to lower case
- private void setMDCPartnerName(Map<String, List<String>> headers){
- String partnerName=getValueOrDefault(headers, ONAPLogConstants.Headers.PARTNER_NAME.toLowerCase(),"");
- MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME,partnerName);
+ // CXF Appears to flatten headers to lower case
+ private void setMDCPartnerName(Map<String, List<String>> headers) {
+ String partnerName = getValueOrDefault(headers, ONAPLogConstants.Headers.PARTNER_NAME.toLowerCase(), "");
+ MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, partnerName);
}
private void setInvocationId(Map<String, List<String>> headers) {
- String invocationId=getValueOrDefault(headers, ONAPLogConstants.Headers.INVOCATION_ID.toLowerCase(),UUID.randomUUID().toString());
+ String invocationId = getValueOrDefault(headers, ONAPLogConstants.Headers.INVOCATION_ID.toLowerCase(),
+ UUID.randomUUID().toString());
MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId);
}
private void setRequestId(Map<String, List<String>> headers) {
- String requestId=getValueOrDefault(headers, ONAPLogConstants.Headers.REQUEST_ID.toLowerCase(),UUID.randomUUID().toString());
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID,requestId);
+ String requestId = getValueOrDefault(headers, ONAPLogConstants.Headers.REQUEST_ID.toLowerCase(),
+ UUID.randomUUID().toString());
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, requestId);
}
- private String getValueOrDefault(Map<String, List<String>> headers, String headerName, String defaultValue){
+ private String getValueOrDefault(Map<String, List<String>> headers, String headerName, String defaultValue) {
String headerValue;
- List<String> headerList=headers.get(headerName);
- if(headerList != null && !headerList.isEmpty()){
- headerValue= headerList.get(0);
- if(headerValue == null || headerValue.isEmpty())
+ List<String> headerList = headers.get(headerName);
+ if (headerList != null && !headerList.isEmpty()) {
+ headerValue = headerList.get(0);
+ if (headerValue == null || headerValue.isEmpty())
headerValue = defaultValue;
- }else
+ } else
headerValue = defaultValue;
return headerValue;
}
diff --git a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java
index ed4ba76268..92b266870c 100644
--- a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java
+++ b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java
@@ -33,14 +33,14 @@ import org.slf4j.MDC;
-public class SOAPLoggingOutInterceptor extends AbstractSoapInterceptor{
+public class SOAPLoggingOutInterceptor extends AbstractSoapInterceptor {
private static final String _500 = "500";
protected static Logger logger = LoggerFactory.getLogger(SOAPLoggingOutInterceptor.class);
-
-
+
+
public SOAPLoggingOutInterceptor() {
super(Phase.WRITE);
}
@@ -50,15 +50,16 @@ public class SOAPLoggingOutInterceptor extends AbstractSoapInterceptor{
try {
Exception ex = message.getContent(Exception.class);
if (ex == null) {
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.COMPLETED.toString());
- }else{
+ MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE,
+ ONAPLogConstants.ResponseStatus.COMPLETED.toString());
+ } else {
int responseCode = 0;
responseCode = (int) message.get(Message.RESPONSE_CODE);
- if(responseCode != 0 )
+ if (responseCode != 0)
MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, String.valueOf(responseCode));
else
MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, _500);
-
+
MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.ERROR.toString());
}
logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
diff --git a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPMDCSetup.java b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPMDCSetup.java
index ef47106fa1..8258ce6f99 100644
--- a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPMDCSetup.java
+++ b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPMDCSetup.java
@@ -35,18 +35,18 @@ import org.slf4j.MDC;
public class SOAPMDCSetup {
-
- protected static Logger logger = LoggerFactory.getLogger(SOAPMDCSetup.class);
-
+
+ protected static Logger logger = LoggerFactory.getLogger(SOAPMDCSetup.class);
+
private static final String INSTANCE_UUID = UUID.randomUUID().toString();
-
- public void setInstanceUUID(){
+
+ public void setInstanceUUID() {
MDC.put(ONAPLogConstants.MDCs.INSTANCE_UUID, INSTANCE_UUID);
}
- public void setServerFQDN(){
+ public void setServerFQDN() {
String serverFQDN = "";
- InetAddress addr= null;
+ InetAddress addr = null;
try {
addr = InetAddress.getLocalHost();
serverFQDN = addr.toString();
@@ -57,17 +57,18 @@ public class SOAPMDCSetup {
MDC.put(ONAPLogConstants.MDCs.SERVER_FQDN, serverFQDN);
}
- public void setClientIPAddress(HttpServletRequest httpServletRequest){
+ public void setClientIPAddress(HttpServletRequest httpServletRequest) {
String remoteIpAddress = "";
if (httpServletRequest != null) {
remoteIpAddress = httpServletRequest.getRemoteAddr();
- }
+ }
MDC.put(ONAPLogConstants.MDCs.CLIENT_IP_ADDRESS, remoteIpAddress);
}
public void setEntryTimeStamp() {
- MDC.put(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP,ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT));
+ MDC.put(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP,
+ ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT));
}
-
-
+
+
}