use of org.codelibs.fess.es.config.exentity.CrawlingConfig.ConfigType in project fess by codelibs.
the class CrawlingConfigHelper method getCrawlingConfig.
public CrawlingConfig getCrawlingConfig(final String configId) {
try {
return crawlingConfigCache.get(configId, () -> {
final ConfigType configType = getConfigType(configId);
if (configType == null) {
return null;
}
final String id = getId(configId);
if (id == null) {
return null;
}
switch(configType) {
case WEB:
final WebConfigService webConfigService = ComponentUtil.getComponent(WebConfigService.class);
return webConfigService.getWebConfig(id).get();
case FILE:
final FileConfigService fileConfigService = ComponentUtil.getComponent(FileConfigService.class);
return fileConfigService.getFileConfig(id).get();
case DATA:
final DataConfigService dataConfigService = ComponentUtil.getComponent(DataConfigService.class);
return dataConfigService.getDataConfig(id).get();
default:
return null;
}
});
} catch (final ExecutionException e) {
logger.warn("Failed to access a crawling config cache: {}", configId, e);
return null;
}
}
Aggregations