View Full Version : Using FilenameFilter with FileSource
Jun 3rd, 2008, 05:44 AM
SI's FileSource supports the use of a FilenameFilter. Could anybody tell me how to inject a FilenameFilter if I create a file source using the following configuration?
<source-endpoint source="fileSource" channel="channel1">
<file-source id="fileSource" type="text" directory="//input"/>
Jun 3rd, 2008, 06:00 AM
Namespace support is not currently available for those properties. However, I just created the following JIRA issue: http://jira.springframework.org/browse/INT-242
For now, to configure a fileFilter or filenameFilter, you would need to define the FileSource instance as a <bean/>. The id of that bean can still be used as a reference from the <source-endpoint/> element's "source" attribute.
Jun 3rd, 2008, 06:11 AM
I thought that was the answer.
Many thanks for your prompt reply.
Jun 3rd, 2008, 12:16 PM
If you grab the latest version from SVN, the "file-filter" or "filename-filter" attributes may now be provided on a <file-source/> element (with a reference to a FileFilter or FilenameFilter instance respectively).
Thanks again for bringing this to our attention.
Jun 5th, 2008, 01:40 AM
We have many requirements for file sources which filter based on a regular expression against the file name. Typically we have many of these in a single integration context, so it would be great if we could write:
<file-source id="fileSource" type="text" directory="/input" filename-regex="rental*"/>
<file-source id="fileSource" type="text" directory="/input" filename-regex="sale*"/>
<file-source id="fileSource" type="text" directory="/input" filename-regex="disposal*"/>
ORO, which is already an SI dependency, provides three pre-baked FilenameFilter implementations in org.apache.oro.io which take their regex from a String: AwkFilenameFilter, GlobFilenameFilter and Perl5FilenameFilter.
What do you think of providing a regex attribute to file-source, and would it be reasonable to implement it with one of the ORO filters? I'll volunteer to code it as long as it's not a misguided idea :-).
Jun 9th, 2008, 09:05 PM
It seems that the idea of a filename-regex attribute is good, but it's better to do it without ORO. See issue INT-252 in Jira for more details.
Powered by vBulletin® Version 4.2.1 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.