Hi You can take a look at GenericFileExclusiveReadLockStrategy which is more suitable for this kind as its the strategy how to acquire a lock on the file, which in your case is when the .DONE file has been written.
Since you are doing FTP stuff the <T> should be FTPFile which is the raw type used by the real FTP framework underneath. The FTPFile type has a method to get the file name which you can use to compare it with .DONE On Wed, Jan 27, 2010 at 3:52 PM, Kevin Jackson <[email protected]> wrote: > 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 > -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
