use of net.sf.webdav.exceptions.WebdavException in project indy by Commonjava.
the class ArtifactStoreSubStore method getStorageAdviceFor.
private StorageAdvice getStorageAdviceFor(final StoreURIMatcher matcher) throws WebdavException {
final String uri = matcher.getURI();
final StoreKey key = matcher.getStoreKey();
ArtifactStore store;
try {
store = indy.getArtifactStore(key);
} catch (final IndyDataException e) {
logger.error(String.format("Failed to retrieve artifact store: %s for URI: %s\nReason: %s", key, uri, e.getMessage()), e);
throw new WebdavException("Cannot create: " + uri);
}
if (store == null) {
throw new WebdavException("Cannot retrieve ArtifactStore: " + key);
}
StorageAdvice advice;
try {
advice = advisor.getStorageAdvice(store);
} catch (final DotMavenException e) {
logger.error(String.format("Failed to retrieve storage advice for: %s (URI: %s)\nReason: %s", key, uri, e.getMessage()), e);
throw new WebdavException("Cannot create: " + uri);
}
if (!advice.isDeployable()) {
throw new WebdavException("Read-only area. Cannot create: " + uri);
}
return advice;
}
Aggregations