org.indy
Class CommandEvent

java.lang.Object
  |
  +--org.indy.CommandEvent

public final class CommandEvent
extends java.lang.Object

Command represents information about commands received by a TCPServer for an executing PeerThread, and handled using a CommandHandler. Command provides properties that identify the Thread generating the command, and the CommandHandler used to service the command. In addition, TIdCommand also implements methods that allow assigning the response for the command, and a mechanism for sending the command reply using the thread connection that generated the command request. Command instances are created in CommandHandler#check(String,PeerThread) when a given command can be handled by the CommandHandlers for the server, using the PeerThread that is executed in the TCPServer context.

Version:
1.0
Author:
OTG
See Also:
CommandHandler, CommandHandler#check(String,PeerThread), TCPServer, PeerThread, RFCReply

Method Summary
 CommandHandler getCommandHandler()
          CommandHandler is a read-only CommandHandler property that represents the command handler that created the CommandEvent object instance.
 StringList getParams()
          Returns the parameters associated with this Command as a StringList.
 boolean getPerformReply()
          Returns whether the RFCReply returned by getReply() should be sent back to the peer in reponse.
 java.lang.String getRawLine()
          Gets the raw line that was sent to the server for this command.
 RFCReply getReply()
          Gets the RFCReply associated with this command.
 StringList getResponse()
          Gets the response attribute of this Command as a StringList
 PeerThread getThread()
          Gets the PeerThread that is handling this command.
 java.lang.String getUnparsedParams()
          Returns the parameters sent to the server as an unparsed string.
 void sendReply()
          Forces the command to send a reply back to the client.
 void setPerformReply(boolean performReply)
          Sets whether or not the RFCReply returned by getReply() should be sent back to the peer.
 void setReply(RFCReply reply)
          Sets the RFCReply to be sent back to the peer.
 void setResponse(StringList response)
          Sets the IdStrings to use as a resopnse for this command
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setPerformReply

public void setPerformReply(boolean performReply)
Sets whether or not the RFCReply returned by getReply() should be sent back to the peer.
Parameters:
performReply - The new performReply value
See Also:
getPerformReply(), getReply(), RFCReply

setReply

public void setReply(RFCReply reply)
Sets the RFCReply to be sent back to the peer.
Parameters:
reply - The new RFCReply obect to use.
See Also:
getReply(), RFCReply

setResponse

public void setResponse(StringList response)
Sets the IdStrings to use as a resopnse for this command
Parameters:
response - The new response value

getCommandHandler

public CommandHandler getCommandHandler()
CommandHandler is a read-only CommandHandler property that represents the command handler that created the CommandEvent object instance. The CommandHandler is assigned when the object instance is created as the peer thread is executed in CommandHandler#check(String,PeerThread).
Returns:
This CommandEvent handler.
See Also:
CommandHandler

getPerformReply

public boolean getPerformReply()
Returns whether the RFCReply returned by getReply() should be sent back to the peer in reponse.
Returns:
Whether this command is set to reply or not.
See Also:
getPeformReply, RFCReply

getParams

public StringList getParams()
Returns the parameters associated with this Command as a StringList. If the creating CommandHandler had it's parseParams property set to true then the StringList will contain the parameters tokenised using the CommandHandler's command delimiter. Otherwise the list will just contain the unparsed parameteters as a single string.
Returns:
A collection of strings representing the parameters sent with this command.

getRawLine

public java.lang.String getRawLine()
Gets the raw line that was sent to the server for this command.
Returns:
The raw line that was sent to the server for this command.

getReply

public RFCReply getReply()
Gets the RFCReply associated with this command.
Returns:
The associated RFCReply object.

getResponse

public StringList getResponse()
Gets the response attribute of this Command as a StringList
Returns:
The response value

getThread

public PeerThread getThread()
Gets the PeerThread that is handling this command.
Returns:
The PeerThread that is handling this command.

getUnparsedParams

public java.lang.String getUnparsedParams()
Returns the parameters sent to the server as an unparsed string.
Returns:
The unparsed parameters sent to the server.

sendReply

public void sendReply()
               throws IndyException
Forces the command to send a reply back to the client.
Throws:
IndyException - If an exception occurs whilst writing the reply to the socket.


Copyright © 2002-2002 IndyJ. All Rights Reserved.