Package org.locationtech.geogig.web.api

Examples of org.locationtech.geogig.web.api.CommandResponse$ErrorLiteral


        }
        final Remote remote;
        try {
            remote = geogig.command(RemoteAddOp.class).setName(remoteName).setURL(remoteURL)
                    .setUserName(username).setPassword(password).call();
            context.setResponseContent(new CommandResponse() {
                @Override
                public void write(ResponseWriter out) throws Exception {
                    out.start();
                    out.writeElement("name", remote.getName());
                    out.finish();
View Full Code Here


            } else {
                geogig.command(RemoteRemoveOp.class).setName(remoteName).call();
                newRemote = geogig.command(RemoteAddOp.class).setName(remoteName).setURL(remoteURL)
                        .setUserName(username).setPassword(password).call();
            }
            context.setResponseContent(new CommandResponse() {
                @Override
                public void write(ResponseWriter out) throws Exception {
                    out.start();
                    out.writeElement("name", newRemote.getName());
                    out.finish();
View Full Code Here

            return;
        } catch (Exception e) {
            context.setResponseContent(CommandResponse.error("Aborting Remote Remove"));
            return;
        }
        context.setResponseContent(new CommandResponse() {
            @Override
            public void write(ResponseWriter out) throws Exception {
                out.start();
                out.writeElement("name", remote.getName());
                out.finish();
View Full Code Here

            }
            remotePingResponse = ref != null;
        } else {
            remotePingResponse = false;
        }
        context.setResponseContent(new CommandResponse() {
            @Override
            public void write(ResponseWriter out) throws Exception {
                out.start();
                out.writeRemotePingResponse(remotePingResponse);
                out.finish();
View Full Code Here

    }

    private void remoteList(CommandContext context, final Context geogig) {
        final List<Remote> remotes = geogig.command(RemoteListOp.class).call();

        context.setResponseContent(new CommandResponse() {
            @Override
            public void write(ResponseWriter out) throws Exception {
                out.start();
                out.writeRemoteListResponse(remotes, verbose);
                out.finish();
View Full Code Here

        if (path != null) {
            command.addPattern(path);
        }

        command.call();
        context.setResponseContent(new CommandResponse() {
            @Override
            public void write(ResponseWriter out) throws Exception {
                out.start();
                out.writeElement("Add", "Success");
                out.finish();
View Full Code Here

                }
            }
        }

        command.addPathToRemove(path).call();
        context.setResponseContent(new CommandResponse() {
            @Override
            public void write(ResponseWriter out) throws Exception {
                out.start();
                out.writeElement("Deleted", path);
                out.finish();
View Full Code Here

        try {
            final BlameReport report = geogig.command(BlameOp.class).setPath(path)
                    .setCommit(commit.orNull()).call();

            context.setResponseContent(new CommandResponse() {
                @Override
                public void write(ResponseWriter out) throws Exception {
                    out.start();
                    try {
                        out.writeBlameReport(report);
View Full Code Here

                throw new CommandSpecException("Repository has no HEAD, can't merge.");
            }

            final String target = ((SymRef) head.get()).getTarget();
            command.setSource(branchOrCommit).call();
            context.setResponseContent(new CommandResponse() {
                @Override
                public void write(ResponseWriter out) throws Exception {
                    out.start();
                    out.writeElement("OldTarget", target);
                    out.writeElement("NewTarget", branchOrCommit);
                    out.finish();
                }
            });
        } else if (path != null) {
            command.addPath(path);
            if (ours && !theirs) {
                command.setOurs(ours);
            } else if (theirs && !ours) {
                command.setTheirs(theirs);
            } else {
                throw new CommandSpecException(
                        "Please specify either ours or theirs to update the feature path specified.");
            }
            command.call();
            context.setResponseContent(new CommandResponse() {
                @Override
                public void write(ResponseWriter out) throws Exception {
                    out.start();
                    out.writeElement("Path", path);
                    out.writeElement("Strategy", ours ? "ours" : "theirs");
View Full Code Here

                            .setNewVersion(result.getNewRef().getObjectId())
                            .setOldVersion(result.getOldRef().getObjectId()).call();
                }
            }

            context.setResponseContent(new CommandResponse() {
                @Override
                public void write(ResponseWriter out) throws Exception {
                    out.start();
                    out.writePullResponse(result, iter, geogig);
                    out.finish();
                }
            });
        } catch (SynchronizationException e) {
            switch (e.statusCode) {
            case HISTORY_TOO_SHALLOW:
            default:
                context.setResponseContent(CommandResponse
                        .error("Unable to pull, the remote history is shallow."));
            }
        } catch (MergeConflictsException e) {
            String[] refs = refSpec.split(":");
            String remoteRef = Ref.REMOTES_PREFIX + remoteName + "/" + refs[0];
            Optional<Ref> sourceRef = geogig.command(RefParse.class).setName(remoteRef).call();
            String destinationref = "";
            if (refs.length == 2) {
                destinationref = refs[1];
            } else {
                final Optional<Ref> currHead = geogig.command(RefParse.class).setName(Ref.HEAD)
                        .call();
                if (!currHead.isPresent()) {
                    context.setResponseContent(CommandResponse
                            .error("Repository has no HEAD, can't pull."));
                } else if (!(currHead.get() instanceof SymRef)) {
                    context.setResponseContent(CommandResponse
                            .error("Can't pull from detached HEAD"));
                }
                final SymRef headRef = (SymRef) currHead.get();
                destinationref = headRef.getTarget();
            }

            Optional<Ref> destRef = geogig.command(RefParse.class).setName(destinationref).call();
            final RevCommit theirs = context.getGeoGIG().getRepository()
                    .getCommit(sourceRef.get().getObjectId());
            final RevCommit ours = context.getGeoGIG().getRepository()
                    .getCommit(destRef.get().getObjectId());
            final Optional<ObjectId> ancestor = geogig.command(FindCommonAncestor.class)
                    .setLeft(ours).setRight(theirs).call();
            context.setResponseContent(new CommandResponse() {
                final MergeScenarioReport report = geogig.command(ReportMergeScenarioOp.class)
                        .setMergeIntoCommit(ours).setToMergeCommit(theirs).call();

                @Override
                public void write(ResponseWriter out) throws Exception {
View Full Code Here

TOP

Related Classes of org.locationtech.geogig.web.api.CommandResponse$ErrorLiteral

Copyright © 2018 www.massapicom. 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.