OMAttribute version = elem.getAttribute(ATT_VERSION);
if (single == null && correlation == null) {
String msg = "The 'single' attribute value of true or a 'correlation' attribute is " +
"required for the configuration of a RMSequence mediator";
throw new MediatorException(msg);
}
if (correlation != null) {
if (correlation.getAttributeValue() != null &&
correlation.getAttributeValue().trim().length() == 0) {
String msg = "Invalid attribute value specified for correlation";
throw new MediatorException(msg);
} else {
try {
this.correlation =
SynapseXPathFactory.getSynapseXPath(elem, ATT_CORR);
this.single = false;
} catch (JaxenException e) {
String msg = "Invalid XPath expression for attribute correlation : "
+ correlation.getAttributeValue();
throw new MediatorException(msg);
}
}
}
if (single != null) {
this.single = Boolean.valueOf(single.getAttributeValue());
}
if (this.single && this.correlation != null) {
String msg = "Invalid RMSequence mediator. A RMSequence can't have both a "
+ "single attribute value of true and a correlation attribute specified.";
throw new MediatorException(msg);
} else if (!this.single && correlation == null) {
String msg = "Invalid RMSequence mediator. A RMSequence must have a "
+ "single attribute value of true or a correlation attribute specified.";
throw new SynapseException(msg);
}
if (lastMessage != null) {
if (lastMessage.getAttributeValue() != null &&
lastMessage.getAttributeValue().trim().length() == 0) {
String msg = "Invalid attribute value specified for last-message";
throw new MediatorException(msg);
} else {
try {
this.lastMessage =
SynapseXPathFactory.getSynapseXPath(elem, ATT_LASTMSG);
} catch (JaxenException e) {
String msg = "Invalid XPath expression for attribute last-message : "
+ lastMessage.getAttributeValue();
throw new MediatorException(msg);
}
}
}
if (this.single && this.lastMessage != null) {
String msg = "Invalid RMSequence mediator. A RMSequence can't have both a "
+ "single attribute value of true and a last-message attribute specified.";
throw new SynapseException(msg);
}
if (version != null) {
if (!XMLConfigConstants.SEQUENCE_VERSION_1_0.equals(version.getAttributeValue()) &&
!XMLConfigConstants.SEQUENCE_VERSION_1_1.equals(version.getAttributeValue())) {
String msg = "Only '" + XMLConfigConstants.SEQUENCE_VERSION_1_0 + "' or '" +
XMLConfigConstants.SEQUENCE_VERSION_1_1
+ "' values are allowed for attribute version for a RMSequence mediator"
+ ", Unsupported version " + version.getAttributeValue();
throw new MediatorException(msg);
}
this.version = version.getAttributeValue();
}
// after successfully creating the mediator