View Full Version : FTP Adapter (initiateListParsing)
smor
Jul 8th, 2008, 06:43 AM
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?
mbogoevici
Jul 8th, 2008, 04:20 PM
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
iwein
Jul 9th, 2008, 04:47 AM
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.
iwein
Jul 31st, 2008, 05:30 AM
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?
smor
Aug 15th, 2008, 03:42 AM
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.
iwein
Aug 15th, 2008, 08:44 AM
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.
Powered by vBulletin® Version 4.2.1 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.