@Override public String apply(NodeRef noderef) { return noderef.path(); } };
@Override public String apply(NodeRef noderef) { return noderef.path(); } };
/** * Implementation detail: {@link PreOrderDiffWalk} may call in this consumer's tree/endtree * bucket/endBucket methods from different threads, but the pairs of start/end calls are * called from the same thread. This method prepends the thread name to the node path so * there are no clashes in the "stack" map above. */ private String treePath(NodeRef left, NodeRef right) { return left == null ? right.path() : left.path(); }
private GeoGigFeatureWriter(final FeatureReader<SimpleFeatureType, SimpleFeature> reader, final NodeRef typeRef, final WorkingTree workingTree) { this.reader = reader; this.typePath = typeRef.path(); this.featureTypeId = typeRef.getMetadataId(); this.workingTree = workingTree; }
/** * @return the Node represented as a readable string. */ @Override public String toString() { return new StringBuilder("NodeRef").append('[').append(path()).append(" -> ") .append(node.getObjectId()).append(']').toString(); }
String getTypeTreePath() { NodeRef typeRef = getTypeRef(); String path = typeRef.path(); return path; }
public UpdateTree setChild(NodeRef childTreeNode) { checkNotNull(childTreeNode); final String path = childTreeNode.path(); NodeRef.checkValidPath(path); checkArgument(RevObject.TYPE.TREE.equals(childTreeNode.getType())); childTreeRemoves.remove(path); childTreeUpdates.put(path, childTreeNode); return this; }
public Name getDescriptorName(NodeRef treeRef) { Preconditions.checkNotNull(treeRef); Preconditions.checkArgument(TYPE.TREE.equals(treeRef.getType())); Preconditions.checkArgument(!treeRef.getMetadataId().isNull(), "NodeRef '%s' is not a feature type reference", treeRef.path()); return new NameImpl(getNamespaceURI(), NodeRef.nodeFromPath(treeRef.path())); }
private void verifyTreeStructure(ObjectId treeId, NodeRef... treeRefs) { Set<String> expectedPaths = ImmutableSet .copyOf(Iterables.transform(Arrays.asList(treeRefs), (nr) -> nr.path())); ImmutableMap<String, NodeRef> refs = getTreeRefsByPath(treeId); assertEquals(expectedPaths, refs.keySet()); }
@Override public boolean apply(NodeRef ref) { TYPE type = ref.getType(); String path = ref.path(); return TYPE.TREE.equals(type) && treePath.equals(path); } }
private ImmutableMap<String, NodeRef> getTreeRefsByPath(ObjectId newRepoRoot) { Iterator<NodeRef> iterator = geogig.command(LsTreeOp.class) .setReference(newRepoRoot.toString()).setStrategy(Strategy.DEPTHFIRST_ONLY_TREES) .call(); ImmutableMap<String, NodeRef> refsByPath = Maps.uniqueIndex(iterator, (n) -> n.path()); return refsByPath; }
private ImmutableMap<String, NodeRef> getRefsByPath(ObjectId repoRoot, boolean includeFeatures) { Strategy strategy = includeFeatures ? Strategy.DEPTHFIRST : Strategy.DEPTHFIRST_ONLY_TREES; Iterator<NodeRef> iterator = geogig.command(LsTreeOp.class) .setReference(repoRoot.toString()).setStrategy(strategy).call(); ImmutableMap<String, NodeRef> refsByPath = Maps.uniqueIndex(iterator, (n) -> n.path()); return refsByPath; }
private void createQuadTree(String tree) throws IOException { Map<String, NodeRef> all = Maps.uniqueIndex( geogig.command(FindFeatureTypeTrees.class).setRootTreeRef("HEAD").call(), (r) -> r.path()); NodeRef typeTreeRef = all.get(tree); assertNotNull(typeTreeRef); CreateQuadTree command = geogig.command(CreateQuadTree.class); command.setTypeTreeRef(typeTreeRef); command.call(); }
private NodeRef putFeatures(NodeRef layer, int featureCount) { List<FeatureInfo> features = createFeatures(layer, featureCount); repo.workingTree().insert(features.iterator(), new DefaultProgressListener()); Optional<NodeRef> ref = repo.command(FindTreeChild.class) .setParent(repo.workingTree().getTree()).setChildPath(layer.path()).call(); assertTrue(ref.isPresent()); return ref.get(); }
@Test public void testCreateTypeNestedNonExistingParent() throws Exception { NodeRef treeRef = workTree.createTypeTree("path/to/nested/type", pointsType); assertNotNull(treeRef); assertEquals("path/to/nested/type", treeRef.path()); assertEquals("path/to/nested", treeRef.getParentPath()); assertTrue(treeRef.getNode().getMetadataId().isPresent()); assertEquals(treeRef.getMetadataId(), treeRef.getNode().getMetadataId().get()); RevFeatureType featureType = repo.objectDatabase().getFeatureType(treeRef.getMetadataId()); RevObjectTestUtil.deepEquals(RevFeatureType.builder().type(pointsType).build(), featureType); }
@Test public void testCreateTypeTree() throws Exception { NodeRef treeRef = workTree.createTypeTree("points2", pointsType); assertNotNull(treeRef); assertEquals("points2", treeRef.path()); assertEquals("", treeRef.getParentPath()); assertTrue(treeRef.getNode().getMetadataId().isPresent()); assertEquals(treeRef.getMetadataId(), treeRef.getNode().getMetadataId().get()); RevFeatureType featureType = repo.objectDatabase().getFeatureType(treeRef.getMetadataId()); RevObjectTestUtil.deepEquals(RevFeatureType.builder().type(pointsType).build(), featureType); }