Package org.wso2.carbon.cep.core.internal.config

Source Code of org.wso2.carbon.cep.core.internal.config.PropertyHelper

package org.wso2.carbon.cep.core.internal.config;

import org.apache.axiom.om.OMElement;
import org.wso2.carbon.cep.core.Property;
import org.wso2.carbon.cep.core.internal.util.CEPConstants;

import javax.xml.namespace.QName;

/**
* This class will help to build Property object from a given OMElement
*/
public class PropertyHelper {
    public static Property fromOM(OMElement propertyElement) {
        Property property = new Property();
        String name = propertyElement.getAttributeValue(new QName(CEPConstants.CEP_CONF_ELE_NAME));
        String xpath = propertyElement.getAttributeValue(new QName(CEPConstants.CEP_CONF_ELE_XPATH));
        String type = propertyElement.getAttributeValue(new QName(CEPConstants.CEP_CONF_ELE_TYPE));
        String xmlFieldName = propertyElement.getAttributeValue(new QName(CEPConstants.CE_CONF_ELE_XML_FIELD_NAME));
        String xmlFieldType = propertyElement.getAttributeValue(new QName(CEPConstants.CE_CONF_ELE_XML_FIELD_TYPE));

        property.setName(name);
        property.setXpath(xpath);
        property.setType(type);
        property.setXmlFieldName(xmlFieldName);
        property.setXmlFieldType(xmlFieldType);

        return property;
    }
}
TOP

Related Classes of org.wso2.carbon.cep.core.internal.config.PropertyHelper

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.