public Map<String, SimpleFeature> getFeatures(@NonNull String rootTreeIsh,
@Nullable String layerName) {
Map<String, RevFeatureType> types = getFeatureTypes(rootTreeIsh);
String treeIsh = layerName == null ? rootTreeIsh
: String.format("%s:%s", rootTreeIsh, layerName);
Map<String, NodeRef> nodes = getFeatureNodes(treeIsh);
Context context = getContext();
Map<String, SimpleFeature> featuresByPath = new HashMap<>();
try (AutoCloseableIterator<ObjectInfo<RevFeature>> features = context.objectDatabase()
.getObjects(nodes.values().iterator(), BulkOpListener.NOOP_LISTENER,
RevFeature.class)) {
features.forEachRemaining(rf -> {
String typeName = rf.ref().getParentPath();
String path = rf.ref().path();
String id = rf.node().getName();
SimpleFeature feature = (SimpleFeature) new FeatureBuilder(types.get(typeName))
.build(id, rf.object());
featuresByPath.put(path, feature);
});
}
return featuresByPath;
}