1 package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration;
 
   3 import org.openecomp.config.api.Configuration;
 
   4 import org.openecomp.config.api.ConfigurationManager;
 
   5 import org.openecomp.core.utilities.CommonMethods;
 
   6 import org.openecomp.sdc.common.errors.CoreException;
 
   7 import org.openecomp.sdc.datatypes.configuration.ImplementationConfiguration;
 
   8 import org.openecomp.sdc.vendorsoftwareproduct.dao.errors.OrchestrationTemplateFileExtensionErrorBuilder;
 
  11 import java.util.Objects;
 
  12 import java.util.concurrent.ConcurrentHashMap;
 
  14 import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.OrchestrationUtil.ORCHESTRATION_CONFIG_NAMESPACE;
 
  15 import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.OrchestrationUtil.ORCHESTRATION_IMPL_KEY;
 
  17 public class OrchestrationUploadFactory {
 
  18     private static Map<String, ImplementationConfiguration> fileHanlders;
 
  21         Configuration config = ConfigurationManager.lookup();
 
  22         fileHanlders = new ConcurrentHashMap<>(config.populateMap(ORCHESTRATION_CONFIG_NAMESPACE,
 
  23                 ORCHESTRATION_IMPL_KEY, ImplementationConfiguration.class));
 
  27     public static final OrchestrationTemplateFileHandler createOrchestrationTemplateFileHandler(String fileSuffix) {
 
  28         String fileExtension = fileSuffix.toLowerCase();
 
  29         ImplementationConfiguration orchestrationTemplateFileHandler = fileHanlders.get(fileExtension);
 
  31         if(Objects.isNull(orchestrationTemplateFileHandler)){
 
  32             throw new CoreException(new OrchestrationTemplateFileExtensionErrorBuilder
 
  36         return  CommonMethods.newInstance(orchestrationTemplateFileHandler.getImplementationClass(),
 
  37                         OrchestrationTemplateFileHandler.class);