use of io.servicecomb.foundation.common.config.impl.IncConfigs.IncConfig in project java-chassis by ServiceComb.
the class ConfigMgr method init.
public void init() throws Exception {
List<Resource> resArr = PaaSResourceUtils.getSortedResources("classpath*:config/config.inc.xml", ".inc.xml");
IncConfigs incConfigs = new IncConfigs();
incConfigs.setPropertiesList(new ArrayList<>());
incConfigs.setXmlList(new ArrayList<>());
for (Resource resource : resArr) {
IncConfigs tmp = XmlLoaderUtils.load(resource, IncConfigs.class);
if (tmp.getPropertiesList() != null) {
incConfigs.getPropertiesList().addAll(tmp.getPropertiesList());
}
if (tmp.getXmlList() != null) {
incConfigs.getXmlList().addAll(tmp.getXmlList());
}
}
configLoaderMap = new HashMap<>();
for (IncConfig incConfig : incConfigs.getPropertiesList()) {
PropertiesLoader loader = (PropertiesLoader) configLoaderMap.get(incConfig.getId());
if (loader != null) {
loader.getLocationPatternList().addAll(incConfig.getPathList());
continue;
}
configLoaderMap.put(incConfig.getId(), new PropertiesLoader(incConfig.getPathList()));
}
for (IncConfig incConfig : incConfigs.getXmlList()) {
XmlLoader loader = (XmlLoader) configLoaderMap.get(incConfig.getId());
if (loader != null) {
loader.getLocationPatternList().addAll(incConfig.getPathList());
continue;
}
configLoaderMap.put(incConfig.getId(), new XmlLoader(incConfig.getPathList()));
}
}
Aggregations