aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2019-03-01 21:48:51 +0000
committerGerrit Code Review <gerrit@onap.org>2019-03-01 21:48:51 +0000
commit0f4371f47e72c413b2a28d3a0426bdac49f1291b (patch)
tree952e4b2e16697faaed7b5bbff03fa598ba413ada
parent09b025a1f352b60cab591e467b1a2b56ca856147 (diff)
parent85abd0c592e82eade34ff60a99b923de1385afa0 (diff)
Merge "Removed MsoLogger from 'mso-api-handler-common'"
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java29
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaTaskClient.java11
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/PathResourceResolver.java9
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java11
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java6
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java13
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.java13
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java11
8 files changed, 66 insertions, 37 deletions
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java
index 0ca85f0a06..d3e8323f37 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java
@@ -5,6 +5,7 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (c) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,13 +42,15 @@ import org.onap.so.apihandler.camundabeans.CamundaRequest;
import org.onap.so.apihandler.camundabeans.CamundaVIDRequest;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
public class CamundaClient extends RequestClient{
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, CamundaClient.class);
+ private static Logger logger = LoggerFactory.getLogger(CamundaClient.class);
private static final String CAMUNDA_URL_MESAGE = "Camunda url is: ";
public CamundaClient() {
@@ -60,19 +63,19 @@ public class CamundaClient extends RequestClient{
String requestTimeout, String schemaVersion, String serviceInstanceId, String action)
throws ClientProtocolException, IOException{
HttpPost post = new HttpPost(url);
- msoLogger.debug(CAMUNDA_URL_MESAGE + url);
+ logger.debug(CAMUNDA_URL_MESAGE + url);
String jsonReq = wrapRequest(camundaReqXML, requestId, serviceInstanceId, requestTimeout, schemaVersion);
StringEntity input = new StringEntity(jsonReq);
input.setContentType(CommonConstants.CONTENT_TYPE_JSON);
- msoLogger.info("Camunda Request Content: " + jsonReq);
+ logger.info("Camunda Request Content: {}", jsonReq);
post.setEntity(input);
setupHeaders(post);
HttpResponse response = client.execute(post);
- msoLogger.debug("Response is: " + response);
+ logger.debug("Response is: {}", response);
return response;
}
@@ -98,7 +101,7 @@ public class CamundaClient extends RequestClient{
public HttpResponse post(String jsonReq)
throws ClientProtocolException, IOException{
HttpPost post = new HttpPost(url);
- msoLogger.debug(CAMUNDA_URL_MESAGE + url);
+ logger.debug(CAMUNDA_URL_MESAGE + url);
StringEntity input = new StringEntity(jsonReq);
input.setContentType(CommonConstants.CONTENT_TYPE_JSON);
@@ -118,7 +121,7 @@ public class CamundaClient extends RequestClient{
post.setEntity(input);
HttpResponse response = client.execute(post);
- msoLogger.debug("Response is: " + response);
+ logger.debug("Response is: {}", response);
return response;
}
@@ -126,7 +129,7 @@ public class CamundaClient extends RequestClient{
public HttpResponse post(RequestClientParameter parameterObject)
throws ClientProtocolException, IOException{
HttpPost post = new HttpPost(url);
- msoLogger.debug(CAMUNDA_URL_MESAGE+ url);
+ logger.debug(CAMUNDA_URL_MESAGE+ url);
String jsonReq = wrapVIDRequest(parameterObject.getRequestId(), parameterObject.isBaseVfModule(), parameterObject.getRecipeTimeout(), parameterObject.getRequestAction(),
parameterObject.getServiceInstanceId(), parameterObject.getPnfCorrelationId(), parameterObject.getVnfId(), parameterObject.getVfModuleId(), parameterObject.getVolumeGroupId(), parameterObject.getNetworkId(), parameterObject.getConfigurationId(),
parameterObject.getServiceType(), parameterObject.getVnfType(), parameterObject.getVfModuleType(), parameterObject.getNetworkType(), parameterObject.getRequestDetails(), parameterObject.getApiVersion(), parameterObject.isaLaCarte(), parameterObject.getRequestUri(), parameterObject.getRecipeParamXsd(),
@@ -151,7 +154,7 @@ public class CamundaClient extends RequestClient{
post.setEntity(input);
HttpResponse response = client.execute(post);
- msoLogger.debug("Response is: " + response);
+ logger.debug("Response is: {}", response);
return response;
}
@@ -189,9 +192,10 @@ public class CamundaClient extends RequestClient{
mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
jsonReq = mapper.writeValueAsString(camundaRequest);
- msoLogger.trace("request body is " + jsonReq);
+ logger.trace("request body is {}", jsonReq);
}catch(Exception e){
- msoLogger.error(MessageEnum.APIH_WARP_REQUEST, "Camunda", "wrapRequest", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH Warp request", e);
+ logger.error("{} {} {} {} {}", MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", "wrapRequest",
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e);
}
return jsonReq;
}
@@ -281,9 +285,10 @@ public class CamundaClient extends RequestClient{
mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
jsonReq = mapper.writeValueAsString(camundaRequest);
- msoLogger.trace("request body is " + jsonReq);
+ logger.trace("request body is {}", jsonReq);
}catch(Exception e){
- msoLogger.error(MessageEnum.APIH_WARP_REQUEST, "Camunda", "wrapVIDRequest", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH Warp request", e);
+ logger.error("{} {} {} {} {}", MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", "wrapVIDRequest",
+ MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e);
}
return jsonReq;
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaTaskClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaTaskClient.java
index bb0a4b0172..d8c785dcb3 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaTaskClient.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaTaskClient.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -28,10 +30,11 @@ import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class CamundaTaskClient extends RequestClient{
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, CamundaTaskClient.class);
+ private static Logger logger = LoggerFactory.getLogger(CamundaTaskClient.class);
public CamundaTaskClient() {
super(CommonConstants.CAMUNDATASK);
@@ -40,7 +43,7 @@ public class CamundaTaskClient extends RequestClient{
@Override
public HttpResponse post(String jsonReq) throws IOException{
HttpPost post = new HttpPost(url);
- msoLogger.debug("Camunda Task url is: "+ url);
+ logger.debug("Camunda Task url is: {}", url);
StringEntity input = new StringEntity(jsonReq);
input.setContentType(CommonConstants.CONTENT_TYPE_JSON);
@@ -75,7 +78,7 @@ public class CamundaTaskClient extends RequestClient{
@Override
public HttpResponse get() throws IOException {
HttpGet get = new HttpGet(url);
- msoLogger.debug("Camunda Task url is: "+ url);
+ logger.debug("Camunda Task url is: {}", url);
String encryptedCredentials;
if(props!=null){
encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH);
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/PathResourceResolver.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/PathResourceResolver.java
index 4e37561891..ee1ea8e562 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/PathResourceResolver.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/PathResourceResolver.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -26,13 +28,14 @@ import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.InputStreamReader;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.w3c.dom.ls.LSInput;
import org.w3c.dom.ls.LSResourceResolver;
public class PathResourceResolver implements LSResourceResolver {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, PathResourceResolver.class);
+ private static Logger logger = LoggerFactory.getLogger(PathResourceResolver.class);
private String path;
@@ -50,7 +53,7 @@ public class PathResourceResolver implements LSResourceResolver {
try {
stream = new FileInputStream(path + systemId);
} catch (FileNotFoundException e) {
- msoLogger.debug ("Could not resolve resource based on file: " + path + systemId, e);
+ logger.debug ("Could not resolve resource based on file: {}", path + systemId, e);
}
input.setPublicId(publicId);
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java
index ca1ad7a277..9f5c8460a1 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClient.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -26,12 +28,13 @@ import java.security.GeneralSecurityException;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.utils.CryptoUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.core.env.Environment;
public abstract class RequestClient {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH,RequestClient.class);
+ private static Logger logger = LoggerFactory.getLogger(RequestClient.class);
protected Environment props;
protected String url;
protected HttpClient client;
@@ -80,7 +83,7 @@ public abstract class RequestClient {
return result;
}
catch (GeneralSecurityException e) {
- msoLogger.debug("Security exception", e);
+ logger.debug("Security exception", e);
}
return defaultValue;
}
@@ -91,7 +94,7 @@ public abstract class RequestClient {
return result;
}
catch (GeneralSecurityException e) {
- msoLogger.debug("Security exception", e);
+ logger.debug("Security exception", e);
}
return defaultValue;
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java
index 0cac7db404..3d09a30731 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -37,6 +39,8 @@ import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class ResponseHandler {
@@ -45,7 +49,7 @@ public class ResponseHandler {
private String responseBody="";
private HttpResponse httpResponse;
private int type;
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, ResponseHandler.class);
+ private static Logger logger = LoggerFactory.getLogger(ResponseHandler.class);
public ResponseHandler(HttpResponse httpResponse, int type) throws ApiException{
this.httpResponse = httpResponse;
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java
index 414ac8b3cc..da13ff509b 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -35,6 +37,8 @@ import org.apache.commons.io.IOUtils;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.xml.sax.SAXException;
public class XMLValidator {
@@ -54,7 +58,7 @@ public class XMLValidator {
private SchemaFactory factory;
private Schema schema;
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, XMLValidator.class);
+ private static Logger logger = LoggerFactory.getLogger(XMLValidator.class);
public XMLValidator (String xsdFile){
@@ -73,7 +77,7 @@ public class XMLValidator {
} catch (IOException | SAXException e) {
- msoLogger.debug ("Cannot open file " + XSDS_PATH + xsdFile, e);
+ logger.debug ("Cannot open file {}", XSDS_PATH + xsdFile, e);
errorMsg = "ErrorDetails: xsd file " + xsdFile + "could not be opened - " + e.getMessage ();
}
}
@@ -89,11 +93,12 @@ public class XMLValidator {
validator.validate (src2);
} catch (IOException | SAXException e) {
- msoLogger.debug ("Exception: ", e);
+ logger.debug ("Exception: ", e);
return "ErrorDetails: " + e.getMessage ();
} catch (Exception e) {
- msoLogger.error (MessageEnum.APIH_CANNOT_READ_SCHEMA, "", "", MsoLogger.ErrorCode.SchemaError, "APIH cannot read schema file", e);
+ logger.error("{} {} {}", MessageEnum.APIH_CANNOT_READ_SCHEMA.toString(),
+ MsoLogger.ErrorCode.SchemaError.getValue(), "APIH cannot read schema file", e);
return "ErrorDetails: " + "Unable to read the schema file";
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.java
index d801a94c9b..aeed65b3c3 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/recipe/CamundaClientErrorHandler.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -22,7 +24,8 @@ package org.onap.so.apihandler.recipe;
import java.io.IOException;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.web.client.ResponseErrorHandler;
@@ -31,14 +34,12 @@ import org.springframework.web.client.ResponseErrorHandler;
public class CamundaClientErrorHandler implements ResponseErrorHandler{
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, CamundaClientErrorHandler.class);
+ private static Logger logger = LoggerFactory.getLogger(CamundaClientErrorHandler.class);
@Override
public void handleError(ClientHttpResponse response) throws IOException {
-
- msoLogger.debug(response.getBody().toString());
- //msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.ERROR,
- // MsoLogger.ResponseCode.CommunicationError, e.getMessage(), "BPMN", fullURL, null);
+
+ logger.debug(response.getBody().toString());
}
@Override
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java
index ef19852cd1..282ca12e2b 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -48,11 +50,13 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
@Provider
public class ApiExceptionMapper implements ExceptionMapper<ApiException> {
- private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, ApiExceptionMapper.class);
+ private static Logger logger = LoggerFactory.getLogger(ApiExceptionMapper.class);
private final JAXBContext context;
@@ -132,7 +136,8 @@ public class ApiExceptionMapper implements ExceptionMapper<ApiException> {
}
} catch (JsonProcessingException | JAXBException e) {
String errorMsg = "Exception in buildServiceErrorResponse writing exceptionType to string " + e.getMessage();
- logger.error(MessageEnum.GENERAL_EXCEPTION, "BuildServiceErrorResponse", "", "", MsoLogger.ErrorCode.DataError, errorMsg, e);
+ logger.error("{} {} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), "BuildServiceErrorResponse",
+ MsoLogger.ErrorCode.DataError.getValue(), errorMsg, e);
return errorMsg;
}
@@ -141,7 +146,7 @@ public class ApiExceptionMapper implements ExceptionMapper<ApiException> {
protected void writeErrorLog(Exception e, String errorText, ErrorLoggerInfo errorLogInfo) {
if( e!= null)
- logger.error(e);
+ logger.error("Exception occurred", e);
if(errorLogInfo != null)
logger.error(errorLogInfo.getLoggerMessageType().toString(), errorLogInfo.getErrorSource(), errorLogInfo.getTargetEntity(), errorLogInfo.getTargetServiceName(), errorLogInfo.getErrorCode(), errorText);