throws ConfigurationException
{
// Setting common things on a repository
// FIXME: hm, we are called when we are dirty, so....
CRepository repo = coreConfiguration.getConfiguration(true);
// NX-198: filling up the default variable to store the "default" local URL
File defaultStorageFile = new File(new File(configuration.getWorkingDirectory(), "storage"), repo.getId());
try {
repo.defaultLocalStorageUrl = defaultStorageFile.toURI().toURL().toString();
}
catch (MalformedURLException e) {
// will not happen, not user settable
throw new InvalidConfigurationException("Malformed URL for LocalRepositoryStorage!", e);
}
String localUrl;
boolean usingDefaultLocalUrl;
if (repo.getLocalStorage() != null && !Strings.isNullOrEmpty(repo.getLocalStorage().getUrl())) {
localUrl = repo.getLocalStorage().getUrl();
usingDefaultLocalUrl = false;
}
else {
localUrl = repo.defaultLocalStorageUrl;
usingDefaultLocalUrl = true;
}
if (repo.getLocalStorage() == null) {
repo.setLocalStorage(new CLocalStorage());
repo.getLocalStorage().setProvider("file");
}
LocalRepositoryStorage ls = getLocalRepositoryStorage(repo.getId(), repo.getLocalStorage().getProvider());
try {
ls.validateStorageUrl(localUrl);
if (!usingDefaultLocalUrl) {
repo.getLocalStorage().setUrl(localUrl);
}
repository.setLocalStorage(ls);
// mark local storage context dirty, if applicable
final LocalStorageContext ctx = repository.getLocalStorageContext();