use of org.commonjava.indy.dotmaven.data.StorageAdvice in project indy by Commonjava.
the class ArtifactStoreSubStore method createResource.
@Override
public void createResource(final ITransaction transaction, final String resourceUri) throws WebdavException {
final StoreURIMatcher matcher = new StoreURIMatcher(resourceUri);
if (!matcher.hasStorePath()) {
throw new WebdavException("No store-level path specified: '" + resourceUri + "'. This URI references either a list of stores, a root store directory, or something else equally read-only.");
}
final StorageAdvice advice = getStorageAdviceFor(matcher);
final String path = matcher.getStorePath();
final Transfer item = fileManager.getStorageReference(advice.getHostedStore(), path);
try {
item.createFile();
} catch (final IOException e) {
logger.error("Failed to create file: {} in store: {}. Reason: {}", e, path, advice.getStore().getKey(), e.getMessage());
throw new WebdavException("Failed to create file: " + resourceUri);
}
}
Aggregations