Examples of ClientCommand


Examples of org.jboss.adminclient.command.ClientCommand

    private boolean executeCommand(String[] args)
    {
        String commandName = args[0];
        if (COMMANDS.containsKey(commandName))
        {
            ClientCommand command = COMMANDS.get(commandName);
            if (command.isConnectionRequired() && !isConnected())
            {
                outputWriter.println("The '" + commandName
                        + "' command requires a connection. Please run the 'connect' command first.");
                return true;
            }
            String[] params = new String[args.length - 1];
            System.arraycopy(args, 1, params, 0, args.length - 1);
            OptionParser optionParser = command.getOptionParser();
            optionParser.acceptsAll(asList("h", "?", "help"), "display help");
            OptionSet options = optionParser.parse(params);
            if (options.has("help"))
            {
                try
                {
                    optionParser.printHelpOn(this.outputWriter);
                }
                catch (IOException e)
                {
                    throw new IllegalStateException(e);
                }
            }
            else
            {
                try
                {
                    return command.execute(this, options);
                }
                catch (Exception e)
                {
                    getPrintWriter().write("Command failed: " + e.getLocalizedMessage());
                    e.printStackTrace(getPrintWriter());
View Full Code Here

Examples of org.jboss.adminclient.command.ClientCommand

                if (!executeCommand(commandName))
                    System.exit(0);
            }
        }

        ClientCommand connectCommand = COMMANDS.get(ConnectCommand.COMMAND_NAME);
        OptionParser connectOptionParser = connectCommand.getOptionParser();
        List<String> connectOptions = new ArrayList<String>();
        if (this.host != null)
        {
            connectOptions.add("--host");
            connectOptions.add(this.host);
        }
        if (this.port != null)
        {
            connectOptions.add("--port");
            connectOptions.add(this.port.toString());
        }
        if (this.username != null)
        {
            connectOptions.add("--username");
            connectOptions.add(this.username);
        }
        if (this.password != null)
        {
            connectOptions.add("--password");
            connectOptions.add(this.password);
        }
        OptionSet connectOptionSet = connectOptionParser.parse(connectOptions.toArray(new String[connectOptions.size()]));
        connectCommand.execute(this, connectOptionSet);
    }
View Full Code Here

Examples of org.rhq.enterprise.client.commands.ClientCommand

        }
    }

    private static void initCommands() {
        for (Class<ClientCommand> commandClass : ClientCommand.COMMANDS) {
            ClientCommand command;
            try {
                command = commandClass.newInstance();
                commands.put(command.getPromptCommandString(), command);
            } catch (InstantiationException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }
View Full Code Here

Examples of org.rhq.enterprise.client.commands.ClientCommand

    }

    public boolean executePromptCommand(String[] args) throws Exception {
        String cmd = args[0];
        if (commands.containsKey(cmd)) {
            ClientCommand command = commands.get(cmd);

            if (shouldDisplayHelp(args)) {
                outputWriter.println("Usage: " + command.getSyntax());
                outputWriter.println(command.getDetailedHelp());
                return true;
            }

            try {
                boolean response = command.execute(this, args);
                processNotes(outputWriter);
                outputWriter.println("");
                return response;
            } catch (CommandLineParseException e) {
                outputWriter.println(command.getPromptCommandString() + ": " + e.getMessage());
                outputWriter.println("Usage: " + command.getSyntax());
            } catch (ArrayIndexOutOfBoundsException e) {
                outputWriter.println(command.getPromptCommandString()
                    + ": An incorrect number of arguments was specified.");
                outputWriter.println("Usage: " + command.getSyntax());
            }
        } else {
            boolean result = commands.get("exec").execute(this, args);
            if (loggedIn()) {
                this.codeCompletion.setScriptContext(getScriptEngine().getContext());
View Full Code Here

Examples of org.rhq.enterprise.client.commands.ClientCommand

                    System.exit(0);
                }
            }

            if (getUser() != null && getPass() != null) {
                ClientCommand loginCmd = getCommands().get("login");
                List<String> argsList = new ArrayList<String>(6); // 6 args at most
                argsList.add("login");
                argsList.add(getUser());
                argsList.add(getPass());
                String host = getHost();
                int port = getPort();
                String transport = getTransport();
                if (host != null) {
                    argsList.add(host);
                    if (port != 0) {
                        argsList.add(String.valueOf(port));
                        if (transport != null) {
                            argsList.add(transport);
                        }
                    }
                }
                loginCmd.execute(ClientMain.this, argsList.toArray(new String[argsList.size()]));
                if (!loggedIn()) {
                    if (isInteractiveMode()) {
                        return;
                    } else {
                        System.exit(1);
View Full Code Here

Examples of soc.qase.com.message.ClientCommand

*  multi-map demos*/
/*-------------------------------------------------------------------*/
  public synchronized void disconnect(boolean stopRecording)
  {
    ClientPacket packet = null;
    ClientCommand message = null;

    if(dm2Recorder.isRecording() && stopRecording)
      dm2Recorder.stopRecording();

    if(connected)
    {
      inGame = false;
      message = new ClientCommand(clientID, "disconnect");
      packet = new ClientPacket(message);
      communicator.sendUnreliable(packet);
      communicator.disconnect();
      connected = false;
    }
View Full Code Here

Examples of soc.qase.com.message.ClientCommand

*  Called by sendCommand and sendConsoleCommand.
@param command the command to send to the server */
/*-------------------------------------------------------------------*/
  protected ClientPacket buildCommandPacket(String command)
  {
    return new ClientPacket(new ClientCommand(clientID, command));
  }
View Full Code Here

Examples of soc.qase.com.message.ClientCommand

/*-------------------------------------------------------------------*/
  private void sendBegin()
  {
    String command = null;
    ClientPacket packet = null;
    ClientCommand message = null;

    message = new ClientCommand(clientID, "begin " + server.getLevelKey());
    packet = new ClientPacket(message);
    communicator.sendReliable(packet);
  }
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.