*/
public class MappingHelper {
public static Mapping fromOM(OMElement mappingElement)
throws CEPConfigurationException {
Mapping mapping = new Mapping();
String stream =
mappingElement.getAttributeValue(
new QName(CEPConstants.CEP_CONF_ATTR_STREAM));
mapping.setStream(stream);
for (Iterator iterator = mappingElement.getChildrenWithName(new QName(CEPConstants.CEP_CONF_NAMESPACE,
CEPConstants.CEP_CONF_ELE_XPATH_DEFINITON)); iterator.hasNext();) {
OMElement xpathDefinitionElement = (OMElement) iterator.next();
String prefix = xpathDefinitionElement.getAttributeValue(
new QName(CEPConstants.CEP_CONF_ATTR_PREFIX));
String namespace = xpathDefinitionElement.getAttributeValue(
new QName(CEPConstants.CEP_CONF_ATTR_NAMESPACE));
XpathDefinition xpathDefinition = new XpathDefinition();
xpathDefinition.setPrefix(prefix);
xpathDefinition.setNamespace(namespace);
mapping.addXpathDefinition(xpathDefinition);
}
for (Iterator iterator = mappingElement.getChildrenWithName(new QName(CEPConstants.CEP_CONF_NAMESPACE,
CEPConstants.CEP_CONF_ELE_PROPERTY)); iterator.hasNext();) {
OMElement propertyElement = (OMElement) iterator.next();
Property property = PropertyHelper.fromOM(propertyElement);
property.setInputProperty(true);
mapping.addProperty(property);
}
return mapping;
}