#592 rxftp.cls input/output format dependency

None
rejected
None
none
1
2014-03-31
2014-03-29
No

Currently rxftp.cls only accepts filenames as input/output, making it dependent on .stream objects as i/o method. I propose that the code be changed to become sensitive to the type of object that the caller provides as input and output in get and put operations: if either of these parameters is not a string object, it should be assumed to be an object of a class that supports a get or a put method. This lets us use other media then .stream objects to send and receive data over ftp.

Related

Feature Requests: #592

Discussion

  • Staffan Tylen

    Staffan Tylen - 2014-03-29

    The use of GET and PUT is not actually a correct implementation as I suggested, instead the following is a working example of this proposal:

    To make this work rxFtp.cls could be changed to replace all floc = .stream~new(flocal) stmts with:

    if flocal~isA(.String) then
    floc = .Stream~new(flocal)
    else
    floc = flocal

    To receive a file over FTP without creating a result file:

    recvr = .Recvr~new
    retc = myftp~FtpGet(recvr, "remote.file", "ASCII")

    To extract the received data:

    loop line over recvr~allitems
    say line
    end

    Here is the recvr class:

    ::class recvr subclass queue
    ::attribute receivedData
    ::method open
    self~receivedData = ""
    return "READY:"
    ::method charout
    self~receivedData ||= arg(1)
    return 0
    ::method close
    self~empty
    loop line over self~receivedData~makeArray(x'0d0a')
    self~queue(line)
    end
    return "READY:"

    A similar class can be used to send data over ftp without using a local file as source.

     
  • David Ashley

    David Ashley - 2014-03-31

    There really is no reason to do this. It is the File Transfer Protocol application after all.

    In fact, this is the perfect place for a developer to subclass the ftp class and perform this kind of transformation. It make more sense to subclass it rather that change an expected behaviour.

     
  • David Ashley

    David Ashley - 2014-03-31
    • status: unread --> rejected
    • assigned_to: David Ashley
     
    • Staffan Tylen

      Staffan Tylen - 2014-03-31

      David, I started off trying to subclass this class, but I quickly found
      that I had to move most of the logic into the subclass to make it work. In
      addition, some of the methods are defined with the private attribute so
      they cannot be called from a subclass. If you can show me a simple way to
      subclass this class in a way that provides the functionality that I need it
      would be very much appreciated.

      Thanks,
      Staffan

      On Mon, Mar 31, 2014 at 3:18 PM, David Ashley wdashley@users.sf.net wrote:

      • status: unread --> rejected
      • assigned_to: David Ashley
      • Comment:

      There really is no reason to do this. It is the File Transfer Protocol
      application after all.

      In fact, this is the perfect place for a developer to subclass the ftp
      class and perform this kind of transformation. It make more sense to
      subclass it rather that change an expected behaviour.


      Status: rejected
      Milestone: None
      Created: Sat Mar 29, 2014 01:04 AM UTC by Staffan Tylen
      Last Updated: Sat Mar 29, 2014 07:35 PM UTC
      Owner: David Ashley

      Currently rxftp.cls only accepts filenames as input/output, making it
      dependent on .stream objects as i/o method. I propose that the code be
      changed to become sensitive to the type of object that the caller provides
      as input and output in get and put operations: if either of these
      parameters is not a string object, it should be assumed to be an object of
      a class that supports a get or a put method. This lets us use other media
      then .stream objects to send and receive data over ftp.


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/oorexx/feature-requests/592/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       

      Related

      Feature Requests: #592

      • Staffan Tylen

        Staffan Tylen - 2014-03-31

        And one more thing: my proposed change would NOT change the current
        behaviour of rxftp as per your comment, any existing programs would work
        without changes. The result would just make rxftp more flexible.

        Staffan

        On Mon, Mar 31, 2014 at 3:39 PM, Staffan Tylen staffan.tylen@gmail.comwrote:

        David, I started off trying to subclass this class, but I quickly found
        that I had to move most of the logic into the subclass to make it work. In
        addition, some of the methods are defined with the private attribute so
        they cannot be called from a subclass. If you can show me a simple way to
        subclass this class in a way that provides the functionality that I need it
        would be very much appreciated.

        Thanks,
        Staffan

        On Mon, Mar 31, 2014 at 3:18 PM, David Ashley wdashley@users.sf.netwrote:

        • status: unread --> rejected
        • assigned_to: David Ashley
        • Comment:

        There really is no reason to do this. It is the File Transfer Protocol
        application after all.

        In fact, this is the perfect place for a developer to subclass the ftp
        class and perform this kind of transformation. It make more sense to
        subclass it rather that change an expected behaviour.


        Status: rejected
        Milestone: None
        Created: Sat Mar 29, 2014 01:04 AM UTC by Staffan Tylen
        Last Updated: Sat Mar 29, 2014 07:35 PM UTC
        Owner: David Ashley

        Currently rxftp.cls only accepts filenames as input/output, making it
        dependent on .stream objects as i/o method. I propose that the code be
        changed to become sensitive to the type of object that the caller provides
        as input and output in get and put operations: if either of these
        parameters is not a string object, it should be assumed to be an object of
        a class that supports a get or a put method. This lets us use other media
        then .stream objects to send and receive data over ftp.


        Sent from sourceforge.net because you indicated interest in
        https://sourceforge.net/p/oorexx/feature-requests/592/

        To unsubscribe from further messages, please visit
        https://sourceforge.net/auth/subscriptions/

         

        Related

        Feature Requests: #592


Anonymous

Cancel  Add attachments





Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks