On Fri, Nov 14, 2008 at 11:35 PM, Sai Pullabhotla
<[EMAIL PROTECTED]> wrote:
> What do you think of the following change:
>
> Change the signature of Ftplet.afterCommand to -
>
> FtpletResult afterCommand(FtpSession session, FtpRequest request,
> FtpReply reply)
>            throws FtpException, IOException;

As noted in an earlier mail on this thread, multiple replies might
have been sent for one request, meaning we need to provide a list of
replies. Besides that, I like this change.

> I know this breaks the existing applications that are using this
> interface, but I'm not sure if there is a way to prevent this.

Meaning it has to go into M4 (I hope to have a stable public API in
M4), so we should have it done quickly.

> Implemntations can then check to see if reply.getCode() and see if it
> is a Positive Completion Reply (2XX) which means, the requested action
> was successful. A 4xx or 5xx message means that the requested action
> has failed.
>
> The implementations can then process the parameters of FtpRequest and
> get any additional details such as file name that the command acted
> on, its size etc.
>
> This would be a good beginning. However, if we want to take it one
> more step further, It is not a bad idea to create subclasses of
> DefaultFtpReply to include some more additional information. For e.g.
> create a new class FtpUploadReply as shown below:
>
> public class FtpUploadReply extends DefaultFtpReply {
>    private FileObject file = null;
>    private long bytesReceived = 0L; //This may not be needed, as it
> could be retrieved from the FileObject.
>    private long transferStartTime = 0L;
>    private long transferEndTime = 0L;
> }

We might need to think some further on the details, but I like the
change in general. However, as this is a non-breaking change, we can
do this later. For now we should focus on the change above.

> Hope this all makes sense. Let me know what you think and if you would
> like me to work on this.

Feel free to take a stab. First of all, add JIRA issues describing the
improvements you would like to see and then we'll attempt to get the
first change into M4.

/niklas

Reply via email to