diff options
author | Yuli Shlosberg <ys9693@att.com> | 2018-03-06 17:57:45 +0200 |
---|---|---|
committer | Yuli Shlosberg <ys9693@att.com> | 2018-03-11 10:16:03 +0200 |
commit | 4cea23f8111aa3d3532ec8d74351eccbf0ac44a5 (patch) | |
tree | e13926beacf7c0de8f942bb323684889dd263488 /src/main | |
parent | 644e2206bcbaa87744b08b869ee8a378c9fae2fc (diff) |
update SDC-TOSCA package namesv1.3.0
Change-Id: I496713bcf2551f3b5c7f629f89ffcb8b1954b489
Issue-ID: SDC-951
Signed-off-by: Yuli Shlosberg <ys9693@att.com>
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/onap/sdc/tosca/parser/api/ConformanceLevel.java (renamed from src/main/java/org/openecomp/sdc/tosca/parser/api/ConformanceLevel.java) | 2 | ||||
-rw-r--r-- | src/main/java/org/onap/sdc/tosca/parser/api/ISdcCsarHelper.java (renamed from src/main/java/org/openecomp/sdc/tosca/parser/api/ISdcCsarHelper.java) | 28 | ||||
-rw-r--r-- | src/main/java/org/onap/sdc/tosca/parser/api/Version.java (renamed from src/main/java/org/openecomp/sdc/tosca/parser/api/Version.java) | 2 | ||||
-rw-r--r-- | src/main/java/org/onap/sdc/tosca/parser/config/Configuration.java (renamed from src/main/java/org/openecomp/sdc/tosca/parser/config/Configuration.java) | 4 | ||||
-rw-r--r-- | src/main/java/org/onap/sdc/tosca/parser/config/ConfigurationManager.java (renamed from src/main/java/org/openecomp/sdc/tosca/parser/config/ConfigurationManager.java) | 4 | ||||
-rw-r--r-- | src/main/java/org/onap/sdc/tosca/parser/config/ErrorConfiguration.java (renamed from src/main/java/org/openecomp/sdc/tosca/parser/config/ErrorConfiguration.java) | 2 | ||||
-rw-r--r-- | src/main/java/org/onap/sdc/tosca/parser/config/ErrorInfo.java (renamed from src/main/java/org/openecomp/sdc/tosca/parser/config/ErrorInfo.java) | 2 | ||||
-rw-r--r-- | src/main/java/org/onap/sdc/tosca/parser/config/JToscaValidationIssueInfo.java (renamed from src/main/java/org/openecomp/sdc/tosca/parser/config/JToscaValidationIssueInfo.java) | 2 | ||||
-rw-r--r-- | src/main/java/org/onap/sdc/tosca/parser/config/JtoscaValidationIssueConfiguration.java (renamed from src/main/java/org/openecomp/sdc/tosca/parser/config/JtoscaValidationIssueConfiguration.java) | 2 | ||||
-rw-r--r-- | src/main/java/org/onap/sdc/tosca/parser/config/SdcToscaParserErrors.java (renamed from src/main/java/org/openecomp/sdc/tosca/parser/config/SdcToscaParserErrors.java) | 4 | ||||
-rw-r--r-- | src/main/java/org/onap/sdc/tosca/parser/exceptions/SdcToscaParserException.java (renamed from src/main/java/org/openecomp/sdc/tosca/parser/exceptions/SdcToscaParserException.java) | 40 | ||||
-rw-r--r-- | src/main/java/org/onap/sdc/tosca/parser/impl/FilterType.java (renamed from src/main/java/org/openecomp/sdc/tosca/parser/impl/FilterType.java) | 2 | ||||
-rw-r--r-- | src/main/java/org/onap/sdc/tosca/parser/impl/JToscaValidationIssueType.java (renamed from src/main/java/org/openecomp/sdc/tosca/parser/impl/JToscaValidationIssueType.java) | 2 | ||||
-rw-r--r-- | src/main/java/org/onap/sdc/tosca/parser/impl/SdcCsarHelperImpl.java (renamed from src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcCsarHelperImpl.java) | 26 | ||||
-rw-r--r-- | src/main/java/org/onap/sdc/tosca/parser/impl/SdcPropertyNames.java (renamed from src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcPropertyNames.java) | 2 | ||||
-rw-r--r-- | src/main/java/org/onap/sdc/tosca/parser/impl/SdcToscaParserFactory.java (renamed from src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcToscaParserFactory.java) | 400 | ||||
-rw-r--r-- | src/main/java/org/onap/sdc/tosca/parser/impl/SdcTypes.java (renamed from src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcTypes.java) | 2 | ||||
-rw-r--r-- | src/main/java/org/onap/sdc/tosca/parser/utils/GeneralUtility.java (renamed from src/main/java/org/openecomp/sdc/tosca/parser/utils/GeneralUtility.java) | 2 | ||||
-rw-r--r-- | src/main/java/org/onap/sdc/tosca/parser/utils/SdcToscaUtility.java (renamed from src/main/java/org/openecomp/sdc/tosca/parser/utils/SdcToscaUtility.java) | 38 | ||||
-rw-r--r-- | src/main/java/org/onap/sdc/tosca/parser/utils/YamlToObjectConverter.java (renamed from src/main/java/org/openecomp/sdc/tosca/parser/utils/YamlToObjectConverter.java) | 2 |
20 files changed, 284 insertions, 284 deletions
diff --git a/src/main/java/org/openecomp/sdc/tosca/parser/api/ConformanceLevel.java b/src/main/java/org/onap/sdc/tosca/parser/api/ConformanceLevel.java index a026938..4b4d646 100644 --- a/src/main/java/org/openecomp/sdc/tosca/parser/api/ConformanceLevel.java +++ b/src/main/java/org/onap/sdc/tosca/parser/api/ConformanceLevel.java @@ -1,4 +1,4 @@ -package org.openecomp.sdc.tosca.parser.api; +package org.onap.sdc.tosca.parser.api; public class ConformanceLevel { diff --git a/src/main/java/org/openecomp/sdc/tosca/parser/api/ISdcCsarHelper.java b/src/main/java/org/onap/sdc/tosca/parser/api/ISdcCsarHelper.java index df9e47d..76798d5 100644 --- a/src/main/java/org/openecomp/sdc/tosca/parser/api/ISdcCsarHelper.java +++ b/src/main/java/org/onap/sdc/tosca/parser/api/ISdcCsarHelper.java @@ -16,18 +16,18 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.openecomp.sdc.tosca.parser.api; +package org.onap.sdc.tosca.parser.api; import java.util.List; import java.util.Map; import org.apache.commons.lang3.tuple.Pair; -import org.openecomp.sdc.tosca.parser.impl.FilterType; -import org.openecomp.sdc.tosca.parser.impl.SdcTypes; -import org.openecomp.sdc.toscaparser.api.*; -import org.openecomp.sdc.toscaparser.api.elements.Metadata; -import org.openecomp.sdc.toscaparser.api.parameters.Input; +import org.onap.sdc.tosca.parser.impl.SdcTypes; +import org.onap.sdc.tosca.parser.impl.FilterType; +import org.onap.sdc.toscaparser.api.*; +import org.onap.sdc.toscaparser.api.elements.Metadata; +import org.onap.sdc.toscaparser.api.parameters.Input; public interface ISdcCsarHelper { @@ -48,7 +48,7 @@ public interface ISdcCsarHelper { public List<NodeTemplate> getServiceNodeTemplates(); /** - * Get groups of a VF with type "org.openecomp.groups.VfModule". + * Get groups of a VF with type "org.onap.groups.VfModule". * * @param vfCustomizationUuid - customizationUuid of VF instance. * @return list of vfModule groups. @@ -192,11 +192,11 @@ public interface ISdcCsarHelper { * For the below:<br><br> * * substitution_mappings:<br> - type: org.openecomp.services.ViprATM<br> + type: org.onap.services.ViprATM<br> calling<br> getServiceSubstitutionMappingsTypeName()<br> - will return "org.openecomp.services.ViprATM" + will return "org.onap.services.ViprATM" * @return - the type name of the CSAR service's substitution mappings element */ public String getServiceSubstitutionMappingsTypeName(); @@ -245,7 +245,7 @@ public interface ISdcCsarHelper { * For example, for this group definition:<br><br> * * ViprAtm..vIPR-ATM-Base..module-0:<br> - type: org.openecomp.groups.VfModule<br> + type: org.onap.groups.VfModule<br> .................<br> members: [vIPR_ATM_Ha_Two, vIPR_ATM_Ha_One, vIPR_ATM_OAM_SG, vIPR_ATM_HA_TWO_SG, vIPR_ATM_HA_ONE_SG]<br><br> @@ -268,12 +268,12 @@ public interface ISdcCsarHelper { * For example, if we have the below two node templates in the vIPR VF:<br><br> * * oam_extCP:<br> - type: org.openecomp.resources.cp.extCP<br> + type: org.onap.resources.cp.extCP<br> requirements:<br> - virtualBinding: vipr_atm_firewall<br><br> * * vipr_atm_firewall: <br> - type: org.openecomp.resources.vfc.ViprAtm.abstract.nodes.heat.vipr_atm<br> + type: org.onap.resources.vfc.ViprAtm.abstract.nodes.heat.vipr_atm<br> ........<br><br> * @@ -301,10 +301,10 @@ public interface ISdcCsarHelper { * For this node template:<br> * * vipr_atm_firewall: <br> - type: org.openecomp.resources.vfc.ViprAtm.abstract.nodes.heat.vipr_atm<br> + type: org.onap.resources.vfc.ViprAtm.abstract.nodes.heat.vipr_atm<br> ........<br><br> * - * the function will return "org.openecomp.resources.vfc.ViprAtm.abstract.nodes.heat.vipr_atm" + * the function will return "org.onap.resources.vfc.ViprAtm.abstract.nodes.heat.vipr_atm" * * @param nodeTemplate - node template object * @return - node type string. diff --git a/src/main/java/org/openecomp/sdc/tosca/parser/api/Version.java b/src/main/java/org/onap/sdc/tosca/parser/api/Version.java index 473e3a8..c485b18 100644 --- a/src/main/java/org/openecomp/sdc/tosca/parser/api/Version.java +++ b/src/main/java/org/onap/sdc/tosca/parser/api/Version.java @@ -1,4 +1,4 @@ -package org.openecomp.sdc.tosca.parser.api; +package org.onap.sdc.tosca.parser.api; public class Version implements Comparable<Version> { diff --git a/src/main/java/org/openecomp/sdc/tosca/parser/config/Configuration.java b/src/main/java/org/onap/sdc/tosca/parser/config/Configuration.java index 1d00d14..7135b6b 100644 --- a/src/main/java/org/openecomp/sdc/tosca/parser/config/Configuration.java +++ b/src/main/java/org/onap/sdc/tosca/parser/config/Configuration.java @@ -1,6 +1,6 @@ -package org.openecomp.sdc.tosca.parser.config; +package org.onap.sdc.tosca.parser.config; -import org.openecomp.sdc.tosca.parser.api.ConformanceLevel; +import org.onap.sdc.tosca.parser.api.ConformanceLevel; public class Configuration { diff --git a/src/main/java/org/openecomp/sdc/tosca/parser/config/ConfigurationManager.java b/src/main/java/org/onap/sdc/tosca/parser/config/ConfigurationManager.java index f2fc903..e0b9dc8 100644 --- a/src/main/java/org/openecomp/sdc/tosca/parser/config/ConfigurationManager.java +++ b/src/main/java/org/onap/sdc/tosca/parser/config/ConfigurationManager.java @@ -1,8 +1,8 @@ -package org.openecomp.sdc.tosca.parser.config; +package org.onap.sdc.tosca.parser.config; import com.google.common.base.Charsets; import com.google.common.io.Resources; -import org.openecomp.sdc.tosca.parser.utils.YamlToObjectConverter; +import org.onap.sdc.tosca.parser.utils.YamlToObjectConverter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/org/openecomp/sdc/tosca/parser/config/ErrorConfiguration.java b/src/main/java/org/onap/sdc/tosca/parser/config/ErrorConfiguration.java index 59e8c6d..1b1f2e2 100644 --- a/src/main/java/org/openecomp/sdc/tosca/parser/config/ErrorConfiguration.java +++ b/src/main/java/org/onap/sdc/tosca/parser/config/ErrorConfiguration.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.sdc.tosca.parser.config; +package org.onap.sdc.tosca.parser.config; import java.util.Map; diff --git a/src/main/java/org/openecomp/sdc/tosca/parser/config/ErrorInfo.java b/src/main/java/org/onap/sdc/tosca/parser/config/ErrorInfo.java index 34983ef..52a92c4 100644 --- a/src/main/java/org/openecomp/sdc/tosca/parser/config/ErrorInfo.java +++ b/src/main/java/org/onap/sdc/tosca/parser/config/ErrorInfo.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.sdc.tosca.parser.config; +package org.onap.sdc.tosca.parser.config; public class ErrorInfo { diff --git a/src/main/java/org/openecomp/sdc/tosca/parser/config/JToscaValidationIssueInfo.java b/src/main/java/org/onap/sdc/tosca/parser/config/JToscaValidationIssueInfo.java index 31ab0a0..0e76b29 100644 --- a/src/main/java/org/openecomp/sdc/tosca/parser/config/JToscaValidationIssueInfo.java +++ b/src/main/java/org/onap/sdc/tosca/parser/config/JToscaValidationIssueInfo.java @@ -1,4 +1,4 @@ -package org.openecomp.sdc.tosca.parser.config; +package org.onap.sdc.tosca.parser.config; public class JToscaValidationIssueInfo { diff --git a/src/main/java/org/openecomp/sdc/tosca/parser/config/JtoscaValidationIssueConfiguration.java b/src/main/java/org/onap/sdc/tosca/parser/config/JtoscaValidationIssueConfiguration.java index ff13251..55912e6 100644 --- a/src/main/java/org/openecomp/sdc/tosca/parser/config/JtoscaValidationIssueConfiguration.java +++ b/src/main/java/org/onap/sdc/tosca/parser/config/JtoscaValidationIssueConfiguration.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.sdc.tosca.parser.config; +package org.onap.sdc.tosca.parser.config; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/org/openecomp/sdc/tosca/parser/config/SdcToscaParserErrors.java b/src/main/java/org/onap/sdc/tosca/parser/config/SdcToscaParserErrors.java index ce84a9c..730142c 100644 --- a/src/main/java/org/openecomp/sdc/tosca/parser/config/SdcToscaParserErrors.java +++ b/src/main/java/org/onap/sdc/tosca/parser/config/SdcToscaParserErrors.java @@ -1,9 +1,9 @@ -package org.openecomp.sdc.tosca.parser.config; +package org.onap.sdc.tosca.parser.config; import java.util.EnumMap; import java.util.Map; -import org.openecomp.sdc.toscaparser.api.utils.JToscaErrorCodes; +import org.onap.sdc.toscaparser.api.utils.JToscaErrorCodes; public enum SdcToscaParserErrors { diff --git a/src/main/java/org/openecomp/sdc/tosca/parser/exceptions/SdcToscaParserException.java b/src/main/java/org/onap/sdc/tosca/parser/exceptions/SdcToscaParserException.java index a7fd99d..5576750 100644 --- a/src/main/java/org/openecomp/sdc/tosca/parser/exceptions/SdcToscaParserException.java +++ b/src/main/java/org/onap/sdc/tosca/parser/exceptions/SdcToscaParserException.java @@ -1,20 +1,20 @@ -package org.openecomp.sdc.tosca.parser.exceptions;
-
-public class SdcToscaParserException extends Exception {
-
- private static final long serialVersionUID = 626014844866501196L;
- private String code;
-
- public SdcToscaParserException(String string, String code) {
- super(string);
- this.code = code;
- }
-
- public String getCode() {
- return code;
- }
-
- public void setCode(String code) {
- this.code = code;
- }
-}
+package org.onap.sdc.tosca.parser.exceptions; + +public class SdcToscaParserException extends Exception { + + private static final long serialVersionUID = 626014844866501196L; + private String code; + + public SdcToscaParserException(String string, String code) { + super(string); + this.code = code; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } +} diff --git a/src/main/java/org/openecomp/sdc/tosca/parser/impl/FilterType.java b/src/main/java/org/onap/sdc/tosca/parser/impl/FilterType.java index 0f7810f..09c3c5c 100644 --- a/src/main/java/org/openecomp/sdc/tosca/parser/impl/FilterType.java +++ b/src/main/java/org/onap/sdc/tosca/parser/impl/FilterType.java @@ -1,4 +1,4 @@ -package org.openecomp.sdc.tosca.parser.impl; +package org.onap.sdc.tosca.parser.impl; public enum FilterType { diff --git a/src/main/java/org/openecomp/sdc/tosca/parser/impl/JToscaValidationIssueType.java b/src/main/java/org/onap/sdc/tosca/parser/impl/JToscaValidationIssueType.java index 1e68c51..fb13867 100644 --- a/src/main/java/org/openecomp/sdc/tosca/parser/impl/JToscaValidationIssueType.java +++ b/src/main/java/org/onap/sdc/tosca/parser/impl/JToscaValidationIssueType.java @@ -1,4 +1,4 @@ -package org.openecomp.sdc.tosca.parser.impl; +package org.onap.sdc.tosca.parser.impl; public enum JToscaValidationIssueType { CRITICAL, diff --git a/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcCsarHelperImpl.java b/src/main/java/org/onap/sdc/tosca/parser/impl/SdcCsarHelperImpl.java index 901b315..0c42a4f 100644 --- a/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcCsarHelperImpl.java +++ b/src/main/java/org/onap/sdc/tosca/parser/impl/SdcCsarHelperImpl.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.sdc.tosca.parser.impl; +package org.onap.sdc.tosca.parser.impl; import java.util.*; import java.util.Map.Entry; @@ -26,22 +26,18 @@ import java.util.stream.Collectors; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; -import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper; -import org.openecomp.sdc.tosca.parser.config.ConfigurationManager; -import org.openecomp.sdc.toscaparser.api.CapabilityAssignments; -import org.openecomp.sdc.tosca.parser.utils.GeneralUtility; -import org.openecomp.sdc.toscaparser.api.RequirementAssignments; -import org.openecomp.sdc.tosca.parser.utils.SdcToscaUtility; -import org.openecomp.sdc.toscaparser.api.*; -import org.openecomp.sdc.toscaparser.api.elements.Metadata; -import org.openecomp.sdc.toscaparser.api.elements.NodeType; -import org.openecomp.sdc.toscaparser.api.functions.Function; -import org.openecomp.sdc.toscaparser.api.parameters.Input; +import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; +import org.onap.sdc.tosca.parser.config.ConfigurationManager; +import org.onap.sdc.tosca.parser.utils.GeneralUtility; +import org.onap.sdc.tosca.parser.utils.SdcToscaUtility; +import org.onap.sdc.toscaparser.api.*; +import org.onap.sdc.toscaparser.api.elements.Metadata; +import org.onap.sdc.toscaparser.api.elements.NodeType; +import org.onap.sdc.toscaparser.api.functions.Function; +import org.onap.sdc.toscaparser.api.parameters.Input; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import static org.openecomp.sdc.tosca.parser.impl.SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID; - public class SdcCsarHelperImpl implements ISdcCsarHelper { private static final String PATH_DELIMITER = "#"; @@ -884,7 +880,7 @@ public class SdcCsarHelperImpl implements ISdcCsarHelper { //Assumed to be unique property for the list private NodeTemplate getNodeTemplateByCustomizationUuid(List<NodeTemplate> nodeTemplates, String customizationId) { if (customizationId != null) { - Optional<NodeTemplate> findFirst = nodeTemplates.stream().filter(x -> (x.getMetaData() != null && customizationId.equals(x.getMetaData().getValue(PROPERTY_NAME_CUSTOMIZATIONUUID)))).findFirst(); + Optional<NodeTemplate> findFirst = nodeTemplates.stream().filter(x -> (x.getMetaData() != null && customizationId.equals(x.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)))).findFirst(); return findFirst.isPresent() ? findFirst.get() : null; } else { diff --git a/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcPropertyNames.java b/src/main/java/org/onap/sdc/tosca/parser/impl/SdcPropertyNames.java index 7d34c6f..7235593 100644 --- a/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcPropertyNames.java +++ b/src/main/java/org/onap/sdc/tosca/parser/impl/SdcPropertyNames.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.sdc.tosca.parser.impl; +package org.onap.sdc.tosca.parser.impl; public class SdcPropertyNames { public static String PROPERTY_NAME_INVARIANTUUID = "invariantUUID"; diff --git a/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcToscaParserFactory.java b/src/main/java/org/onap/sdc/tosca/parser/impl/SdcToscaParserFactory.java index 9fc59f2..bc8d1b1 100644 --- a/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcToscaParserFactory.java +++ b/src/main/java/org/onap/sdc/tosca/parser/impl/SdcToscaParserFactory.java @@ -1,199 +1,203 @@ -package org.openecomp.sdc.tosca.parser.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.openecomp.sdc.tosca.parser.api.ConformanceLevel;
-import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper;
-import org.openecomp.sdc.tosca.parser.config.*;
-import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException;
-import org.openecomp.sdc.tosca.parser.utils.GeneralUtility;
-import org.openecomp.sdc.toscaparser.api.ToscaTemplate;
-import org.openecomp.sdc.toscaparser.api.common.JToscaValidationIssue;
-import org.openecomp.sdc.toscaparser.api.common.JToscaException;
-import org.openecomp.sdc.toscaparser.api.utils.JToscaErrorCodes;
-import org.openecomp.sdc.toscaparser.api.utils.ThreadLocalsHolder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class SdcToscaParserFactory {
- private static Logger log = LoggerFactory.getLogger(SdcToscaParserFactory.class.getName());
-
- private static ConfigurationManager configurationManager;
- private static volatile SdcToscaParserFactory instance;
- private List<JToscaValidationIssue> criticalExceptions = new ArrayList<>();
- private List<JToscaValidationIssue> warningExceptions = new ArrayList<>();
- private List<JToscaValidationIssue> notAnalyzadExceptions = new ArrayList<>();
- private SdcToscaParserFactory() {}
-
- /**
- * Get an SdcToscaParserFactory instance.
- * @return SdcToscaParserFactory instance.
- */
- public static SdcToscaParserFactory getInstance() {
- if (instance == null) {
- synchronized (SdcToscaParserFactory.class) {
- if (instance == null) {
- instance = new SdcToscaParserFactory();
- configurationManager = ConfigurationManager.getInstance();
- }
- }
- }
- return instance;
- }
-
- public static void setConfigurationManager(ConfigurationManager configurationManager) {
- SdcToscaParserFactory.configurationManager = configurationManager;
- }
-
- /**
- * Get an ISdcCsarHelper object for this CSAR file.
- *
- * @param csarPath - the absolute path to CSAR file.
- * @return ISdcCsarHelper object.
- * @throws SdcToscaParserException - in case the path or CSAR are invalid.
- */
- public ISdcCsarHelper getSdcCsarHelper(String csarPath) throws SdcToscaParserException {
- return init(csarPath, true);
- }
-
- /**
- * Get an ISdcCsarHelper object for this CSAR file.
- *
- * @param csarPath - the absolute path to CSAR file.
- * @param resolveGetInput - resolve get_input properties
- * @return ISdcCsarHelper object.
- * @throws SdcToscaParserException - in case the path or CSAR are invalid.
- */
- public ISdcCsarHelper getSdcCsarHelper(String csarPath, boolean resolveGetInput) throws SdcToscaParserException {
- return init(csarPath, resolveGetInput);
- }
-
- private ISdcCsarHelper init(String csarPath, boolean resolveGetInput) throws SdcToscaParserException {
- synchronized (SdcToscaParserFactory.class) {
- ToscaTemplate tosca = null;
- try {
- tosca = new ToscaTemplate(csarPath, null, true, null, resolveGetInput);
- } catch (JToscaException e) {
- throwSdcToscaParserException(e);
- }
- SdcCsarHelperImpl sdcCsarHelperImpl = new SdcCsarHelperImpl(tosca, configurationManager);
- String cSarConformanceLevel = sdcCsarHelperImpl.getConformanceLevel();
- validateCsarVersion(cSarConformanceLevel);
- try {
- handleErrorsByTypes(csarPath, cSarConformanceLevel);
- } catch (JToscaException e) {
- throwSdcToscaParserException(e);
- }
- return sdcCsarHelperImpl;
- }
- }
-
- private void handleErrorsByTypes(String csarPath, String cSarConformanceLevel) throws JToscaException {
- clearValidationIssuesLists();
- for(JToscaValidationIssue toscaValidationIssue : ThreadLocalsHolder.getCollector().getValidationIssues().values()){
- List<JToscaValidationIssueInfo> issueInfos = configurationManager.getJtoscaValidationIssueConfiguration().getValidationIssues().get(toscaValidationIssue.getCode());
- if(issueInfos != null && !issueInfos.isEmpty()){
- JToscaValidationIssueInfo issueInfo = null;
- issueInfo = issueInfos.stream()
- .filter(i-> isMatchConformanceLevel(cSarConformanceLevel,i.getSinceCsarConformanceLevel()))
- .max((i1,i2) -> GeneralUtility.conformanceLevelCompare(i1.getSinceCsarConformanceLevel(), i2.getSinceCsarConformanceLevel()) )
- .orElse(null);
-
- if(issueInfo != null){
- switch (JToscaValidationIssueType.valueOf(issueInfo.getIssueType())) {
- case CRITICAL:
- criticalExceptions.add(toscaValidationIssue);
- break;
- case WARNING:
- warningExceptions.add(toscaValidationIssue);
- break;
- default:
- break;
- }
- }else{
- notAnalyzadExceptions.add(toscaValidationIssue);
- }
- }else{//notAnalyzed
- notAnalyzadExceptions.add(toscaValidationIssue);
- }
- }
- logErrors(csarPath);
- }
-
- private void clearValidationIssuesLists(){
- notAnalyzadExceptions.clear();
- criticalExceptions.clear();
- warningExceptions.clear();
- }
-
- private void logErrors(String inputPath) throws JToscaException{
- //Warnings
- int warningsCount = warningExceptions.size();
- if (warningsCount > 0) {
- log.warn("####################################################################################################");
- log.warn("CSAR Warnings found! CSAR name - {}", inputPath);
- log.warn("ToscaTemplate - verifyTemplate - {} Parsing Warning{} occurred...", warningsCount, (warningsCount > 1 ? "s" : ""));
- for (JToscaValidationIssue info : warningExceptions) {
- log.warn("JTosca Exception [{}]: {}. CSAR name - {}", info.getCode(),info.getMessage(), inputPath);
- }
- log.warn("####################################################################################################");
- }
- //Criticals
- int criticalsCount = criticalExceptions.size();
- if (criticalsCount > 0) {
- log.error("####################################################################################################");
- log.error("ToscaTemplate - verifyTemplate - {} Parsing Critical{} occurred...", criticalsCount, (criticalsCount > 1 ? "s" : ""));
- for (JToscaValidationIssue info : criticalExceptions) {
- log.error("JTosca Exception [{}]: {}. CSAR name - {}", info.getCode(),info.getMessage(), inputPath);
- }
- throw new JToscaException(String.format("CSAR Validation Failed. CSAR name - {}. Please check logs for details.", inputPath), JToscaErrorCodes.CSAR_TOSCA_VALIDATION_ERROR.getValue());
- }
- }
- public List<JToscaValidationIssue> getCriticalExceptions() {
- return criticalExceptions;
- }
-
- public List<JToscaValidationIssue> getWarningExceptions() {
- return warningExceptions;
- }
-
- public List<JToscaValidationIssue> getNotAnalyzadExceptions() {
- return notAnalyzadExceptions;
- }
-
-
- private void validateCsarVersion(String cSarVersion) throws SdcToscaParserException {
- ConformanceLevel level = configurationManager.getConfiguration().getConformanceLevel();
- String minVersion = level.getMinVersion();
- String maxVersion = level.getMaxVersion();
- if (cSarVersion != null) {
- if ((GeneralUtility.conformanceLevelCompare(cSarVersion, minVersion) < 0) || (GeneralUtility.conformanceLevelCompare(cSarVersion, maxVersion) > 0)) {
- throwConformanceLevelException(minVersion, maxVersion);
- }
- } else {
- throwConformanceLevelException(minVersion, maxVersion);
- }
- }
-
- private boolean isMatchConformanceLevel(String ValidationIssueVersion, String cSarVersion){
- if (ValidationIssueVersion != null && cSarVersion != null) {
- if ((GeneralUtility.conformanceLevelCompare(ValidationIssueVersion, cSarVersion) >= 0)) {
- return true;
- }
- }
- return false;
- }
- private void throwConformanceLevelException(String minVersion, String maxVersion) throws SdcToscaParserException {
- ErrorInfo errorInfo = configurationManager.getErrorConfiguration().getErrorInfo(SdcToscaParserErrors.CONFORMANCE_LEVEL_ERROR.toString());
- throw new SdcToscaParserException(String.format(errorInfo.getMessage(), minVersion, maxVersion), errorInfo.getCode());
- }
-
- private void throwSdcToscaParserException(JToscaException e) throws SdcToscaParserException {
- ErrorInfo errorInfo = configurationManager.getErrorConfiguration().getErrorInfo(SdcToscaParserErrors.getSdcErrorByJToscaError(JToscaErrorCodes.getByCode(e.getCode())).toString());
- throw new SdcToscaParserException(errorInfo.getMessage(), errorInfo.getCode());
- }
-
-
-
+package org.onap.sdc.tosca.parser.impl; + +import java.util.ArrayList; +import java.util.List; + +import org.onap.sdc.tosca.parser.api.ConformanceLevel; +import org.onap.sdc.tosca.parser.config.ConfigurationManager; +import org.onap.sdc.tosca.parser.config.ErrorInfo; +import org.onap.sdc.tosca.parser.config.JToscaValidationIssueInfo; +import org.onap.sdc.tosca.parser.config.SdcToscaParserErrors; +import org.onap.sdc.tosca.parser.utils.GeneralUtility; +import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; +import org.onap.sdc.tosca.parser.config.*; +import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException; +import org.onap.sdc.toscaparser.api.ToscaTemplate; +import org.onap.sdc.toscaparser.api.common.JToscaValidationIssue; +import org.onap.sdc.toscaparser.api.common.JToscaException; +import org.onap.sdc.toscaparser.api.utils.JToscaErrorCodes; +import org.onap.sdc.toscaparser.api.utils.ThreadLocalsHolder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SdcToscaParserFactory { + private static Logger log = LoggerFactory.getLogger(SdcToscaParserFactory.class.getName()); + + private static ConfigurationManager configurationManager; + private static volatile SdcToscaParserFactory instance; + private List<JToscaValidationIssue> criticalExceptions = new ArrayList<>(); + private List<JToscaValidationIssue> warningExceptions = new ArrayList<>(); + private List<JToscaValidationIssue> notAnalyzadExceptions = new ArrayList<>(); + private SdcToscaParserFactory() {} + + /** + * Get an SdcToscaParserFactory instance. + * @return SdcToscaParserFactory instance. + */ + public static SdcToscaParserFactory getInstance() { + if (instance == null) { + synchronized (SdcToscaParserFactory.class) { + if (instance == null) { + instance = new SdcToscaParserFactory(); + configurationManager = ConfigurationManager.getInstance(); + } + } + } + return instance; + } + + public static void setConfigurationManager(ConfigurationManager configurationManager) { + SdcToscaParserFactory.configurationManager = configurationManager; + } + + /** + * Get an ISdcCsarHelper object for this CSAR file. + * + * @param csarPath - the absolute path to CSAR file. + * @return ISdcCsarHelper object. + * @throws SdcToscaParserException - in case the path or CSAR are invalid. + */ + public ISdcCsarHelper getSdcCsarHelper(String csarPath) throws SdcToscaParserException { + return init(csarPath, true); + } + + /** + * Get an ISdcCsarHelper object for this CSAR file. + * + * @param csarPath - the absolute path to CSAR file. + * @param resolveGetInput - resolve get_input properties + * @return ISdcCsarHelper object. + * @throws SdcToscaParserException - in case the path or CSAR are invalid. + */ + public ISdcCsarHelper getSdcCsarHelper(String csarPath, boolean resolveGetInput) throws SdcToscaParserException { + return init(csarPath, resolveGetInput); + } + + private ISdcCsarHelper init(String csarPath, boolean resolveGetInput) throws SdcToscaParserException { + synchronized (SdcToscaParserFactory.class) { + ToscaTemplate tosca = null; + try { + tosca = new ToscaTemplate(csarPath, null, true, null, resolveGetInput); + } catch (JToscaException e) { + throwSdcToscaParserException(e); + } + SdcCsarHelperImpl sdcCsarHelperImpl = new SdcCsarHelperImpl(tosca, configurationManager); + String cSarConformanceLevel = sdcCsarHelperImpl.getConformanceLevel(); + validateCsarVersion(cSarConformanceLevel); + try { + handleErrorsByTypes(csarPath, cSarConformanceLevel); + } catch (JToscaException e) { + throwSdcToscaParserException(e); + } + return sdcCsarHelperImpl; + } + } + + private void handleErrorsByTypes(String csarPath, String cSarConformanceLevel) throws JToscaException { + clearValidationIssuesLists(); + for(JToscaValidationIssue toscaValidationIssue : ThreadLocalsHolder.getCollector().getValidationIssues().values()){ + List<JToscaValidationIssueInfo> issueInfos = configurationManager.getJtoscaValidationIssueConfiguration().getValidationIssues().get(toscaValidationIssue.getCode()); + if(issueInfos != null && !issueInfos.isEmpty()){ + JToscaValidationIssueInfo issueInfo = null; + issueInfo = issueInfos.stream() + .filter(i-> isMatchConformanceLevel(cSarConformanceLevel,i.getSinceCsarConformanceLevel())) + .max((i1,i2) -> GeneralUtility.conformanceLevelCompare(i1.getSinceCsarConformanceLevel(), i2.getSinceCsarConformanceLevel()) ) + .orElse(null); + + if(issueInfo != null){ + switch (JToscaValidationIssueType.valueOf(issueInfo.getIssueType())) { + case CRITICAL: + criticalExceptions.add(toscaValidationIssue); + break; + case WARNING: + warningExceptions.add(toscaValidationIssue); + break; + default: + break; + } + }else{ + notAnalyzadExceptions.add(toscaValidationIssue); + } + }else{//notAnalyzed + notAnalyzadExceptions.add(toscaValidationIssue); + } + } + logErrors(csarPath); + } + + private void clearValidationIssuesLists(){ + notAnalyzadExceptions.clear(); + criticalExceptions.clear(); + warningExceptions.clear(); + } + + private void logErrors(String inputPath) throws JToscaException{ + //Warnings + int warningsCount = warningExceptions.size(); + if (warningsCount > 0) { + log.warn("####################################################################################################"); + log.warn("CSAR Warnings found! CSAR name - {}", inputPath); + log.warn("ToscaTemplate - verifyTemplate - {} Parsing Warning{} occurred...", warningsCount, (warningsCount > 1 ? "s" : "")); + for (JToscaValidationIssue info : warningExceptions) { + log.warn("JTosca Exception [{}]: {}. CSAR name - {}", info.getCode(),info.getMessage(), inputPath); + } + log.warn("####################################################################################################"); + } + //Criticals + int criticalsCount = criticalExceptions.size(); + if (criticalsCount > 0) { + log.error("####################################################################################################"); + log.error("ToscaTemplate - verifyTemplate - {} Parsing Critical{} occurred...", criticalsCount, (criticalsCount > 1 ? "s" : "")); + for (JToscaValidationIssue info : criticalExceptions) { + log.error("JTosca Exception [{}]: {}. CSAR name - {}", info.getCode(),info.getMessage(), inputPath); + } + throw new JToscaException(String.format("CSAR Validation Failed. CSAR name - {}. Please check logs for details.", inputPath), JToscaErrorCodes.CSAR_TOSCA_VALIDATION_ERROR.getValue()); + } + } + public List<JToscaValidationIssue> getCriticalExceptions() { + return criticalExceptions; + } + + public List<JToscaValidationIssue> getWarningExceptions() { + return warningExceptions; + } + + public List<JToscaValidationIssue> getNotAnalyzadExceptions() { + return notAnalyzadExceptions; + } + + + private void validateCsarVersion(String cSarVersion) throws SdcToscaParserException { + ConformanceLevel level = configurationManager.getConfiguration().getConformanceLevel(); + String minVersion = level.getMinVersion(); + String maxVersion = level.getMaxVersion(); + if (cSarVersion != null) { + if ((GeneralUtility.conformanceLevelCompare(cSarVersion, minVersion) < 0) || (GeneralUtility.conformanceLevelCompare(cSarVersion, maxVersion) > 0)) { + throwConformanceLevelException(minVersion, maxVersion); + } + } else { + throwConformanceLevelException(minVersion, maxVersion); + } + } + + private boolean isMatchConformanceLevel(String ValidationIssueVersion, String cSarVersion){ + if (ValidationIssueVersion != null && cSarVersion != null) { + if ((GeneralUtility.conformanceLevelCompare(ValidationIssueVersion, cSarVersion) >= 0)) { + return true; + } + } + return false; + } + private void throwConformanceLevelException(String minVersion, String maxVersion) throws SdcToscaParserException { + ErrorInfo errorInfo = configurationManager.getErrorConfiguration().getErrorInfo(SdcToscaParserErrors.CONFORMANCE_LEVEL_ERROR.toString()); + throw new SdcToscaParserException(String.format(errorInfo.getMessage(), minVersion, maxVersion), errorInfo.getCode()); + } + + private void throwSdcToscaParserException(JToscaException e) throws SdcToscaParserException { + ErrorInfo errorInfo = configurationManager.getErrorConfiguration().getErrorInfo(SdcToscaParserErrors.getSdcErrorByJToscaError(JToscaErrorCodes.getByCode(e.getCode())).toString()); + throw new SdcToscaParserException(errorInfo.getMessage(), errorInfo.getCode()); + } + + + }
\ No newline at end of file diff --git a/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcTypes.java b/src/main/java/org/onap/sdc/tosca/parser/impl/SdcTypes.java index aeb4ee0..9daf0ef 100644 --- a/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcTypes.java +++ b/src/main/java/org/onap/sdc/tosca/parser/impl/SdcTypes.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.sdc.tosca.parser.impl; +package org.onap.sdc.tosca.parser.impl; import java.util.Arrays; import java.util.List; diff --git a/src/main/java/org/openecomp/sdc/tosca/parser/utils/GeneralUtility.java b/src/main/java/org/onap/sdc/tosca/parser/utils/GeneralUtility.java index 84150f6..cddccd3 100644 --- a/src/main/java/org/openecomp/sdc/tosca/parser/utils/GeneralUtility.java +++ b/src/main/java/org/onap/sdc/tosca/parser/utils/GeneralUtility.java @@ -1,4 +1,4 @@ -package org.openecomp.sdc.tosca.parser.utils; +package org.onap.sdc.tosca.parser.utils; import java.util.Arrays; diff --git a/src/main/java/org/openecomp/sdc/tosca/parser/utils/SdcToscaUtility.java b/src/main/java/org/onap/sdc/tosca/parser/utils/SdcToscaUtility.java index 77f7d55..57f4187 100644 --- a/src/main/java/org/openecomp/sdc/tosca/parser/utils/SdcToscaUtility.java +++ b/src/main/java/org/onap/sdc/tosca/parser/utils/SdcToscaUtility.java @@ -1,19 +1,19 @@ -package org.openecomp.sdc.tosca.parser.utils;
-
-import java.util.regex.Pattern;
-
-public class SdcToscaUtility {
-
- public final static Pattern COMPONENT_INSTANCE_NAME_DELIMETER_PATTERN = Pattern.compile("[\\.\\-]+");
-
- public static String normaliseComponentInstanceName(String name) {
- String normalizedName = name.toLowerCase();
- normalizedName = COMPONENT_INSTANCE_NAME_DELIMETER_PATTERN.matcher(normalizedName).replaceAll(" ");
- String[] split = normalizedName.split(" ");
- StringBuffer sb = new StringBuffer();
- for (String splitElement : split) {
- sb.append(splitElement);
- }
- return sb.toString();
- }
-}
+package org.onap.sdc.tosca.parser.utils; + +import java.util.regex.Pattern; + +public class SdcToscaUtility { + + public final static Pattern COMPONENT_INSTANCE_NAME_DELIMETER_PATTERN = Pattern.compile("[\\.\\-]+"); + + public static String normaliseComponentInstanceName(String name) { + String normalizedName = name.toLowerCase(); + normalizedName = COMPONENT_INSTANCE_NAME_DELIMETER_PATTERN.matcher(normalizedName).replaceAll(" "); + String[] split = normalizedName.split(" "); + StringBuffer sb = new StringBuffer(); + for (String splitElement : split) { + sb.append(splitElement); + } + return sb.toString(); + } +} diff --git a/src/main/java/org/openecomp/sdc/tosca/parser/utils/YamlToObjectConverter.java b/src/main/java/org/onap/sdc/tosca/parser/utils/YamlToObjectConverter.java index 926b155..89963d8 100644 --- a/src/main/java/org/openecomp/sdc/tosca/parser/utils/YamlToObjectConverter.java +++ b/src/main/java/org/onap/sdc/tosca/parser/utils/YamlToObjectConverter.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.sdc.tosca.parser.utils; +package org.onap.sdc.tosca.parser.utils; import com.fasterxml.jackson.databind.ObjectMapper; import org.slf4j.Logger; |