summaryrefslogtreecommitdiffstats
path: root/openecomp-be/backend
diff options
context:
space:
mode:
authormojahidi <mojahidul.islam@amdocs.com>2017-12-27 15:46:26 +0530
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2017-12-27 13:16:47 +0000
commitad5181d9e3b82327a3a14564947fe34465f32008 (patch)
treeaa2626f2bad454e0ac4f2ebe2710a6a65fb8fcc2 /openecomp-be/backend
parent51b5c62d198a07707de99cee2e96bdd8c1c227a8 (diff)
Fixed sonar issues - OrchestrationProcessFactory
Fixed all sonar issues except exception handling Change-Id: Id1ecf35c157be3c1c9c3f5614bd97b5f8c856e5b Issue-ID: SDC-343 Signed-off-by: mojahidi <mojahidul.islam@amdocs.com>
Diffstat (limited to 'openecomp-be/backend')
-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;