From 952d02d501e09ffcee4eefc08fae7b6cf4e7baee Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Wed, 30 Nov 2011 15:08:52 -0500 Subject: [PATCH 1/2] INT-2261 added documentation for Resource Inbound Channel Adapter added resource.xml file --- docs/src/reference/docbook/index.xml | 1 + docs/src/reference/docbook/resource.xml | 88 ++++++++++++++++++++++++ docs/src/reference/docbook/whats-new.xml | 12 ++++ 3 files changed, 101 insertions(+) create mode 100644 docs/src/reference/docbook/resource.xml 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..7c8efd7d45 --- /dev/null +++ b/docs/src/reference/docbook/resource.xml @@ -0,0 +1,88 @@ + + + Resource Support + +
+ Introduction + + 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 + + Resource Inbound Channel Adapter is a polling adapter that creates a Message + with collection of Resource objects as payload + + + Resource objects are resolved based on the pattern specified using pattern attribute. + The collection of the resolved Resource objects is than sent as a payload with an + outgoing Message. That is one major difference that Resource Inbound Channel Adapter + has with File Inbound Channel Adapter which buffers File objects and sends a single File object per + Message. + + + Below is an example of very simple configuration which will find all files with 'property' + extension in the foo.bar package available on the classpath and will send them as + payload of a Message to resultChannel: + + + +]]> + + + Resource Inbound Channel Adapter relies on + org.springframework.core.io.support.ResourcePatternResolver to resolve provided pattern. + It defaults to an instance of the current ApplicationContext. However you may provide your own + instance of the ResourcePatternResolver using pattern-resolver attribute: + + + + +]]> + + + There may be a use case where you might want to filter resources in addition to what was already + resolved by the ResourcePatternResolver. For example, you may want to prevent resources + that were resolved once to never appear in the 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 use no additional filtering at all. + You can accomplish this by providing your own implementation of org.springframework.integration.util.CollectionFilter + strategy: + { + + Collection filter(Collection unfilteredElements); + +}]]> + + As you can see the CollectionFilter receives a collection of un-filtered Resource + objects and returns a collection of filtered Resource objects. + + + + The default implementation of CollectionFilter used by the Resource Inbound Channel Adapter + is org.springframework.integration.util.AcceptOnceCollectionFilter which 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 use filter attribute. + + + + +]]> + + If you don't need any additional filtering and you want to disable default CollectionFilter strategy + simply configure empty 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 From af47009123d643080d55560480065b2b27ed098c Mon Sep 17 00:00:00 2001 From: Mark Fisher Date: Thu, 1 Dec 2011 09:35:13 -0500 Subject: [PATCH 2/2] polishing --- docs/src/reference/docbook/resource.xml | 85 +++++++++++++------------ 1 file changed, 46 insertions(+), 39 deletions(-) diff --git a/docs/src/reference/docbook/resource.xml b/docs/src/reference/docbook/resource.xml index 7c8efd7d45..ef5d3406b1 100644 --- a/docs/src/reference/docbook/resource.xml +++ b/docs/src/reference/docbook/resource.xml @@ -6,7 +6,7 @@
Introduction - Resource Inbound Channel Adapter builds upon Spring's Resource abstraction to + 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. @@ -16,72 +16,79 @@
Resource Inbound Channel Adapter - Resource Inbound Channel Adapter is a polling adapter that creates a Message - with collection of Resource objects as payload + 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 pattern attribute. - The collection of the resolved Resource objects is than sent as a payload with an - outgoing Message. That is one major difference that Resource Inbound Channel Adapter - has with File Inbound Channel Adapter which buffers File objects and sends a single File object per + 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 very simple configuration which will find all files with 'property' + 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 - payload of a Message to resultChannel: + the payload of a Message to the channel named 'resultChannel': - - + + ]]> - Resource Inbound Channel Adapter relies on - org.springframework.core.io.support.ResourcePatternResolver to resolve provided pattern. - It defaults to an instance of the current ApplicationContext. However you may provide your own - instance of the ResourcePatternResolver using pattern-resolver attribute: - - + 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: + + -]]> +]]> - There may be a use case where you might want to filter resources in addition to what was already + 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 once to never appear in the 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 use no additional filtering at all. - You can accomplish this by providing your own implementation of org.springframework.integration.util.CollectionFilter - strategy: + 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); + Collection filter(Collection unfilteredElements); }]]> - As you can see the CollectionFilter receives a collection of un-filtered Resource - objects and returns a collection of filtered Resource objects. + 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. - The default implementation of CollectionFilter used by the Resource Inbound Channel Adapter - is org.springframework.integration.util.AcceptOnceCollectionFilter which remembers the - elements passed in the previous invocation in order to avoid returning those elements more than once. + 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 use filter attribute. - - + To inject your own implementation of CollectionFilter instead, use the filter attribute. + + -]]> +]]> - If you don't need any additional filtering and you want to disable default CollectionFilter strategy - simply configure empty filter attribute (e.g., filter="") + 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="")