@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()) {
// System.out.println("newConfigPath=" + newConfigPath);
// System.out.println("config=" + config);
// Do not reload the config if the actual config is the same
if (config == null || !config.getFullPath().equalsIgnoreCase(newConfigPath)) {
// System.out.println("create config");
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;
e.printStackTrace();
}
}
}
else {
salsaException = new SalsaException("configPath is null or empty");
}
if (newConfig == null) {
configLoaded = false;
}