use of org.locationtech.geogig.repository.WorkingTree in project GeoGig by boundlessgeo.
the class GeogigFeatureSource method getWorkingTree.
/**
* @return
*/
WorkingTree getWorkingTree() {
Context commandLocator = getCommandLocator();
WorkingTree workingTree = commandLocator.workingTree();
return workingTree;
}
use of org.locationtech.geogig.repository.WorkingTree in project GeoGig by boundlessgeo.
the class GeogigFeatureStore method getWriterInternal.
@Override
protected FeatureWriter<SimpleFeatureType, SimpleFeature> getWriterInternal(Query query, final int flags) throws IOException {
Preconditions.checkArgument(flags != 0, "no write flags set");
Preconditions.checkState(getDataStore().isAllowTransactions(), "Transactions not supported; head is not a local branch");
FeatureReader<SimpleFeatureType, SimpleFeature> features;
if ((flags | WRITER_UPDATE) == WRITER_UPDATE) {
features = delegate.getReader(query);
} else {
features = new EmptyFeatureReader<SimpleFeatureType, SimpleFeature>(getSchema());
}
String path = delegate.getTypeTreePath();
WorkingTree wtree = getFeatureSource().getWorkingTree();
GeoGigFeatureWriter writer;
if ((flags | WRITER_ADD) == WRITER_ADD) {
writer = GeoGigFeatureWriter.createAppendable(features, path, wtree);
} else {
writer = GeoGigFeatureWriter.create(features, path, wtree);
}
return writer;
}
use of org.locationtech.geogig.repository.WorkingTree in project GeoGig by boundlessgeo.
the class GeogigFeatureStore method removeFeatures.
@Override
public void removeFeatures(Filter filter) throws IOException {
Preconditions.checkState(getDataStore().isAllowTransactions(), "Transactions not supported; head is not a local branch");
final WorkingTree workingTree = delegate.getWorkingTree();
final String typeTreePath = delegate.getTypeTreePath();
filter = (Filter) filter.accept(new SimplifyingFilterVisitor(), null);
if (Filter.INCLUDE.equals(filter)) {
workingTree.delete(typeTreePath);
return;
}
if (Filter.EXCLUDE.equals(filter)) {
return;
}
Iterator<SimpleFeature> featureIterator = featureIterator(filter);
Iterator<String> affectedFeaturePaths = Iterators.transform(featureIterator, new Function<SimpleFeature, String>() {
@Override
public String apply(SimpleFeature input) {
String fid = input.getID();
return NodeRef.appendChild(typeTreePath, fid);
}
});
workingTree.delete(affectedFeaturePaths);
}
use of org.locationtech.geogig.repository.WorkingTree in project GeoGig by boundlessgeo.
the class RemoteRepositoryTestCase method insert.
/**
* Inserts the feature to the index but does not stages it to be committed
*/
protected ObjectId insert(GeoGIG geogig, Feature f) throws Exception {
final WorkingTree workTree = geogig.getRepository().workingTree();
Name name = f.getType().getName();
String parentPath = name.getLocalPart();
Node ref = workTree.insert(parentPath, f);
ObjectId objectId = ref.getObjectId();
return objectId;
}
use of org.locationtech.geogig.repository.WorkingTree in project GeoGig by boundlessgeo.
the class RepositoryTestCase method insert.
/**
* Inserts the feature to the index but does not stages it to be committed
*/
public ObjectId insert(GeogigTransaction transaction, Feature f) throws Exception {
final WorkingTree workTree = (transaction != null ? transaction.workingTree() : repo.workingTree());
Name name = f.getType().getName();
String parentPath = name.getLocalPart();
Node ref = workTree.insert(parentPath, f);
ObjectId objectId = ref.getObjectId();
return objectId;
}
Aggregations