Removed MsoLogger class
[so.git] / bpmn / MSOCommonBPMN / src / main / groovy / org / onap / so / bpmn / common / scripts / CatalogDbUtils.groovy
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Modifications Copyright (c) 2019 Samsung
8  * ================================================================================
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  * ============LICENSE_END=========================================================
21  */
22
23 package org.onap.so.bpmn.common.scripts
24
25 import org.apache.commons.lang3.StringUtils
26 import org.camunda.bpm.engine.delegate.DelegateExecution
27 import org.json.JSONArray
28 import org.json.JSONObject
29 import org.onap.logging.ref.slf4j.ONAPLogConstants
30 import org.onap.so.bpmn.core.UrnPropertiesReader
31 import org.onap.so.bpmn.core.json.JsonUtils
32 import org.onap.so.client.HttpClient
33 import org.onap.so.client.HttpClientFactory
34 import org.onap.so.logger.ErrorCode
35 import org.onap.so.logger.MessageEnum
36
37 import org.slf4j.Logger
38 import org.slf4j.LoggerFactory
39 import org.onap.so.utils.TargetEntity
40 import org.springframework.web.util.UriUtils
41
42 import javax.ws.rs.core.MediaType
43 import javax.ws.rs.core.Response
44
45 /***
46  * Utilities for accessing Catalog DB Adapter to retrieve Networks, VNF/VFModules, AllottedResources and complete ServiceResources information
47  *
48  */
49
50 class CatalogDbUtils {
51     private static final Logger logger = LoggerFactory.getLogger( CatalogDbUtils.class);
52
53         private HttpClientFactory httpClientFactory
54         private MsoUtils msoUtils
55         private  JsonUtils jsonUtils
56         static private String defaultDbAdapterVersion = "v2"
57
58         CatalogDbUtils(HttpClientFactory httpClientFactory, MsoUtils msoUtils, JsonUtils jsonUtils) {
59                 this.httpClientFactory = httpClientFactory
60                 this.msoUtils = msoUtils
61                 this.jsonUtils = jsonUtils
62         }
63
64         public JSONArray getAllVnfsByVnfModelCustomizationUuid(DelegateExecution execution, String vnfModelCustomizationUuid, String catalogUtilsVersion) {
65                 JSONArray vnfsList = null
66                 String endPoint = "/serviceVnfs?vnfModelCustomizationUuid=" + UriUtils.encode(vnfModelCustomizationUuid, "UTF-8")
67                 try {
68                         logger.debug("ENDPOINT: " + endPoint)
69                         String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
70
71                         if (catalogDbResponse != null) {
72                                 if (!catalogUtilsVersion.equals("v1")) {
73                                         JSONObject responseJson = new JSONObject(catalogDbResponse)
74                                         vnfsList = responseJson.getJSONArray("serviceVnfs")
75                                 }
76                                 else {
77                                         vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", catalogUtilsVersion)
78                                 }
79                         }
80
81                 }
82                 catch (Exception e) {
83                         logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
84                                         "Exception in Querying Catalog DB", "BPMN",
85                                         ErrorCode.UnknownError.getValue(), e.message);
86                         throw e
87                 }
88
89                 return vnfsList
90         }
91
92         public JSONObject getServiceResourcesByServiceModelUuid(DelegateExecution execution, String serviceModelUuid, String catalogUtilsVersion) {
93                 JSONObject resources = null
94                 String endPoint = "/serviceResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")
95                 try {
96                         String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
97
98                         if (catalogDbResponse != null) {
99                                 if (!catalogUtilsVersion.equals("v1")) {
100                                         resources = new JSONObject(catalogDbResponse)
101                                 }
102                                 else {
103                                         resources = parseServiceResourcesJson(catalogDbResponse, catalogUtilsVersion)
104                                 }
105                         }
106                 }
107                 catch (Exception e) {
108                         msoUtils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
109                         throw e
110                 }
111
112                 return resources
113         }
114
115         public String getServiceResourcesByServiceModelInvariantUuidString(DelegateExecution execution, String serviceModelInvariantUuid) {
116                 String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
117                 try {
118                         return getResponseFromCatalogDb(execution, endPoint)
119                 }
120                 catch (Exception e) {
121                         logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
122                                         "Exception in Querying Catalog DB", "BPMN",
123                                         ErrorCode.UnknownError.getValue(), e.message);
124                         throw e
125                 }
126         }
127
128         public JSONObject getServiceResourcesByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid, String catalogUtilsVersion) {
129                 JSONObject resources = null
130                 String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
131                 try {
132                         String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
133
134                         if (catalogDbResponse != null) {
135                                 if (!catalogUtilsVersion.equals("v1")) {
136                                         resources = new JSONObject(catalogDbResponse)
137                                 }
138                                 else {
139                                         resources = parseServiceResourcesJson(catalogDbResponse, catalogUtilsVersion)
140                                 }
141                         }
142
143                 }
144                 catch (Exception e) {
145                         logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
146                                         "Exception in Querying Catalog DB", "BPMN",
147                                         ErrorCode.UnknownError.getValue(), e.message);
148                         throw e
149                 }
150
151                 return resources
152         }
153
154         public JSONObject getServiceResourcesByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) {
155                 JSONObject resources = null
156                 String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")
157                 try {
158                         String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
159
160                         if (catalogDbResponse != null) {
161                                 if (!catalogUtilsVersion.equals("v1")) {
162                                         resources = new JSONObject(catalogDbResponse)
163                                 }
164                                 else {
165                                         resources = parseServiceResourcesJson(catalogDbResponse, catalogUtilsVersion)
166                                 }
167                         }
168
169                 }
170                 catch (Exception e) {
171                         logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
172                                         "Exception in Querying Catalog DB", "BPMN",
173                                         ErrorCode.UnknownError.getValue(), e.message);
174                         throw e
175                 }
176
177                 return resources
178         }
179
180         private JSONArray parseNetworksJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) {
181                 JSONArray modelInfos = null
182
183                 logger.debug("parseNetworksJson - catalogUtilsVersion is " + catalogUtilsVersion)
184                 try {
185                         // Create array of jsons
186
187                         JSONObject responseJson = new JSONObject(catalogDbResponse)
188                         JSONArray networks = responseJson.getJSONArray(arrayName)
189                         modelInfos = new JSONArray()
190
191                         for (int i = 0; i < networks.length(); i++) {
192
193                                 JSONObject network = networks.getJSONObject(i)
194                                 JSONObject modelJson = new JSONObject()
195                                 JSONObject modelInfo = buildModelInfo("network", network, catalogUtilsVersion)
196                                 modelJson.put("modelInfo", modelInfo)
197                                 String networkType = jsonUtils.getJsonValueForKey(network, "networkType")
198                                 modelJson.put("networkType", networkType)
199
200                                 switch (catalogUtilsVersion) {
201                                         case "v1":
202                                                 break
203                                         default:
204                                                 String toscaNodeType = jsonUtils.getJsonValueForKey(network, "toscaNodeType")
205                                                 modelJson.put("toscaNodeType", toscaNodeType)
206                                                 String networkTechnology = jsonUtils.getJsonValueForKey(network, "networkTechnology")
207                                                 modelJson.put("networkTechnology", networkTechnology)
208                                                 String networkRole = jsonUtils.getJsonValueForKey(network, "networkRole")
209                                                 modelJson.put("networkRole", networkRole)
210                                                 String networkScope = jsonUtils.getJsonValueForKey(network, "networkScope")
211                                                 modelJson.put("networkScope", networkScope)
212                                                 break
213                                 }
214                                 modelInfos.put(modelJson)
215                         }
216
217                         String modelInfosString = modelInfos.toString()
218                         logger.debug("Returning networks JSON: " + modelInfosString)
219
220                 } catch (Exception e) {
221                         logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
222                                         "Exception in parsing Catalog DB Response", "BPMN",
223                                         ErrorCode.UnknownError.getValue(), e.message);
224                 }
225
226                 return modelInfos
227         }
228
229         private JSONArray parseVnfsJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) {
230                 JSONArray modelInfos = null
231
232                 logger.debug("parseVnfsJson - catalogUtilsVersion is " + catalogUtilsVersion)
233
234                 try {
235                         // Create array of jsons
236
237                         JSONObject responseJson = new JSONObject(catalogDbResponse)
238                         JSONArray vnfs = responseJson.getJSONArray(arrayName)
239                         modelInfos = new JSONArray()
240
241                         for (int i = 0; i < vnfs.length(); i++) {
242                                 JSONObject vnf = vnfs.getJSONObject(i)
243
244                                 logger.debug(vnf.toString(2))
245                                 JSONObject modelInfo = buildModelInfo("vnf", vnf, catalogUtilsVersion)
246                                 JSONObject modelJson = new JSONObject()
247                                 modelJson.put("modelInfo", modelInfo)
248                                 switch(catalogUtilsVersion) {
249                                         case "v1":
250                                                 break
251                                         default:
252                                                 String toscaNodeType = jsonUtils.getJsonValueForKey(vnf, "toscaNodeType")
253                                                 modelJson.put("toscaNodeType", toscaNodeType)
254                                                 String nfType = jsonUtils.getJsonValueForKey(vnf, "nfType")
255                                                 modelJson.put("nfType", nfType)
256                                                 String nfRole = jsonUtils.getJsonValueForKey(vnf, "nfRole")
257                                                 modelJson.put("nfRole", nfRole)
258                                                 String nfCode = jsonUtils.getJsonValueForKey(vnf, "nfCode")
259                                                 modelJson.put("nfNamingCode", nfCode)
260                                                 String nfFunction = jsonUtils.getJsonValueForKey(vnf, "nfFunction")
261                                                 modelJson.put("nfFunction", nfFunction)
262                                                 String multiStageDesign = jsonUtils.getJsonValueForKey(vnf, "multiStageDesign")
263                                                 modelJson.put("multiStageDesign", multiStageDesign)
264                                                 break
265                                 }
266
267                                 JSONArray vfModules = null
268                                 try {
269                                         vfModules = vnf.getJSONArray("vfModules")
270                                 } catch (Exception e)
271                                 {
272                                         logger.debug("Cannot find VF MODULE ARRAY: " + i + ", exception is " + e.message)
273                                 }
274
275                                 if (vfModules != null) {
276                                         JSONArray vfModuleInfo = new JSONArray()
277                                         for (int j = 0; j < vfModules.length(); j++) {
278                                                 JSONObject vfModule = vfModules.getJSONObject(j)
279                                                 JSONObject vfModuleModelInfo = buildModelInfo("vfModule", vfModule, catalogUtilsVersion)
280                                                 JSONObject vfModuleModelJson = new JSONObject()
281                                                 vfModuleModelJson.put("modelInfo", vfModuleModelInfo)
282                                                 String vfModuleType = jsonUtils.getJsonValueForKey(vfModule, "type")
283                                                 vfModuleModelJson.put("vfModuleType", vfModuleType)
284                                                 vfModuleModelJson.put("isBase", jsonUtils.getJsonBooleanValueForKey(vfModule, "isBase"))
285                                                 String vfModuleLabel = jsonUtils.getJsonValueForKey(vfModule, "label")
286                                                 vfModuleModelJson.put("vfModuleLabel", vfModuleLabel)
287                                                 Integer initialCount = jsonUtils.getJsonIntValueForKey(vfModule, "initialCount")
288                                                 vfModuleModelJson.put("initialCount", initialCount.intValue())
289                                                 vfModuleInfo.put(vfModuleModelJson)
290                                         }
291                                         modelJson.put("vfModules", vfModuleInfo)
292                                 }
293                                 modelInfos.put(modelJson)
294                         }
295
296                         String modelInfosString = modelInfos.toString()
297                         logger.debug("Returning vnfs JSON: " + modelInfosString)
298
299                 } catch (Exception e) {
300                         logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
301                                         "Exception in parsing Catalog DB Response", "BPMN",
302                                         ErrorCode.UnknownError.getValue(), e.message);
303                 }
304
305                 return modelInfos
306         }
307
308         private JSONArray parseAllottedResourcesJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) {
309                 JSONArray modelInfos = null
310
311                 logger.debug("parseAllottedResourcesJson - catalogUtilsVersion is " + catalogUtilsVersion)
312
313                 try {
314                         // Create array of jsons
315
316                         JSONObject responseJson = new JSONObject(catalogDbResponse)
317                         JSONArray allottedResources = responseJson.getJSONArray(arrayName)
318                         modelInfos = new JSONArray()
319
320                         for (int i = 0; i < allottedResources.length(); i++) {
321                                 JSONObject allottedResource = allottedResources.getJSONObject(i)
322                                 JSONObject modelInfo = buildModelInfo("allottedResource", allottedResource, catalogUtilsVersion)
323                                 JSONObject modelJson = new JSONObject()
324                                 modelJson.put("modelInfo", modelInfo)
325                                 switch(catalogUtilsVersion) {
326                                         case "v1":
327                                                 break
328                                         default:
329                                                 String toscaNodeType = jsonUtils.getJsonValueForKey(allottedResource, "toscaNodeType")
330                                                 modelJson.put("toscaNodeType", toscaNodeType)
331                                                 String nfType = jsonUtils.getJsonValueForKey(allottedResource, "nfType")
332                                                 modelJson.put("nfType", nfType)
333                                                 String nfRole = jsonUtils.getJsonValueForKey(allottedResource, "nfRole")
334                                                 modelJson.put("nfRole", nfRole)
335                                                 String nfCode = jsonUtils.getJsonValueForKey(allottedResource, "nfCode")
336                                                 modelJson.put("nfNamingCode", nfCode)
337                                                 String nfFunction = jsonUtils.getJsonValueForKey(allottedResource, "nfFunction")
338                                                 modelJson.put("nfFunction", nfFunction)
339                                                 String providingServiceModelName = jsonUtils.getJsonValueForKey(allottedResource, "providingServiceModelName")
340                                                 modelJson.put("providingServiceModelName", providingServiceModelName)
341                                                 String providingServiceModelUuid = jsonUtils.getJsonValueForKey(allottedResource, "providingServiceModelUuid")
342                                                 modelJson.put("providingServiceModelUuid", providingServiceModelUuid)
343                                                 break
344                                 }
345
346
347                                 modelInfos.put(modelJson)
348                         }
349
350                         String modelInfosString = modelInfos.toString()
351                         logger.debug("Returning allottedResources JSON: " + modelInfosString)
352
353                 } catch (Exception e) {
354                         logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
355                                         "Exception in parsing Catalog DB Response", "BPMN",
356                                         ErrorCode.UnknownError.getValue(), e.message);
357                 }
358
359                 return modelInfos
360         }
361
362         private JSONObject parseServiceResourcesJson (String catalogDbResponse, String catalogUtilsVersion) {
363                 JSONObject serviceResources = new JSONObject()
364                 JSONObject serviceResourcesObject = new JSONObject()
365
366                 try {
367                         // Create array of jsons
368
369                         JSONObject responseJson = new JSONObject(catalogDbResponse)
370                         JSONObject serviceResourcesRoot = responseJson.getJSONObject("serviceResources")
371                         JSONObject modelInfo = buildModelInfo("", serviceResourcesRoot, catalogUtilsVersion)
372                         serviceResources.put("modelInfo", modelInfo)
373                         JSONArray vnfsArray = parseVnfsJson(serviceResourcesRoot.toString(), "serviceVnfs", catalogUtilsVersion)
374                         serviceResources.put("serviceVnfs", vnfsArray)
375                         JSONArray networksArray = parseNetworksJson(serviceResourcesRoot.toString(), "serviceNetworks", catalogUtilsVersion)
376                         serviceResources.put("serviceNetworks", networksArray)
377                         JSONArray allottedResourcesArray = parseAllottedResourcesJson(serviceResourcesRoot.toString(), "serviceAllottedResources", catalogUtilsVersion)
378                         serviceResources.put("serviceAllottedResources", allottedResourcesArray)
379                         serviceResourcesObject.put("serviceResources", serviceResources)
380                         logger.debug("Returning serviceResources JSON: " + serviceResourcesObject.toString())
381
382                 } catch (Exception e) {
383                         logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
384                                         "Exception in parsing Catalog DB Response", "BPMN",
385                                         ErrorCode.UnknownError.getValue(), e.message);
386                 }
387
388                 return serviceResourcesObject
389         }
390
391         private JSONObject buildModelInfo(String modelType, JSONObject modelFromDb, String catalogUtilsVersion) {
392                 JSONObject modelInfo = null
393                 try {
394                         modelInfo = new JSONObject()
395                         modelInfo.put("modelType", modelType)
396                         String modelInvariantId = jsonUtils.getJsonValueForKey(modelFromDb, "modelInvariantUuid")
397                         modelInfo.put("modelInvariantId", modelInvariantId)
398                         if(modelType.equalsIgnoreCase("allottedResource") || modelType.equalsIgnoreCase("vnf")){
399                                 String modelInstanceName = jsonUtils.getJsonValueForKey(modelFromDb, "modelInstanceName")
400                                 modelInfo.put("modelInstanceName", modelInstanceName)
401                         }
402                         if ((!"vfModule".equals(modelType) && !"vnf".equals(modelType)) || !catalogUtilsVersion.equals("v1")) {
403                                 String modelVersionId = jsonUtils.getJsonValueForKey(modelFromDb, "modelUuid")
404                                 modelInfo.put("modelVersionId", modelVersionId)
405                         }
406                         else {
407                                 String modelVersionId = jsonUtils.getJsonValueForKey(modelFromDb, "asdcUuid")
408                                 modelInfo.put("modelVersionId", modelVersionId)
409                         }
410                         String modelName = jsonUtils.getJsonValueForKey(modelFromDb, "modelName")
411                         modelInfo.put("modelName", modelName)
412                         String modelVersion = jsonUtils.getJsonValueForKey(modelFromDb, "modelVersion")
413                         modelInfo.put("modelVersion", modelVersion)
414                         if (!"vfModule".equals(modelType)) {
415                                 String modelCustomizationName = jsonUtils.getJsonValueForKey(modelFromDb, "modelCustomizationName")
416                                 modelInfo.put("modelCustomizationName", modelCustomizationName)
417                         }
418                         String modelCustomizationId = jsonUtils.getJsonValueForKey(modelFromDb, "modelCustomizationUuid")
419                         switch (catalogUtilsVersion) {
420                                 case "v1":
421                                         modelInfo.put("modelCustomizationId", modelCustomizationId)
422                                         break
423                                 default:
424                                         modelInfo.put("modelCustomizationUuid", modelCustomizationId)
425                                         break
426                         }
427                         JSONObject modelJson = new JSONObject()
428                         modelJson.put("modelInfo", modelInfo)
429                 }
430                 catch (Exception e) {
431                         logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
432                                         "Exception while parsing model information", "BPMN",
433                                         ErrorCode.UnknownError.getValue(), e.message);
434                 }
435                 return modelInfo
436         }
437
438         private String getResponseFromCatalogDb (DelegateExecution execution, String endPoint) {
439                 try {
440
441                         String catalogDbEndpoint = UrnPropertiesReader.getVariable("mso.catalog.db.endpoint",execution)
442                         String queryEndpoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + endPoint
443                         def responseData = ''
444                         HttpClient client = httpClientFactory.newJsonClient(new URL(queryEndpoint), TargetEntity.CATALOG_DB)
445                         client.addAdditionalHeader(ONAPLogConstants.Headers.REQUEST_ID, UUID.randomUUID().toString())
446                         client.addAdditionalHeader('X-FromAppId', "BPMN")
447                         client.addAdditionalHeader('Accept', MediaType.APPLICATION_JSON)
448                         String basicAuthCred = execution.getVariable("BasicAuthHeaderValueDB")
449                         client.addAdditionalHeader("Authorization", StringUtils.defaultIfEmpty(basicAuthCred, getBasicDBAuthHeader(execution)))
450
451                         logger.debug('sending GET to Catalog DB endpoint: ' + endPoint)
452                         Response response = client.get()
453
454                         responseData = response.readEntity(String.class)
455                         if (responseData != null) {
456                                 logger.debug("Received data from Catalog DB: " + responseData)
457                         }
458
459                         logger.debug('Response code:' + response.getStatus())
460                         logger.debug('Response:' + System.lineSeparator() + responseData)
461                         if (response.getStatus() == 200) {
462                                 // parse response as needed
463                                 return responseData
464                         }
465                         else {
466                                 return null
467                         }
468                 }
469                 catch (Exception e) {
470                         logger.debug("ERROR WHILE QUERYING CATALOG DB: " + e.message)
471                         throw e
472                 }
473
474         }
475
476         /**
477          * get resource recipe by resource model uuid and action
478          */
479         public JSONObject getResourceRecipe(DelegateExecution execution, String resourceModelUuid, String action) {
480                 String endPoint = "/resourceRecipe?resourceModelUuid=" + UriUtils.encode(resourceModelUuid, "UTF-8")+ "&action=" + UriUtils.encode(action, "UTF-8")
481                 JSONObject responseJson = null
482                 try {
483                         logger.debug("ENDPOINT: " + endPoint)
484                         String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
485
486                         if (catalogDbResponse != null) {
487                                 responseJson = new JSONObject(catalogDbResponse)
488                         }
489                 }
490                 catch (Exception e) {
491                         msoUtils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
492                         throw e
493                 }
494
495                 return responseJson
496         }
497
498         private String getBasicDBAuthHeader(DelegateExecution execution) {
499
500                 String encodedString = null
501                 try {
502                         String basicAuthValueDB = UrnPropertiesReader.getVariable("mso.adapters.db.auth", execution)
503                         msoUtils.log("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB)
504
505                         encodedString = msoUtils.getBasicAuth(basicAuthValueDB, UrnPropertiesReader.getVariable("mso.msoKey", execution))
506                         execution.setVariable("BasicAuthHeaderValueDB",encodedString)
507                 } catch (IOException ex) {
508                         String dataErrorMessage = " Unable to encode Catalog DB user/password string - " + ex.getMessage()
509                         msoUtils.log("ERROR", dataErrorMessage)
510                 }
511                 return encodedString
512         }
513
514 }