use of org.commonjava.indy.dotmaven.util.SettingsURIMatcher in project indy by Commonjava.
the class SettingsSubStore method getChildrenNames.
@Override
public String[] getChildrenNames(final ITransaction transaction, final String folderUri) throws WebdavException {
final SettingsURIMatcher matcher = new SettingsURIMatcher(folderUri);
final Set<String> names = new TreeSet<String>();
if (matcher.isSettingsRootResource()) {
for (final StoreType type : StoreType.values()) {
names.add(type.singularEndpointName());
}
} else if (matcher.isSettingsTypeResource()) {
final StoreType type = matcher.getStoreType();
List<? extends ArtifactStore> all;
try {
all = indy.query().packageType(MAVEN_PKG_KEY).storeTypes(type).getAll();
} catch (final IndyDataException e) {
logger.error(String.format("Failed to retrieve list of artifact stores: %s", e.getMessage()), e);
throw new WebdavException("Failed to retrieve list of settings configurations.");
}
for (final ArtifactStore store : all) {
final String storeName = formatSettingsResourceName(store.getKey().getType(), store.getName());
// logger.info( "\n\nCreating settings resource for: '{}'\n\n", storeName );
names.add(storeName);
}
}
return names.toArray(new String[names.size()]);
}
use of org.commonjava.indy.dotmaven.util.SettingsURIMatcher 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