Package com.persistit.util

Examples of com.persistit.util.ArgParser


                final Command command = COMMANDS.get(commandName);
                if (command != null) {
                    list.remove(0);
                    try {
                        final String[] args = list.toArray(new String[list.size()]);
                        final ArgParser ap = new ArgParser(commandName, args, command.argTemplate).strict();
                        if (!ap.isUsageOnly()) {
                            final String result = command.execute(this, ap);
                            if (result != null) {
                                _writer.println(result);
                            }
                            _lastStatus += " - done";
View Full Code Here


        }

    }

    public static void main(final String[] args) throws Exception {
        final ArgParser ap = new ArgParser("VolumeHeader", args, ARGS_TEMPLATE).strict();
        if (ap.isUsageOnly()) {
            return;
        }
        final Task task = new VolumeInfoTask(ap.getStringValue("path"));
        task.setMessageWriter(new PrintWriter(System.out));
        task.runTask();
    }
View Full Code Here

    public static void main(final String[] args) throws Exception {
        final String[] template = {
                "path||pathname of journal, e.g., /xxx/yyy/zzz_journal "
                        + "for files such as /xxx/yyy/zzz_journal.0000000000000047",
                "_flags|t|emit transaction details" };
        final ArgParser argParser = new ArgParser("RecoveryManager", args, template).strict();
        final Persistit persistit = new Persistit();
        persistit.initializeJournal();
        final RecoveryManager rman = new RecoveryManager(persistit);
        rman.init(argParser.getStringValue("path"));
        rman.analyze();
    }
View Full Code Here

    public static void main(final String[] args) throws Exception {
        final String[] template = {
                "path||pathname of journal, e.g., /xxx/yyy/zzz_journal "
                        + "for files such as /xxx/yyy/zzz_journal.0000000000000047",
                "_flags|t|emit transaction details" };
        final ArgParser argParser = new ArgParser("RecoveryManager", args, template).strict();
        final Persistit persistit = new Persistit();
        persistit.initializeJournal();
        final RecoveryManager rman = new RecoveryManager(persistit);
        rman.init(argParser.getStringValue("path"));
        rman.analyze();
    }
View Full Code Here

     *
     * @param args
     * @throws Exception
     */
    public static void main(final String[] args) throws Exception {
        final ArgParser ap = new ArgParser("Persistit", args, ARG_TEMPLATE).strict();
        if (ap.isUsageOnly()) {
            return;
        }

        Persistit persistit = null;
        final String propertiesFileName = ap.getStringValue("properties");
        if (!propertiesFileName.isEmpty()) {
            persistit = new Persistit();
            persistit.setPropertiesFromFile(propertiesFileName);
            persistit.initialize();
        }
        final String scriptName = ap.getStringValue("script");

        final int cliport = ap.getIntValue("cliport");

        if (cliport > -1 && !propertiesFileName.isEmpty()) {
            throw new IllegalArgumentException("Specify only one: properties or cliport");
        }

        if (cliport > 1) {
            System.out.printf("Starting a Persistit CLI server on port %d\n", cliport);
            final Task task = CLI.cliserver(cliport);
            task.runTask();
            task.setPersistit(persistit);
        } else if (!scriptName.isEmpty()) {
            final BufferedReader reader = new BufferedReader(new FileReader(scriptName));
            final PrintWriter writer = new PrintWriter(System.out);
            CLI.runScript(persistit, reader, writer);
        } else {
            if (persistit == null) {
                throw new IllegalArgumentException("Must specify a properties file");
            }
            final boolean gui = ap.isFlag('g');
            final boolean icheck = ap.isFlag('i');
            final boolean wait = ap.isFlag('w');
            final boolean copy = ap.isFlag('c');

            try {
                if (gui) {
                    persistit.setupGUI(wait);
                }
View Full Code Here

        final Command command = COMMANDS.get(commandName);
        if (command == null) {
            return null;
        }
        final Task task = command.createTask(persistit,
                new ArgParser(commandName, pieces.toArray(new String[pieces.size()]), command.argTemplate).strict());
        if (task != null) {
            task.setPersistit(persistit);
        }
        return task;
    }
View Full Code Here

                final Command command = COMMANDS.get(commandName);
                if (command != null) {
                    list.remove(0);
                    try {
                        final String[] args = list.toArray(new String[list.size()]);
                        final ArgParser ap = new ArgParser(commandName, args, command.argTemplate).strict();
                        if (!ap.isUsageOnly()) {
                            final String result = command.execute(this, ap);
                            if (result != null) {
                                _writer.println(result);
                            }
                            _lastStatus += " - done";
View Full Code Here

        @Override
        public String toString() {
            final StringBuilder sb = new StringBuilder(name);
            sb.append(Util.NEW_LINE);
            sb.append(new ArgParser(name, new String[0], argTemplate).strict());
            return sb.toString();
        }
View Full Code Here

        final String commandName = pieces.remove(0);
        Command command = COMMANDS.get(commandName);
        if (command == null) {
            return null;
        }
        Task task = command.createTask(persistit, new ArgParser(commandName, pieces.toArray(new String[pieces.size()]),
                command.argTemplate).strict());
        if (task != null) {
            task.setPersistit(persistit);
        }
        return task;
View Full Code Here

                final Command command = COMMANDS.get(commandName);
                if (command != null) {
                    list.remove(0);
                    try {
                        final String[] args = list.toArray(new String[list.size()]);
                        final ArgParser ap = new ArgParser(commandName, args, command.argTemplate).strict();
                        if (!ap.isUsageOnly()) {
                            String result = command.execute(this, ap);
                            if (result != null) {
                                _writer.println(result);
                            }
                            _lastStatus += " - done";
View Full Code Here

TOP

Related Classes of com.persistit.util.ArgParser

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.