Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.0 M3
    • Fix Version/s: 1.0 M4
    • Component/s: Adapters
    • Labels:
      None

      Description

      Create a FileNameMapper, the input would be a java File object, you can then return a Message whose payload is just the filename.

      http://forum.springframework.org/showthread.php?p=173644#post173644

        Activity

        Hide
        Mark Fisher added a comment -

        We will likely change the FileSourceAdapter to use a default mapping strategy that sends the java.io.File object as its payload. Then it would be simple to grab the file name, full path, or whatever is necessary.

        Also note that the adapter will use Spring's Resource abstraction as requested here: INT-188

        Show
        Mark Fisher added a comment - We will likely change the FileSourceAdapter to use a default mapping strategy that sends the java.io.File object as its payload. Then it would be simple to grab the file name, full path, or whatever is necessary. Also note that the adapter will use Spring's Resource abstraction as requested here: INT-188
        Hide
        Marius Bogoevici added a comment -

        The feature will be supported by allowing a custom mapper on the <file-source/> element, like this:

        <file-source mapper="com.springsource..FileNameMapper" .../>

        this will replace the text="true|false" attribute. Instead, one will use:

        <file-source mapper="text"/>

        <file-source mapper="binary"/>

        Show
        Marius Bogoevici added a comment - The feature will be supported by allowing a custom mapper on the <file-source/> element, like this: <file-source mapper="com.springsource..FileNameMapper" .../> this will replace the text="true|false" attribute. Instead, one will use: <file-source mapper="text"/> <file-source mapper="binary"/>
        Hide
        Mark Fisher added a comment -

        I think we should probably just use a default FileMapper that passes a java.io.File object as the message payload. If someone wants to use a different mapper (such as the current "text" or "byte-array" mappers), they should supply a bean reference in the "mapper" attribute. The reference seems to be the most consistent option - rather than an enum of type names or fully-qualified classnames.

        Since the filename can easily be retrieved from a File object, an explicit filename-mapper probably is not necessary if we do provide the FileMapper as a default.

        Show
        Mark Fisher added a comment - I think we should probably just use a default FileMapper that passes a java.io.File object as the message payload. If someone wants to use a different mapper (such as the current "text" or "byte-array" mappers), they should supply a bean reference in the "mapper" attribute. The reference seems to be the most consistent option - rather than an enum of type names or fully-qualified classnames. Since the filename can easily be retrieved from a File object, an explicit filename-mapper probably is not necessary if we do provide the FileMapper as a default.
        Hide
        Marius Bogoevici added a comment -

        Fixed as follows:

        The MessageCreator for FileSource is configurable, either one the predefined types text, binary, file can be used:

        <file-source id="fileSource" type="text | binary | file" ...>

        or a custom one can be injected:

        <file-source id="fileSource" message-creator="referenceToMessageCreatorBean" />

        Show
        Marius Bogoevici added a comment - Fixed as follows: The MessageCreator for FileSource is configurable, either one the predefined types text, binary, file can be used: <file-source id="fileSource" type="text | binary | file" ...> or a custom one can be injected: <file-source id="fileSource" message-creator="referenceToMessageCreatorBean" />

          People

          • Assignee:
            Marius Bogoevici
            Reporter:
            Paddy Daly
          • Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 0.25d
              0.25d
              Remaining:
              Remaining Estimate - 0.25d
              0.25d
              Logged:
              Time Spent - Not Specified
              Not Specified