@@ -54,14 +54,15 @@ public class ScatterGatherMediatorFactory extends AbstractMediatorFactory {
54
54
= new QName (XMLConfigConstants .SYNAPSE_NAMESPACE , "scatter-gather" );
55
55
private static final QName ELEMENT_AGGREGATE_Q
56
56
= new QName (XMLConfigConstants .SYNAPSE_NAMESPACE , "aggregation" );
57
- private static final QName ATT_VALUE_TO_AGGREGATE = new QName ("value " );
57
+ private static final QName ATT_AGGREGATE_EXPRESSION = new QName ("expression " );
58
58
private static final QName ATT_CONDITION = new QName ("condition" );
59
59
private static final QName ATT_TIMEOUT = new QName ("timeout" );
60
60
private static final QName ATT_MIN_MESSAGES = new QName ("min-messages" );
61
61
private static final QName ATT_MAX_MESSAGES = new QName ("max-messages" );
62
62
private static final QName SEQUENCE_Q = new QName (XMLConfigConstants .SYNAPSE_NAMESPACE , "sequence" );
63
63
private static final QName PARALLEL_EXEC_Q = new QName ("parallel-execution" );
64
64
private static final QName RESULT_TARGET_Q = new QName ("result-target" );
65
+ private static final QName ROOT_ELEMENT_Q = new QName ("root-element" );
65
66
private static final QName CONTENT_TYPE_Q = new QName ("content-type" );
66
67
67
68
private static final SequenceMediatorFactory fac = new SequenceMediatorFactory ();
@@ -87,7 +88,15 @@ public Mediator createSpecificMediator(OMElement elem, Properties properties) {
87
88
if ("JSON" .equals (contentTypeAttr .getAttributeValue ())) {
88
89
mediator .setContentType (ScatterGather .JSON_TYPE );
89
90
} else if ("XML" .equals (contentTypeAttr .getAttributeValue ())) {
90
- mediator .setContentType (ScatterGather .XML_TYPE );
91
+ OMAttribute rootElementAttr = elem .getAttribute (ROOT_ELEMENT_Q );
92
+ if (rootElementAttr != null && StringUtils .isNotBlank (rootElementAttr .getAttributeValue ())) {
93
+ mediator .setRootElementName (rootElementAttr .getAttributeValue ());
94
+ mediator .setContentType (ScatterGather .XML_TYPE );
95
+ } else {
96
+ String msg = "The 'root-element' attribute is required for the configuration of a " +
97
+ "Scatter Gather mediator when the 'content-type' is 'XML'" ;
98
+ throw new SynapseException (msg );
99
+ }
91
100
} else {
92
101
String msg = "The 'content-type' attribute should be either 'JSON' or 'XML'" ;
93
102
throw new SynapseException (msg );
@@ -119,16 +128,16 @@ public Mediator createSpecificMediator(OMElement elem, Properties properties) {
119
128
120
129
OMElement aggregateElement = elem .getFirstChildWithName (ELEMENT_AGGREGATE_Q );
121
130
if (aggregateElement != null ) {
122
- OMAttribute aggregateExpr = aggregateElement .getAttribute (ATT_VALUE_TO_AGGREGATE );
131
+ OMAttribute aggregateExpr = aggregateElement .getAttribute (ATT_AGGREGATE_EXPRESSION );
123
132
if (aggregateExpr != null ) {
124
133
try {
125
134
mediator .setAggregationExpression (
126
- SynapsePathFactory .getSynapsePath (aggregateElement , ATT_VALUE_TO_AGGREGATE ));
135
+ SynapsePathFactory .getSynapsePath (aggregateElement , ATT_AGGREGATE_EXPRESSION ));
127
136
} catch (JaxenException e ) {
128
137
handleException ("Unable to load the aggregating expression" , e );
129
138
}
130
139
} else {
131
- String msg = "The 'value ' attribute is required for the configuration of a Scatter Gather mediator" ;
140
+ String msg = "The 'expression ' attribute is required for the configuration of a Scatter Gather mediator" ;
132
141
throw new SynapseException (msg );
133
142
}
134
143
0 commit comments