diff options
Diffstat (limited to 'adapters/mso-sdnc-adapter/src/main/java')
4 files changed, 32 insertions, 25 deletions
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java index fba1d25a76..e74dd64bb3 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java @@ -66,7 +66,7 @@ public class SDNCAdapterService extends Service { try { logger.info(MessageEnum.RA_PRINT_URL, SDNC_ADAPTER_WSDL, wsdlUrl.toURI().toString(), ""); } catch (Exception e) { - logger.error(MessageEnum.RA_WSDL_URL_CONVENTION_EXC, "SDNCAdapter.wsdl", "", "", MsoLogger.ErrorCode.DataError, "Exception - print URL", e); + logger.error(MessageEnum.RA_WSDL_URL_CONVENTION_EXC, SDNC_ADAPTER_WSDL, "", "", MsoLogger.ErrorCode.DataError, "Exception - print URL", e); } } WSDL_LOCATION = wsdlUrl; diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java index e68bac4178..e4882090bf 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java @@ -45,7 +45,7 @@ import org.onap.so.logger.MsoLogger; public class SDNCCallbackAdapterService extends Service { private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, SDNCCallbackAdapterService.class); - + private static final String SDNC_CALLBACK_ADAPTER_WSDL="SDNCCallbackAdapter.wsdl"; public static final URL WSDL_LOCATION; public static final QName SERVICE = new QName("http://org.onap/workflow/sdnc/adapter/callback/wsdl/v1", "SDNCCallbackAdapterService"); public static final QName SDNCCallbackAdapterSoapHttpPort = new QName("http://org.onap/workflow/sdnc/adapter/callback/wsdl/v1", "SDNCCallbackAdapterSoapHttpPort"); @@ -54,15 +54,15 @@ public class SDNCCallbackAdapterService extends Service { try { wsdlUrl = Thread.currentThread().getContextClassLoader().getResource("main/resources/SDNCCallbackAdapter.wsdl"); } catch (Exception e) { - msoLogger.error(MessageEnum.RA_WSDL_NOT_FOUND, "SDNCCallbackAdapter.wsdl", "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - WSDL not found", e); + msoLogger.error(MessageEnum.RA_WSDL_NOT_FOUND, SDNC_CALLBACK_ADAPTER_WSDL, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - WSDL not found", e); } if(wsdlUrl == null) { - msoLogger.error(MessageEnum.RA_WSDL_NOT_FOUND, "SDNCCallbackAdapter.wsdl", "SDNC", "", MsoLogger.ErrorCode.DataError, "WSDL not found"); + msoLogger.error(MessageEnum.RA_WSDL_NOT_FOUND, SDNC_CALLBACK_ADAPTER_WSDL, "SDNC", "", MsoLogger.ErrorCode.DataError, "WSDL not found"); } else { try { - msoLogger.info(MessageEnum.RA_PRINT_URL, "SDNCCallbackAdapter.wsdl", wsdlUrl.toURI().toString(), "SDNC"); + msoLogger.info(MessageEnum.RA_PRINT_URL, SDNC_CALLBACK_ADAPTER_WSDL, wsdlUrl.toURI().toString(), "SDNC"); } catch (Exception e) { - msoLogger.error(MessageEnum.RA_WSDL_URL_CONVENTION_EXC, "SDNCCallbackAdapter.wsdl", "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - URL convention problem", e); + msoLogger.error(MessageEnum.RA_WSDL_URL_CONVENTION_EXC, SDNC_CALLBACK_ADAPTER_WSDL, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - URL convention problem", e); } } WSDL_LOCATION = wsdlUrl; diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java index 58feaac0e7..71937245bc 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java @@ -5,6 +5,8 @@ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -73,7 +75,9 @@ public class SDNCRestClient{ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,SDNCRestClient.class); private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger(); - + private static final String EXCEPTION_MSG="Exception while evaluate xpath"; + private static final String MSO_INTERNAL_ERROR="MsoInternalError"; + private static final String CAMUNDA="Camunda"; @Async public void executeRequest(SDNCAdapterRequest bpelRequest) { @@ -217,7 +221,7 @@ public class SDNCRestClient{ eType = xpath.evaluate("error-type", error); sdncErrMsg = new StringBuilder(". SDNC Returned-[error-type:" + eType); } catch (Exception e3) { - msoLogger.error (MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-type", error.toString(), "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception while evaluate xpath", e3); + msoLogger.error (MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-type", error.toString(), "SDNC", "", MsoLogger.ErrorCode.DataError, EXCEPTION_MSG, e3); } String eTag = null; @@ -225,7 +229,7 @@ public class SDNCRestClient{ eTag = xpath.evaluate( "error-tag", error); sdncErrMsg.append(", error-tag:").append(eTag); } catch (Exception e3) { - msoLogger.error (MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-tag", error.toString(), "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception while evaluate xpath", e3); + msoLogger.error (MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-tag", error.toString(), "SDNC", "", MsoLogger.ErrorCode.DataError, EXCEPTION_MSG, e3); } String eMsg = null; @@ -233,7 +237,7 @@ public class SDNCRestClient{ eMsg = xpath.evaluate("error-message", error); sdncErrMsg.append(", error-message:").append(eMsg).append("]"); } catch (Exception e3) { - msoLogger.error (MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-message", error.toString(), "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception while evaluate xpath", e3); + msoLogger.error (MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-message", error.toString(), "SDNC", "", MsoLogger.ErrorCode.DataError, EXCEPTION_MSG, e3); } } } catch (Exception e2) { @@ -253,7 +257,7 @@ public class SDNCRestClient{ sdncResp.setRespMsg(respMsg); msoLogger.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with SDNC", e); - alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, respMsg); + alarmLogger.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, respMsg); return sdncResp; } finally @@ -275,15 +279,15 @@ public class SDNCRestClient{ { cbReq.setRequestData(sdncResp.getSdncRespXml()); } - msoLogger.info(MessageEnum.RA_CALLBACK_BPEL.name() + ":\n" + cbReq.toString(), "Camunda", ""); + msoLogger.info(MessageEnum.RA_CALLBACK_BPEL.name() + ":\n" + cbReq.toString(), CAMUNDA, ""); URL wsdlUrl = null; try { wsdlUrl = new URL (bpelUrl); } catch (MalformedURLException e1) { error = "Caught exception initializing Callback wsdl " + e1.getMessage(); - msoLogger.error(MessageEnum.RA_INIT_CALLBACK_WSDL_ERR, "Camunda", "", MsoLogger.ErrorCode.DataError, "Exception initializing Callback wsdl", e1); - alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + msoLogger.error(MessageEnum.RA_INIT_CALLBACK_WSDL_ERR, CAMUNDA, "", MsoLogger.ErrorCode.DataError, "Exception initializing Callback wsdl", e1); + alarmLogger.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, error); } SDNCCallbackAdapterService cbSvc = new SDNCCallbackAdapterService(); @@ -312,8 +316,8 @@ public class SDNCRestClient{ } catch (Exception e2) { error = "Unable to set authorization in callback request " + e2.getMessage(); - msoLogger.error(MessageEnum.RA_SET_CALLBACK_AUTH_EXC, "Camunda", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - Unable to set authorization in callback request", e2); - alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + msoLogger.error(MessageEnum.RA_SET_CALLBACK_AUTH_EXC, CAMUNDA, "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - Unable to set authorization in callback request", e2); + alarmLogger.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, error); } msoLogger.debug("Invoking Bpel Callback. BpelCallbackUrl:" + bpelUrl); @@ -324,9 +328,9 @@ public class SDNCRestClient{ { error = "Error sending BpelCallback request" + e.getMessage(); msoLogger.error("Error " + MsoLogger.ErrorCode.BusinessProcesssError + " - " + MessageEnum.RA_CALLBACK_BPEL_EXC + " - " + error, e); - alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + alarmLogger.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, error); } - msoLogger.info(MessageEnum.RA_CALLBACK_BPEL_COMPLETE.name(), "Camunda", ""); + msoLogger.info(MessageEnum.RA_CALLBACK_BPEL_COMPLETE.name(), CAMUNDA, ""); return; } diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java index 6bd7037ca1..6e4fbd830e 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java @@ -5,6 +5,8 @@ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -68,7 +70,8 @@ import org.springframework.core.env.Environment; public abstract class SDNCConnector { private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,SDNCConnector.class); private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger(); - + private static final String MSO_INTERNAL_ERROR="MsoInternalError"; + private static final String XPATH_EXCEPTION="XPath Exception"; @Autowired private Environment env; @@ -146,7 +149,7 @@ public abstract class SDNCConnector { } logError(errMsg); - ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg); + ALARMLOGGER.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, errMsg); return createErrorResponse(statusCode, errMsg, rt); } @@ -196,13 +199,13 @@ public abstract class SDNCConnector { protected void logError(String errMsg) { LOGGER.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "", MsoLogger.ErrorCode.AvailabilityError, errMsg); - ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg); + ALARMLOGGER.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, errMsg); } protected void logError(String errMsg, Throwable t) { LOGGER.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "", MsoLogger.ErrorCode.AvailabilityError, errMsg, t); - ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg); + ALARMLOGGER.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, errMsg); } /** @@ -286,7 +289,7 @@ public abstract class SDNCConnector { info += "error-type:" + errorType; } catch (XPathExpressionException e) { LOGGER.error(MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-type", error.toString(), "SDNC", "", - MsoLogger.ErrorCode.DataError, "XPath Exception", e); + MsoLogger.ErrorCode.DataError, XPATH_EXCEPTION, e); } try { @@ -297,7 +300,7 @@ public abstract class SDNCConnector { info += "error-tag:" + errorTag; } catch (XPathExpressionException e) { LOGGER.error(MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-tag", error.toString(), "SDNC", "", - MsoLogger.ErrorCode.DataError, "XPath Exception", e); + MsoLogger.ErrorCode.DataError, XPATH_EXCEPTION, e); } try { @@ -308,7 +311,7 @@ public abstract class SDNCConnector { info += "error-message:" + errorMessage; } catch (Exception e) { LOGGER.error(MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-message", error.toString(), "SDNC", "", - MsoLogger.ErrorCode.DataError, "XPath Exception", e); + MsoLogger.ErrorCode.DataError, XPATH_EXCEPTION, e); } if (!info.isEmpty()) { |