}
@Override
public IConfig<?> getConfigByPath(String fullPath, IConfig<?> lastLoadedConfig)
throws ScanNotFoundException {
IDirectory root = getRootDirectory();
String[] path = fullPath.split("/");
List<String> pathList = new ArrayList<String>();
pathList.addAll(Arrays.asList(path));
String configName = pathList.remove(pathList.size() - 1);
IConfig<?> c = findConfig(root, pathList, configName);
Integer configId = -1;
if (c != null) {
boolean shouldRecoverConfig;
configId = c.getId();
if (lastLoadedConfig == null
|| !ObjectUtils.sameObject(fullPath, lastLoadedConfig.getFullPath())
|| !ObjectUtils.sameObject(configId, lastLoadedConfig.getId())) {
shouldRecoverConfig = true;
}
else {
Timestamp timestamp = getConfigTimestamp(configId);
if (timestamp == null
|| timestamp.getTime() > lastLoadedConfig.getLastModificationDate()) {
shouldRecoverConfig = true;
}
else {
shouldRecoverConfig = false;
}
}
if (shouldRecoverConfig) {
c = getConfigById(configId);
IDirectory directory = c.getDirectory();
if (directory != null) {
try {
directory = getDirectoryById(directory.getId(), true);
}
catch (Exception e) {
directory = c.getDirectory();
}
}