use of org.locationtech.geogig.api.Context in project GeoGig by boundlessgeo.
the class GeogigFeatureSource method getNativeType.
SimpleFeatureType getNativeType() {
final NodeRef typeRef = getTypeRef();
final String treePath = typeRef.path();
final ObjectId metadataId = typeRef.getMetadataId();
Context commandLocator = getCommandLocator();
Optional<RevFeatureType> revType = commandLocator.command(RevObjectParse.class).setObjectId(metadataId).call(RevFeatureType.class);
if (!revType.isPresent()) {
throw new IllegalStateException(String.format("Feature type for tree %s not found", treePath));
}
SimpleFeatureType featureType = (SimpleFeatureType) revType.get().type();
return featureType;
}
use of org.locationtech.geogig.api.Context in project GeoGig by boundlessgeo.
the class GeogigFeatureSource method getTypeTree.
/**
* @return
*/
RevTree getTypeTree() {
String refSpec = getRootRef() + ":" + getTypeTreePath();
Context commandLocator = getCommandLocator();
Optional<RevTree> ref = commandLocator.command(RevObjectParse.class).setRefSpec(refSpec).call(RevTree.class);
Preconditions.checkState(ref.isPresent(), "Ref %s not found on working tree", refSpec);
return ref.get();
}
Aggregations