2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.mso.client.sdnc.sync;
23 import javax.annotation.PostConstruct;
24 import javax.jws.WebService;
25 import javax.servlet.http.HttpServletResponse;
27 import org.openecomp.mso.client.sdnc.beans.SDNCRequest;
28 import org.openecomp.mso.logger.MessageEnum;
29 import org.openecomp.mso.logger.MsoAlarmLogger;
30 import org.openecomp.mso.logger.MsoLogger;
31 import org.openecomp.mso.properties.MsoPropertiesException;
32 import org.openecomp.mso.properties.MsoPropertiesFactory;
34 //BPEL SDNCAdapter SOAP Web Service implementation
35 @WebService(serviceName = "SDNCAdapterService", endpointInterface = "org.openecomp.mso.client.sdnc.sync.SDNCAdapterPortType", targetNamespace = "http://org.openecomp/workflow/sdnc/ad")
36 public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType {
38 private MsoPropertiesFactory msoPropertiesFactory=new MsoPropertiesFactory();
40 private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
41 private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger();
42 private static final String LOG_SERVICE_NAME = "MSO-BPMN:MSO-SDNCAdapter.";
43 private static final String LOG_REPLY_NAME = "MSO-SDNCAdapter:MSO-BPMN.";
44 public static final String MSO_PROP_SDNC_ADAPTER="MSO_PROP_SDNC_ADAPTER";
48 msoLogger.info(MessageEnum.RA_INIT_SDNC_ADAPTER, "SDNC", "SDNCAdapterPortType");
52 * Health Check web method. Does nothing but return to show the adapter is deployed.
55 public void healthCheck ()
57 msoLogger.debug("Health check call in SDNC Adapter");
60 public static String getProperty(String key, String defaultValue, MsoPropertiesFactory msoPropertiesFactoryp) {
63 value = msoPropertiesFactoryp.getMsoJavaProperties(MSO_PROP_SDNC_ADAPTER).getProperty(key, defaultValue);
64 } catch (MsoPropertiesException e) {
65 msoLogger.error (MessageEnum.NO_PROPERTIES, "Unknown. Mso Properties ID not found in cache: " + MSO_PROP_SDNC_ADAPTER, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - Mso Properties ID not found in cache", e);
68 msoLogger.debug("Config read for " + MSO_PROP_SDNC_ADAPTER + " - key:" + key + " value:" + value);
73 public SDNCAdapterResponse sdncAdapter(SDNCRequest bpelRequest) {
74 String bpelReqId = bpelRequest.getRequestId();
75 String callbackUrl = bpelRequest.getCallbackUrl();
76 long startTime = System.currentTimeMillis ();
77 MsoLogger.setLogContext(SDNCRequestIdUtil.getSDNCOriginalRequestId (bpelReqId), bpelRequest.getSvcInstanceId());
78 MsoLogger.setServiceName (bpelRequest.getSvcAction().toString());
79 msoLogger.info(MessageEnum.RA_RECEIVE_BPEL_REQUEST, bpelReqId, callbackUrl, "SDNC", "");
81 SDNCSyncRpcClient sdncClient = new SDNCSyncRpcClient(bpelRequest,msoPropertiesFactory);
82 long subStartTime = System.currentTimeMillis ();
84 Thread sdncClientThread = new Thread(sdncClient);
85 sdncClientThread.start();
88 String respMsg = "Error sending request to SDNC. Failed to start SDNC Client thread " + e.getMessage();
89 msoLogger.error(MessageEnum.RA_SEND_REQUEST_SDNC_ERR, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception sending request to SDNC. Failed to start SDNC Client thread", e);
90 alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, respMsg);
91 SDNCResponse sdncResp = new SDNCResponse(bpelReqId);
92 sdncResp.setRespCode(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
93 sdncResp.setRespMsg(respMsg);
96 msoLogger.debug("Sending synchronous response to BPEL");
97 SDNCAdapterResponse wsResp = new SDNCAdapterResponse();
98 msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
103 public org.openecomp.mso.client.sdnc.sync.SDNCAdapterResponse sdncAdapter(
104 org.openecomp.mso.client.sdnc.sync.SDNCAdapterRequest sdncAdapterRequest) {
105 // TODO Auto-generated method stub