diff options
author | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2022-11-07 08:35:37 +0000 |
---|---|---|
committer | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2022-11-07 08:38:19 +0000 |
commit | fbb02159b84435cf37221ae8ae5e0045167be15a (patch) | |
tree | 78196f6a3e5e4d0b1e5ca6ecadec0f9e9a623303 /aai-els-onap-logging/src/main | |
parent | 58f0fd2f6ef58de52e1f9a73540c1bb895c0d6e6 (diff) |
Reduce the number of problems in aai-common by removing unused imports
- run mvn spotless:apply across aai-commmon to remove unused imports
- run mvn formatter:format across aai-common
Issue-ID: AAI-3583
Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
Change-Id: I2dfeb395eafa2824ce8369bba3a18db3e1845522
Diffstat (limited to 'aai-els-onap-logging/src/main')
42 files changed, 296 insertions, 233 deletions
diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/filter/AaiAuditLogContainerFilter.java b/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/filter/AaiAuditLogContainerFilter.java index c826df3d..cddf953c 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/filter/AaiAuditLogContainerFilter.java +++ b/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/filter/AaiAuditLogContainerFilter.java @@ -20,13 +20,6 @@ package org.onap.aai.aailog.filter; -import org.onap.aai.aailog.logs.ServiceName; -import org.onap.logging.filter.base.AuditLogContainerFilter; -import org.onap.logging.filter.base.Constants; -import org.onap.logging.filter.base.SimpleMap; -import org.onap.logging.ref.slf4j.ONAPLogConstants; -import org.slf4j.MDC; - import javax.annotation.Priority; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.container.ContainerRequestContext; @@ -34,6 +27,13 @@ import javax.ws.rs.container.PreMatching; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.UriInfo; +import org.onap.aai.aailog.logs.ServiceName; +import org.onap.logging.filter.base.AuditLogContainerFilter; +import org.onap.logging.filter.base.Constants; +import org.onap.logging.filter.base.SimpleMap; +import org.onap.logging.ref.slf4j.ONAPLogConstants; +import org.slf4j.MDC; + @PreMatching @Priority(1) public class AaiAuditLogContainerFilter extends AuditLogContainerFilter { @@ -43,7 +43,7 @@ public class AaiAuditLogContainerFilter extends AuditLogContainerFilter { String partnerName = headers.get(ONAPLogConstants.Headers.PARTNER_NAME); if (partnerName == null || partnerName.isEmpty()) { logger.trace("No valid X-ONAP-PartnerName header value. Checking X-FromAppId header for partnerName."); - partnerName = headers.get (Constants.HttpHeaders.HEADER_FROM_APP_ID); + partnerName = headers.get(Constants.HttpHeaders.HEADER_FROM_APP_ID); if (partnerName == null || partnerName.isEmpty()) { logger.trace("No valid X-FromAppId header value. Checking User-Agent header for partnerName."); partnerName = headers.get(HttpHeaders.USER_AGENT); @@ -59,6 +59,7 @@ public class AaiAuditLogContainerFilter extends AuditLogContainerFilter { } MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, partnerName); } + @Override protected void setServiceName(ContainerRequestContext containerRequest) { UriInfo uriInfo = containerRequest.getUriInfo(); diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/filter/RestClientLoggingInterceptor.java b/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/filter/RestClientLoggingInterceptor.java index 629587d5..348aaa2e 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/filter/RestClientLoggingInterceptor.java +++ b/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/filter/RestClientLoggingInterceptor.java @@ -17,11 +17,13 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.aai.aailog.filter; import java.io.IOException; import java.util.List; import java.util.UUID; + import org.onap.aai.aailog.logs.ServiceName; import org.onap.logging.filter.base.AbstractMetricLogFilter; import org.onap.logging.filter.base.Constants; @@ -33,11 +35,11 @@ import org.springframework.http.client.ClientHttpRequestExecution; import org.springframework.http.client.ClientHttpRequestInterceptor; import org.springframework.http.client.ClientHttpResponse; -public class RestClientLoggingInterceptor extends AbstractMetricLogFilter<HttpRequest, ClientHttpResponse, HttpHeaders> implements ClientHttpRequestInterceptor { +public class RestClientLoggingInterceptor extends AbstractMetricLogFilter<HttpRequest, ClientHttpResponse, HttpHeaders> + implements ClientHttpRequestInterceptor { @Override public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) - throws IOException - { + throws IOException { this.setInvocationId(request.getHeaders()); pre(request, request.getHeaders()); ClientHttpResponse resp = execution.execute(request, body); @@ -45,6 +47,7 @@ public class RestClientLoggingInterceptor extends AbstractMetricLogFilter<HttpRe return resp; } + protected void pre(HttpRequest request, HttpHeaders requestHeaders) { try { setupMDC(request); @@ -54,6 +57,7 @@ public class RestClientLoggingInterceptor extends AbstractMetricLogFilter<HttpRe logger.warn("Error in RestClientLoggingInterceptor pre", e); } } + protected void setupHeaders(HttpRequest clientRequest, HttpHeaders requestHeaders) { String requestId = extractRequestID(requestHeaders); addHeader(requestHeaders, ONAPLogConstants.Headers.REQUEST_ID, requestId); @@ -69,6 +73,7 @@ public class RestClientLoggingInterceptor extends AbstractMetricLogFilter<HttpRe addHeader(requestHeaders, ONAPLogConstants.Headers.PARTNER_NAME, pName); } } + protected String extractRequestID(HttpHeaders requestHeaders) { String requestId = MDC.get(ONAPLogConstants.MDCs.REQUEST_ID); if (requestId == null || requestId.isEmpty()) { @@ -80,13 +85,14 @@ public class RestClientLoggingInterceptor extends AbstractMetricLogFilter<HttpRe } return requestId; } + public void setInvocationId(HttpHeaders headers) { String invocationId = null; List<String> headerList = headers.get(ONAPLogConstants.Headers.INVOCATION_ID); if (headerList != null && (!headerList.isEmpty())) { for (String h : headerList) { - if ( h != null && (!h.isEmpty()) ) { + if (h != null && (!h.isEmpty())) { invocationId = h; break; } @@ -98,6 +104,7 @@ public class RestClientLoggingInterceptor extends AbstractMetricLogFilter<HttpRe } MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId); } + @Override protected void addHeader(HttpHeaders requestHeaders, String headerName, String headerValue) { requestHeaders.add(headerName, headerValue); @@ -106,18 +113,18 @@ public class RestClientLoggingInterceptor extends AbstractMetricLogFilter<HttpRe protected String getTargetServiceName(HttpRequest request) { return (getServiceName(request)); } - protected String getServiceName(HttpRequest request){ + + protected String getServiceName(HttpRequest request) { String path = request.getURI().getRawPath(); - return(ServiceName.extractServiceName(path)); + return (ServiceName.extractServiceName(path)); } protected int getHttpStatusCode(ClientHttpResponse response) { int result = 0; - if (response != null ) { + if (response != null) { try { result = response.getStatusCode().value(); - } - catch (IOException e) { + } catch (IOException e) { logger.warn("Error in RestClientLoggingInterceptor getHttpStatusCode {}", e.getMessage()); } } @@ -126,11 +133,10 @@ public class RestClientLoggingInterceptor extends AbstractMetricLogFilter<HttpRe protected String getResponseCode(ClientHttpResponse response) { String result = ""; - if (response != null ) { + if (response != null) { try { result = response.getStatusCode().toString(); - } - catch (IOException e) { + } catch (IOException e) { logger.warn("Error in RestClientLoggingInterceptor getResponseCode {}", e.getMessage()); } } @@ -138,7 +144,7 @@ public class RestClientLoggingInterceptor extends AbstractMetricLogFilter<HttpRe } protected String getTargetEntity(HttpRequest request) { - //TODO where do we get this from? + // TODO where do we get this from? return Constants.DefaultValues.UNKNOWN_TARGET_ENTITY; } } diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/filter/RestControllerClientLoggingInterceptor.java b/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/filter/RestControllerClientLoggingInterceptor.java index 7e332ec5..c09023d1 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/filter/RestControllerClientLoggingInterceptor.java +++ b/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/filter/RestControllerClientLoggingInterceptor.java @@ -17,6 +17,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.aai.aailog.filter; import com.sun.jersey.api.client.ClientHandler; @@ -24,25 +25,27 @@ import com.sun.jersey.api.client.ClientHandlerException; import com.sun.jersey.api.client.ClientRequest; import com.sun.jersey.api.client.ClientResponse; import com.sun.jersey.api.client.filter.ClientFilter; -import org.onap.aai.aailog.logs.ServiceName; -import org.onap.logging.filter.base.Constants; -import org.onap.logging.filter.base.MDCSetup; -import org.onap.logging.ref.slf4j.ONAPLogConstants; -import org.slf4j.*; -import javax.ws.rs.core.MultivaluedMap; import java.time.ZoneOffset; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; import java.util.UUID; +import javax.ws.rs.core.MultivaluedMap; + +import org.onap.aai.aailog.logs.ServiceName; +import org.onap.logging.filter.base.Constants; +import org.onap.logging.filter.base.MDCSetup; +import org.onap.logging.ref.slf4j.ONAPLogConstants; +import org.slf4j.*; + public class RestControllerClientLoggingInterceptor extends ClientFilter { private static final Logger logger = LoggerFactory.getLogger(RestControllerClientLoggingInterceptor.class); private static final Marker INVOKE_RETURN = MarkerFactory.getMarker("INVOKE-RETURN"); private final MDCSetup mdcSetup; private final String partnerName; - public RestControllerClientLoggingInterceptor () { + public RestControllerClientLoggingInterceptor() { mdcSetup = new MDCSetup(); partnerName = getPartnerName(); } @@ -62,11 +65,11 @@ public class RestControllerClientLoggingInterceptor extends ClientFilter { return clientResponse; } - protected String getTargetServiceName(ClientRequest clientRequest) { + protected String getTargetServiceName(ClientRequest clientRequest) { return getServiceName(clientRequest); } - protected String getServiceName(ClientRequest clientRequest) { + protected String getServiceName(ClientRequest clientRequest) { String path = clientRequest.getURI().getRawPath(); return ServiceName.extractServiceName(path); } @@ -75,12 +78,11 @@ public class RestControllerClientLoggingInterceptor extends ClientFilter { return response.getStatus(); } - protected String getResponseCode(ClientResponse clientResponse) { + protected String getResponseCode(ClientResponse clientResponse) { return String.valueOf(clientResponse.getStatus()); } - - protected String getTargetEntity(ClientRequest ClientRequest) { + protected String getTargetEntity(ClientRequest ClientRequest) { return Constants.DefaultValues.UNKNOWN_TARGET_ENTITY; }; @@ -94,12 +96,13 @@ public class RestControllerClientLoggingInterceptor extends ClientFilter { logger.warn("Error in RestControllerClientLoggingInterceptor pre", e.getMessage()); } } + public void setInvocationId(ClientRequest clientRequest) { String invocationId = null; MultivaluedMap<String, Object> requestHeaders = clientRequest.getHeaders(); Object id = requestHeaders.get(ONAPLogConstants.Headers.INVOCATION_ID); if (id != null) { - invocationId = (String)id; + invocationId = (String) id; } requestHeaders.remove(ONAPLogConstants.Headers.INVOCATION_ID); if (invocationId == null) { @@ -107,6 +110,7 @@ public class RestControllerClientLoggingInterceptor extends ClientFilter { } MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId); } + protected void setupHeaders(ClientRequest clientRequest) { String requestId = extractRequestID(clientRequest); MultivaluedMap<String, Object> requestHeaders = clientRequest.getHeaders(); @@ -118,14 +122,14 @@ public class RestControllerClientLoggingInterceptor extends ClientFilter { } addHeader(requestHeaders, Constants.HttpHeaders.ECOMP_REQUEST_ID, requestId); addHeader(requestHeaders, ONAPLogConstants.Headers.INVOCATION_ID, MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID)); - if (partnerName != null && (!partnerName.isEmpty())){ + if (partnerName != null && (!partnerName.isEmpty())) { addHeader(requestHeaders, ONAPLogConstants.Headers.PARTNER_NAME, partnerName); } } protected void setupMDC(ClientRequest clientRequest) { MDC.put(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP, - ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT)); + ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT)); MDC.put(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME, getTargetServiceName(clientRequest)); MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString()); mdcSetup.setInvocationIdFromMDC(); @@ -151,15 +155,15 @@ public class RestControllerClientLoggingInterceptor extends ClientFilter { MultivaluedMap<String, Object> requestHeaders = clientRequest.getHeaders(); Object requestIdObj = requestHeaders.getFirst(Constants.HttpHeaders.TRANSACTION_ID); if (requestIdObj != null) { - requestId = (String)requestIdObj; + requestId = (String) requestIdObj; } - if ( requestId == null || requestId.isEmpty() ) { + if (requestId == null || requestId.isEmpty()) { requestId = UUID.randomUUID().toString(); } mdcSetup.setLogTimestamp(); mdcSetup.setElapsedTimeInvokeTimestamp(); logger.warn("No value found in MDC when checking key {} value will be set to {}", - ONAPLogConstants.MDCs.REQUEST_ID, requestId); + ONAPLogConstants.MDCs.REQUEST_ID, requestId); MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, requestId); } return requestId; @@ -178,6 +182,7 @@ public class RestControllerClientLoggingInterceptor extends ClientFilter { logger.warn("Error in RestControllerClientLoggingInterceptor post", e.getMessage()); } } + protected String getPartnerName() { return mdcSetup.getProperty(Constants.Property.PARTNER_NAME); } diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/logs/AaiDBMetricLog.java b/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/logs/AaiDBMetricLog.java index 0269943b..da5923d6 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/logs/AaiDBMetricLog.java +++ b/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/logs/AaiDBMetricLog.java @@ -20,14 +20,14 @@ package org.onap.aai.aailog.logs; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.Response; + import org.onap.logging.filter.base.AbstractMetricLogFilter; import org.onap.logging.filter.base.ONAPComponents; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.slf4j.*; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; - public class AaiDBMetricLog extends AbstractMetricLogFilter<DBRequestWrapper, Response, MultivaluedMap<String, Object>> { @@ -35,6 +35,7 @@ public class AaiDBMetricLog private final String partnerName; private static final Marker INVOKE_RETURN = MarkerFactory.getMarker("INVOKE-RETURN"); private static final String TARGET_ENTITY = ONAPComponents.AAI.toString() + ".DB"; + public AaiDBMetricLog(String subcomponent) { partnerName = getPartnerName(subcomponent); } @@ -85,6 +86,7 @@ public class AaiDBMetricLog logger.warn("Error in AaiDBMetricLog pre", e); } } + public void post(DBRequestWrapper request, Response response) { try { setLogTimestamp(); @@ -98,13 +100,13 @@ public class AaiDBMetricLog logger.warn("Error in AaiDBMetricLog post", e); } } + @Override public void setResponseStatusCode(int code) { String statusCode; if (code / 100 == 2) { statusCode = ONAPLogConstants.ResponseStatus.COMPLETE.toString(); - } - else { + } else { statusCode = ONAPLogConstants.ResponseStatus.ERROR.toString(); setErrorCode(code); setErrorDesc(code); diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/logs/AaiDebugLog.java b/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/logs/AaiDebugLog.java index ef11f08e..60d90a9c 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/logs/AaiDebugLog.java +++ b/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/logs/AaiDebugLog.java @@ -20,12 +20,12 @@ package org.onap.aai.aailog.logs; +import java.util.UUID; + import org.onap.logging.filter.base.MDCSetup; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.slf4j.MDC; -import java.util.UUID; - public class AaiDebugLog extends MDCSetup { public void setupMDC() { diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/logs/AaiDmaapMetricLog.java b/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/logs/AaiDmaapMetricLog.java index 35d206f0..0d3a573d 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/logs/AaiDmaapMetricLog.java +++ b/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/logs/AaiDmaapMetricLog.java @@ -20,16 +20,15 @@ package org.onap.aai.aailog.logs; +import java.time.ZoneOffset; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; + import org.onap.aai.logging.AaiElsErrorCode; import org.onap.logging.filter.base.MDCSetup; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.slf4j.*; -import java.time.ZoneOffset; -import java.time.ZonedDateTime; -import java.time.format.DateTimeFormatter; -import java.util.regex.PatternSyntaxException; - public class AaiDmaapMetricLog extends MDCSetup { protected static final Logger logger = LoggerFactory.getLogger(AaiDmaapMetricLog.class); @@ -37,15 +36,16 @@ public class AaiDmaapMetricLog extends MDCSetup { private static final String TARGET_ENTITY = "DMaaP"; public AaiDmaapMetricLog() { - if(MDC.get(ONAPLogConstants.MDCs.SERVER_FQDN) == null) { - setServerFQDN(); - } + if (MDC.get(ONAPLogConstants.MDCs.SERVER_FQDN) == null) { + setServerFQDN(); + } } + public void pre(String targetServiceName, String event, String transactionId, String serviceName) { try { MDC.put(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP, - ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT)); + ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT)); setLogTimestamp(); setElapsedTimeInvokeTimestamp(); MDC.put(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME, targetServiceName); @@ -58,7 +58,7 @@ public class AaiDmaapMetricLog extends MDCSetup { MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, serviceName); } setInvocationIdFromMDC(); - logger.info(ONAPLogConstants.Markers.INVOKE, event ); + logger.info(ONAPLogConstants.Markers.INVOKE, event); } catch (Exception e) { logger.warn("Error in AaiDmaapMetricLog pre", e.getMessage()); @@ -82,8 +82,7 @@ public class AaiDmaapMetricLog extends MDCSetup { String statusCode; if (AaiElsErrorCode.SUCCESS.equals(aaiElsErrorCode)) { statusCode = ONAPLogConstants.ResponseStatus.COMPLETE.toString(); - } - else { + } else { statusCode = ONAPLogConstants.ResponseStatus.ERROR.toString(); MDC.put(ONAPLogConstants.MDCs.ERROR_CODE, aaiElsErrorCode); MDC.put(ONAPLogConstants.MDCs.ERROR_DESC, errorDescription); diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/logs/AaiScheduledTaskAuditLog.java b/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/logs/AaiScheduledTaskAuditLog.java index 60460fff..75b602ec 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/logs/AaiScheduledTaskAuditLog.java +++ b/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/logs/AaiScheduledTaskAuditLog.java @@ -18,8 +18,13 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.aai.aailog.logs; +import java.util.UUID; + +import javax.ws.rs.core.Response; + import org.onap.logging.filter.base.MDCSetup; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.slf4j.Logger; @@ -29,9 +34,6 @@ import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; -import javax.ws.rs.core.Response; -import java.util.UUID; - @Component @Scope(scopeName = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class AaiScheduledTaskAuditLog extends MDCSetup { diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/logs/DBRequestWrapper.java b/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/logs/DBRequestWrapper.java index 2b78613d..19a11999 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/logs/DBRequestWrapper.java +++ b/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/logs/DBRequestWrapper.java @@ -17,7 +17,9 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.aai.aailog.logs; + import java.net.URI; public interface DBRequestWrapper { diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/logs/ServiceName.java b/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/logs/ServiceName.java index 97f042f0..3f34081b 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/logs/ServiceName.java +++ b/aai-els-onap-logging/src/main/java/org/onap/aai/aailog/logs/ServiceName.java @@ -17,16 +17,18 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.aai.aailog.logs; public class ServiceName { /** * Extract the service name from a URI path * Service name should be the URI path up to two levels down from the version or less + * * @param path the URI path * @return the service name */ - public static String extractServiceName (String path) { + public static String extractServiceName(String path) { StringBuilder sBuilder = new StringBuilder(); String[] parts = path.split("/"); String part = ""; @@ -38,8 +40,8 @@ public class ServiceName { break; } } - if ((sBuilder.length() > 0) && (sBuilder.charAt(sBuilder.length()-1) == '/')) { - sBuilder.deleteCharAt(sBuilder.length()-1); + if ((sBuilder.length() > 0) && (sBuilder.charAt(sBuilder.length() - 1) == '/')) { + sBuilder.deleteCharAt(sBuilder.length() - 1); } String serviceName = sBuilder.toString(); if (serviceName != null && (!serviceName.isEmpty())) { diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/Fault.java b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/Fault.java index fe51ab05..f356275e 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/Fault.java +++ b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/Fault.java @@ -26,10 +26,11 @@ package org.onap.aai.domain.restPolicyException; -import javax.xml.bind.annotation.*; import java.util.ArrayList; import java.util.List; +import javax.xml.bind.annotation.*; + /** * <p> * Java class for anonymous complex type. diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/ObjectFactory.java b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/ObjectFactory.java index d7837f9f..613c76d8 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/ObjectFactory.java +++ b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/ObjectFactory.java @@ -54,8 +54,9 @@ public class ObjectFactory { public ObjectFactory() { } - /**a - * * Create an instance of {@link Fult }. + /** + * a + * * Create an instance of {@link Fult }. * * @return the fault */ diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/PolicyException.java b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/PolicyException.java index ae6b6da1..16f52ef2 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/PolicyException.java +++ b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/PolicyException.java @@ -22,12 +22,13 @@ package org.onap.aai.domain.restPolicyException; import com.fasterxml.jackson.annotation.*; -import javax.annotation.Generated; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.annotation.Generated; + @JsonInclude(JsonInclude.Include.NON_NULL) @Generated("org.jsonschema2pojo") @JsonPropertyOrder({"messageId", "text", "variables"}) diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/RESTResponse.java b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/RESTResponse.java index e1df4512..708a1117 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/RESTResponse.java +++ b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/RESTResponse.java @@ -22,10 +22,11 @@ package org.onap.aai.domain.restPolicyException; import com.fasterxml.jackson.annotation.*; -import javax.annotation.Generated; import java.util.HashMap; import java.util.Map; +import javax.annotation.Generated; + @JsonInclude(JsonInclude.Include.NON_NULL) @Generated("org.jsonschema2pojo") @JsonPropertyOrder({"requestError"}) diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/RequestError.java b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/RequestError.java index 2b041840..717c1059 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/RequestError.java +++ b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restPolicyException/RequestError.java @@ -22,10 +22,11 @@ package org.onap.aai.domain.restPolicyException; import com.fasterxml.jackson.annotation.*; -import javax.annotation.Generated; import java.util.HashMap; import java.util.Map; +import javax.annotation.Generated; + @JsonInclude(JsonInclude.Include.NON_NULL) @Generated("org.jsonschema2pojo") @JsonPropertyOrder({"policyException"}) diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restResponseInfo/Info.java b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restResponseInfo/Info.java index f4a4b47f..3685e5aa 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restResponseInfo/Info.java +++ b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restResponseInfo/Info.java @@ -26,10 +26,11 @@ package org.onap.aai.domain.restResponseInfo; -import javax.xml.bind.annotation.*; import java.util.ArrayList; import java.util.List; +import javax.xml.bind.annotation.*; + /** * <p> * Java class for anonymous complex type. diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/Fault.java b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/Fault.java index 09558455..36a8cb79 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/Fault.java +++ b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/Fault.java @@ -26,10 +26,11 @@ package org.onap.aai.domain.restServiceException; -import javax.xml.bind.annotation.*; import java.util.ArrayList; import java.util.List; +import javax.xml.bind.annotation.*; + /** * <p> * Java class for anonymous complex type. diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/RESTResponse.java b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/RESTResponse.java index d812c37b..a0687637 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/RESTResponse.java +++ b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/RESTResponse.java @@ -22,10 +22,11 @@ package org.onap.aai.domain.restServiceException; import com.fasterxml.jackson.annotation.*; -import javax.annotation.Generated; import java.util.HashMap; import java.util.Map; +import javax.annotation.Generated; + @JsonInclude(JsonInclude.Include.NON_NULL) @Generated("org.jsonschema2pojo") @JsonPropertyOrder({"requestError"}) diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/RequestError.java b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/RequestError.java index 79fca83f..cff5f69d 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/RequestError.java +++ b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/RequestError.java @@ -22,10 +22,11 @@ package org.onap.aai.domain.restServiceException; import com.fasterxml.jackson.annotation.*; -import javax.annotation.Generated; import java.util.HashMap; import java.util.Map; +import javax.annotation.Generated; + @JsonInclude(JsonInclude.Include.NON_NULL) @Generated("org.jsonschema2pojo") @JsonPropertyOrder({"serviceException"}) diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/ServiceException.java b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/ServiceException.java index f215bd58..e3339fae 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/ServiceException.java +++ b/aai-els-onap-logging/src/main/java/org/onap/aai/domain/restServiceException/ServiceException.java @@ -22,12 +22,13 @@ package org.onap.aai.domain.restServiceException; import com.fasterxml.jackson.annotation.*; -import javax.annotation.Generated; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.annotation.Generated; + @JsonInclude(JsonInclude.Include.NON_NULL) @Generated("org.jsonschema2pojo") @JsonPropertyOrder({"messageId", "text", "variables"}) diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/exceptions/AAIException.java b/aai-els-onap-logging/src/main/java/org/onap/aai/exceptions/AAIException.java index 24228e83..320d5630 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/aai/exceptions/AAIException.java +++ b/aai-els-onap-logging/src/main/java/org/onap/aai/exceptions/AAIException.java @@ -22,13 +22,13 @@ package org.onap.aai.exceptions; +import java.util.Collection; +import java.util.LinkedList; + import org.onap.aai.logging.ErrorLogHelper; import org.onap.aai.logging.ErrorObject; import org.onap.aai.logging.ErrorObjectNotFoundException; -import java.util.Collection; -import java.util.LinkedList; - public class AAIException extends Exception { private static final String UPDATE_ERROR_PROPERTIES_BEFORE_USING_THIS_EXCEPTION_CODE = diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/logging/CNName.java b/aai-els-onap-logging/src/main/java/org/onap/aai/logging/CNName.java index 10e4782e..bdf5346d 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/aai/logging/CNName.java +++ b/aai-els-onap-logging/src/main/java/org/onap/aai/logging/CNName.java @@ -20,16 +20,18 @@ package org.onap.aai.logging; +import static java.util.Base64.getDecoder; + import ch.qos.logback.access.pattern.AccessConverter; import ch.qos.logback.access.spi.IAccessEvent; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; + +import java.security.cert.X509Certificate; import javax.security.auth.x500.X500Principal; import javax.servlet.http.HttpServletRequest; -import java.security.cert.X509Certificate; -import static java.util.Base64.getDecoder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class CNName extends AccessConverter { protected static final Logger LOGGER = LoggerFactory.getLogger(CNName.class); diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/logging/ErrorLogHelper.java b/aai-els-onap-logging/src/main/java/org/onap/aai/logging/ErrorLogHelper.java index 1bc33f49..1cdee738 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/aai/logging/ErrorLogHelper.java +++ b/aai-els-onap-logging/src/main/java/org/onap/aai/logging/ErrorLogHelper.java @@ -69,6 +69,7 @@ public class ErrorLogHelper { /** * Load properties. + * * @throws IOException the exception * @throws ErrorObjectFormatException */ @@ -78,9 +79,10 @@ public class ErrorLogHelper { final Properties properties = new Properties(); try (final FileInputStream fis = new FileInputStream(filePath)) { - LOGGER.info("Found the error.properties in the following location: {}", AAIConstants.AAI_HOME_ETC_APP_PROPERTIES); + LOGGER.info("Found the error.properties in the following location: {}", + AAIConstants.AAI_HOME_ETC_APP_PROPERTIES); properties.load(fis); - } catch(Exception ex){ + } catch (Exception ex) { LOGGER.info("Unable to find the error.properties from filesystem so using file in jar"); if (is != null) { properties.load(is); @@ -572,16 +574,16 @@ public class ErrorLogHelper { public static void logException(AAIException e) { final ErrorObject errorObject = e.getErrorObject(); /* - String severityCode = errorObject.getSeverityCode(errorObject.getSeverity()); - - Severify should be left empty per Logging Specification 2019.11 - if (!StringUtils.isEmpty(severityCode)) { - int sevCode = Integer.parseInt(severityCode); - if (sevCode > 0 && sevCode <= 3) { - LoggingContext.severity(sevCode); - } - } - */ + * String severityCode = errorObject.getSeverityCode(errorObject.getSeverity()); + * + * Severify should be left empty per Logging Specification 2019.11 + * if (!StringUtils.isEmpty(severityCode)) { + * int sevCode = Integer.parseInt(severityCode); + * if (sevCode > 0 && sevCode <= 3) { + * LoggingContext.severity(sevCode); + * } + * } + */ String stackTrace = ""; try { stackTrace = LogFormatTools.getStackTop(e); diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/logging/ErrorObject.java b/aai-els-onap-logging/src/main/java/org/onap/aai/logging/ErrorObject.java index 2e849d25..20068e9e 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/aai/logging/ErrorObject.java +++ b/aai-els-onap-logging/src/main/java/org/onap/aai/logging/ErrorObject.java @@ -75,6 +75,7 @@ public class ErrorObject { /** * Instantiates a new error object. + * * @param severity the severity * @param errorCode the error code * @param errorText the error text @@ -305,6 +306,7 @@ public class ErrorObject { public void setDetails(String details) { this.details = details == null ? "" : details; } + /** * Sets the aai els error code. * @@ -313,6 +315,7 @@ public class ErrorObject { public void setAaiElsErrorCode(String elsErrorCode) { aaiElsErrorCode = elsErrorCode; } + /** * Gets the aai els error code. * @@ -321,6 +324,7 @@ public class ErrorObject { public String getAaiElsErrorCode() { return (aaiElsErrorCode); } + /** * Gets the error code string. This is also the string * configured in Nagios to alert on diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/logging/LoggingContext.java b/aai-els-onap-logging/src/main/java/org/onap/aai/logging/LoggingContext.java index 13f324ec..97288af8 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/aai/logging/LoggingContext.java +++ b/aai-els-onap-logging/src/main/java/org/onap/aai/logging/LoggingContext.java @@ -20,14 +20,14 @@ package org.onap.aai.logging; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.slf4j.MDC; - import java.util.HashMap; import java.util.Map; import java.util.concurrent.TimeUnit; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.MDC; + public class LoggingContext { private static final Logger logger = LoggerFactory.getLogger(LoggingContext.class); @@ -43,7 +43,6 @@ public class LoggingContext { public static final Map<String, String> responseMap = new HashMap(); - // Specific Log Event Fields public static enum LoggingField { START_TIME("startTime"), REQUEST_ID("requestId"), SERVICE_INSTANCE_ID("serviceInstanceId"), SERVER_NAME( diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/util/AAIApplicationConfig.java b/aai-els-onap-logging/src/main/java/org/onap/aai/util/AAIApplicationConfig.java index 93969795..a7a87dca 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/aai/util/AAIApplicationConfig.java +++ b/aai-els-onap-logging/src/main/java/org/onap/aai/util/AAIApplicationConfig.java @@ -88,7 +88,8 @@ public class AAIApplicationConfig { TRUSTSTORE_PASSWORD = retrieveTruststorePassword(); KEYSTORE_PASSWORD = retrieveKeystorePassword(); } catch (Exception fnfe) { - final InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("application.properties"); + final InputStream is = + Thread.currentThread().getContextClassLoader().getResourceAsStream("application.properties"); LOGGER.info("Unable to find the application.properties from filesystem so using file in jar"); if (is != null) { try { @@ -108,7 +109,7 @@ public class AAIApplicationConfig { /** * Gets the key value * - * @param key the key + * @param key the key * @param defaultValue the default value * @return the string */ @@ -165,6 +166,7 @@ public class AAIApplicationConfig { public static String getKeystore() throws AAIException { return (get(SERVER_SSL_KEYSTORE_PROP_NAME)); } + /** * Gets the PKCS12 keystore path * @@ -174,6 +176,7 @@ public class AAIApplicationConfig { public static String getKeystorePkcs12() throws AAIException { return (get(SERVER_SSL_KEYSTORE_PKCS12_PROP_NAME)); } + /** * Gets the keystore path * @@ -196,12 +199,12 @@ public class AAIApplicationConfig { } try { certPath = replaceProperties(certPath); - } - catch (AAIException e) { + } catch (AAIException e) { return null; } return (retrieveKeystorePasswordWithCertPath(certPath)); } + /** * Retrieve the keystore password * @@ -236,6 +239,7 @@ public class AAIApplicationConfig { } return keystorePassword; } + /** * Get the keystore password * @@ -244,6 +248,7 @@ public class AAIApplicationConfig { public static String getKeystorePassword() { return (KEYSTORE_PASSWORD); } + /** * Gets the truststore password * @@ -258,7 +263,6 @@ public class AAIApplicationConfig { passphrasesFile = new File(certPath + PASSPHRASSES_FILENAME); passphrasesStream = new FileInputStream(passphrasesFile); - Properties passphrasesProps = new Properties(); passphrasesProps.load(passphrasesStream); truststorePassword = passphrasesProps.getProperty(TRUSTSTORE_PASSWORD_PROP_NAME); @@ -281,6 +285,7 @@ public class AAIApplicationConfig { return truststorePassword; } + /** * Gets the truststore password * @@ -293,8 +298,7 @@ public class AAIApplicationConfig { } try { certPath = replaceProperties(certPath); - } - catch (AAIException e) { + } catch (AAIException e) { return null; } return (retrieveTruststorePasswordWithCertPath(certPath)); @@ -352,17 +356,19 @@ public class AAIApplicationConfig { private static String replaceProperties(String originalValue) throws AAIException { final Pattern p = Pattern.compile(PROPERTY_REGEX); Matcher m = p.matcher(originalValue); - /*if (!m.matches()) { - return originalValue; - }*/ + /* + * if (!m.matches()) { + * return originalValue; + * } + */ StringBuffer sb = new StringBuffer(); - while(m.find()) { + while (m.find()) { String text = m.group(1); String replacement = get(text); m.appendReplacement(sb, replacement); } m.appendTail(sb); - return(sb.toString()); + return (sb.toString()); } public static Properties retrieveKeystoreProps() throws AAIException { @@ -374,7 +380,7 @@ public class AAIApplicationConfig { String keystorePassword = System.getProperty(KEYSTORE_PASSWORD_NAME); String certLocation = System.getProperty(SERVER_CERTS_LOCATION_PROP_NAME); - if (truststorePath == null || truststorePath.isEmpty()){ + if (truststorePath == null || truststorePath.isEmpty()) { truststorePath = AAIApplicationConfig.getTruststore(); } if (truststorePath != null) { @@ -383,8 +389,7 @@ public class AAIApplicationConfig { if (truststorePassword == null || truststorePassword.isEmpty()) { if (certLocation != null && (!certLocation.isEmpty())) { truststorePassword = AAIApplicationConfig.retrieveTruststorePasswordWithCertPath(certLocation); - } - else { + } else { truststorePassword = AAIApplicationConfig.getTruststorePassword(); } @@ -392,23 +397,22 @@ public class AAIApplicationConfig { if (truststorePassword != null) { props.setProperty(TRUSTSTORE_PASSWORD_NAME, truststorePassword); } - if (keystorePath == null || keystorePath.isEmpty()){ + if (keystorePath == null || keystorePath.isEmpty()) { keystorePath = AAIApplicationConfig.getKeystorePkcs12(); } if (keystorePath != null) { props.setProperty(SERVER_SSL_KEYSTORE_PKCS12_PROP_NAME, keystorePath); } - if (keystorePassword == null || keystorePassword.isEmpty()){ + if (keystorePassword == null || keystorePassword.isEmpty()) { if (certLocation != null && (!certLocation.isEmpty())) { keystorePassword = AAIApplicationConfig.retrieveKeystorePasswordWithCertPath(certLocation); - } - else { + } else { keystorePassword = AAIApplicationConfig.getKeystorePassword(); } } if (keystorePassword != null) { props.setProperty(KEYSTORE_PASSWORD_NAME, keystorePassword); } - return(props); + return (props); } } diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/util/AAIConfig.java b/aai-els-onap-logging/src/main/java/org/onap/aai/util/AAIConfig.java index 2428f1e9..106640d8 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/aai/util/AAIConfig.java +++ b/aai-els-onap-logging/src/main/java/org/onap/aai/util/AAIConfig.java @@ -20,15 +20,15 @@ package org.onap.aai.util; -import org.eclipse.jetty.util.security.Password; -import org.onap.aai.exceptions.AAIException; -import org.onap.aai.logging.ErrorLogHelper; - import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.net.InetAddress; import java.util.Properties; + +import org.eclipse.jetty.util.security.Password; +import org.onap.aai.exceptions.AAIException; +import org.onap.aai.logging.ErrorLogHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -90,7 +90,8 @@ public class AAIConfig { propsInitialized = true; serverProps = newServerProps; } catch (Exception fnfe) { - final InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("aaiconfig.properties"); + final InputStream is = + Thread.currentThread().getContextClassLoader().getResourceAsStream("aaiconfig.properties"); LOGGER.info("Unable to find the aaiconfig.properties from filesystem so using file in jar"); if (is != null) { try { diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/util/AAIConfigProxy.java b/aai-els-onap-logging/src/main/java/org/onap/aai/util/AAIConfigProxy.java index faacc527..e79bfec9 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/aai/util/AAIConfigProxy.java +++ b/aai-els-onap-logging/src/main/java/org/onap/aai/util/AAIConfigProxy.java @@ -17,6 +17,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.aai.util; /** @@ -31,11 +32,11 @@ package org.onap.aai.util; // TODO - Find an better name for this interface name public interface AAIConfigProxy { - default String get(String key, String defaultValue){ + default String get(String key, String defaultValue) { return AAIConfig.get(key, defaultValue); } - default int getInt(String key, String defaultValue){ + default int getInt(String key, String defaultValue) { return AAIConfig.getInt(key, defaultValue); } } diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/util/HbaseSaltPrefixer.java b/aai-els-onap-logging/src/main/java/org/onap/aai/util/HbaseSaltPrefixer.java index 95f9c1b7..1708b8c7 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/aai/util/HbaseSaltPrefixer.java +++ b/aai-els-onap-logging/src/main/java/org/onap/aai/util/HbaseSaltPrefixer.java @@ -27,7 +27,7 @@ package org.onap.aai.util; * as these keys are generated in a couple places, I made a class to contain that logic */ public class HbaseSaltPrefixer { - // the number of hbase region servers per cluster + // the number of hbase region servers per cluster private static int NUM_REGION_BUCKETS = 3; private static class SingletonHolder { diff --git a/aai-els-onap-logging/src/main/java/org/onap/aai/util/MapperUtil.java b/aai-els-onap-logging/src/main/java/org/onap/aai/util/MapperUtil.java index d856999e..9373eb71 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/aai/util/MapperUtil.java +++ b/aai-els-onap-logging/src/main/java/org/onap/aai/util/MapperUtil.java @@ -27,6 +27,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule; + import org.onap.aai.exceptions.AAIException; public class MapperUtil { diff --git a/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/AbstractAuditLogFilter.java b/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/AbstractAuditLogFilter.java index ce2f4489..222b98c2 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/AbstractAuditLogFilter.java +++ b/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/AbstractAuditLogFilter.java @@ -21,6 +21,7 @@ package org.onap.logging.filter.base; import javax.servlet.http.HttpServletRequest; + import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/AbstractMetricLogFilter.java b/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/AbstractMetricLogFilter.java index ab1daab5..dea496a5 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/AbstractMetricLogFilter.java +++ b/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/AbstractMetricLogFilter.java @@ -24,6 +24,7 @@ import java.time.ZoneOffset; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; import java.util.UUID; + import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/AbstractServletFilter.java b/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/AbstractServletFilter.java index 28495c84..7f8017f7 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/AbstractServletFilter.java +++ b/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/AbstractServletFilter.java @@ -21,6 +21,7 @@ package org.onap.logging.filter.base; import java.util.Enumeration; + import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.ws.rs.core.HttpHeaders; diff --git a/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/AuditLogContainerFilter.java b/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/AuditLogContainerFilter.java index a0194850..530d53b3 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/AuditLogContainerFilter.java +++ b/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/AuditLogContainerFilter.java @@ -21,15 +21,14 @@ package org.onap.logging.filter.base; import java.io.IOException; + import javax.annotation.Priority; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.container.*; import javax.ws.rs.core.Context; -import javax.ws.rs.ext.Provider; import javax.ws.rs.ext.Providers; + import org.onap.logging.ref.slf4j.ONAPLogConstants; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.slf4j.MDC; @Priority(1) diff --git a/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/AuditLogServletFilter.java b/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/AuditLogServletFilter.java index a8f5eae9..c2d8a96f 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/AuditLogServletFilter.java +++ b/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/AuditLogServletFilter.java @@ -23,6 +23,7 @@ package org.onap.logging.filter.base; import java.io.IOException; + import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; @@ -31,6 +32,7 @@ import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.slf4j.MDC; diff --git a/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/MDCSetup.java b/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/MDCSetup.java index 369a9f20..9b2503b7 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/MDCSetup.java +++ b/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/MDCSetup.java @@ -27,9 +27,11 @@ import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; import java.time.temporal.ChronoUnit; import java.util.UUID; + import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.Response; + import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -86,7 +88,7 @@ public class MDCSetup { return requestId; } if (requestId != null && !requestId.isEmpty()) { - //invalid + // invalid return UUID.randomUUID().toString(); } logger.trace("No valid X-ONAP-RequestID header value. Checking X-RequestID header for requestId."); @@ -95,7 +97,7 @@ public class MDCSetup { return requestId; } if (requestId != null && !requestId.isEmpty()) { - //invalid + // invalid return UUID.randomUUID().toString(); } logger.trace("No valid X-RequestID header value. Checking X-TransactionID header for requestId."); @@ -104,7 +106,7 @@ public class MDCSetup { return requestId; } if (requestId != null && !requestId.isEmpty()) { - //invalid + // invalid return UUID.randomUUID().toString(); } logger.trace("No valid X-TransactionID header value. Checking X-ECOMP-RequestID header for requestId."); @@ -113,11 +115,12 @@ public class MDCSetup { return requestId; } if (requestId != null && !requestId.isEmpty()) { - //invalid + // invalid return UUID.randomUUID().toString(); } return requestId; } + protected boolean isValidUUID(String transId) { try { UUID.fromString(transId); @@ -126,6 +129,7 @@ public class MDCSetup { } return true; } + public void setInvocationId(SimpleMap headers) { String invocationId = headers.get(ONAPLogConstants.Headers.INVOCATION_ID); if (invocationId == null || invocationId.isEmpty()) @@ -200,7 +204,7 @@ public class MDCSetup { } public void clearClientMDCs() { - //MDC.remove(ONAPLogConstants.MDCs.INVOCATION_ID); + // MDC.remove(ONAPLogConstants.MDCs.INVOCATION_ID); MDC.remove(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION); MDC.remove(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE); MDC.remove(ONAPLogConstants.MDCs.RESPONSE_CODE); @@ -230,7 +234,7 @@ public class MDCSetup { logger.info("System property was null or empty. Checking environment variable for: {}", property); propertyValue = System.getenv(property); if (propertyValue == null || propertyValue.isEmpty()) { - logger.info("Environment variable: {} was null or empty", property ); + logger.info("Environment variable: {} was null or empty", property); } } return propertyValue; diff --git a/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/MetricLogClientFilter.java b/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/MetricLogClientFilter.java index da4d9827..986d1895 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/MetricLogClientFilter.java +++ b/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/MetricLogClientFilter.java @@ -25,10 +25,8 @@ import javax.ws.rs.client.ClientRequestContext; import javax.ws.rs.client.ClientRequestFilter; import javax.ws.rs.client.ClientResponseContext; import javax.ws.rs.client.ClientResponseFilter; -import javax.ws.rs.container.PreMatching; import javax.ws.rs.core.Context; import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.ext.Provider; import javax.ws.rs.ext.Providers; @Priority(0) diff --git a/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/ONAPComponents.java b/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/ONAPComponents.java index 06fbba9a..5465b7ce 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/ONAPComponents.java +++ b/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/ONAPComponents.java @@ -24,35 +24,7 @@ import java.util.EnumSet; import java.util.Set; public enum ONAPComponents implements ONAPComponentsList { - OPENSTACK_ADAPTER, - BPMN, - GRM, - AAI, - DMAAP, - POLICY, - CATALOG_DB, - REQUEST_DB, - SNIRO, - SDC, - EXTERNAL, - VNF_ADAPTER, - SDNC_ADAPTER, - MULTICLOUD, - CLAMP, - PORTAL, - VID, - APPC, - DCAE, - HOLMES, - SDNC, - SO, - VFC, - ESR, - DBC, - DR, - MR, - OPTF; - + OPENSTACK_ADAPTER, BPMN, GRM, AAI, DMAAP, POLICY, CATALOG_DB, REQUEST_DB, SNIRO, SDC, EXTERNAL, VNF_ADAPTER, SDNC_ADAPTER, MULTICLOUD, CLAMP, PORTAL, VID, APPC, DCAE, HOLMES, SDNC, SO, VFC, ESR, DBC, DR, MR, OPTF; public static Set<ONAPComponents> getSOInternalComponents() { return EnumSet.of(OPENSTACK_ADAPTER, BPMN, CATALOG_DB, REQUEST_DB, VNF_ADAPTER, SDNC_ADAPTER); diff --git a/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/PayloadLoggingClientFilter.java b/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/PayloadLoggingClientFilter.java index 88c95aa4..1908d45f 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/PayloadLoggingClientFilter.java +++ b/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/PayloadLoggingClientFilter.java @@ -28,6 +28,7 @@ import java.io.InputStream; import java.io.OutputStream; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; + import javax.ws.rs.WebApplicationException; import javax.ws.rs.client.ClientRequestContext; import javax.ws.rs.client.ClientRequestFilter; @@ -38,6 +39,7 @@ import javax.ws.rs.core.MultivaluedHashMap; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.WriterInterceptor; import javax.ws.rs.ext.WriterInterceptorContext; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/PayloadLoggingServletFilter.java b/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/PayloadLoggingServletFilter.java index fa8533a7..cae4ebd6 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/PayloadLoggingServletFilter.java +++ b/aai-els-onap-logging/src/main/java/org/onap/logging/filter/base/PayloadLoggingServletFilter.java @@ -30,6 +30,7 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.zip.GZIPInputStream; + import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; diff --git a/aai-els-onap-logging/src/main/java/org/onap/logging/ref/slf4j/ONAPLogAdapter.java b/aai-els-onap-logging/src/main/java/org/onap/logging/ref/slf4j/ONAPLogAdapter.java index aafc74d4..4670f500 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/logging/ref/slf4j/ONAPLogAdapter.java +++ b/aai-els-onap-logging/src/main/java/org/onap/logging/ref/slf4j/ONAPLogAdapter.java @@ -37,48 +37,56 @@ import org.slf4j.event.Level; * Extensible adapter for cheaply meeting ONAP logging obligations using * an SLF4J facade. * - * <p>This can be used with any SLF4J-compatible logging provider, with - * appropriate provider configuration.</p> + * <p> + * This can be used with any SLF4J-compatible logging provider, with + * appropriate provider configuration. + * </p> * - * <p>The basics are that: + * <p> + * The basics are that: * <ul> - * <li>{@link #entering} sets all MDCs.</li> - * <li>{@link #exiting} unsets all MDCs *and* logs response information.</li> - * <li>{@link #invoke} logs and returns a UUID to passed during invocation, - * and optionally sets these for you on your downstream request by way of - * an adapter.</li> - * <li>Call {@link #getServiceDescriptor()} and its setters to set service-related MDCs.</li> - * <li>Call {@link #getResponseDescriptor()} and its setters to set response-related MDCs.</li> + * <li>{@link #entering} sets all MDCs.</li> + * <li>{@link #exiting} unsets all MDCs *and* logs response information.</li> + * <li>{@link #invoke} logs and returns a UUID to passed during invocation, + * and optionally sets these for you on your downstream request by way of + * an adapter.</li> + * <li>Call {@link #getServiceDescriptor()} and its setters to set service-related MDCs.</li> + * <li>Call {@link #getResponseDescriptor()} and its setters to set response-related MDCs.</li> * </ul> * </p> * - * <p>Minimal usage is: + * <p> + * Minimal usage is: * <ol> - * <li>#entering(RequestAdapter)</li> - * <li>#invoke, #invoke, ...</li> - * <li>#getResponse + setters (or #setResponse)</li> - * <li>#exiting</li> + * <li>#entering(RequestAdapter)</li> + * <li>#invoke, #invoke, ...</li> + * <li>#getResponse + setters (or #setResponse)</li> + * <li>#exiting</li> * </ol> * </p> * - * <p> ... if you're happy for service information to be automatically derived as follows: + * <p> + * ... if you're happy for service information to be automatically derived as follows: * <ul> - * <li><tt>ServiceName</tt> - from <tt>HttpServletRequest#getRequestURI()</tt></li> - * <li><tt>InstanceUUID</tt> - classloader-scope UUID.</li> + * <li><tt>ServiceName</tt> - from <tt>HttpServletRequest#getRequestURI()</tt></li> + * <li><tt>InstanceUUID</tt> - classloader-scope UUID.</li> * </ul> * </p> * - * <p>... and if those defaults don't suit, then you can override using properties on + * <p> + * ... and if those defaults don't suit, then you can override using properties on * {@link #getServiceDescriptor()}, or by injecting your own adapter using * {@link #setServiceDescriptor(ServiceDescriptor)}, or by overriding - * a <tt>protected</tt> methods like{@link #setEnteringMDCs}.</p> + * a <tt>protected</tt> methods like{@link #setEnteringMDCs}. + * </p> * - * <p>For everything else: + * <p> + * For everything else: * <ul> - * <li>The underlying SLF4J {@link Logger} can be retrieved using {@link #unwrap}. - * Use this or create your own using the usual SLF4J factor.</li> - * <li>Set whatever MDCs you like.</li> - * <li>Log whatever else you like.</li> + * <li>The underlying SLF4J {@link Logger} can be retrieved using {@link #unwrap}. + * Use this or create your own using the usual SLF4J factor.</li> + * <li>Set whatever MDCs you like.</li> + * <li>Log whatever else you like.</li> * </ul> * </p> */ @@ -178,8 +186,7 @@ public class ONAPLogAdapter { try { this.mResponseDescriptor.setMDCs(); this.mLogger.info(ONAPLogConstants.Markers.EXIT, EMPTY_MESSAGE); - } - finally { + } finally { MDC.clear(); } return this; @@ -188,8 +195,10 @@ public class ONAPLogAdapter { /** * Report pending invocation with <tt>INVOKE</tt> marker. * - * <p>If you call this variant, then YOU are assuming responsibility for - * setting the requisite ONAP headers.</p> + * <p> + * If you call this variant, then YOU are assuming responsibility for + * setting the requisite ONAP headers. + * </p> * * @param sync whether synchronous. * @return invocation ID to be passed with invocation. @@ -218,8 +227,7 @@ public class ONAPLogAdapter { * @param sync whether synchronous, nullable. * @return invocation ID to be passed with invocation. */ - public UUID invoke(final RequestBuilder builder, - final ONAPLogConstants.InvocationMode sync) { + public UUID invoke(final RequestBuilder builder, final ONAPLogConstants.InvocationMode sync) { // Sync can be defaulted. Builder cannot. @@ -233,8 +241,7 @@ public class ONAPLogAdapter { builder.setHeader(ONAPLogConstants.Headers.REQUEST_ID, defaultToEmpty(MDC.get(ONAPLogConstants.MDCs.REQUEST_ID))); - builder.setHeader(ONAPLogConstants.Headers.INVOCATION_ID, - defaultToEmpty(invocationID)); + builder.setHeader(ONAPLogConstants.Headers.INVOCATION_ID, defaultToEmpty(invocationID)); builder.setHeader(ONAPLogConstants.Headers.PARTNER_NAME, defaultToEmpty(MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME))); @@ -245,15 +252,16 @@ public class ONAPLogAdapter { * Report vanilla <tt>INVOKE</tt> marker. * * @param builder builder for downstream requests, if you want the - * standard ONAP headers to be added automatically. + * standard ONAP headers to be added automatically. * @return invocation ID to be passed with invocation. */ public UUID invoke(final RequestBuilder builder) { - return this.invoke(builder, (ONAPLogConstants.InvocationMode)null); + return this.invoke(builder, (ONAPLogConstants.InvocationMode) null); } /** * Get descriptor, for overriding service details. + * * @return non-null descriptor. */ public ServiceDescriptor getServiceDescriptor() { @@ -262,6 +270,7 @@ public class ONAPLogAdapter { /** * Override {@link ServiceDescriptor}. + * * @param d non-null override. * @return this. */ @@ -272,6 +281,7 @@ public class ONAPLogAdapter { /** * Get descriptor, for setting response details. + * * @return non-null descriptor. */ public ResponseDescriptor getResponseDescriptor() { @@ -280,6 +290,7 @@ public class ONAPLogAdapter { /** * Override {@link ResponseDescriptor}. + * * @param d non-null override. * @return this. */ @@ -297,9 +308,11 @@ public class ONAPLogAdapter { /** * Set MDCs that persist for the duration of an invocation. * - * <p>It would be better to roll this into {@link #entering}, like + * <p> + * It would be better to roll this into {@link #entering}, like * with {@link #exiting}. Then it would be easier to do, but it - * would mean more work. </p> + * would mean more work. + * </p> * * @param request incoming HTTP request. * @return this. @@ -318,8 +331,7 @@ public class ONAPLogAdapter { // ServiceDescriptor to add them. MDC.put(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP, - ZonedDateTime.now(ZoneOffset.UTC) - .format(DateTimeFormatter.ISO_INSTANT)); + ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT)); MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, requestID); MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationID); MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, partnerName); @@ -333,8 +345,8 @@ public class ONAPLogAdapter { // Default the service name to the requestURI, in the event that // no value has been provided. - if (MDC.get(ONAPLogConstants.MDCs.SERVICE_NAME) == null || - MDC.get(ONAPLogConstants.MDCs.SERVICE_NAME).equalsIgnoreCase(EMPTY_MESSAGE)) { + if (MDC.get(ONAPLogConstants.MDCs.SERVICE_NAME) == null + || MDC.get(ONAPLogConstants.MDCs.SERVICE_NAME).equalsIgnoreCase(EMPTY_MESSAGE)) { MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, request.getRequestURI()); } @@ -390,7 +402,9 @@ public class ONAPLogAdapter { /** * Extensible descriptor for reporting service details. * - * <p>In most cases extension isn't required. </p> + * <p> + * In most cases extension isn't required. + * </p> */ public static class ServiceDescriptor { @@ -402,6 +416,7 @@ public class ONAPLogAdapter { /** * Set name. + * * @param name <tt>ServiceName</tt>. * @return this. */ @@ -412,6 +427,7 @@ public class ONAPLogAdapter { /** * Set name. + * * @param uuid <tt>InstanceUUID</tt>. * @return this. */ @@ -507,11 +523,15 @@ public class ONAPLogAdapter { /** * Adapter for reading information from an incoming HTTP request. * - * <p>Incoming is generally easy, because in most cases you'll be able to - * get your hands on the <tt>HttpServletRequest</tt>.</p> + * <p> + * Incoming is generally easy, because in most cases you'll be able to + * get your hands on the <tt>HttpServletRequest</tt>. + * </p> * - * <p>Perhaps should be generalized to refer to constants instead of - * requiring the implementation of specific methods.</p> + * <p> + * Perhaps should be generalized to refer to constants instead of + * requiring the implementation of specific methods. + * </p> * * @param <T> type, for chaining. */ @@ -519,6 +539,7 @@ public class ONAPLogAdapter { /** * Get header by name. + * * @param name header name. * @return header value, or null. */ @@ -526,18 +547,21 @@ public class ONAPLogAdapter { /** * Get client address. + * * @return address, if available. */ String getClientAddress(); /** * Get server address. + * * @return address, if available. */ String getServerAddress(); /** * Get default service name, from service URI. + * * @return service name default. */ String getRequestURI(); @@ -554,6 +578,7 @@ public class ONAPLogAdapter { /** * Construct adapter for HTTP request. + * * @param request to be wrapped; */ public HttpServletRequestAdapter(final HttpServletRequest request) { @@ -598,8 +623,10 @@ public class ONAPLogAdapter { * vary a lot from caller to caller, since they each get to choose their * own REST (or HTTP, or whatever) client APIs. * - * <p>No default implementation, because there's no HTTP client that's - * sufficiently ubiquitous to warrant incurring a mandatory dependency.</p> + * <p> + * No default implementation, because there's no HTTP client that's + * sufficiently ubiquitous to warrant incurring a mandatory dependency. + * </p> * * @param <T> type, for chaining. */ @@ -607,6 +634,7 @@ public class ONAPLogAdapter { /** * Set HTTP header. + * * @param name header name. * @param value header value. * @return this. diff --git a/aai-els-onap-logging/src/main/java/org/onap/logging/ref/slf4j/ONAPLogConstants.java b/aai-els-onap-logging/src/main/java/org/onap/logging/ref/slf4j/ONAPLogConstants.java index 77ca084d..027a99db 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/logging/ref/slf4j/ONAPLogConstants.java +++ b/aai-els-onap-logging/src/main/java/org/onap/logging/ref/slf4j/ONAPLogConstants.java @@ -27,7 +27,9 @@ import org.slf4j.MarkerFactory; /** * Constants for standard ONAP headers, MDCs, etc. * - * <p>See <tt>package-info.java</tt>.</p> + * <p> + * See <tt>package-info.java</tt>. + * </p> */ public final class ONAPLogConstants { @@ -57,7 +59,7 @@ public final class ONAPLogConstants { /** Marker reporting invocation. */ public static final Marker INVOKE = MarkerFactory.getMarker("INVOKE"); - + /** Marker reporting invocation return. */ public static final Marker INVOKE_RETURN = MarkerFactory.getMarker("INVOKE_RETURN"); @@ -75,6 +77,7 @@ public final class ONAPLogConstants { /** * Build nested, detached marker. + * * @param m1 top token. * @param m2 sub-token. * @return detached Marker. @@ -114,7 +117,7 @@ public final class ONAPLogConstants { /** MDC recording target service. */ public static final String TARGET_SERVICE_NAME = "TargetServiceName"; - + /** MDC recording target entity. */ public static final String TARGET_ENTITY = "TargetEntity"; @@ -124,7 +127,7 @@ public final class ONAPLogConstants { /** MDC recording current service instance id. */ public static final String SERVICE_INSTANCE_ID = "ServiceInstanceID"; - /** MDC recording current instance id. */ + /** MDC recording current instance id. */ public static final String INSTANCE_UUID = "InstanceID"; // Network. //////////////////////////////////////////////////////////// @@ -148,14 +151,21 @@ public final class ONAPLogConstants { * MDC recording timestamp at the start of the current request, * with the same scope as {@link #REQUEST_ID}. * - * <p>Open issues: + * <p> + * Open issues: + * <ul> * <ul> - * <ul>Easily confused with {@link #INVOKE_TIMESTAMP}.</ul> - * <ul>No mechanism for propagation between components, e.g. via HTTP headers.</ul> - * <ul>Whatever mechanism we define, it's going to be costly.</ul> + * Easily confused with {@link #INVOKE_TIMESTAMP}. + * </ul> + * <ul> + * No mechanism for propagation between components, e.g. via HTTP headers. + * </ul> + * <ul> + * Whatever mechanism we define, it's going to be costly. + * </ul> * </ul> * </p> - * */ + */ public static final String ENTRY_TIMESTAMP = "EntryTimestamp"; /** MDC recording timestamp at the start of the current invocation. */ @@ -164,7 +174,7 @@ public final class ONAPLogConstants { /** MDC recording elapsed time. */ public static final String ELAPSED_TIME = "ElapsedTime"; - /** MDC recording log timestamp. */ + /** MDC recording log timestamp. */ public static final String LOG_TIMESTAMP = "LogTimestamp"; // Outcomes. /////////////////////////////////////////////////////////// @@ -182,8 +192,8 @@ public final class ONAPLogConstants { public static final String RESPONSE_STATUS_CODE = "StatusCode"; /** MDC recording error code. */ - public static final String ERROR_CODE = "ErrorCode"; - + public static final String ERROR_CODE = "ErrorCode"; + /** MDC recording error description. */ public static final String ERROR_DESC = "ErrorDesc"; @@ -235,7 +245,7 @@ public final class ONAPLogConstants { /** Not. */ ERROR, - + /** In Progress. */ INPROGRESS } diff --git a/aai-els-onap-logging/src/main/java/org/onap/logging/ref/slf4j/package-info.java b/aai-els-onap-logging/src/main/java/org/onap/logging/ref/slf4j/package-info.java index d9a62472..561cc94b 100644 --- a/aai-els-onap-logging/src/main/java/org/onap/logging/ref/slf4j/package-info.java +++ b/aai-els-onap-logging/src/main/java/org/onap/logging/ref/slf4j/package-info.java @@ -9,7 +9,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -22,11 +22,12 @@ package org.onap.logging.ref.slf4j; /** - * <p>Code in here has potential application outside this reference + * <p> + * Code in here has potential application outside this reference * example, and accordingly: * <ul> - * <li>Packaged in <tt>common</tt>.</li> - * <li>Has minimal dependencies.</li> + * <li>Packaged in <tt>common</tt>.</li> + * <li>Has minimal dependencies.</li> * </ul> * </p> - */
\ No newline at end of file + */ |