aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationProcessFactory.java46
1 files changed, 26 insertions, 20 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationProcessFactory.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationProcessFactory.java
index 6200b287a1..64edf86dc7 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationProcessFactory.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationProcessFactory.java
@@ -1,15 +1,27 @@
+/*
+ * Copyright © 2016-2017 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.process;
import org.openecomp.config.api.Configuration;
import org.openecomp.config.api.ConfigurationManager;
import org.openecomp.core.utilities.CommonMethods;
-import org.openecomp.core.utilities.file.FileUtils;
-import org.openecomp.core.utilities.json.JsonUtil;
import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
import org.openecomp.sdc.datatypes.configuration.ImplementationConfiguration;
import org.openecomp.sdc.vendorsoftwareproduct.types.ConfigConstants;
-
-import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
@@ -17,43 +29,37 @@ import java.util.concurrent.ConcurrentHashMap;
import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.OrchestrationUtil.ORCHESTRATION_CONFIG_NAMESPACE;
public class OrchestrationProcessFactory {
- private static final String confFile = "config-orchestration.json";
- private static Map<String, ImplementationConfiguration> processImplMap;
+ private static final Map<String, ImplementationConfiguration> PROCESS_IMPL_MAP;
+ private OrchestrationProcessFactory() {
+
+ }
static {
Configuration config = ConfigurationManager.lookup();
- processImplMap = new ConcurrentHashMap<>(config.populateMap(ORCHESTRATION_CONFIG_NAMESPACE,
+ PROCESS_IMPL_MAP = new ConcurrentHashMap<>(config.populateMap(ORCHESTRATION_CONFIG_NAMESPACE,
ConfigConstants.PROCESS_IMPL_KEY, ImplementationConfiguration.class));
}
public static Optional<OrchestrationTemplateProcessHandler> getInstance(String fileSuffix) {
+
if (fileSuffix == null) {
return Optional.empty();
}
-
- fileSuffix = fileSuffix.toLowerCase().trim();
- OnboardingTypesEnum onboardingTypesEnum = OnboardingTypesEnum.getOnboardingTypesEnum(fileSuffix);
+ String updatedFileSuffix = fileSuffix;
+ updatedFileSuffix = updatedFileSuffix.toLowerCase().trim();
+ OnboardingTypesEnum onboardingTypesEnum = OnboardingTypesEnum.getOnboardingTypesEnum(updatedFileSuffix);
if (onboardingTypesEnum == null) {
return Optional.empty();
}
try {
- return Optional.of(createInstance(processImplMap.get(onboardingTypesEnum.toString())));
+ return Optional.of(createInstance(PROCESS_IMPL_MAP.get(onboardingTypesEnum.toString())));
}catch (Exception e){
return Optional.empty();
}
}
- private static Map<String, String> getOrchestrationImplMap(){
- try {
- return FileUtils.readViaInputStream(confFile,
- stream -> JsonUtil.json2Object(stream, Map.class));
- }catch (Exception e){
- return new HashMap<>();
- }
- }
-
private static OrchestrationTemplateProcessHandler createInstance(ImplementationConfiguration implClass)
throws Exception {
OrchestrationTemplateProcessHandler handler;