use of org.commonjava.indy.dotmaven.util.SettingsTemplate in project indy by Commonjava.
the class SettingsSubStore method getSettingsTemplate.
private synchronized SettingsTemplate getSettingsTemplate(final URIMatcher matcher) throws WebdavException {
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. Reason: %s", key, e.getMessage()), e);
throw new WebdavException("Failed to retrieve length for: " + matcher.getURI());
}
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. Reason: %s", key, e.getMessage()), e);
throw new WebdavException("Failed to retrieve length for: " + matcher.getURI());
}
return new SettingsTemplate(key, advice, requestInfo, templatingEngine);
}
use of org.commonjava.indy.dotmaven.util.SettingsTemplate in project indy by Commonjava.
the class SettingsSubStore method getStoredObject.
@Override
public StoredObject getStoredObject(final ITransaction transaction, final String uri) throws WebdavException {
final StoredObject so = new StoredObject();
final Date d = new Date();
so.setCreationDate(d);
so.setLastModified(d);
final SettingsURIMatcher matcher = new SettingsURIMatcher(uri);
if (matcher.isSettingsFileResource()) {
so.setFolder(false);
final SettingsTemplate st = getSettingsTemplate(matcher);
so.setResourceLength(st.getLength());
} else {
so.setFolder(true);
}
return so;
}
Aggregations