Results 1 to 6 of 6

Thread: FTP Adapter (initiateListParsing)

  1. #1
    Join Date
    Jul 2008
    Location
    Copenhagen
    Posts
    2

    Default FTP Adapter (initiateListParsing)

    Hi

    I have a problem with the FtpSource since it doesn't allow me to call the method initiateListParsing on the FtpClient. I need my own ConfigurableFTPFileEntryParserImpl as my FTP server shows the file listing with a Danish date format (this can't be changed).

    I have tried to extend the FtpSource to set up my own FtpClient, but since the FtpClient in FtpSource is private final it can't be changed.

    The only way I can think of to solve this problem is to override the FtpSource class completely, but I don't feel this is the right way to do it.

    I have tried working with both the FtpSource of milestone 4 and the latest from svn, but I end up having the same problem.

    Does anyone have any ideas on how to make a workaround on this problem?

  2. #2
    Join Date
    Oct 2007
    Location
    Toronto, ON
    Posts
    90

    Default

    Hi,

    For now, this is a limitation, but please follow on:

    http://jira.springframework.org/browse/INT-293.

    The goal is to allow the better configuration of the underlying FtpClient components.

    Regards,
    Marius
    Marius Bogoevici,
    Spring Integration Committer

  3. #3
    Join Date
    May 2007
    Location
    Netherlands
    Posts
    614

    Default

    Quote Originally Posted by smor View Post
    Hi
    The only way I can think of to solve this problem is to override the FtpSource class completely, but I don't feel this is the right way to do it.
    [...]
    Does anyone have any ideas on how to make a workaround on this problem?
    You and Liskov share that feeling, mate!

    The thing to do is implement your own Source. You can see if you can reuse code from our FtpSource, or do it your way completely. Then if we come up with an FtpSource that is good enough it will be trivial to swap the source in your configuration. You could probably start with extending AbstractDirectorySource that contains the basic strategies common to reading from directories.

  4. #4
    Join Date
    May 2007
    Location
    Netherlands
    Posts
    614

    Default

    The latest changes to FtpSource allow you to inject your own FTPClient. If you call configure on that client (e.g. using a FactoryBean or postprocessing), you could set your ConfigurableFTPFileEntryParserImpl on the client before it connects.

    Will this be sufficient for you, or do you need other hooks?

  5. #5
    Join Date
    Jul 2008
    Location
    Copenhagen
    Posts
    2

    Default

    Hi all

    After a long summer vacation - I'm back However I didn't have time to fully revisit the problem - but my first solution was to make my own copy of FTPSource and then implement what I needed.

    This works fine - but with the latest changes in milestone 5, I had to re-implement my FTPSource. Which wasn't a problem.

    The solution with injecting my own FtpClient is exactly what I'm looking for. I just didn't have time to check this out.

  6. #6
    Join Date
    May 2007
    Location
    Netherlands
    Posts
    614

    Default

    The next cleanup action will be to allow you to inject an FTPClientFactory, like with FTPTarget. This will allow you to preconfigure the connection before you hand it over to the source (so you could set some modes etc). With the next milestone you could configure instead of reimplement, this will save you some time I guess. Just drop in a Jira issue if something is missing.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •