Package org.locationtech.geogig.api

Examples of org.locationtech.geogig.api.Context.command()


        checkArgSpec(mappingFile == null || mappingFile.exists(),
                "The specified mapping file does not exist");

        AbstractGeoGigOp<Optional<OSMReport>> command;
        if (update) {
            command = context.command(OSMUpdateOp.class).setRebase(rebase).setMessage(messageArg)
                    .setAPIUrl(OSMUtils.DEFAULT_API_ENDPOINT);
        } else {
            command = context.command(OSMDownloadOp.class).setBbox(bbox).setFilterFile(filterFile)
                    .setMessage(messageArg).setMappingFile(mappingFile)
                    .setOsmAPIUrl(OSMUtils.DEFAULT_API_ENDPOINT);
View Full Code Here


        AbstractGeoGigOp<Optional<OSMReport>> command;
        if (update) {
            command = context.command(OSMUpdateOp.class).setRebase(rebase).setMessage(messageArg)
                    .setAPIUrl(OSMUtils.DEFAULT_API_ENDPOINT);
        } else {
            command = context.command(OSMDownloadOp.class).setBbox(bbox).setFilterFile(filterFile)
                    .setMessage(messageArg).setMappingFile(mappingFile)
                    .setOsmAPIUrl(OSMUtils.DEFAULT_API_ENDPOINT);
        }

        AsyncCommand<Optional<OSMReport>> asyncCommand;
View Full Code Here

                    + " * message: Optional. Message for the commit to create.";

            throw new CommandSpecException(msg);
        }

        OSMImportOp command = context.command(OSMImportOp.class);
        command.setAdd(add);
        command.setDataSource(urlOrFilepath);
        command.setMapping(mapping);
        command.setMessage(message);
        command.setNoRaw(noRaw);
View Full Code Here

        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));
View Full Code Here

     * @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();
    }

View Full Code Here

            if (this.geogigTx != null) {
                geogigTx.abort();
            }
            GeoGigDataStore dataStore = (GeoGigDataStore) entry.getDataStore();
            Context commandLocator = dataStore.getCommandLocator(this.tx);
            this.geogigTx = commandLocator.command(TransactionBegin.class).call();
            // checkout the working branch
            final String workingBranch = dataStore.getOrFigureOutBranch();
            this.geogigTx.command(CheckoutOp.class).setForce(true).setSource(workingBranch).call();
        }
    }
View Full Code Here

    private List<NodeRef> findTypeRefs(@Nullable Transaction tx) {

        final String rootRef = getRootRef(tx);
        Context commandLocator = getCommandLocator(tx);
        List<NodeRef> typeTrees = commandLocator.command(FindFeatureTypeTrees.class)
                .setRootTreeRef(rootRef).call();
        return typeTrees;
    }

    String getRootRef(@Nullable Transaction tx) {
View Full Code Here

        Ref master = new Ref(Ref.MASTER, ObjectId.forString("hash me"));

        when(mockRefParse.call()).thenReturn(Optional.of(master));

        Context injector = mock(Context.class);
        when(injector.command(eq(RefParse.class))).thenReturn(mockRefParse);
        when(injector.platform()).thenReturn(platform);
        when(injector.repository()).thenReturn(mockRepo);
        init.setContext(injector);

        assertTrue(ResolveGeogigDir.lookup(platform.pwd()).isPresent());
View Full Code Here

            throw new CommandSpecException(
                    "No transaction was specified, add requires a transaction to preserve the stability of the repository.");
        }
        final Context geogig = this.getCommandLocator(context);

        AddOp command = geogig.command(AddOp.class);

        if (path != null) {
            command.addPattern(path);
        }
View Full Code Here

        if (this.path == null) {
            throw new CommandSpecException("No path was specified for removal.");
        }

        final Context geogig = this.getCommandLocator(context);
        RemoveOp command = geogig.command(RemoveOp.class);

        NodeRef.checkValidPath(path);

        Optional<NodeRef> node = geogig.command(FindTreeChild.class)
                .setParent(geogig.workingTree().getTree()).setIndex(true).setChildPath(path)
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.