com.lyrisoft.chat.server.remote
Class CommandProcessorRemote

java.lang.Object
  |
  +--com.lyrisoft.chat.server.remote.CommandProcessorRemote
All Implemented Interfaces:
ICommands

public class CommandProcessorRemote
extends java.lang.Object
implements ICommands

When messages come in on the socket from the client, they have to be processed. This class does that, by invoking the proper ICommandProcessorRemote. Instance of ICommandProcessorRemote are kept in a registry (HashMap), using the constants in ICommands as keys.

See Also:
ICommands

Fields inherited from interface com.lyrisoft.chat.ICommands
ACCESS_DENIED, ACK_KILL, ALREADY_SIGNED_ON, DELIMITER, EMOTE_TO_ROOM, EMOTE_TO_USER, ERROR, GET_ROOMS, GET_USERS_IN_ROOM, GET_USERS_ON_SERVER, HELP, HYPERLINK, IGNORE, INVALID_CHARACTER, INVITE, JOIN_ROOM, JOIN_ROOM_ACK, KICK, KILL, NO_INVITE, NO_SUCH_USER, OP, PART_ROOM, PART_ROOM_ACK, PING, PONG, REMOTE_CLIENT_MESSAGE, ROOM_ACCESS_DENIED, ROOM_DIFF, ROOM_MSG, ROOM_USER_DIFF, SAY_TO_ROOM, SAY_TO_USER, SHUTDOWN, SIGNOFF, SIGNON, SIGNON_ACK, STATS, UNIGNORE, UNINVITE, USER_DIFF, VERSION, WHOIS
 
Constructor Summary
CommandProcessorRemote()
           
 
Method Summary
static java.lang.String[] decompose(java.lang.String input)
          Decompose a raw message into an array of String, splitting on the DELIMITER defined in ICommands.
static void extendCommandSet(java.lang.String command, ICommandProcessorRemote processor)
          Used to extend the core set of commands that the server can process.
static java.util.Map getCommandProcessors()
          Get the map that contains the command processors.
static void init(java.util.Properties p)
           
static boolean process(java.lang.String input, ChatClient client)
          Process a raw message from the client The message is decomposed into a string array of arguments Use the first argument to look up an ICommandProcessorRemote instance in the registry If found, check the access level Invoke process() on the ICommandProcessorRemote instance If an ICommandProcessorRemote was not found, then use the UnknownCommandProcessor()
If the access level on the client is less than the required access, then send a generalError() to the client.
static void processDistributed(java.lang.String input, java.lang.String origin, java.lang.String client, ChatServer server)
           
static void setIdleTimeImmune(java.lang.String command)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandProcessorRemote

public CommandProcessorRemote()
Method Detail

init

public static void init(java.util.Properties p)

extendCommandSet

public static void extendCommandSet(java.lang.String command,
                                    ICommandProcessorRemote processor)
Used to extend the core set of commands that the server can process. Note: If a custom reply is to be sent back, there should be a corresponding extension on the client side.
Parameters:
command - the first argument of the command
processor - an ICommandProcessorRemote instance that will handle the new command.
See Also:
CommandProcessorLocal.extendCommandSet(java.lang.String, com.lyrisoft.chat.server.local.command.ICommandProcessorLocal)

setIdleTimeImmune

public static void setIdleTimeImmune(java.lang.String command)

process

public static boolean process(java.lang.String input,
                              ChatClient client)
Process a raw message from the client If an ICommandProcessorRemote was not found, then use the UnknownCommandProcessor()
If the access level on the client is less than the required access, then send a generalError() to the client.
Returns:
a boolean indicating whether idle time should be affected
See Also:
com.lyrisoft.chat.server.remote.command, ChatClient.generalError(java.lang.String)

processDistributed

public static void processDistributed(java.lang.String input,
                                      java.lang.String origin,
                                      java.lang.String client,
                                      ChatServer server)

decompose

public static java.lang.String[] decompose(java.lang.String input)
Decompose a raw message into an array of String, splitting on the DELIMITER defined in ICommands.
See Also:
ICommands

getCommandProcessors

public static java.util.Map getCommandProcessors()
Get the map that contains the command processors. This method exists so the Help command processor can do its work


Copyright © 2000-2002 Taso Lyristis