aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib')
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/TranslationContext.java88
1 files changed, 38 insertions, 50 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/TranslationContext.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/TranslationContext.java
index d2ad6daba1..6f77f22625 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/TranslationContext.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/TranslationContext.java
@@ -23,7 +23,6 @@ import org.openecomp.core.utilities.CommonMethods;
import org.openecomp.core.utilities.file.FileContentHandler;
import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
import org.openecomp.sdc.common.errors.CoreException;
-import org.openecomp.sdc.common.utils.SdcCommon;
import org.openecomp.sdc.datatypes.configuration.ImplementationConfiguration;
import org.openecomp.sdc.heat.datatypes.manifest.FileData;
import org.openecomp.sdc.heat.datatypes.manifest.ManifestFile;
@@ -60,38 +59,7 @@ public class TranslationContext {
private static Map<String, ImplementationConfiguration> supportedConsolidationComputeResources;
private static Map<String, ImplementationConfiguration> supportedConsolidationPortResources;
private static List<String> enrichPortResourceProperties;
-
- static {
- Configuration config = ConfigurationManager.lookup();
- String propertyFileName = SdcCommon.HEAT_TO_TOSCA_MAPPING_CONF;
- translationMapping =
- config.generateMap(ConfigConstants.MAPPING_NAMESPACE, ConfigConstants.RESOURCE_MAPPING_KEY);
- try {
- globalServiceTemplates =
- GlobalTypesGenerator.getGlobalTypesServiceTemplate(OnboardingTypesEnum.ZIP);
- } catch (Exception exc) {
- throw new RuntimeException("Failed to load GlobalTypes", exc);
- }
- nameExtractorImplMap = config.populateMap(ConfigConstants.TRANSLATOR_NAMESPACE,
- ConfigConstants.NAMING_CONVENTION_EXTRACTOR_IMPL_KEY, ImplementationConfiguration.class);
- supportedConsolidationComputeResources = config.populateMap(ConfigConstants
- .MANDATORY_UNIFIED_MODEL_NAMESPACE, ConfigConstants
- .SUPPORTED_CONSOLIDATION_COMPUTE_RESOURCES_KEY, ImplementationConfiguration.class);
- supportedConsolidationPortResources = config.populateMap(ConfigConstants
- .MANDATORY_UNIFIED_MODEL_NAMESPACE, ConfigConstants
- .SUPPORTED_CONSOLIDATION_PORT_RESOURCES_KEY, ImplementationConfiguration.class);
- enrichPortResourceProperties = config.getAsStringValues(ConfigConstants
- .MANDATORY_UNIFIED_MODEL_NAMESPACE, ConfigConstants
- .ENRICH_PORT_RESOURCE_PROP);
-
- }
-
private ManifestFile manifest;
-
- public static List<String> getEnrichPortResourceProperties() {
- return enrichPortResourceProperties;
- }
-
private FileContentHandler files = new FileContentHandler();
private Map<String, FileData.Type> manifestFiles = new HashMap<>();
//Key - file name, value - file type
@@ -124,6 +92,33 @@ public class TranslationContext {
private Set<String> nodeTemplateIdsPointingToStWithoutNodeTemplates = new HashSet<>();
+ static {
+ Configuration config = ConfigurationManager.lookup();
+ translationMapping =
+ config.generateMap(ConfigConstants.MAPPING_NAMESPACE, ConfigConstants.RESOURCE_MAPPING_KEY);
+ try {
+ globalServiceTemplates =
+ GlobalTypesGenerator.getGlobalTypesServiceTemplate(OnboardingTypesEnum.ZIP);
+ } catch (Exception exc) {
+ throw new RuntimeException("Failed to load GlobalTypes", exc);
+ }
+ nameExtractorImplMap = config.populateMap(ConfigConstants.TRANSLATOR_NAMESPACE,
+ ConfigConstants.NAMING_CONVENTION_EXTRACTOR_IMPL_KEY, ImplementationConfiguration.class);
+ supportedConsolidationComputeResources = config.populateMap(ConfigConstants
+ .MANDATORY_UNIFIED_MODEL_NAMESPACE, ConfigConstants
+ .SUPPORTED_CONSOLIDATION_COMPUTE_RESOURCES_KEY, ImplementationConfiguration.class);
+ supportedConsolidationPortResources = config.populateMap(ConfigConstants
+ .MANDATORY_UNIFIED_MODEL_NAMESPACE, ConfigConstants
+ .SUPPORTED_CONSOLIDATION_PORT_RESOURCES_KEY, ImplementationConfiguration.class);
+ enrichPortResourceProperties = config.getAsStringValues(ConfigConstants
+ .MANDATORY_UNIFIED_MODEL_NAMESPACE, ConfigConstants
+ .ENRICH_PORT_RESOURCE_PROP);
+ }
+
+ public static List<String> getEnrichPortResourceProperties() {
+ return enrichPortResourceProperties;
+ }
+
public static Map<String, ImplementationConfiguration>
getSupportedConsolidationComputeResources() {
return supportedConsolidationComputeResources;
@@ -265,14 +260,14 @@ public class TranslationContext {
}
public Set<String> getAllTranslatedResourceIdsFromDiffNestedFiles(String
- nestedHeatFileNameToSkip){
+ nestedHeatFileNameToSkip) {
Set<String> allTranslatedResourceIds = new HashSet<>();
this.translatedIds.entrySet().stream().filter(
heatFileNameToTranslatedIdsEntry -> !heatFileNameToTranslatedIdsEntry.getKey()
- .equals(nestedHeatFileNameToSkip)).forEach(heatFileNameToTranslatedIdsEntry -> {
- allTranslatedResourceIds.addAll(heatFileNameToTranslatedIdsEntry.getValue().keySet());
- });
+ .equals(nestedHeatFileNameToSkip)).forEach(heatFileNameToTranslatedIdsEntry ->
+ allTranslatedResourceIds.addAll(heatFileNameToTranslatedIdsEntry.getValue().keySet())
+ );
return allTranslatedResourceIds;
}
@@ -442,9 +437,9 @@ public class TranslationContext {
*/
public String getUnifiedAbstractNodeTemplateId(ServiceTemplate serviceTemplate,
String nodeTemplateId) {
- UnifiedSubstitutionData unifiedSubstitutionData =
+ UnifiedSubstitutionData unifiedSubsData =
this.unifiedSubstitutionData.get(ToscaUtil.getServiceTemplateFileName(serviceTemplate));
- return unifiedSubstitutionData.getNodesRelatedAbstractNode().get(nodeTemplateId);
+ return unifiedSubsData.getNodesRelatedAbstractNode().get(nodeTemplateId);
}
/**
@@ -456,9 +451,9 @@ public class TranslationContext {
*/
public String getUnifiedSubstitutionNodeTemplateId(ServiceTemplate serviceTemplate,
String nodeTemplateId) {
- UnifiedSubstitutionData unifiedSubstitutionData =
+ UnifiedSubstitutionData unifiedSubsData =
this.unifiedSubstitutionData.get(ToscaUtil.getServiceTemplateFileName(serviceTemplate));
- return unifiedSubstitutionData.getNodesRelatedSubstitutionServiceTemplateNode()
+ return unifiedSubsData.getNodesRelatedSubstitutionServiceTemplateNode()
.get(nodeTemplateId);
}
@@ -496,13 +491,6 @@ public class TranslationContext {
.isComputeTypeHandledInServiceTemplate(computeType);
}
- public int getHandledNestedComputeNodeTemplateIndex(String serviceTemplateName,
- String nestedServiceTemplateName,
- String computeType){
- return this.unifiedSubstitutionData.get(serviceTemplateName)
- .getHandledNestedComputeNodeTemplateIndex(computeType);
- }
-
public boolean isNestedServiceTemplateWasHandled(String serviceTemplateName,
String nestedServiceTemplateFileName) {
if (Objects.isNull(this.unifiedSubstitutionData.get(serviceTemplateName))) {
@@ -512,10 +500,10 @@ public class TranslationContext {
.isNestedServiceTemplateWasHandled(nestedServiceTemplateFileName);
}
- public Set<String> getAllRelatedNestedNodeTypeIds(){
+ public Set<String> getAllRelatedNestedNodeTypeIds() {
String globalName = "GlobalSubstitutionTypes";
- if(Objects.isNull(this.unifiedSubstitutionData) ||
- Objects.isNull(this.unifiedSubstitutionData.get(globalName))){
+ if (Objects.isNull(this.unifiedSubstitutionData)
+ || Objects.isNull(this.unifiedSubstitutionData.get(globalName))) {
return new HashSet<>();
}