Examples of CliCommand


Examples of com.sun.enterprise.admin.cli.CLICommand

    }

    @Override
    protected int instanceNotRunning() throws CommandException {
        logger.warning(Strings.get("restart.instanceNotRunning"));
        CLICommand cmd = habitat.getService(CLICommand.class, "start-local-instance");
        /*
         * Collect the arguments that also apply to start-instance-domain.
         * The start-local-instance CLICommand object will already have the
         * ProgramOptions injected into it so we don't need to worry
         * about them here.
         *
         * Usage: asadmin [asadmin-utility-options] start-local-instance
         *    [--verbose[=<verbose(default:false)>]]
         *    [--debug[=<debug(default:false)>]] [--sync <sync(default:normal)>]
         *    [--nodedir <nodedir>] [--node <node>]
         *    [-?|--help[=<help(default:false)>]] [instance_name]
         *
         * Only --debug, --nodedir, -node, and the operand apply here.
         */
        List<String> opts = new ArrayList<String>();
        opts.add("start-local-instance");
        if (debug != null) {
            opts.add("--debug");
            opts.add(debug.toString());
        }
        if (nodeDir != null) {
            opts.add("--nodedir");
            opts.add(nodeDir);
        }
        if (node != null) {
            opts.add("--node");
            opts.add(node);
        }
        if (instanceName != null)
            opts.add(instanceName);

        return cmd.execute(opts.toArray(new String[opts.size()]));
    }
View Full Code Here

Examples of com.sun.enterprise.admin.cli.CLICommand

    protected int dasNotRunning(boolean local) throws CommandException {
        if (!local)
            throw new CommandException(
                Strings.get("restart.dasNotRunningNoRestart"));
        logger.warning(strings.get("restart.dasNotRunning"));
        CLICommand cmd = habitat.getService(CLICommand.class, "start-domain");
        /*
         * Collect the arguments that also apply to start-domain.
         * The start-domain CLICommand object will already have the
         * ProgramOptions injected into it so we don't need to worry
         * about them here.
         *
         * Usage: asadmin [asadmin-utility-options] start-domain
         *      [-v|--verbose[=<verbose(default:false)>]]
         *      [--upgrade[=<upgrade(default:false)>]]
         *      [--debug[=<debug(default:false)>]] [--domaindir <domaindir>]
         *      [-?|--help[=<help(default:false)>]] [domain_name]
         *
         * Only --debug, --domaindir, and the operand apply here.
         */
        List<String> opts = new ArrayList<String>();
        opts.add("start-domain");
        if (debug != null) {
            opts.add("--debug");
            opts.add(debug.toString());
        }
        if (domainDirParam != null) {
            opts.add("--domaindir");
            opts.add(domainDirParam);
            // XXX - would this be better?
            //opts.add(getDomainRootDir().toString());
        }
        if (getDomainName() != null)
            opts.add(getDomainName());

        return cmd.execute(opts.toArray(new String[opts.size()]));
    }
View Full Code Here

Examples of com.sun.enterprise.admin.cli.CLICommand

    }

    @Override
    protected int instanceNotRunning() throws CommandException {
        logger.warning(Strings.get("restart.instanceNotRunning"));
        CLICommand cmd = habitat.getService(CLICommand.class, "start-local-instance");
        /*
         * Collect the arguments that also apply to start-instance-domain.
         * The start-local-instance CLICommand object will already have the
         * ProgramOptions injected into it so we don't need to worry
         * about them here.
         *
         * Usage: asadmin [asadmin-utility-options] start-local-instance
         *    [--verbose[=<verbose(default:false)>]]
         *    [--debug[=<debug(default:false)>]] [--sync <sync(default:normal)>]
         *    [--nodedir <nodedir>] [--node <node>]
         *    [-?|--help[=<help(default:false)>]] [instance_name]
         *
         * Only --debug, --nodedir, -node, and the operand apply here.
         */
        List<String> opts = new ArrayList<String>();
        opts.add("start-local-instance");
        if (debug != null) {
            opts.add("--debug");
            opts.add(debug.toString());
        }
        if (nodeDir != null) {
            opts.add("--nodedir");
            opts.add(nodeDir);
        }
        if (node != null) {
            opts.add("--node");
            opts.add(node);
        }
        if (instanceName != null)
            opts.add(instanceName);

        return cmd.execute(opts.toArray(new String[opts.size()]));
    }
View Full Code Here

Examples of com.sun.enterprise.admin.cli.CLICommand

    protected int dasNotRunning() throws CommandException {
        if (!isLocal())
            throw new CommandException(
                Strings.get("restart.dasNotRunningNoRestart"));
        logger.warning(strings.get("restart.dasNotRunning"));
        CLICommand cmd = habitat.getService(CLICommand.class, "start-domain");
        /*
         * Collect the arguments that also apply to start-domain.
         * The start-domain CLICommand object will already have the
         * ProgramOptions injected into it so we don't need to worry
         * about them here.
         *
         * Usage: asadmin [asadmin-utility-options] start-domain
         *      [-v|--verbose[=<verbose(default:false)>]]
         *      [--upgrade[=<upgrade(default:false)>]]
         *      [--debug[=<debug(default:false)>]] [--domaindir <domaindir>]
         *      [-?|--help[=<help(default:false)>]] [domain_name]
         *
         * Only --debug, --domaindir, and the operand apply here.
         */
        List<String> opts = new ArrayList<String>();
        opts.add("start-domain");
        if (debug != null) {
            opts.add("--debug");
            opts.add(debug.toString());
        }
        if (domainDirParam != null) {
            opts.add("--domaindir");
            opts.add(domainDirParam);
            // XXX - would this be better?
            //opts.add(getDomainRootDir().toString());
        }
        if (getDomainName() != null)
            opts.add(getDomainName());

        return cmd.execute(opts.toArray(new String[opts.size()]));
    }
View Full Code Here

Examples of com.sun.enterprise.admin.cli.CLICommand

    }

    @Override
    protected int instanceNotRunning() throws CommandException {
        logger.warning(Strings.get("restart.instanceNotRunning"));
        CLICommand cmd = habitat.getService(CLICommand.class, "start-local-instance");
        /*
         * Collect the arguments that also apply to start-instance-domain.
         * The start-local-instance CLICommand object will already have the
         * ProgramOptions injected into it so we don't need to worry
         * about them here.
         *
         * Usage: asadmin [asadmin-utility-options] start-local-instance
         *    [--verbose[=<verbose(default:false)>]]
         *    [--debug[=<debug(default:false)>]] [--sync <sync(default:normal)>]
         *    [--nodedir <nodedir>] [--node <node>]
         *    [-?|--help[=<help(default:false)>]] [instance_name]
         *
         * Only --debug, --nodedir, -node, and the operand apply here.
         */
        List<String> opts = new ArrayList<String>();
        opts.add("start-local-instance");
        if (debug != null) {
            opts.add("--debug");
            opts.add(debug.toString());
        }
        if (nodeDir != null) {
            opts.add("--nodedir");
            opts.add(nodeDir);
        }
        if (node != null) {
            opts.add("--node");
            opts.add(node);
        }
        if (instanceName != null)
            opts.add(instanceName);

        return cmd.execute(opts.toArray(new String[opts.size()]));
    }
View Full Code Here

Examples of com.sun.enterprise.admin.cli.CLICommand

    protected int dasNotRunning() throws CommandException {
        if (!isLocal())
            throw new CommandException(
                Strings.get("restart.dasNotRunningNoRestart"));
        logger.warning(strings.get("restart.dasNotRunning"));
        CLICommand cmd = habitat.getService(CLICommand.class, "start-domain");
        /*
         * Collect the arguments that also apply to start-domain.
         * The start-domain CLICommand object will already have the
         * ProgramOptions injected into it so we don't need to worry
         * about them here.
         *
         * Usage: asadmin [asadmin-utility-options] start-domain
         *      [-v|--verbose[=<verbose(default:false)>]]
         *      [--upgrade[=<upgrade(default:false)>]]
         *      [--debug[=<debug(default:false)>]] [--domaindir <domaindir>]
         *      [-?|--help[=<help(default:false)>]] [domain_name]
         *
         * Only --debug, --domaindir, and the operand apply here.
         */
        List<String> opts = new ArrayList<String>();
        opts.add("start-domain");
        if (debug != null) {
            opts.add("--debug");
            opts.add(debug.toString());
        }
        if (domainDirParam != null) {
            opts.add("--domaindir");
            opts.add(domainDirParam);
            // XXX - would this be better?
            //opts.add(getDomainRootDir().toString());
        }
        if (getDomainName() != null)
            opts.add(getDomainName());

        return cmd.execute(opts.toArray(new String[opts.size()]));
    }
View Full Code Here

Examples of com.sun.enterprise.admin.cli.CLICommand



    @Override
    protected int executeCommand() throws CommandException {
        CLICommand command = null;

        if (domainDirParam != null && nodeDir != null) {
            throw new CommandException(strings.get("both.domaindir.nodedir.not.allowed"));
        }
        try {
            if (isDomain()) {  // is it domain
                command = CLICommand.getCommand(habitat,
                        CHANGE_MASTER_PASSWORD_DAS);
                return command.execute(argv);
            }

            if (nodeDir != null) {
                command = CLICommand.getCommand(habitat,
                        CHANGE_MASTER_PASSWORD_NODE);
                return command.execute(argv);
            } else {

                // nodeDir is not specified and domainNameOrNodeName is not a domain.
                // It could be a node
                // We add defaultNodeDir parameter to args
                ArrayList arguments = new ArrayList<String>(Arrays.asList(argv));
                arguments.remove(argv.length -1);
                arguments.add("--nodedir");
                arguments.add(getDefaultNodesDirs().getAbsolutePath());
                arguments.add(domainNameOrNodeName);
                String[] newargs = (String[]) arguments.toArray(new String[arguments.size()]);

                command = CLICommand.getCommand(habitat,
                        CHANGE_MASTER_PASSWORD_NODE);
                return command.execute(newargs);
            }
        } catch (IOException e) {
            throw new CommandException(e.getMessage(),e);
        }
    }
View Full Code Here

Examples of com.sun.enterprise.admin.cli.CLICommand



    @Override
    protected int executeCommand() throws CommandException {
        CLICommand command = null;

        if (domainDirParam != null && nodeDir != null) {
            throw new CommandException(strings.get("both.domaindir.nodedir.not.allowed"));
        }
        try {
            if (isDomain()) {  // is it domain
                command = CLICommand.getCommand(habitat,
                        CHANGE_MASTER_PASSWORD_DAS);
                return command.execute(argv);
            }

            if (nodeDir != null) {
                command = CLICommand.getCommand(habitat,
                        CHANGE_MASTER_PASSWORD_NODE);
                return command.execute(argv);
            } else {

                // nodeDir is not specified and domainNameOrNodeName is not a domain.
                // It could be a node
                // We add defaultNodeDir parameter to args
                ArrayList arguments = new ArrayList<String>(Arrays.asList(argv));
                arguments.remove(argv.length -1);
                arguments.add("--nodedir");
                arguments.add(getDefaultNodesDirs().getAbsolutePath());
                arguments.add(domainNameOrNodeName);
                String[] newargs = (String[]) arguments.toArray(new String[0]);

                command = CLICommand.getCommand(habitat,
                        CHANGE_MASTER_PASSWORD_NODE);
                return command.execute(newargs);
            }
        } catch (IOException e) {
            throw new CommandException(e.getMessage(),e);
        }
    }
View Full Code Here

Examples of com.sun.enterprise.admin.cli.CLICommand

    }

    @Override
    protected int instanceNotRunning() throws CommandException {
        logger.warning(Strings.get("restart.instanceNotRunning"));
        CLICommand cmd = habitat.getComponent(CLICommand.class, "start-local-instance");
        /*
         * Collect the arguments that also apply to start-instance-domain.
         * The start-local-instance CLICommand object will already have the
         * ProgramOptions injected into it so we don't need to worry
         * about them here.
         *
         * Usage: asadmin [asadmin-utility-options] start-local-instance
         *    [--verbose[=<verbose(default:false)>]]
         *    [--debug[=<debug(default:false)>]] [--sync <sync(default:normal)>]
         *    [--nodedir <nodedir>] [--node <node>]
         *    [-?|--help[=<help(default:false)>]] [instance_name]
         *
         * Only --debug, --nodedir, -node, and the operand apply here.
         */
        List<String> opts = new ArrayList<String>();
        opts.add("start-local-instance");
        if (debug != null) {
            opts.add("--debug");
            opts.add(debug.toString());
        }
        if (nodeDir != null) {
            opts.add("--nodedir");
            opts.add(nodeDir);
        }
        if (node != null) {
            opts.add("--node");
            opts.add(node);
        }
        if (instanceName != null)
            opts.add(instanceName);

        return cmd.execute(opts.toArray(new String[opts.size()]));
    }
View Full Code Here

Examples of edu.drexel.cs544.mcmuc.ui.CLICommand

        Controller controller = Controller.getInstance();
        controller.setUI(cli);

        while (true) {
            try {
                CLICommand command = cli.getNextCommand();
                if (command.getCommand() == CLICommand.Command.EXIT) { // Stop and kill this program
                    System.err.println("Exit command received, shutting down...");
                    controller.shutdown();
                    System.exit(0);
                } else if (command.getCommand() == CLICommand.Command.USEROOM) {
                    controller.useRoom(command.getArg(1), command.getArg(0));
                } else if (command.getCommand() == CLICommand.Command.LEAVEROOM) {
                    controller.leaveRoom(command.getArg(0));
                } else if (command.getCommand() == CLICommand.Command.PRESENCE) {
                    Status s;
                    if (command.getArg(1).equalsIgnoreCase("Online"))
                        s = Status.Online;
                    else if (command.getArg(1).equalsIgnoreCase("Offline"))
                        s = Status.Offline;
                    else {
                        System.err.println("Unknown status");
                        continue;
                    }
                    controller.setRoomStatus(command.getArg(0), s);
                } else if (command.getCommand() == CLICommand.Command.MESSAGE) {
                    controller.messageRoom(command.getArg(0), new Message(controller.getUserName(command.getArg(0)), command.getArg(1)));
                } else if (command.getCommand() == CLICommand.Command.PVTMESSAGE) {
                    controller.messageRoom(command.getArg(1), new Message(controller.getUserName(command.getArg(1)), command.getArg(2), command.getArg(0)));
                } else if (command.getCommand() == CLICommand.Command.ADDKEY) {
                    FileInputStream publicKeyFile = new FileInputStream(command.getArg(1));
                    byte publicKey[] = new byte[(int) publicKeyFile.available()];
                    publicKeyFile.read(publicKey);

                    FileInputStream privateKeyFile = new FileInputStream(command.getArg(2));
                    byte privateKey[] = new byte[(int) privateKeyFile.available()];
                    privateKeyFile.read(privateKey);

                    controller.addKeyPair(command.getArg(0), new Certificate("X.509", publicKey), new Certificate("X.509", privateKey));
                } else if (command.getCommand() == CLICommand.Command.REMOVEKEY) {
                    FileInputStream publicKeyFile = new FileInputStream(command.getArg(1));
                    byte publicKey[] = new byte[(int) publicKeyFile.available()];
                    publicKeyFile.read(publicKey);

                    controller.removeKeyPair(command.getArg(0), new Certificate("X.509", publicKey));

                } else if (command.getCommand() == CLICommand.Command.SECUREMESSAGE) {
                    FileInputStream publicKeyFile = new FileInputStream(command.getArg(0));
                    byte publicKey[] = new byte[(int) publicKeyFile.available()];
                    publicKeyFile.read(publicKey);

                    Certificate cert = new Certificate("X.509", publicKey);
                    controller.messageRoom(command.getArg(2), new Message(controller.getUserName(command.getArg(2)), command.getArg(3), command.getArg(1), cert));
                }
            } catch (RoomDoesNotExistException e) {
                cli.alert(e.getMessage());
            } catch (FileNotFoundException e) {
                e.printStackTrace();
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.