|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mockftpserver.core.command.AbstractCommandHandler
org.mockftpserver.core.command.AbstractTrackingCommandHandler
public abstract class AbstractTrackingCommandHandler
The abstract superclass for CommandHandler classes that manage the List of InvocationRecord objects corresponding to each invocation of the command handler, and provide helper methods for subclasses.
| Field Summary |
|---|
| Fields inherited from class org.mockftpserver.core.command.AbstractCommandHandler |
|---|
LOG |
| Constructor Summary | |
|---|---|
AbstractTrackingCommandHandler()
|
|
| Method Summary | |
|---|---|
void |
clearInvocations()
Clear out the invocation history for this CommandHandler. |
InvocationRecord |
getInvocation(int index)
Return the InvocationRecord representing the command invoction data for the nth invocation for this command handler instance. |
void |
handleCommand(Command command,
Session session)
Handle the specified command for the session. |
protected abstract void |
handleCommand(Command command,
Session session,
InvocationRecord invocationRecord)
Handle the specified command for the session. |
int |
numberOfInvocations()
|
protected void |
sendReply(Session session,
int replyCode,
String replyMessageKey,
String replyText,
Object[] arguments)
Send a reply for this command on the control connection. |
| Methods inherited from class org.mockftpserver.core.command.AbstractCommandHandler |
|---|
assertValidReplyCode, getReplyTextBundle, quotes, setReplyTextBundle |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractTrackingCommandHandler()
| Method Detail |
|---|
public final void handleCommand(Command command,
Session session)
throws Exception
handleCommand in interface CommandHandlercommand - - the Command to be handledsession - - the session on which the Command was submitted
Exception
AssertFailedException - - if the command or session is nullCommandHandler.handleCommand(org.mockftpserver.core.command.Command,
org.mockftpserver.core.session.Session)
protected abstract void handleCommand(Command command,
Session session,
InvocationRecord invocationRecord)
throws Exception
command - - the Command to be handledsession - - the session on which the Command was submittedinvocationRecord - - the InvocationRecord; CommandHandlers are expected to add
handler-specific data to the InvocationRecord, as appropriate
Exception
protected void sendReply(Session session,
int replyCode,
String replyMessageKey,
String replyText,
Object[] arguments)
replyCode property, and the reply text
is determined by the following rules:
replyText property is non-null, then use that.replyMessageKey is non-null, the use that to retrieve a
localized message from the replyText ResourceBundle.replyText ResourceBundle,
using the reply code as the key.MessageFormat class.
session - - the SessionreplyCode - - the reply codereplyMessageKey - - if not null (and replyText is null), this is used as the ResourceBundle
message key instead of the reply code.replyText - - if non-null, this is used as the reply textarguments - - the array of arguments to be formatted and substituted within the reply
text; may be null
AssertFailedException - - if session is nullMessageFormatpublic int numberOfInvocations()
numberOfInvocations in interface InvocationHistoryInvocationHistory.numberOfInvocations()public InvocationRecord getInvocation(int index)
getInvocation in interface InvocationHistoryindex - - the index of the invocation record to return. The first record is at index zero.
AssertFailedException - - if there is no invocation record corresponding to the specified indexInvocationHistory.getInvocation(int)public void clearInvocations()
numberOfInvocations() method will return zero.
clearInvocations in interface InvocationHistoryInvocationHistory.clearInvocations()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||