Examples of CommandLineOptionParser


Examples of org.apache.qpid.utils.CommandLineOptionParser

    public void startup()
    {
        conn = ConnectorFactory.getConnector(ConnectionConstants.BROKER_HOSTNAME, ConnectionConstants.BROKER_PORT);
        JMXConnector jmxc = conn.getConnector();
        MBeanServerConnection mbsc = conn.getMBeanServerConnection();
        CommandLineOptionParser parser = new CommandLineOptionParser(command.split(" "));
        info = new JMXinfo(jmxc,parser,mbsc);
        move = new Commandmove(info,"move");


View Full Code Here

Examples of org.apache.qpid.utils.CommandLineOptionParser

    public void startup()
    {
        conn = ConnectorFactory.getConnector(ConnectionConstants.BROKER_HOSTNAME, ConnectionConstants.BROKER_PORT);
        JMXConnector jmxc = conn.getConnector();
        MBeanServerConnection mbsc = conn.getMBeanServerConnection();
        CommandLineOptionParser parser = new CommandLineOptionParser(command.split(" "));
        info = new JMXinfo(jmxc,parser,mbsc);
        viewcontent = new Commandviewcontent(info,"viewcontent");


View Full Code Here

Examples of org.apache.qpid.utils.CommandLineOptionParser

    public void startup()
    {
        conn = ConnectorFactory.getConnector(ConnectionConstants.BROKER_HOSTNAME, ConnectionConstants.BROKER_PORT);
        JMXConnector jmxc = conn.getConnector();
        MBeanServerConnection mbsc = conn.getMBeanServerConnection();
        CommandLineOptionParser parser = new CommandLineOptionParser(command.split(" "));
        info = new JMXinfo(jmxc,parser,mbsc);
        view = new Commandview(info,"view");
    }
View Full Code Here

Examples of org.apache.qpid.utils.CommandLineOptionParser

    public void startup()
    {
        conn = ConnectorFactory.getConnector(ConnectionConstants.BROKER_HOSTNAME, ConnectionConstants.BROKER_PORT);
        JMXConnector jmxc = conn.getConnector();
        MBeanServerConnection mbsc = conn.getMBeanServerConnection();
        CommandLineOptionParser parser = new CommandLineOptionParser(command.split(" "));
        info = new JMXinfo(jmxc,parser,mbsc);
        infocommand = new Commandinfo(info,"list");

    }
View Full Code Here

Examples of org.apache.qpid.utils.CommandLineOptionParser

    public void startup()
    {
        conn = ConnectorFactory.getConnector(ConnectionConstants.BROKER_HOSTNAME, ConnectionConstants.BROKER_PORT);
        JMXConnector jmxc = conn.getConnector();
        MBeanServerConnection mbsc = conn.getMBeanServerConnection();
        CommandLineOptionParser parser = new CommandLineOptionParser(command.split(" "));
        info = new JMXinfo(jmxc,parser,mbsc);
        delete = new Commanddelete(info,"delete");


View Full Code Here

Examples of org.apache.qpid.utils.CommandLineOptionParser

    public void startup()
    {
        conn = ConnectorFactory.getConnector(ConnectionConstants.BROKER_HOSTNAME, ConnectionConstants.BROKER_PORT);
        JMXConnector jmxc = conn.getConnector();
        MBeanServerConnection mbsc = conn.getMBeanServerConnection();
        CommandLineOptionParser parser = new CommandLineOptionParser(command.split(" "));
        info = new JMXinfo(jmxc,parser,mbsc);
        list = new Commandlist(info,"list");

    }
View Full Code Here

Examples of org.apache.qpid.utils.CommandLineOptionParser

        args = command.split(" ");
//        System.out.println(args[0]);
        conn = ConnectorFactory.getConnector(ConnectionConstants.BROKER_HOSTNAME, ConnectionConstants.BROKER_PORT);
        jmxc = conn.getConnector();
        mbsc = conn.getMBeanServerConnection();
        parser = new CommandLineOptionParser(args,args[0]);

    }
View Full Code Here

Examples of org.apache.qpid.utils.CommandLineOptionParser

            parse them in to config method */
            JMXConnector jmxc = null;
            MBeanServerConnection mbsc = null;
            ConsoleReader reader = new ConsoleReader();
            reader.setBellEnabled(false);
            CommandLineOptionParser commandlineoptionparser = null;

            if ((args == null) || (args.length) == 0) {
                Usage();
            }
            /* here special constructor is calling, when parsing options,in here first option value is starting from minus sign
              so this is handle by a special constructor */
            else {
                if (args[0].startsWith("-")) {
                    commandlineoptionparser = new CommandLineOptionParser(args, args[0]);     // if user specify any argument with the qpid-cli script
                }
            }

            /* Connecting with the broker */
//            commandlineoptionparser = new CommandLineOptionParser(args);
//            JMXConfiguration config = new JMXConfiguration(commandlineoptionparser.getAlloptions());
            try {
                if (commandlineoptionparser == null)
                    commandlineoptionparser = new CommandLineOptionParser(args);

                JMXConfiguration config = new JMXConfiguration(commandlineoptionparser.getAlloptions());
                conn = ConnectorFactory.getConnector(config.gethostname(), config.getport());
                jmxc = conn.getConnector();
                mbsc = conn.getMBeanServerConnection();
                if (config.checkoptionsetting("r", commandlineoptionparser.getAlloptions())) {
                    JMXinfo info = new JMXinfo(jmxc, commandlineoptionparser, mbsc);
                    ReportGenerator reportgen = new ReportGenerator(config.optionchecker("r", commandlineoptionparser.getAlloptions()), info);
                    reportgen.loadproperties();
                    reportgen.run();
                }
                /* This implementation is for the people who are using the interactive
                mode for one shot this run the user given command and exit */
                for (int i = 0; i < args.length; i++) {
                    if (args[i].compareTo("list") == 0 || args[i].compareTo("info") == 0 || args[i].compareTo("view") == 0 || args[i].compareTo("viewcontent") == 0
                            || args[i].compareTo("delete") == 0 || args[i].compareTo("move") == 0) {
                        oneshotmode(args,commandlineoptionparser,jmxc,mbsc);

                        return;
                    }
                }
            } catch (Exception ex) {
                connectionrefuse();
                return;
            }
            /* In this point connection has been established */
            String line;
            String[] command;

            /* prividing GNU readline features using Jline library */
            //String list = "list";
            PrintWriter out = new PrintWriter(System.out);
            reader.addCompletor(new ArgumentCompletor(
                    new SimpleCompletor(new String[]{"list", "info", "exit", "quit", "delete", "move", "view", "viewcontent", "queue", "exchange", "connection", "usermanagement", "virtualhost"})));
            while ((line = reader.readLine("qpid-admin-$ ")) != null) {
                out.flush();
                if (removeSpaces(line).equalsIgnoreCase("quit") || removeSpaces(line).equalsIgnoreCase("exit"))
                    break;
                else if (line.length() == 0)
                    continue;
                else {
                    command = line.split("\\s+");
                    commandlineoptionparser = new CommandLineOptionParser(command);
                    JMXinfo info = new JMXinfo(jmxc, commandlineoptionparser, mbsc);
                    CommandExecusionEngine engine = new CommandExecusionEngine(info);
                    if (engine.CommandSelector())
                        engine.runcommand();
                }
View Full Code Here

Examples of org.apache.qpid.utils.CommandLineOptionParser

        }
        for (int i = 0; i < (args.length - 2 * check); i++) {     // mulitply by 2 because have to remove the option letter with the option value//
            args[i] = args[i + check * 2];
        }

        commandlineoptionparser = new CommandLineOptionParser(args);           //change the args string array which works as interactive mode//
        JMXinfo info = new JMXinfo(jmxc, commandlineoptionparser, mbsc);
        CommandExecusionEngine engine = new CommandExecusionEngine(info);
        if (engine.CommandSelector())
            engine.runcommand();
        return args;
View Full Code Here

Examples of org.apache.qpid.utils.CommandLineOptionParser

             */
            JMXConnector jmxc = null;
            MBeanServerConnection mbsc = null;
            ConsoleReader reader = new ConsoleReader();
            reader.setBellEnabled(false);
            CommandLineOptionParser commandlineoptionparser = null;

            if ((args == null) || (args.length) == 0)
            {
                Usage();
            }
            /*
             * here special constructor is calling, when parsing options,in here
             * first option value is starting from minus sign so this is handle
             * by a special constructor
             */
            else
            {
                if (args[0].startsWith("-"))
                {
                    commandlineoptionparser = new CommandLineOptionParser(args, args[0]); // if
                                                                                          // user
                                                                                          // specify
                                                                                          // any
                                                                                          // argument
                                                                                          // with
                                                                                          // the
                                                                                          // qpid-cli
                                                                                          // script
                }
            }

            registerCommands();

            /* Connecting with the broker */
            try
            {
                if (commandlineoptionparser == null)
                    commandlineoptionparser = new CommandLineOptionParser(args);

                JMXConfiguration config = new JMXConfiguration(commandlineoptionparser.getAlloptions());
                conn = ConnectorFactory.getConnector(config.gethostname(), config.getport(), config.getUsername(),
                        config.getPassword());
                jmxc = conn.getConnector();
                mbsc = conn.getMBeanServerConnection();
                if (config.checkoptionsetting("r", commandlineoptionparser.getAlloptions()))
                {
                    JMXinfo info = new JMXinfo(jmxc, commandlineoptionparser, mbsc);
                    ReportGenerator reportgen = new ReportGenerator(config.optionchecker("r", commandlineoptionparser
                            .getAlloptions()), info);
                    reportgen.loadproperties();
                    reportgen.run();
                }
                /*
                 * This implementation is for the people who are using the
                 * interactive mode for one shot this run the user given command
                 * and exit
                 */
                for (int i = 0; i < args.length; i++)
                {
                    if (CommandExecutionEngine.getCommands().keySet().contains(args[i]))
                    {
                        oneshotmode(args, commandlineoptionparser, jmxc, mbsc);
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                connectionrefuse(ex);
                return;
            }
            /* In this point connection has been established */
            String line;
            String[] command;

            /* prividing GNU readline features using Jline library */
            PrintWriter out = new PrintWriter(System.out);
            SimpleCompletor completer = new SimpleCompletor(new String[] {
                    COMMAND_EXIT, COMMAND_QUIT, OBJECT_QUEUE, OBJECT_EXCHANGE, OBJECT_CONNECTION,
                    OBJECT_USERMANAGEMENT, OBJECT_VIRTUALHOST});
            for (String commandName : CommandExecutionEngine.getCommands().keySet())
            {
                completer.addCandidateString(commandName);
            }
            reader.addCompletor(new ArgumentCompletor(completer));
            while ((line = reader.readLine("qpid-admin-$ ")) != null)
            {
                out.flush();
                if (removeSpaces(line).equalsIgnoreCase(COMMAND_QUIT) || removeSpaces(line).equalsIgnoreCase(COMMAND_EXIT))
                    break;
                else if (line.length() == 0)
                    continue;
                else
                {
                    command = line.split("\\s+");
                    commandlineoptionparser = new CommandLineOptionParser(command);
                    JMXinfo info = new JMXinfo(jmxc, commandlineoptionparser, mbsc);
                    CommandExecutionEngine engine = new CommandExecutionEngine(info);
                    if (engine.CommandSelector())
                        engine.runcommand();
                }
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.