summaryrefslogtreecommitdiffstats
path: root/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationUploadFactory.java
blob: 104da69ed88ffb71463e5a72c274a6cf5b4cb35f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration;

import org.openecomp.config.api.Configuration;
import org.openecomp.config.api.ConfigurationManager;
import org.openecomp.core.utilities.CommonMethods;
import org.openecomp.sdc.datatypes.configuration.ImplementationConfiguration;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.OrchestrationUtil.ORCHESTRATION_CONFIG_NAMESPACE;
import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.OrchestrationUtil.ORCHESTRATION_Impl_Key;

public class OrchestrationUploadFactory {
    private static Map<String, ImplementationConfiguration> fileHanlders;

    static {
        Configuration config = ConfigurationManager.lookup();
        fileHanlders = new ConcurrentHashMap<>(config.populateMap(ORCHESTRATION_CONFIG_NAMESPACE,
                ORCHESTRATION_Impl_Key, ImplementationConfiguration.class));

    }

    public static final OrchestrationTemplateFileHandler createOrchestrationTemplateFileHandler(String filePrefix) {
        ImplementationConfiguration orchestrationTemplateFileHandler = fileHanlders.get(filePrefix);
        return  CommonMethods.newInstance(orchestrationTemplateFileHandler.getImplementationClass(),
                        OrchestrationTemplateFileHandler.class);
    }
}