From d7e7fd7348bdbd93ba01f421f978cfaeb554ed2a Mon Sep 17 00:00:00 2001 From: Mark Fisher Date: Sat, 5 Feb 2011 19:14:08 -0500 Subject: [PATCH] doc polishing --- docs/src/reference/docbook/groovy.xml | 74 +++++++++++++-------------- 1 file changed, 36 insertions(+), 38 deletions(-) diff --git a/docs/src/reference/docbook/groovy.xml b/docs/src/reference/docbook/groovy.xml index a919a7c7f3..50155b9c6d 100644 --- a/docs/src/reference/docbook/groovy.xml +++ b/docs/src/reference/docbook/groovy.xml @@ -79,59 +79,57 @@ You already know that by default, 'payload' and 'headers' will be bound as Groovy binding variables. - However, some times in order to take the most out of Groovy you may want to customize Groovy bindings - (e.g., include extra variables pointing to some scalar values or bind some beans as variables etc.) - To support this requirement we have defined a simple strategy ScriptVariableGenerator. + (e.g., include extra variables pointing to some scalar values or bind some beans as variables). + To support this requirement we have defined a simple strategy: ScriptVariableGenerator. generateScriptVariables(Message message); }]]> - As you can see the only method that needs to be implemented is generateScriptVariables(Message) which takes - Message as an argument (allowing you to use data available in Message payload/headers) and returns the Map of variables - that will be bound as Groovy bindings. This method will be called every time the script is executed. We also provide - default implementation and namespace based configuration for simple bindings via <variable> sub-element (see below): + As you can see the only method to implement is generateScriptVariables(Message). It takes the Message + as an argument. That allows you to use data available in the Message payload and/or headers. The return value is + the Map of variables that will be bound to the script's evaluation context. This method will be called every time + the script is executed, corresponding to the processing of that particular Message. We also provide a + default implementation and namespace based configuration for simple bindings via <variable> sub-elements (see below): ]]> - As you can see similar to other constructs in Spring, when setting binding variables you can either set scalar values - or reference another bean in the Application Context. + As you can see similar to other constructs in Spring, when binding each of these variables you can either provide a + scalar value or reference another bean in the Application Context. - However if you need more dynamics with regard to how a particular variable is generated then all you need to do is - provide your own implementation of ScriptVariableGenerator and inject it via script-variable-generator attribute: + If you need more control over how a particular variable is generated, then all you need to do is + provide your own implementation of ScriptVariableGenerator and reference it with the script-variable-generator + attribute: -]]> + script-variable-generator="variableGenerator"/> + +]]> - - Remember that script-variable-generator and use of <variable> sub-element is mutually exclusive. - You can only use one of another. Also, the script-variable-generator and/or <variable> sub-elements can - not be used when using inline script, only when pointing to the script via location attribute. - + The script-variable-generator attribute and <variable> sub-element(s) are mutually exclusive. + You can use at most one of them. Also, the script-variable-generator and <variable> sub-elements + cannot be used with an inline script, but rather only when pointing to the script via the location attribute. - If you need control over customization of the Groovy object itself which goes beyond setting variables - (e.g., properties, MetaObject etc.) you can also register a GroovyObjectCustomizer which is an implementation of - org.springframework.scripting.groovy.GroovyObjectCustomizer via customizer attribute. + If you need to customize the Groovy object itself, beyond setting variables, you can reference + a bean that implementats org.springframework.scripting.groovy.GroovyObjectCustomizer via the + customizer attribute. For example, this might be useful if you want to configure a domain-specific + language (DSL) by modifying the MetaClass and registering functions to be available within the script. - - + + - -]]> -Setting custom GroovyObjectCustomizer is NOT mutually exclusive to <variable> sub-element and/or script-variable-generator - and is allowed with inline scripting. +]]> + Setting a custom GroovyObjectCustomizer is not mutually exclusive with <variable> sub-elements or + the script-variable-generator attribute. It can also be provided when defining an inline script. @@ -144,13 +142,13 @@ Setting custom GroovyObjectCustomizer is NOT mutually exclusive to <variable& monitoring and managing the components within the framework as is used for "application-level" messaging. In Spring Integration we build upon the adapters described above so that it's possible to send Messages as a means - of invoking exposed operations. + of invoking exposed operations. One option for those operations is Groovy scripts. <groovy:control-bus input-channel="operationChannel"/> The Control Bus has an input channel that can be accessed for invoking operations on the beans in the application context. - The groovy control bus executes messages on the input channel as + The Groovy Control Bus executes messages on the input channel as Groovy scripts. It takes a message, compiles the body to a Script, customizes it with a GroovyObjectCustomizer, and then executes it. The Control Bus' customizer exposes all the beans in the application context @@ -159,15 +157,15 @@ Setting custom GroovyObjectCustomizer is NOT mutually exclusive to <variable& (e.g. several of the TaskExecutor and TaskScheduler implementations). - If you need control over customization of the Groovy object itself which goes beyond setting variables - (e.g., properties, MetaObject etc.) you can also register a GroovyObjectCustomizer which is an implementation of - org.springframework.scripting.groovy.GroovyObjectCustomizer via customizer attribute. + If you need to further customize the Groovy objects, you can also provide a reference to a bean + that implements org.springframework.scripting.groovy.GroovyObjectCustomizer via + the customizer attribute. - + -]]> +]]>