diff --git a/docs/src/reference/docbook/index.xml b/docs/src/reference/docbook/index.xml index 3481157d6b..c7dc138bad 100644 --- a/docs/src/reference/docbook/index.xml +++ b/docs/src/reference/docbook/index.xml @@ -140,6 +140,7 @@ + diff --git a/docs/src/reference/docbook/resource.xml b/docs/src/reference/docbook/resource.xml new file mode 100644 index 0000000000..ef5d3406b1 --- /dev/null +++ b/docs/src/reference/docbook/resource.xml @@ -0,0 +1,95 @@ + + + Resource Support + +
+ Introduction + + The Resource Inbound Channel Adapter builds upon Spring's Resource abstraction to + support greater flexibility across a variety of actual types of underlying resources, such as a file, a URL, + or a class path resource. Therefore, it's similar to but more generic than the + File Inbound Channel Adapter. + +
+ +
+ Resource Inbound Channel Adapter + + The Resource Inbound Channel Adapter is a polling adapter that creates a Message + whose payload is a collection of Resource objects. + + + Resource objects are resolved based on the pattern specified using the pattern attribute. + The collection of resolved Resource objects is then sent as a payload within a + Message to the adapter's channel. That is one major difference between Resource Inbound Channel Adapter + and File Inbound Channel Adapter; the latter buffers File objects and sends a single File object per + Message. + + + Below is an example of a very simple configuration which will find all files ending with the 'properties' + extension in the foo.bar package available on the classpath and will send them as + the payload of a Message to the channel named 'resultChannel': + + + +]]> + + + The Resource Inbound Channel Adapter relies on the + org.springframework.core.io.support.ResourcePatternResolver strategy interface to resolve the provided pattern. + It defaults to an instance of the current ApplicationContext. However you may provide a reference to an instance + of your own implementation of ResourcePatternResolver using the pattern-resolver attribute: + + + + +]]> + + + You may have a use case where you need to further filter the collection of resources + resolved by the ResourcePatternResolver. For example, you may want to prevent resources + that were resolved already from appearing in a collection of resolved resources ever again. On the other hand + your resources might be updated rather often and you do want them to be picked up again. + In other words there is a valid use case for defining an additional filter as well as disabling filtering altogether. + You can provide your own implementation of the org.springframework.integration.util.CollectionFilter + strategy interface: + { + + Collection filter(Collection unfilteredElements); + +}]]> + + As you can see the CollectionFilter receives a collection of un-filtered elements + (which would be Resource objects in this case), and it returns a collection of + filtered elements of that same type. + + + + If you are defining the adapter via XML but you do not specify a filter reference, a default implementation of + CollectionFilter will be used by the Resource Inbound Channel Adapter. + The implementation class of that default filter is org.springframework.integration.util.AcceptOnceCollectionFilter. + It remembers the elements passed in the previous invocation in order to avoid returning those elements more than once. + + + To inject your own implementation of CollectionFilter instead, use the filter attribute. + + + + +]]> + + If you don't need any filtering and want to disable even the default CollectionFilter strategy, + simply provide an empty value for the filter attribute (e.g., filter="") + +
+ +
diff --git a/docs/src/reference/docbook/whats-new.xml b/docs/src/reference/docbook/whats-new.xml index b16d37b610..b84844315c 100644 --- a/docs/src/reference/docbook/whats-new.xml +++ b/docs/src/reference/docbook/whats-new.xml @@ -92,6 +92,18 @@ For further details please see . + +
+ Support for Spring's Resource abstraction + + As of version 2.1, we've introduced a new Resource Inbound Channel Adapter that builds upon + Spring's Resource abstraction to support greater flexibility across a variety of actual types of + underlying resources, such as a file, a URL, or a class path resource. Therefore, it's similar to but + more generic than the File Inbound Channel Adapter. + + + For further details please see . +
Stored Procedure Components