diff options
15 files changed, 103 insertions, 53 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentEntry.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentEntry.java index fd252b634a..3aa77c2c7a 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentEntry.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentEntry.java @@ -3,6 +3,7 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,9 +27,12 @@ import java.util.HashSet; import java.util.ArrayList; import java.util.Set; import org.openecomp.mso.db.catalog.beans.HeatTemplateParam; +import org.openecomp.mso.logger.MsoLogger; public class MsoHeatEnvironmentEntry { + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); + private Set<MsoHeatEnvironmentParameter> parameters = null; private Set<MsoHeatEnvironmentResource> resources = null; private StringBuilder rawEntry = null; @@ -48,7 +52,7 @@ public class MsoHeatEnvironmentEntry { private void processRawEntry() { try { - if (this.rawEntry == null || this.rawEntry.equals("")) + if (this.rawEntry == null || "".equals(this.rawEntry)) return; byte[] b = this.rawEntry.toString().getBytes(); MsoYamlEditorWithEnvt yaml = new MsoYamlEditorWithEnvt(b); @@ -61,6 +65,7 @@ public class MsoHeatEnvironmentEntry { this.resourceRegistryEntryRaw = sb; } } catch (Exception e) { + LOGGER.debug("Exception:", e); this.valid = false; this.errorString = e.getMessage(); //e.printStackTrace(); @@ -97,13 +102,13 @@ public class MsoHeatEnvironmentEntry { public void addParameter(MsoHeatEnvironmentParameter hep) { if (this.parameters == null) { - this.parameters = new HashSet<MsoHeatEnvironmentParameter>(); + this.parameters = new HashSet<>(); } this.parameters.add(hep); } public void addResource(MsoHeatEnvironmentResource her) { if (this.resources == null) { - this.resources = new HashSet<MsoHeatEnvironmentResource>(); + this.resources = new HashSet<>(); } this.resources.add(her); } diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentResource.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentResource.java index f5dffc3297..31e2fca4c1 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentResource.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentResource.java @@ -3,6 +3,7 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,10 +21,12 @@ package org.openecomp.mso.openstack.utils; - +import org.openecomp.mso.logger.MsoLogger; public class MsoHeatEnvironmentResource { + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); + private String name; private String value; @@ -77,7 +80,7 @@ public class MsoHeatEnvironmentResource { try { result = this.name.hashCode(); } catch (Exception e) { - // in case it's null - return zero + LOGGER.debug("Exception:", e); } return result; } diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java index 8073c953e9..fad0c2368b 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java @@ -91,12 +91,12 @@ public class MsoHeatUtils extends MsoCommonUtils { // token will be used until it expires. // // The cache key is "tenantId:cloudId" - private static Map <String, HeatCacheEntry> heatClientCache = new HashMap <String, HeatCacheEntry> (); + private static Map <String, HeatCacheEntry> heatClientCache = new HashMap <> (); // Fetch cloud configuration each time (may be cached in CloudConfig class) protected CloudConfig cloudConfig; - private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); protected MsoJavaProperties msoProps = null; @@ -343,7 +343,7 @@ public class MsoHeatUtils extends MsoCommonUtils { if (haveFiles && haveHeatFiles) { // Let's do this here - not in the bean LOGGER.debug ("Found files AND heatFiles - combine and add!"); - Map <String, Object> combinedFiles = new HashMap <String, Object> (); + Map <String, Object> combinedFiles = new HashMap <> (); for (String keyString : files.keySet ()) { combinedFiles.put (keyString, files.get (keyString)); } @@ -584,7 +584,7 @@ public class MsoHeatUtils extends MsoCommonUtils { } } // end while !deleted - StringBuilder errorContextMessage = null; + StringBuilder errorContextMessage; if (createTimedOut) { errorContextMessage = new StringBuilder("Stack Creation Timeout"); } else { @@ -737,7 +737,14 @@ public class MsoHeatUtils extends MsoCommonUtils { String canonicalName = heatStack.getStackName () + "/" + heatStack.getId (); try { - OpenStackRequest <Void> request = heatClient.getStacks ().deleteByName (canonicalName); + OpenStackRequest <Void> request = null; + if(null != heatClient) { + request = heatClient.getStacks ().deleteByName (canonicalName); + } + else { + LOGGER.debug ("Heat Client is NULL" ); + } + executeAndRecordOpenstackRequest (request, msoProps); } catch (OpenStackResponseException e) { if (e.getStatus () == 404) { @@ -845,7 +852,7 @@ public class MsoHeatUtils extends MsoCommonUtils { OpenStackRequest <Stacks> request = heatClient.getStacks ().list (); Stacks stacks = executeAndRecordOpenstackRequest (request, msoProps); - List <StackInfo> stackList = new ArrayList <StackInfo> (); + List <StackInfo> stackList = new ArrayList <> (); // Not sure if returns an empty list or null if no stacks exist if (stacks != null) { @@ -859,7 +866,7 @@ public class MsoHeatUtils extends MsoCommonUtils { if (e.getStatus () == 404) { // Not sure if this can happen, but return an empty list LOGGER.debug ("queryAllStacks - stack not found: "); - return new ArrayList <StackInfo> (); + return new ArrayList <> (); } else { // Convert the OpenStackResponseException to an MsoOpenstackException throw heatExceptionToMsoException (e, QUERY_ALL_STACKS); @@ -891,7 +898,7 @@ public class MsoHeatUtils extends MsoCommonUtils { HeatTemplate heatTemplate) throws IllegalArgumentException { // Check that required parameters have been supplied for this template type String missingParams = null; - List <String> paramList = new ArrayList <String> (); + List <String> paramList = new ArrayList <> (); // TODO: Enhance DB to support defaults for Heat Template parameters @@ -913,8 +920,8 @@ public class MsoHeatUtils extends MsoCommonUtils { } // Remove any extraneous parameters (don't throw an error) - Map <String, Object> updatedParams = new HashMap <String, Object> (); - List <String> extraParams = new ArrayList <String> (); + Map <String, Object> updatedParams = new HashMap <> (); + List <String> extraParams = new ArrayList <> (); for (String key : inputParams.keySet ()) { if (!paramList.contains (key)) { // This is not a valid parameter for this template @@ -1139,7 +1146,7 @@ public class MsoHeatUtils extends MsoCommonUtils { * This may be useful if cached credentials get out of sync. */ public static void heatCacheReset () { - heatClientCache = new HashMap <String, HeatCacheEntry> (); + heatClientCache = new HashMap <> (); } public Map<String, Object> queryStackForOutputs(String cloudSiteId, @@ -1273,7 +1280,7 @@ public class MsoHeatUtils extends MsoCommonUtils { sb.append("(outputs is empty)"); return sb; } - Map<String, Object> outputs = new HashMap<String,Object>(); + Map<String, Object> outputs = new HashMap<>(); for (Output outputItem : outputList) { outputs.put(outputItem.getOutputKey(), outputItem.getOutputValue()); } @@ -1419,7 +1426,7 @@ public class MsoHeatUtils extends MsoCommonUtils { } else { cdl3 = cdl2; } - ArrayList<String> list = new ArrayList<String>(Arrays.asList(cdl3.split(","))); + ArrayList<String> list = new ArrayList<>(Arrays.asList(cdl3.split(","))); return list; } @@ -1441,9 +1448,9 @@ public class MsoHeatUtils extends MsoCommonUtils { * @return HashMap<String, Object> of the inputs, cleaned and converted */ public HashMap<String, Object> convertInputMap(Map<String, String> inputs, HeatTemplate template) { - HashMap<String, Object> newInputs = new HashMap<String, Object>(); - HashMap<String, HeatTemplateParam> params = new HashMap<String, HeatTemplateParam>(); - HashMap<String, HeatTemplateParam> paramAliases = new HashMap<String, HeatTemplateParam>(); + HashMap<String, Object> newInputs = new HashMap<>(); + HashMap<String, HeatTemplateParam> params = new HashMap<>(); + HashMap<String, HeatTemplateParam> paramAliases = new HashMap<>(); if (inputs == null) { LOGGER.debug("convertInputMap - inputs is null - nothing to do here"); @@ -1462,7 +1469,7 @@ public class MsoHeatUtils extends MsoCommonUtils { for (HeatTemplateParam htp : template.getParameters()) { LOGGER.debug("Adding " + htp.getParamName()); params.put(htp.getParamName(), htp); - if (htp.getParamAlias() != null && !htp.getParamAlias().equals("")) { + if (htp.getParamAlias() != null && !"".equals(htp.getParamAlias())) { LOGGER.debug("\tFound ALIAS " + htp.getParamName() + "->" + htp.getParamAlias()); paramAliases.put(htp.getParamAlias(), htp); } @@ -1485,20 +1492,20 @@ public class MsoHeatUtils extends MsoCommonUtils { } } String type = params.get(key).getParamType(); - if (type == null || type.equals("")) { + if (type == null || "".equals(type)) { LOGGER.debug("**PARAM_TYPE is null/empty for " + key + ", will default to string"); type = "string"; } LOGGER.debug("Parameter: " + key + " is of type " + type); - if (type.equalsIgnoreCase("string")) { + if ("string".equalsIgnoreCase(type)) { // Easiest! String str = inputs.get(key); if (alias) newInputs.put(realName, str); else newInputs.put(key, str); - } else if (type.equalsIgnoreCase("number")) { - String integerString = inputs.get(key).toString(); + } else if ("number".equalsIgnoreCase(type)) { + String integerString = inputs.get(key); Integer anInteger = null; try { anInteger = Integer.parseInt(integerString); @@ -1518,8 +1525,8 @@ public class MsoHeatUtils extends MsoCommonUtils { else newInputs.put(key, integerString); } - } else if (type.equalsIgnoreCase("json")) { - String jsonString = inputs.get(key).toString(); + } else if ("json".equalsIgnoreCase(type)) { + String jsonString = inputs.get(key); JsonNode jsonNode = null; try { jsonNode = new ObjectMapper().readTree(jsonString); @@ -1539,8 +1546,8 @@ public class MsoHeatUtils extends MsoCommonUtils { else newInputs.put(key, jsonString); } - } else if (type.equalsIgnoreCase("comma_delimited_list")) { - String commaSeparated = inputs.get(key).toString(); + } else if ("comma_delimited_list".equalsIgnoreCase(type)) { + String commaSeparated = inputs.get(key); try { ArrayList<String> anArrayList = this.convertCdlToArrayList(commaSeparated); if (alias) @@ -1554,8 +1561,8 @@ public class MsoHeatUtils extends MsoCommonUtils { else newInputs.put(key, commaSeparated); } - } else if (type.equalsIgnoreCase("boolean")) { - String booleanString = inputs.get(key).toString(); + } else if ("boolean".equalsIgnoreCase(type)) { + String booleanString = inputs.get(key); Boolean aBool = new Boolean(booleanString); if (alias) newInputs.put(realName, aBool); diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoYamlEditorWithEnvt.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoYamlEditorWithEnvt.java index 4e715fa06e..bd649e867f 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoYamlEditorWithEnvt.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoYamlEditorWithEnvt.java @@ -36,9 +36,12 @@ import java.util.LinkedHashMap; import org.yaml.snakeyaml.Yaml; +import org.openecomp.mso.logger.MsoLogger; public class MsoYamlEditorWithEnvt { + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); + private Map <String, Object> yml; private Yaml yaml = new Yaml (); private static final ObjectMapper JSON_MAPPER = new ObjectMapper(); @@ -65,6 +68,7 @@ public class MsoYamlEditorWithEnvt { try { resourceMap = (Map<String,Object>) yml.get("parameters"); } catch (Exception e) { + LOGGER.debug("Exception:", e); return paramSet; } if (resourceMap == null) { @@ -90,6 +94,7 @@ public class MsoYamlEditorWithEnvt { try { value = JSON_MAPPER.writeValueAsString(obj); } catch (Exception e) { + LOGGER.debug("Exception:", e); value = "_BAD_JSON_MAPPING"; } } else { @@ -104,7 +109,7 @@ public class MsoYamlEditorWithEnvt { } public synchronized Set <MsoHeatEnvironmentResource> getResourceListFromEnvt() { try { - Set<MsoHeatEnvironmentResource> resourceList = new HashSet<MsoHeatEnvironmentResource>(); + Set<MsoHeatEnvironmentResource> resourceList = new HashSet<>(); @SuppressWarnings("unchecked") Map<String, Object> resourceMap = (Map<String,Object>) yml.get("resource_registry"); Iterator<Entry <String,Object>> it = resourceMap.entrySet().iterator(); @@ -118,12 +123,12 @@ public class MsoYamlEditorWithEnvt { } return resourceList; } catch (Exception e) { - + LOGGER.debug("Exception:", e); } return null; } public synchronized Set <HeatTemplateParam> getParameterList () { - Set <HeatTemplateParam> paramSet = new HashSet <HeatTemplateParam> (); + Set <HeatTemplateParam> paramSet = new HashSet <> (); @SuppressWarnings("unchecked") Map <String, Object> resourceMap = (Map <String, Object>) yml.get ("parameters"); Iterator <Entry <String, Object>> it = resourceMap.entrySet ().iterator (); @@ -137,6 +142,7 @@ public class MsoYamlEditorWithEnvt { try { value = resourceEntry.get ("default"); } catch (java.lang.ClassCastException cce) { + LOGGER.debug("Exception:", cce); // This exception only - the value is an integer. For what we're doing // here - we don't care - so set value to something - and it will // get marked as not being required - which is correct. diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkRequestCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkRequestCommon.java index 0b62be6dd0..d9b09fa1b0 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkRequestCommon.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkRequestCommon.java @@ -3,6 +3,7 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,11 +30,13 @@ import javax.xml.bind.Marshaller; import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.map.SerializationConfig; +import org.openecomp.mso.logger.MsoLogger; /** * Everything that is common between all Network Requests. */ public abstract class NetworkRequestCommon { + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); private Boolean skipAAI = false; private String messageId; private String notificationUrl; @@ -63,7 +66,7 @@ public abstract class NetworkRequestCommon { } public boolean isSynchronous() { - return notificationUrl == null || (notificationUrl != null && notificationUrl.isEmpty()); + return notificationUrl == null || (notificationUrl.isEmpty()); } public String toJsonString() { @@ -73,7 +76,7 @@ public abstract class NetworkRequestCommon { mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); jsonString = mapper.writeValueAsString(this); } catch (Exception e) { - // ignore + LOGGER.debug("Exception:", e); } return jsonString; } @@ -87,8 +90,7 @@ public abstract class NetworkRequestCommon { marshaller.marshal(this, bs); return bs.toString(); } catch (Exception e) { - // Shouldn't happen... - e.printStackTrace(); + LOGGER.debug("Exception:", e); return ""; } } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkResponseCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkResponseCommon.java index 40d2aba1c8..56ec73d94a 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkResponseCommon.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkResponseCommon.java @@ -3,6 +3,7 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,12 +30,13 @@ import javax.xml.bind.Marshaller; import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.map.SerializationConfig; - +import org.openecomp.mso.logger.MsoLogger; /** * Everything that is common between all Volume Group Responses, except for QueryVolumeGroupResponse. */ public abstract class NetworkResponseCommon { private String messageId; + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); public NetworkResponseCommon() { messageId = null; @@ -59,7 +61,7 @@ public abstract class NetworkResponseCommon { mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); jsonString = mapper.writeValueAsString(this); } catch (Exception e) { - // ignore + LOGGER.debug("Exception:", e); } return jsonString; } @@ -73,8 +75,7 @@ public abstract class NetworkResponseCommon { marshaller.marshal(this, bs); return bs.toString(); } catch (Exception e) { - // Shouldn't happen... - e.printStackTrace(); + LOGGER.debug("Exception:", e); return ""; } } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/QueryNetworkResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/QueryNetworkResponse.java index 418a15abf2..1ca36aface 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/QueryNetworkResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/QueryNetworkResponse.java @@ -3,6 +3,7 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,6 +32,7 @@ import javax.xml.bind.annotation.XmlRootElement; import org.codehaus.jackson.map.ObjectMapper; import org.jboss.resteasy.annotations.providers.NoJackson; +import org.openecomp.mso.logger.MsoLogger; @XmlRootElement(name = "queryNetworkResponse") @NoJackson @@ -44,6 +46,7 @@ public class QueryNetworkResponse { private List<String> routeTargets; private Map<String, String> subnetIdMap; private Map<String, String> networkOutputs; + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); public QueryNetworkResponse() { super(); @@ -138,7 +141,9 @@ public class QueryNetworkResponse { ObjectMapper mapper = new ObjectMapper(); jsonString = mapper.writeValueAsString(this); } - catch (Exception e) {} + catch (Exception e) { + LOGGER.debug("Exception:", e); + } return jsonString; } } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkRequest.java index ed10540491..09c1b3ee38 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkRequest.java @@ -32,6 +32,7 @@ import java.util.List; import javax.xml.bind.annotation.XmlRootElement; import org.jboss.resteasy.annotations.providers.NoJackson; import org.codehaus.jackson.map.annotate.JsonRootName; +import org.openecomp.mso.logger.MsoLogger; @JsonRootName("updateNetworkRequest") @XmlRootElement(name = "updateNetworkRequest") @@ -50,9 +51,10 @@ public class UpdateNetworkRequest extends NetworkRequestCommon { private ProviderVlanNetwork providerVlanNetwork; private ContrailNetwork contrailNetwork; private Boolean backout = true; - private Map<String,String> networkParams = new HashMap<String, String>(); + private Map<String,String> networkParams = new HashMap<>(); private MsoRequest msoRequest = new MsoRequest(); - + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); + public UpdateNetworkRequest() { super(); } @@ -129,7 +131,7 @@ public class UpdateNetworkRequest extends NetworkRequestCommon { try { this.networkTechnology = NetworkTechnology.valueOf(networkTechnology.toUpperCase()); } catch (IllegalArgumentException e) { - // ignore + LOGGER.debug("Exception:", e); } } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCEvent.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCEvent.java index 2cf5ca2638..9b9c214129 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCEvent.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCEvent.java @@ -3,6 +3,7 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,6 +37,7 @@ import java.io.IOException; import java.io.Serializable; import java.util.LinkedHashMap; import java.util.Map; +import org.openecomp.mso.logger.MsoLogger; // NOTE: the JAXB (XML) annotations are required with JBoss AS7 and RESTEasy, // even though we are using JSON exclusively. The @NoJackson annotation @@ -61,6 +63,8 @@ import java.util.Map; @NoJackson public class SDNCEvent implements Serializable { private static final long serialVersionUID = 1L; + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); // Event type private String eventType; @@ -143,7 +147,7 @@ public class SDNCEvent implements Serializable { mapper.setSerializationInclusion(Inclusion.NON_NULL); return mapper.writeValueAsString(this); } catch (IOException e) { - e.printStackTrace(); + LOGGER.debug("Exception:", e); throw new UnsupportedOperationException("Cannot convert " + getClass().getSimpleName() + " to JSON", e); } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCRequestCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCRequestCommon.java index 4a756aeccd..45609168ee 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCRequestCommon.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCRequestCommon.java @@ -28,12 +28,15 @@ import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion; import javax.xml.bind.annotation.XmlElement; import java.io.IOException; import java.io.Serializable; +import org.openecomp.mso.logger.MsoLogger; /** * Base class for all SDNC adapter requests. */ public abstract class SDNCRequestCommon implements Serializable { private static final long serialVersionUID = 1L; + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); // Endpoint on which BPMN can receive notifications from the SDNC adapter. private String bpNotificationUrl; @@ -101,7 +104,7 @@ public abstract class SDNCRequestCommon implements Serializable { mapper.setSerializationInclusion(Inclusion.NON_NULL); return mapper.writeValueAsString(this); } catch (IOException e) { - e.printStackTrace(); + LOGGER.debug("Exception:", e); throw new UnsupportedOperationException("Cannot convert " + getClass().getSimpleName() + " to JSON", e); } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCResponseCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCResponseCommon.java index f141116aeb..5e6b9394a6 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCResponseCommon.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCResponseCommon.java @@ -3,6 +3,7 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,12 +28,15 @@ import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion; import javax.xml.bind.annotation.XmlElement; import java.io.IOException; import java.io.Serializable; +import org.openecomp.mso.logger.MsoLogger; /** * Base class for all SDNC adapter responses, including errors. */ public abstract class SDNCResponseCommon implements Serializable { private static final long serialVersionUID = 1L; + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); // Identifies the MSO transaction with SDNC. private String sdncRequestId; @@ -109,7 +113,7 @@ public abstract class SDNCResponseCommon implements Serializable { mapper.setSerializationInclusion(Inclusion.NON_NULL); return mapper.writeValueAsString(this); } catch (IOException e) { - e.printStackTrace(); + LOGGER.debug("Exception:", e); throw new UnsupportedOperationException("Cannot convert " + getClass().getSimpleName() + " to JSON", e); } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfRequestCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfRequestCommon.java index 75668143e2..aa6af56082 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfRequestCommon.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfRequestCommon.java @@ -3,6 +3,7 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,7 +46,7 @@ public abstract class VfRequestCommon extends VfResponseCommon { } public boolean isSynchronous() { - return notificationUrl == null || (notificationUrl != null && notificationUrl.isEmpty()); + return notificationUrl == null || notificationUrl.isEmpty(); } // getMessageId, setMessageId, toJsonString, toJsonString are all defined in VfResponseCommon. diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQuery.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQuery.java index 7fe8892ee8..6c7d584f6d 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQuery.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQuery.java @@ -3,6 +3,7 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -73,6 +74,7 @@ public abstract class CatalogQuery { jsonString = mapper.writeValueAsString(this); } catch (Exception e) { + LOGGER.debug("Exception:", e); LOGGER.debug ("jsonString exception:"+e.getMessage()); jsonString = "invalid"; //throws instead? } diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java index 2407581f55..9f709140ec 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java @@ -3,6 +3,7 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,9 +26,11 @@ import org.codehaus.jackson.map.SerializationConfig; import javax.xml.bind.JAXBContext; import javax.xml.bind.Marshaller; import java.io.ByteArrayOutputStream; +import org.openecomp.mso.logger.MsoLogger; public abstract class CatalogQueryExceptionCommon { private String messageId; + protected static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); public CatalogQueryExceptionCommon() { messageId = null; } public CatalogQueryExceptionCommon(String messageId) { this.messageId = messageId; } @@ -43,7 +46,7 @@ public abstract class CatalogQueryExceptionCommon { jsonString = mapper.writeValueAsString(this); return jsonString; } catch (Exception e) { - e.printStackTrace(); + LOGGER.debug ("Exception:", e); return ""; } } @@ -57,7 +60,7 @@ public abstract class CatalogQueryExceptionCommon { marshaller.marshal(this, bs); return bs.toString(); } catch (Exception e) { - e.printStackTrace(); + LOGGER.debug ("Exception:", e); return ""; } } diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModules.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModules.java index f687aca683..3ffb0c6744 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModules.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModules.java @@ -3,6 +3,7 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -74,6 +75,7 @@ public class QueryVfModules { LOGGER.debug ("QueryVfModules jsonString: "+jsonString); } catch (Exception e) { + LOGGER.debug ("Exception:", e); LOGGER.debug ("QueryVfModules jsonString exception:"+e.getMessage()); } return jsonString; |