|
||||||||||
| 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
org.mockftpserver.stub.command.AbstractStubDataCommandHandler
public abstract class AbstractStubDataCommandHandler
Abstract superclass for CommandHandlers that read from or write to the data connection.
Return two replies on the control connection: by default a reply code of 150 before the data transfer across the data connection and another reply of 226 after the data transfer is complete. This class implements the Template Method pattern. Subclasses must implement the abstractprocessData method to perform read or writes across the data connection.
Subclasses can optionally override the beforeProcessData(Command, Session, InvocationRecord)
method for logic before the data transfer or the afterProcessData(Command, Session, InvocationRecord)
method for logic after the data transfer.
Subclasses can optionally override the reply code and/or text for the initial reply (before
the data transfer across the data connection) by calling setPreliminaryReplyCode(int),
setPreliminaryReplyMessageKey(String) and/or setPreliminaryReplyText(String)
methods.
Subclasses can optionally override the reply code and/or text for the final reply (after the
the data transfer is complete) by calling setFinalReplyCode(int),
setFinalReplyMessageKey(String) and/or setFinalReplyText(String) methods.
| Field Summary | |
|---|---|
protected int |
finalReplyCode
|
protected String |
finalReplyMessageKey
|
protected String |
finalReplyText
|
protected int |
preliminaryReplyCode
|
protected String |
preliminaryReplyMessageKey
|
protected String |
preliminaryReplyText
|
| Fields inherited from class org.mockftpserver.core.command.AbstractCommandHandler |
|---|
LOG |
| Constructor Summary | |
|---|---|
protected |
AbstractStubDataCommandHandler()
Constructor. |
| Method Summary | |
|---|---|
protected void |
afterProcessData(Command command,
Session session,
InvocationRecord invocationRecord)
Perform any necessary logic after transferring data across the data connection. |
protected void |
beforeProcessData(Command command,
Session session,
InvocationRecord invocationRecord)
Perform any necessary logic before transferring data across the data connection. |
void |
handleCommand(Command command,
Session session,
InvocationRecord invocationRecord)
Handle the command. |
protected abstract void |
processData(Command command,
Session session,
InvocationRecord invocationRecord)
Abstract method placeholder for subclass transfer of data across the data connection. |
protected void |
sendFinalReply(Session session)
Send the final reply. |
void |
setFinalReplyCode(int finalReplyCode)
Set the completion reply code sent after data transfer |
void |
setFinalReplyMessageKey(String finalReplyMessageKey)
Set the message key for the completion reply text sent after data transfer |
void |
setFinalReplyText(String finalReplyText)
Set the text of the completion reply sent after data transfer |
void |
setPreliminaryReplyCode(int preliminaryReplyCode)
Set the completion reply code sent before data transfer |
void |
setPreliminaryReplyMessageKey(String preliminaryReplyMessageKey)
Set the message key for the completion reply text sent before data transfer |
void |
setPreliminaryReplyText(String preliminaryReplyText)
Set the text of the completion reply sent before data transfer |
| Methods inherited from class org.mockftpserver.core.command.AbstractTrackingCommandHandler |
|---|
clearInvocations, getInvocation, handleCommand, numberOfInvocations, sendReply |
| 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 |
| Methods inherited from interface org.mockftpserver.core.command.CommandHandler |
|---|
handleCommand |
| Field Detail |
|---|
protected int preliminaryReplyCode
protected String preliminaryReplyText
protected String preliminaryReplyMessageKey
protected int finalReplyCode
protected String finalReplyText
protected String finalReplyMessageKey
| Constructor Detail |
|---|
protected AbstractStubDataCommandHandler()
| Method Detail |
|---|
public final void handleCommand(Command command,
Session session,
InvocationRecord invocationRecord)
throws Exception
beforeProcessData() methodprocessData() methodafterProcessData() method
handleCommand in class AbstractTrackingCommandHandlercommand - - 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
ExceptionAbstractTrackingCommandHandler.handleCommand(org.mockftpserver.core.command.Command, org.mockftpserver.core.session.Session, org.mockftpserver.core.command.InvocationRecord)protected void sendFinalReply(Session session)
session - - the Session
protected void beforeProcessData(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 abstract void processData(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 afterProcessData(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
Exceptionpublic void setFinalReplyCode(int finalReplyCode)
finalReplyCode - - the final reply code
AssertFailedException - - if the finalReplyCode is invalidpublic void setFinalReplyMessageKey(String finalReplyMessageKey)
finalReplyMessageKey - - the final reply message keypublic void setFinalReplyText(String finalReplyText)
finalReplyText - - the final reply textpublic void setPreliminaryReplyCode(int preliminaryReplyCode)
preliminaryReplyCode - - the preliminary reply code to set
AssertFailedException - - if the preliminaryReplyCode is invalidpublic void setPreliminaryReplyMessageKey(String preliminaryReplyMessageKey)
preliminaryReplyMessageKey - - the preliminary reply message keypublic void setPreliminaryReplyText(String preliminaryReplyText)
preliminaryReplyText - - the preliminary reply text
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||