Package com.persistit.util

Examples of com.persistit.util.ArgParser


        @Override
        public String toString() {
            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


    public static void main(final String[] args) throws Exception {
        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
     *            Specify one argument in the form file=<pathname>
     * @throws Exception
     */
    public static void main(final String[] args) throws Exception {
        final ArgParser ap = new ArgParser("com.persistit.IOMeter", args, new String[] { "file||log file name",
                "skip|long:0:0:1000000000000|event skip count", "count|long:0:0:2000000000|event count nlimit",
                "_flag|a|Analyze page pattern" }).strict();
        final String fileName = ap.getStringValue("file");
        final long skip = ap.getLongValue("skip");
        final int count = ap.getIntValue("count");
        if (fileName == null) {
            ap.usage();
        } else {
            IOMeter ioMeter = new IOMeter();
            final DataInputStream is = new DataInputStream(new BufferedInputStream(new FileInputStream(fileName)));
            is.skip(skip * DUMP_RECORD_LENGTH);
            ioMeter.dump(is, count == 0 ? Integer.MAX_VALUE : count, ap.isFlag('a'));
            is.close();
        }
    }
View Full Code Here

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

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

        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);
            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");
            }
            boolean gui = ap.isFlag('g');
            boolean icheck = ap.isFlag('i');
            boolean wait = ap.isFlag('w');
            boolean copy = ap.isFlag('c');

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

        _action = new SimpleDumpAction();
        _selectedTypes.set(0, 65535, true);
    }

    public void init(final String[] args) {
        ArgParser ap = new ArgParser("com.persistit.JournalTool", args, ARGS_TEMPLATE).strict();
        if (ap.isUsageOnly()) {
            return;
        }
        init(ap);
    }
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

    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

        @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

     * @param args
     *            Specify one argument in the form file=<pathname>
     * @throws Exception
     */
    public static void main(final String[] args) throws Exception {
        final ArgParser ap = new ArgParser("com.persistit.IOMeter", args, new String[] { "file||log file name",
                "skip|long:0:0:1000000000000|event skip count", "count|long:0:0:2000000000|event count nlimit",
                "_flag|a|Analyze page pattern" }).strict();
        final String fileName = ap.getStringValue("file");
        final long skip = ap.getLongValue("skip");
        final int count = ap.getIntValue("count");
        if (fileName == null) {
            ap.usage();
        } else {
            final IOMeter ioMeter = new IOMeter();
            final DataInputStream is = new DataInputStream(new BufferedInputStream(new FileInputStream(fileName)));
            is.skip(skip * DUMP_RECORD_LENGTH);
            ioMeter.dump(is, count == 0 ? Integer.MAX_VALUE : count, ap.isFlag('a'));
            is.close();
        }
    }
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

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.