Search in sources :

Example 1 with ListMediator

use of org.apache.synapse.mediators.ListMediator in project wso2-synapse by wso2.

the class AbstractListMediatorFactory method addChildren.

protected static void addChildren(OMElement el, ListMediator m, Properties properties) {
    Iterator it = el.getChildren();
    while (it.hasNext()) {
        OMNode child = (OMNode) it.next();
        if (child instanceof OMElement) {
            if (!DESCRIPTION_Q.equals(((OMElement) child).getQName())) {
                // neglect the description tag
                SynapseConfiguration configuration = null;
                if (properties != null) {
                    configuration = properties.get(SynapseConstants.SYNAPSE_CONFIGURATION) != null ? (SynapseConfiguration) properties.get(SynapseConstants.SYNAPSE_CONFIGURATION) : null;
                }
                Mediator med = MediatorFactoryFinder.getInstance().getMediator((OMElement) child, properties, configuration);
                if (med != null) {
                    m.addChild(med);
                } else {
                    String msg = "Unknown mediator : " + ((OMElement) child).getLocalName();
                    log.error(msg);
                    throw new SynapseException(msg);
                }
            }
        } else if (child instanceof OMComment) {
            CommentMediator commendMediator = new CommentMediator();
            commendMediator.setCommentText(((OMComment) child).getValue());
            m.addChild(commendMediator);
        }
    }
}
Also used : OMNode(org.apache.axiom.om.OMNode) SynapseException(org.apache.synapse.SynapseException) OMComment(org.apache.axiom.om.OMComment) Iterator(java.util.Iterator) OMElement(org.apache.axiom.om.OMElement) Mediator(org.apache.synapse.Mediator) ListMediator(org.apache.synapse.mediators.ListMediator) CommentMediator(org.apache.synapse.mediators.builtin.CommentMediator) CommentMediator(org.apache.synapse.mediators.builtin.CommentMediator) SynapseConfiguration(org.apache.synapse.config.SynapseConfiguration)

Aggregations

Iterator (java.util.Iterator)1 OMComment (org.apache.axiom.om.OMComment)1 OMElement (org.apache.axiom.om.OMElement)1 OMNode (org.apache.axiom.om.OMNode)1 Mediator (org.apache.synapse.Mediator)1 SynapseException (org.apache.synapse.SynapseException)1 SynapseConfiguration (org.apache.synapse.config.SynapseConfiguration)1 ListMediator (org.apache.synapse.mediators.ListMediator)1 CommentMediator (org.apache.synapse.mediators.builtin.CommentMediator)1