package pl.maliboo.ftp.invokers { import pl.maliboo.ftp.Commands; import pl.maliboo.ftp.FTPCommand; import pl.maliboo.ftp.errors.InvokeError; import pl.maliboo.ftp.Responses; import pl.maliboo.ftp.events.FTPEvent; import pl.maliboo.ftp.core.FTPClient; import pl.maliboo.ftp.core.FTPInvoker; /** * This command tells the server to abort the previous FTP * service command and any associated transfer of data. The * abort command may require "special action", as discussed in * the Section on FTP Commands, to force recognition by the * server. No action is to be taken if the previous command * has been completed (including data transfer). The control * connection is not to be closed by the server, but the data * connection must be closed. * * @see http://www.w3.org/Protocols/rfc959/4_FileTransfer.html (ABORT) * * @author Wijnand */ public class AbortInv extends FTPInvoker { public function AbortInv(client:FTPClient) { super(client); } /** * @inheritDoc */ override protected function startSequence():void { sendCommand( new FTPCommand(Commands.ABOR) ); } /** * @inheritDoc */ override protected function responseHandler(evt:FTPEvent):void { trace("AbortInv.responseHandler(evt): " + evt.response.code); switch (evt.response.code) { // What we get back from AWS. case Responses.DATA_CONN_OPEN: // Abort command was successfully processed. case Responses.DATA_CONN_CLOSE: // Service request terminated abnormally. case Responses.CONNECTION_CLOSED: // TODO: Not sure we should send event or error... var abortEvent:FTPEvent = new FTPEvent(FTPEvent.ABORT); abortEvent.response = evt.response; release(abortEvent); break; default: releaseWithError(new InvokeError(evt.response.message)); break; } } /** * @inheritDoc */ override protected function cleanUp ():void { } } }