Hi,
I have a problem creating a custom File processing strategy for when
to download a file from an FTP server
Essentially we have to poll for a .DONE file to exist before taking
the data file.
public class MyFTPProcessStrategy<T> extends
GenericFileProcessStrategySupport<T> {
@Override
public boolean begin(GenericFileOperations<T>
tGenericFileOperations, GenericFileEndpoint<T> tGenericFileEndpoint,
Exchange exchange, GenericFile<T> tGenericFile) throws Exception {
super.begin(tGenericFileOperations, tGenericFileEndpoint,
exchange, tGenericFile);
List<GenericFile<T>> files =
(List<GenericFile<T>>)tGenericFileOperations.listFiles();
for(GenericFile<T> f : files) {
if(f.getFileName().endsWith(".DONE")) {
return true;
}
}
return false;
}
}
I get a class cast exception when looping through the files on the server:
java.lang.ClassCastException: org.apache.commons.net.ftp.FTPFile
cannot be cast to org.apache.camel.component.file.GenericFile
When I have checked nabble, this seems to be the correct solution
(check for the existence of a .ready file).
This is with camel-2.1
Is this a known bug, a stupid implementation decision from me, or
something else?
Thanks,
Kev