@Override
public void loadConfig() {
load = true;
IConfig<?> newConfig = null;
SalsaException salsaException = null;
if (currentConfigAtLoad || currentConfigAtNewScan) {
String currentConfigPath = getCurrentConfigPath();
if ((currentConfigPath != null) && (!currentConfigPath.isEmpty()) && (currentConfigPath.indexOf("/") > -1)) {
setNewConfigPath(currentConfigPath);
} else if ((configPath != null) && (!configPath.isEmpty()) && (configPath.indexOf("/") > -1)) {
setNewConfigPath(configPath);
}
}
if ((newConfigPath != null) && !newConfigPath.isEmpty()) {
LOGGER.trace("newConfigPath={}", newConfigPath);
LOGGER.trace("currentConfig={}", config);
// Do not reload the config if the actual config is the same
if ((config == null) || !config.getFullPath().equalsIgnoreCase(newConfigPath)) {
try {
newConfig = SalsaAPI.getConfigByPath(newConfigPath, reloadConfigAtRead);
if (newConfig != null) {
config = newConfig;
} else {
salsaException = new SalsaException("unknown error for loading " + newConfigPath);
}
if (config == null) {
configLoaded = false;
notifyLoadingConfigFailed(configPath, salsaException);
} else {
configLoaded = true;
notifyLoadingConfigSucceed(config);
}
} catch (SalsaException e) {
salsaException = e;
LOGGER.debug(e.getMessage());
LOGGER.debug("Stack trace", e);
}
}
} else {
String errorMessage = "configPath is null or empty";
LOGGER.debug(errorMessage);
salsaException = new SalsaException(errorMessage);
}
if (newConfig == null) {
configLoaded = false;
}