From a96380d2d7ccc93e808ab0c7f4a047095878e254 Mon Sep 17 00:00:00 2001 From: "r.bogacki" Date: Tue, 26 Feb 2019 15:46:22 +0100 Subject: Removed MsoLogger 'so-bpmn-infrastructure-common' Removed MsoLogger from adapters ('so-bpmn-infrastructure-common') Replaced MsoLogger with plain slf4j. Refactored login output. Fixed imports. Change-Id: I52fc6250ccd3ff528e906ac82809fb98c77984a4 Issue-ID: LOG-631 Signed-off-by: Robert Bogacki --- .../aai/groovyflows/AAICreateResources.java | 14 ++++++-------- .../workflow/service/ServicePluginFactory.java | 16 +++++++++------- .../serviceTask/AbstractSdncOperationTask.java | 9 ++++++--- .../SdncNetworkTopologyOperationTask.java | 20 +++++++++++--------- .../SdncServiceTopologyOperationTask.java | 20 +++++++++++--------- .../serviceTask/SdncUnderlayVpnOperationClient.java | 7 +++++-- 6 files changed, 48 insertions(+), 38 deletions(-) (limited to 'bpmn/so-bpmn-infrastructure-common/src/main/java/org') diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java index 6062129a71..0c519ef29f 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAICreateResources.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 @@ -24,23 +26,19 @@ import java.util.HashMap; import java.util.Map; import java.util.Optional; -import javax.ws.rs.NotFoundException; - -import org.onap.aai.domain.yang.ServiceInstance; -import org.onap.aai.domain.yang.ServiceInstances; import org.onap.aai.domain.yang.OwningEntities; import org.onap.aai.domain.yang.OwningEntity; -import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; import org.onap.so.client.aai.AAIObjectPlurals; import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.AAIResourcesClient; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class AAICreateResources { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAICreateResources.class); + private static final Logger logger = LoggerFactory.getLogger(AAICreateResources.class); public void createAAIProject (String projectName, String serviceInstance){ AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, projectName); @@ -73,7 +71,7 @@ public class AAICreateResources { .createResourceUri(AAIObjectPlurals.OWNING_ENTITY) .queryParam("owning-entity-name", owningEntityName)) .orElseGet(() -> { - msoLogger.debug("No Owning Entity matched by name"); + logger.debug("No Owning Entity matched by name"); return null; }); diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java index 477dc34dbd..1f837eb444 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java @@ -64,6 +64,8 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.web.util.UriUtils; import com.fasterxml.jackson.core.JsonProcessingException; @@ -83,7 +85,7 @@ public class ServicePluginFactory { static JsonUtils jsonUtil = new JsonUtils(); - private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ServicePluginFactory.class); + private static Logger logger = LoggerFactory.getLogger(ServicePluginFactory.class); private static ServicePluginFactory instance; @@ -227,7 +229,7 @@ public class ServicePluginFactory { break; } } - LOGGER.debug("Get Terminal TP from InventoryOSS"); + logger.debug("Get Terminal TP from InventoryOSS"); return tpInfoMap; } @@ -685,8 +687,8 @@ public class ServicePluginFactory { try { return mapper.readValue(jsonstr, type); } catch (IOException e) { - LOGGER.error(MessageEnum.RA_NS_EXC, "", "", MsoLogger.ErrorCode.BusinessProcesssError, - "fail to unMarshal json", e); + logger.error("{} {} fail to unMarshal json", MessageEnum.RA_NS_EXC.toString(), + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), e); } return null; } @@ -698,7 +700,7 @@ public class ServicePluginFactory { try { jsonStr = mapper.writeValueAsString(srcObj); } catch (JsonProcessingException e) { - LOGGER.debug("SdcToscaParserException", e); + logger.debug("SdcToscaParserException", e); } return jsonStr; } @@ -745,9 +747,9 @@ public class ServicePluginFactory { try { responseContent = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); } catch (ParseException e) { - LOGGER.debug("ParseException in sendrequest", e); + logger.debug("ParseException in sendrequest", e); } catch (IOException e) { - LOGGER.debug("IOException in sendrequest", e); + logger.debug("IOException in sendrequest", e); } } if (null != method) { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java index 3108adaa53..4f02fe2ec0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.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 @@ -58,8 +60,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; public abstract class AbstractSdncOperationTask extends BaseTask { private static final Logger logger = LoggerFactory.getLogger(AbstractSdncOperationTask.class); - protected static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, AbstractSdncOperationTask.class); - + @Autowired private Environment env; private static final String DEFAULT_MSB_IP = "127.0.0.1"; @@ -282,7 +283,9 @@ public abstract class AbstractSdncOperationTask extends BaseTask { } catch (Exception exception) { logger.info("exception: AbstractSdncOperationTask.updateProgress fail!"); logger.error("exception: AbstractSdncOperationTask.updateProgress fail:", exception); - msoLogger.error(MessageEnum.GENERAL_EXCEPTION, " updateProgress catch exception: ", "", this.getTaskName(), MsoLogger.ErrorCode.UnknownError, exception.getClass().toString()); + logger.error("{} {} {} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), + " updateProgress catch exception: ", this.getTaskName(), + MsoLogger.ErrorCode.UnknownError.getValue(), exception.getClass().toString()); } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java index 3ef1410425..a5c609dc2a 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.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 @@ -41,7 +43,7 @@ import org.springframework.stereotype.Component; @Component public class SdncNetworkTopologyOperationTask extends AbstractSdncOperationTask { - private static final Logger sdncLogger = LoggerFactory.getLogger(SdncNetworkTopologyOperationTask.class); + private static final Logger logger = LoggerFactory.getLogger(SdncNetworkTopologyOperationTask.class); private static final String URL = "/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation"; @@ -50,7 +52,7 @@ public class SdncNetworkTopologyOperationTask extends AbstractSdncOperationTask public void sendRestrequestAndHandleResponse(DelegateExecution execution, Map inputs, GenericResourceApi genericResourceApiClient) throws Exception { - sdncLogger.info("SdncNetworkTopologyOperationTask.sendRestrequestAndHandleResponse begin!"); + logger.info("SdncNetworkTopologyOperationTask.sendRestrequestAndHandleResponse begin!"); updateProgress(execution, RequestsDbConstant.Status.PROCESSING, null, "40", "sendRestrequestAndHandleResponse begin!"); NetworkRpcInputEntityBuilder builder = new NetworkRpcInputEntityBuilder(); RpcNetworkTopologyOperationInputEntity inputEntity = builder.build(execution, inputs); @@ -65,25 +67,25 @@ public class SdncNetworkTopologyOperationTask extends AbstractSdncOperationTask send2SdncDirectly(HeaderUtil.DefaulAuth, inputEntity); } updateProgress(execution, RequestsDbConstant.Status.FINISHED, null, RequestsDbConstant.Progress.ONE_HUNDRED, "execute finished!"); - sdncLogger.info("SdncNetworkTopologyOperationTask.sendRestrequestAndHandleResponse end!"); + logger.info("SdncNetworkTopologyOperationTask.sendRestrequestAndHandleResponse end!"); } private void send2SdncDirectly(String defaulAuth, RpcNetworkTopologyOperationInputEntity inputEntity) throws RouteException { - sdncLogger.info("SdncNetworkTopologyOperationTask.send2SdncDirectly begin!"); + logger.info("SdncNetworkTopologyOperationTask.send2SdncDirectly begin!"); String url = "http://" + getSdncIp() + ":" + getSdncPort() + URL; HttpPost httpPost = new HttpPost(url); httpPost.addHeader("Authorization", defaulAuth); httpPost.addHeader("Content-type", "application/json"); String postBody = getPostbody(inputEntity); - msoLogger.info(MessageEnum.RA_SEND_REQUEST_SDNC, postBody, "SDNC", ""); + logger.info("{} {} {}", MessageEnum.RA_SEND_REQUEST_SDNC, postBody, "SDNC"); httpPost.setEntity(new StringEntity(postBody, ContentType.APPLICATION_XML)); httpPost(url, httpPost); - sdncLogger.info("SdncNetworkTopologyOperationTask.send2SdncDirectly end!"); + logger.info("SdncNetworkTopologyOperationTask.send2SdncDirectly end!"); } private void saveOutput(DelegateExecution execution, RpcNetworkTopologyOperationOutputEntity output) throws RouteException { - sdncLogger.info("SdncNetworkTopologyOperationTask.saveOutput begin!"); + logger.info("SdncNetworkTopologyOperationTask.saveOutput begin!"); String responseCode = output.getOutput().getResponseCode(); if (!"200".equals(responseCode)) { String processKey = getProcessKey(execution); @@ -92,11 +94,11 @@ public class SdncNetworkTopologyOperationTask extends AbstractSdncOperationTask WorkflowException workflowException = new WorkflowException(processKey, errorCode, errorMessage); execution.setVariable("SDNCA_SuccessIndicator", workflowException); updateProgress(execution, RequestsDbConstant.Status.ERROR, String.valueOf(errorCode), "100", errorMessage); - sdncLogger.info("exception: SdncNetworkTopologyOperationTask.saveOutput fail!"); + logger.info("exception: SdncNetworkTopologyOperationTask.saveOutput fail!"); throw new RouteException(); } - sdncLogger.info("SdncNetworkTopologyOperationTask.saveOutput end!"); + logger.info("SdncNetworkTopologyOperationTask.saveOutput end!"); } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java index dc625d35c3..2fd550dbb8 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.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 @@ -42,7 +44,7 @@ import org.springframework.stereotype.Component; @Component public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask { - private static final Logger sdncLogger = LoggerFactory.getLogger(SdncServiceTopologyOperationTask.class); + private static final Logger logger = LoggerFactory.getLogger(SdncServiceTopologyOperationTask.class); private static final String URL = "/restconf/operations/GENERIC-RESOURCE-API:service-topology-operation"; @@ -51,7 +53,7 @@ public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask public void sendRestrequestAndHandleResponse(DelegateExecution execution, Map inputs, GenericResourceApi genericResourceApiClient) throws Exception { - sdncLogger.info("SdncServiceTopologyOperationTask.sendRestrequestAndHandleResponse begin!"); + logger.info("SdncServiceTopologyOperationTask.sendRestrequestAndHandleResponse begin!"); updateProgress(execution, null, null, "40", "sendRestrequestAndHandleResponse begin!"); ServiceRpcInputEntityBuilder builder = new ServiceRpcInputEntityBuilder(); RpcServiceTopologyOperationInputEntity inputEntity = builder.build(execution, inputs); @@ -65,26 +67,26 @@ public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask } else { send2SdncDirectly(HeaderUtil.DefaulAuth, inputEntity); } - sdncLogger.info("SdncServiceTopologyOperationTask.sendRestrequestAndHandleResponse end!"); + logger.info("SdncServiceTopologyOperationTask.sendRestrequestAndHandleResponse end!"); } private void send2SdncDirectly(String defaulAuth, RpcServiceTopologyOperationInputEntity inputEntity) throws RouteException { - sdncLogger.info("SdncServiceTopologyOperationTask.send2SdncDirectly begin!"); + logger.info("SdncServiceTopologyOperationTask.send2SdncDirectly begin!"); String url = getSdncHost() + URL; HttpPost httpPost = new HttpPost(url); httpPost.addHeader("Authorization", defaulAuth); httpPost.addHeader("Content-type", "application/json"); String postBody = getPostbody(inputEntity); - msoLogger.info(MessageEnum.RA_SEND_REQUEST_SDNC, postBody, "SDNC", ""); + logger.info("{} {} {}", MessageEnum.RA_SEND_REQUEST_SDNC, postBody, "SDNC"); httpPost.setEntity(new StringEntity(postBody, ContentType.APPLICATION_XML)); httpPost(url, httpPost); - sdncLogger.info("SdncServiceTopologyOperationTask.send2SdncDirectly end!"); + logger.info("SdncServiceTopologyOperationTask.send2SdncDirectly end!"); } private void saveOutput(DelegateExecution execution, RpcServiceTopologyOperationOutputEntity output) throws Exception { - sdncLogger.info("SdncServiceTopologyOperationTask.saveOutput begin!"); + logger.info("SdncServiceTopologyOperationTask.saveOutput begin!"); String responseCode = output.getOutput().getResponseCode(); if (!"200".equals(responseCode)) { String processKey = getProcessKey(execution); @@ -93,9 +95,9 @@ public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask WorkflowException workflowException = new WorkflowException(processKey, errorCode, errorMessage); execution.setVariable("SDNCA_SuccessIndicator", workflowException); updateProgress(execution, RequestsDbConstant.Status.ERROR, String.valueOf(errorCode), null, errorMessage); - sdncLogger.info("exception: SdncServiceTopologyOperationTask.saveOutput fail!"); + logger.info("exception: SdncServiceTopologyOperationTask.saveOutput fail!"); throw new RouteException(); } - sdncLogger.info("SdncServiceTopologyOperationTask.saveOutput end!"); + logger.info("SdncServiceTopologyOperationTask.saveOutput end!"); } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java index b13d7fc419..f54d6692d6 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.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 @@ -31,8 +33,9 @@ import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.Netwo import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcNetworkTopologyOperationInputEntity; import org.onap.so.db.request.beans.ResourceOperationStatus; import org.onap.so.db.request.beans.ResourceOperationStatusId; -import org.onap.so.logger.MsoLogger; import org.onap.so.requestsdb.RequestsDbConstant; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @Component @@ -41,7 +44,7 @@ public class SdncUnderlayVpnOperationClient { private static final String DEFAULT_MSB_IP = "127.0.0.1"; private static final int DEFAULT_MSB_PORT = 10081; - private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, SdncUnderlayVpnOperationClient.class); + private static Logger logger = LoggerFactory.getLogger(SdncUnderlayVpnOperationClient.class); public boolean excute(String msbIp, int msbPort, -- cgit 1.2.3-korg