Announcement Announcement Module
No announcement yet.
Using FilenameFilter with FileSource Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using FilenameFilter with FileSource

    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">
    <schedule period="10000"/>
    <file-source id="fileSource" type="text" directory="//input"/>

    Many Thanks
    Jon Ford

  • #2
    Namespace support is not currently available for those properties. However, I just created the following JIRA issue:

    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.



    • #3
      I thought that was the answer.

      Many thanks for your prompt reply.

      Jon Ford.


      • #4

        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.



        • #5
          Filename regular expressions

          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 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 :-).


          Jerry Gaines


          • #6
            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.