use of org.apache.sis.storage.Resource in project sis by apache.
the class StoreTest method verifyContent.
/**
* Verifies that the given metadata contains one of the given identifiers.
* The identifiers that are found are removed from the given set.
*/
private static void verifyContent(final Aggregate store, final Set<String> identifiers) throws DataStoreException {
for (final Resource resource : store.components()) {
assertNotNull("resource", resource);
for (Identification info : resource.getMetadata().getIdentificationInfo()) {
final String id = Citations.getIdentifier(info.getCitation());
assertTrue(id, identifiers.remove(id));
if (resource instanceof Aggregate) {
verifyContent((Aggregate) resource, identifiers);
}
}
}
}
use of org.apache.sis.storage.Resource in project sis by apache.
the class Store method close.
/**
* Closes all children resources.
*/
@Override
public synchronized void close() throws DataStoreException {
final Collection<Resource> resources = components;
if (resources != null) {
// Clear first in case of failure.
components = null;
DataStoreException failure = null;
for (final Resource r : resources) {
if (r instanceof DataStore)
try {
((DataStore) r).close();
} catch (DataStoreException ex) {
if (failure == null) {
failure = ex;
} else {
failure.addSuppressed(ex);
}
}
}
if (failure != null) {
throw failure;
}
}
}
Aggregations