return pojoMediator;
}
private void handlePropertyAction(String name, OMElement propElem, POJOCommandMediator m) {
OMAttribute valueAttr = propElem.getAttribute(ATT_VALUE);
OMAttribute exprAttr = propElem.getAttribute(ATT_EXPRN);
OMAttribute ctxNameAttr = propElem.getAttribute(ATT_CTXNAME);
OMAttribute actionAttr = propElem.getAttribute(ATT_ACTION);
SynapseXPath xpath = null;
try {
if (exprAttr != null) {
xpath = SynapseXPathFactory.getSynapseXPath(propElem, ATT_EXPRN);
}
} catch (JaxenException e) {
handleException("Error in building the expression as an SynapseXPath" + e);
}
// if there is a value attribute there is no action (action is implied as read value)
if (valueAttr != null) {
String value = valueAttr.getAttributeValue();
// all other three attributes can not co-exists
if (exprAttr != null && ctxNameAttr != null) {
handleException("Command properties can not contain all three 'value', " +
"'expression' and 'context-name' attributes. Only one or " +
"combination of two can be there.");
} else {
m.addStaticSetterProperty(name, value);
if (exprAttr != null) {
// action ==> ReadValueAndUpdateMesssage
m.addMessageGetterProperty(name, xpath);
} else if (ctxNameAttr != null) {
// action ==> ReadValueAndUpdateContext
m.addContextGetterProperty(name, ctxNameAttr.getAttributeValue());
} // else the action ==> ReadValue
}
} else if (propElem.getFirstElement() != null) {
// all other two attributes can not co-exists
if (exprAttr != null && ctxNameAttr != null) {
handleException("Command properties can not contain all the " +
"'expression' and 'context-name' attributes with a child. Only one " +
"attribute of those can co-exists with a child");
} else {
m.addStaticSetterProperty(name, propElem.getFirstElement());
if (exprAttr != null) {
// action ==> ReadValueAndUpdateMesssage
m.addMessageGetterProperty(name, xpath);
} else if (ctxNameAttr != null) {
// action ==> ReadValueAndUpdateContext
m.addContextGetterProperty(name, ctxNameAttr.getAttributeValue());
} // else the action ==> ReadValue
}
} else {
// if both context-name and expression is there
if (exprAttr != null && ctxNameAttr != null) {
if (actionAttr != null && actionAttr.getAttributeValue() != null) {
String action = actionAttr.getAttributeValue();
if (RM_ACTION.equals(action) || UC_ACTION.equals(action)) {
// action ==> ReadMessageAndUpdateContext
m.addMessageSetterProperty(name, xpath);
m.addContextGetterProperty(name, ctxNameAttr.getAttributeValue());
} else if (RC_ACTION.equals(action) || UM_ACTION.equals(action)) {
// action ==> ReadContextAndUpdateMessage
m.addContextSetterProperty(name, ctxNameAttr.getAttributeValue());
m.addMessageGetterProperty(name, xpath);
} else {
handleException("Invalid action for " +
"the command property with the name " + name);
}
} else {
handleException("Action attribute " +
"is required for the command property with name " + name);
}
} else {
// only one of expression or context-name is present
if (actionAttr != null && actionAttr.getAttributeValue() != null) {
String action = actionAttr.getAttributeValue();
if (exprAttr != null) {
if (RM_ACTION.equals(action)) {
// action ==> ReadMessage
m.addMessageSetterProperty(name, xpath);
} else if (UM_ACTION.equals(action)) {