public abstract class AbstractTrackingCommandHandler extends AbstractCommandHandler implements InvocationHistory
LOG
Constructor and Description |
---|
AbstractTrackingCommandHandler() |
Modifier and Type | Method and Description |
---|---|
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.
|
assertValidReplyCode, getReplyTextBundle, quotes, setReplyTextBundle
public final void handleCommand(Command command, Session session) throws Exception
handleCommand
in interface CommandHandler
command
- - the Command to be handledsession
- - the session on which the Command was submittedException
- - if an error occursAssertFailedException
- - 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 appropriateException
- - if an error occursprotected void sendReply(Session session, int replyCode, String replyMessageKey, String replyText, Object[] arguments)
The reply code is designated by the 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 nullAssertFailedException
- - if session is nullMessageFormat
public int numberOfInvocations()
numberOfInvocations
in interface InvocationHistory
InvocationHistory.numberOfInvocations()
public InvocationRecord getInvocation(int index)
getInvocation
in interface InvocationHistory
index
- - 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 InvocationHistory
InvocationHistory.clearInvocations()
Copyright © 2016. All rights reserved.