2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.core.factory;
24 import org.openecomp.core.factory.api.FactoriesConfiguration;
25 import org.openecomp.core.utilities.file.FileUtils;
26 import org.openecomp.core.utilities.json.JsonUtil;
28 import java.io.InputStream;
29 import java.util.HashMap;
30 import java.util.List;
33 public final class FactoriesConfigImpl implements FactoriesConfiguration {
36 private static final String FACTORY_CONFIG_FILE_NAME = "factoryConfiguration.json";
37 private static Map factoryMap = new HashMap();
38 private static boolean initialized = false;
40 @SuppressWarnings("unchecked")
42 public Map<String, String> getFactoriesMap() {
53 List<InputStream> factoryConfigIsList = FileUtils.getFileInputStreams(FACTORY_CONFIG_FILE_NAME);
54 for (InputStream factoryConfigIs : factoryConfigIsList) {
55 factoryMap.putAll(JsonUtil.json2Object(factoryConfigIs, Map.class));