Package jline.console

Examples of jline.console.ConsoleReader


  private static ConsoleReader reader = null;
  private static IZooReaderWriter zoo = ZooReaderWriter.getInstance();

  private static ConsoleReader getConsoleReader() throws IOException {
    if (reader == null)
      reader = new ConsoleReader();
    return reader;
  }
View Full Code Here


    if (!zookeeperAvailable()) {
      log.fatal("Zookeeper needs to be up and running in order to init. Exiting ...");
      return false;
    }
    if (sconf.get(Property.INSTANCE_SECRET).equals(Property.INSTANCE_SECRET.getDefaultValue())) {
      ConsoleReader c = getConsoleReader();
      c.beep();
      c.println();
      c.println();
      c.println("Warning!!! Your instance secret is still set to the default, this is not secure. We highly recommend you change it.");
      c.println();
      c.println();
      c.println("You can change the instance secret in accumulo by using:");
      c.println("   bin/accumulo " + org.apache.accumulo.server.util.ChangeSecret.class.getName() + " oldPassword newPassword.");
      c.println("You will also need to edit your secret in your configuration file by adding the property instance.secret to your conf/accumulo-site.xml. Without this accumulo will not operate correctly");
    }
    try {
      if (isInitialized(fs)) {
        printInitializeFailureMessages(sconf);
        return false;
View Full Code Here

        this.consoleInput = new ConsoleInputStream();
        this.session = processor.createSession(this.consoleInput, this.out, this.err);
        this.session.put("SCOPE", "shell:osgi:*");
        this.closeCallback = closeCallback;

        reader = new ConsoleReader(null,
                                   this.consoleInput,
                                   this.out,
                                   this.terminal,
                                   encoding);

View Full Code Here

        if (GlobalState.consoleReader != null) {
            GlobalState.consoleReader.shutdown();
        }
        // GlobalState.consoleReader = new ConsoleReader(stdIn,
        // new TeeOutputStream(stdOut, System.err), new UnsupportedTerminal());
        GlobalState.consoleReader = new ConsoleReader(stdIn, stdOut, new UnsupportedTerminal());

        ContextBuilder injectorBuilder = new CLITestContextBuilder(platform);
        Context injector = injectorBuilder.build();

        if (geogigCLI != null) {
View Full Code Here

    @Override
    public void runInternal(GeogigCLI cli) throws IOException {
        ImmutableList<ObjectId> updatedObjects = cli.getGeogig().command(RebuildGraphOp.class)
                .call();

        final ConsoleReader console = cli.getConsole();
        if (updatedObjects.size() > 0) {
            if (quiet) {
                console.println(updatedObjects.size() + " graph elements (commits) were fixed.");
            } else {
                console.println("The following graph elements (commits) were incomplete or missing and have been fixed:");
                for (ObjectId object : updatedObjects) {
                    console.println(object.toString());
                }
            }
        } else {
            console.println("No missing or incomplete graph elements (commits) were found.");
        }
    }
View Full Code Here

    private GeoGIG geogig;

    @Override
    public void runInternal(GeogigCLI cli) throws IOException {

        ConsoleReader console = cli.getConsole();
        geogig = cli.getGeogig();

        Iterable<String> lines = null;
        if (filepath != null) {
            File file = new File(filepath);
            checkParameter(file.exists(), "Insert file cannot be found");
            lines = Files.readLines(file, Charsets.UTF_8);
        } else {
            String featuresText = Joiner.on("\n").join(inputs);
            lines = Splitter.on("\n").split(featuresText);
        }
        Map<String, List<Feature>> features = readFeatures(lines);

        long count = 0;
        for (String key : features.keySet()) {
            List<Feature> treeFeatures = features.get(key);
            geogig.getRepository()
                    .workingTree()
                    .insert(key, treeFeatures.iterator(), cli.getProgressListener(), null,
                            treeFeatures.size());
            count += treeFeatures.size();
        }

        console.print(Long.toString(count) + " features successfully inserted.");
    }
View Full Code Here

    @Override
    public void runInternal(GeogigCLI cli) throws IOException {
        checkParameter(commits.size() == 2, "Two commit references must be provided");

        ConsoleReader console = cli.getConsole();
        GeoGIG geogig = cli.getGeogig();

        Optional<RevObject> left = geogig.command(RevObjectParse.class).setRefSpec(commits.get(0))
                .call();
        checkParameter(left.isPresent(), commits.get(0) + " does not resolve to any object.");
        checkParameter(left.get() instanceof RevCommit, commits.get(0)
                + " does not resolve to a commit");
        Optional<RevObject> right = geogig.command(RevObjectParse.class).setRefSpec(commits.get(1))
                .call();
        checkParameter(right.isPresent(), commits.get(1) + " does not resolve to any object.");
        checkParameter(right.get() instanceof RevCommit, commits.get(1)
                + " does not resolve to a commit");
        Optional<ObjectId> ancestor = geogig.command(FindCommonAncestor.class)
                .setLeft((RevCommit) left.get()).setRight((RevCommit) right.get()).call();
        checkParameter(ancestor.isPresent(), "No common ancestor was found.");

        console.print(ancestor.get().toString());
    }
View Full Code Here

    @Override
    public void runInternal(GeogigCLI cli) throws IOException {
        checkParameter(patchFiles.size() < 2, "Only one single patch file accepted");
        checkParameter(!patchFiles.isEmpty(), "No patch file specified");

        ConsoleReader console = cli.getConsole();

        File patchFile = new File(patchFiles.get(0));
        checkParameter(patchFile.exists(), "Patch file cannot be found");
        FileInputStream stream;
        try {
            stream = new FileInputStream(patchFile);
        } catch (FileNotFoundException e1) {
            throw new IllegalStateException("Can't open patch file " + patchFile);
        }
        BufferedReader reader = null;
        try {
            reader = new BufferedReader(new InputStreamReader(stream, "UTF-8"));
        } catch (UnsupportedEncodingException e) {
            Closeables.closeQuietly(reader);
            Closeables.closeQuietly(stream);
            throw new IllegalStateException("Error reading patch file " + patchFile, e);
        }
        Patch patch = PatchSerializer.read(reader);
        Closeables.closeQuietly(reader);
        Closeables.closeQuietly(stream);

        VerifyPatchResults verify = cli.getGeogig().command(VerifyPatchOp.class).setPatch(patch)
                .setReverse(reverse).call();
        Patch toReject = verify.getToReject();
        Patch toApply = verify.getToApply();
        if (toReject.isEmpty()) {
            console.println("Patch can be applied.");
        } else {
            console.println("Error: Patch cannot be applied\n");
            console.println("Applicable entries:\n");
            console.println(toApply.toString());
            console.println("\nConflicting entries:\n");
            console.println(toReject.toString());
        }

    }
View Full Code Here

            }
        }
        Iterator<NodeRef> iter = cli.getGeogig().command(LsTreeOp.class).setReference(ref)
                .setStrategy(lsStrategy).call();

        final ConsoleReader console = cli.getConsole();

        Function<NodeRef, CharSequence> printFunctor = new Function<NodeRef, CharSequence>() {

            @Override
            public CharSequence apply(NodeRef input) {
                StringBuilder sb = new StringBuilder();
                if (!verbose) {
                    sb.append(input.path());
                } else {
                    Envelope env = new Envelope();
                    input.getNode().expand(env);
                    StringBuilder sbenv = new StringBuilder();
                    sbenv.append(Double.toString(env.getMinX())).append(";")
                            .append(Double.toString(env.getMaxX())).append(";")
                            .append(Double.toString(env.getMinY())).append(";")
                            .append(Double.toString(env.getMaxY()));
                    sb.append(input.getMetadataId().toString()).append(' ')
                            .append(input.getType().toString().toLowerCase()).append(' ')
                            .append(input.objectId().toString()).append(' ').append(input.path())
                            .append(' ').append(sbenv);
                    if (input.getType().equals(TYPE.TREE)) {
                        RevTree tree = cli.getGeogig().command(RevObjectParse.class)
                                .setObjectId(input.objectId()).call(RevTree.class).get();
                        sb.append(' ').append(tree.size()).append(' ').append(tree.numTrees());
                    }
                }
                return sb;
            }
        };

        Iterator<CharSequence> lines = Iterators.transform(iter, printFunctor);

        while (lines.hasNext()) {
            console.println(lines.next());
        }
        console.flush();
    }
View Full Code Here

                    .command(WalkGraphOp.class).setReference(ref) //
                    .setDeduplicator(deduplicator) //
                    // .setStrategy(lsStrategy) //
                    .call();

            final ConsoleReader console = cli.getConsole();
            if (!iter.hasNext()) {
                if (ref == null) {
                    console.println("The working tree is empty");
                } else {
                    console.println("The specified path is empty");
                }
                return;
            }

            Function<RevObject, CharSequence> printFunctor = new Function<RevObject, CharSequence>() {
                @Override
                public CharSequence apply(RevObject input) {
                    if (verbose) {
                        return String.format("%s: %s %s", input.getId(), input.getType(), input);
                    } else {
                        return String.format("%s: %s", input.getId(), input.getType());
                    }
                }
            };

            Iterator<CharSequence> lines = Iterators.transform(iter, printFunctor);

            while (lines.hasNext()) {
                console.println(lines.next());
            }
            console.flush();
        } finally {
            deduplicator.release();
        }
    }
View Full Code Here

TOP

Related Classes of jline.console.ConsoleReader

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.