Results 1 to 6 of 6

Thread: Using FilenameFilter with FileSource

  1. #1
    Join Date
    Jun 2008
    Posts
    2

    Default 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"/>
    </source-endpoint>
    <file-source id="fileSource" type="text" directory="//input"/>

    Many Thanks
    Jon Ford

  2. #2
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    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.

    Thanks,
    Mark

  3. #3
    Join Date
    Jun 2008
    Posts
    2

    Default

    I thought that was the answer.

    Many thanks for your prompt reply.

    Jon Ford.

  4. #4
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

    Jon,

    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.

    -Mark

  5. #5
    Join Date
    Apr 2008
    Location
    Brisbane, Australia
    Posts
    23

    Default 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:

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

    Thanks,

    Jerry Gaines

  6. #6
    Join Date
    Apr 2008
    Location
    Brisbane, Australia
    Posts
    23

    Default

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •