Difference between revisions of "ResultProcessor"
(Created page with "==Description== Defines SubFlows output aggregation policy: ** none : return a java.util.List containig the SubFlows output ** XMLAggregate : aggregate the SubFlow out...") |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
Defines SubFlows output aggregation policy: | Defines SubFlows output aggregation policy: | ||
− | + | * none : return a java.util.List containig the SubFlows output | |
− | + | * XMLAggregate : aggregate the SubFlows output as XML | |
− | + | * JavaScript : use JavaScript to process a java.util.List containig the SubFlows output '''REMOVED in v3.5''' | |
− | + | * OGNLScript : use OGNL to process a java.util.List containig the SubFlows output '''REMOVED in v3.5''' | |
+ | <div class="version_ge3.5"> | ||
+ | * Script : use a Script engine to process a java.util.List containig the SubFlows output | ||
+ | </div> | ||
If isn't defined a processor the SubFlows output is intended as GVBuffer.output content or an Exception. | If isn't defined a processor the SubFlows output is intended as GVBuffer.output content or an Exception. | ||
− | The | + | The *Script processor receives as input a list of '''it.greenvulcano.gvesb.core.flow.parallel.Result''' instances that wrapps the SubFlows input and output. |
=={{VULCON}} / {{GVCONSOLE}} Configuration== | =={{VULCON}} / {{GVCONSOLE}} Configuration== | ||
Line 22: | Line 25: | ||
- gvbuffer-and-error : same as above | - gvbuffer-and-error : same as above | ||
- object-and-error : same as above | - object-and-error : same as above | ||
− | - | + | - *Script |
- only-object : java.util.List of output valid GVBuffer.object content, in the order of instantiation of SubFlows | - only-object : java.util.List of output valid GVBuffer.object content, in the order of instantiation of SubFlows | ||
- only-gvbuffer : java.util.List of output valid GVBuffer (wrapped as Result object), in the order of instantiation of SubFlows | - only-gvbuffer : java.util.List of output valid GVBuffer (wrapped as Result object), in the order of instantiation of SubFlows | ||
Line 30: | Line 33: | ||
The number of elements in the array will depend on several factors related to parallel flow configuration and SubFlow execution. | The number of elements in the array will depend on several factors related to parallel flow configuration and SubFlow execution. | ||
− | If a processor is not defined, the output GVBuffer.object will contain the java.util.List as defined as input for | + | If a processor is not defined, the output GVBuffer.object will contain the java.util.List as defined as input for *Script but unwrapped. |
|- | |- | ||
| fail-on-error || required || If true and any of the SubFlows output contains an Exception then the ResultProcessor returns an error. | | fail-on-error || required || If true and any of the SubFlows output contains an Exception then the ResultProcessor returns an error. | ||
Line 36: | Line 39: | ||
|} | |} | ||
− | Might contain the following elements: | + | Might contain the following elements: |
* [[XMLAggregate]] | * [[XMLAggregate]] | ||
− | * [[OGNLScript]] | + | * [[OGNLScript]] '''REMOVED in v3.5''' |
− | * [[JavaScript]] | + | * [[JavaScript]] '''REMOVED in v3.5''' |
+ | <div class="version_ge3.5"> | ||
+ | * [[Script]] | ||
+ | </div> | ||
+ | |||
+ | Follows an example that illustrate a input/output data manipulation through JavaScript: | ||
+ | <syntaxhighlight lang="xml"> | ||
+ | <ResultProcessor fail-on-error="true" | ||
+ | processor-input="only-gvbuffer"> | ||
+ | <JavaScript><![CDATA[var str = ""; | ||
+ | for (var i=0; i<results.size(); i++) | ||
+ | { | ||
+ | var inV = results.get(i).getInput().getObject(); | ||
+ | var outV = results.get(i).getOutput().getObject(); | ||
+ | str += ";[" + inV + " -> " + outV + "]"; | ||
+ | } | ||
+ | |||
+ | data.setObject(str.substring(1));]]> | ||
+ | </JavaScript> | ||
+ | </ResultProcessor> | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | <div class="version_ge3.5"> | ||
+ | The same example using the generic Script engine: | ||
+ | <syntaxhighlight lang="xml"> | ||
+ | <ResultProcessor fail-on-error="true" | ||
+ | processor-input="only-gvbuffer"> | ||
+ | <Script lang="js"><![CDATA[var str = ""; | ||
+ | for (var i=0; i<results.size(); i++) | ||
+ | { | ||
+ | var inV = results.get(i).getInput().getObject(); | ||
+ | var outV = results.get(i).getOutput().getObject(); | ||
+ | str += ";[" + inV + " -> " + outV + "]"; | ||
+ | } | ||
+ | |||
+ | data.setObject(str.substring(1));]]> | ||
+ | </Script> | ||
+ | </ResultProcessor> | ||
+ | </syntaxhighlight> | ||
+ | </div> |
Latest revision as of 11:19, 2 January 2015
Description
Defines SubFlows output aggregation policy:
- none : return a java.util.List containig the SubFlows output
- XMLAggregate : aggregate the SubFlows output as XML
- JavaScript : use JavaScript to process a java.util.List containig the SubFlows output REMOVED in v3.5
- OGNLScript : use OGNL to process a java.util.List containig the SubFlows output REMOVED in v3.5
- Script : use a Script engine to process a java.util.List containig the SubFlows output
If isn't defined a processor the SubFlows output is intended as GVBuffer.output content or an Exception. The *Script processor receives as input a list of it.greenvulcano.gvesb.core.flow.parallel.Result instances that wrapps the SubFlows input and output.
VulCon / GV Console Configuration
The following table shows the ResultProcessor element's attributes:
Attribute | Type | Description |
---|---|---|
processor-input | required | Defines the input to pass to the specific processor:
- XMLAggregate - only-object : array of output valid GVBuffer.object content, in the order of instantiation of SubFlows - only-gvbuffer : same as above - gvbuffer-and-error : same as above - object-and-error : same as above - *Script - only-object : java.util.List of output valid GVBuffer.object content, in the order of instantiation of SubFlows - only-gvbuffer : java.util.List of output valid GVBuffer (wrapped as Result object), in the order of instantiation of SubFlows - gvbuffer-and-error : java.util.List of output valid GVBuffer or Exception (wrapped as Result object), in the order of instantiation of SubFlows - object-and-error : java.util.List of output valid GVBuffer.object content or Exception , in the order of instantiation of SubFlows The number of elements in the array will depend on several factors related to parallel flow configuration and SubFlow execution. If a processor is not defined, the output GVBuffer.object will contain the java.util.List as defined as input for *Script but unwrapped. |
fail-on-error | required | If true and any of the SubFlows output contains an Exception then the ResultProcessor returns an error.
Default to true. |
Might contain the following elements:
- XMLAggregate
- OGNLScript REMOVED in v3.5
- JavaScript REMOVED in v3.5
Follows an example that illustrate a input/output data manipulation through JavaScript:
<ResultProcessor fail-on-error="true"
processor-input="only-gvbuffer">
<JavaScript><![CDATA[var str = "";
for (var i=0; i<results.size(); i++)
{
var inV = results.get(i).getInput().getObject();
var outV = results.get(i).getOutput().getObject();
str += ";[" + inV + " -> " + outV + "]";
}
data.setObject(str.substring(1));]]>
</JavaScript>
</ResultProcessor>
The same example using the generic Script engine:
<ResultProcessor fail-on-error="true"
processor-input="only-gvbuffer">
<Script lang="js"><![CDATA[var str = "";
for (var i=0; i<results.size(); i++)
{
var inV = results.get(i).getInput().getObject();
var outV = results.get(i).getOutput().getObject();
str += ";[" + inV + " -> " + outV + "]";
}
data.setObject(str.substring(1));]]>
</Script>
</ResultProcessor>