net.jetrix.commands
Class CommandManager

java.lang.Object
  extended by net.jetrix.commands.CommandManager

public class CommandManager
extends Object

CommandManager

Version:
$Revision: 484 $, $Date: 2004-12-12 02:26:37 +0100 (dim., 12 déc. 2004) $
Author:
Emmanuel Bourg

Method Summary
 void addCommand(Command command)
          Register a new command.
 void addCommandAlias(Command command, String alias)
          Register a new alias for a command.
 void clear()
          Clear all commands.
 void execute(CommandMessage m)
          Execute the command specified in the message.
 void execute(CommandMessage m, Command command)
          Execute an unregistered command.
 Command getCommand(String alias)
          Return the command matching the specified alias.
 Iterator<Command> getCommands()
          Return all commands available to clients with the lowest access level.
 Iterator<Command> getCommands(int accessLevel)
          Return all commands available to clients with the specified access level.
static CommandManager getInstance()
           
 void removeCommand(Command command)
          Remove a command.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static CommandManager getInstance()

addCommand

public void addCommand(Command command)
Register a new command.


addCommandAlias

public void addCommandAlias(Command command,
                            String alias)
Register a new alias for a command.


removeCommand

public void removeCommand(Command command)
Remove a command.


getCommand

public Command getCommand(String alias)
Return the command matching the specified alias. The alias is not case sensitive. If no command matches the exact alias specified, it will return the first command starting with the alias.


getCommands

public Iterator<Command> getCommands()
Return all commands available to clients with the lowest access level.


getCommands

public Iterator<Command> getCommands(int accessLevel)
Return all commands available to clients with the specified access level.


execute

public void execute(CommandMessage m)
Execute the command specified in the message. This method checks if the client has the access level required to use the command.


execute

public void execute(CommandMessage m,
                    Command command)
Execute an unregistered command.


clear

public void clear()
Clear all commands.



Copyright © 2001-2008 Emmanuel Bourg. All Rights Reserved.