[ https://issues.apache.org/jira/browse/SSHD-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14332155#comment-14332155 ]
David Evans commented on SSHD-108: ---------------------------------- After having a look through, it looks like it still does everything I need. A little more boiler-plate for me since I'm caching values like access time, child nodes, etc. (calculating them requires a DB lookup) so I'll have to add a bunch of request forwarding to the Path objects, but nothing too bad. Getting back on-topic, it seems you're somewhat constrained by the NIO API. For my purposes, using the stream itself is fine since I'm implementing everything anyway, but for a general use-case where a user wants to keep the out-of-the-box file management but also get an upload-complete notification, it seems like a listener job. There's already a SessionListener which can be applied both globally and on individual sessions, so adding to that might be the best option. In that scenario, the listener would need to be told which Session and Path was involved, and would need to be called after the OutputStream has closed. Unfortunately that means it's impossible to act on failure (success calls CLOSE,SUCCESS, failure calls CLOSE), so there would need to be another method which is called after CLOSE when the upload failed. The failure method would also need to know the Session and Path, and it may be nice to add an enum value indicating the type of failure (perhaps with just a single value ConnectionReset for now, with the ability to extend to Paused, ConnectionLost, etc. later) > Add upload monitoring to sftp and scp > ------------------------------------- > > Key: SSHD-108 > URL: https://issues.apache.org/jira/browse/SSHD-108 > Project: MINA SSHD > Issue Type: Improvement > Affects Versions: 0.5.0 > Reporter: Richard Evans > Priority: Minor > > We have sshd integrated into our application and sftp is working fine. One > of the requirements is to initiate some action when a file upload it > complete. I have made this work by implementing handleClose in my SshFile > implementation and performing the action if createOutputStream had been > called previously. This seems a bit ugly though; it might be nicer if there > was some plug in mechanism to monitor file transfers. > Ideally the monitor would be able to distinguish between a successful upload > and a cancelled one (via ctrl-c at the client), but a quick perusal of the > sftp stuff seems to inidicate that this is not possible. -- This message was sent by Atlassian JIRA (v6.3.4#6332)