filtereventhandler.java

来自「提供ESB 应用mule源代码 提供ESB 应用mule源代码」· Java 代码 · 共 59 行

JAVA
59
字号
/* * $Id: FilterEventHandler.java 12421 2008-07-29 19:00:01Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */package org.mule.module.sxc;import org.mule.api.MuleMessage;import org.mule.api.routing.RoutingException;import com.envoisolutions.sxc.xpath.XPathEvent;import com.envoisolutions.sxc.xpath.XPathEventHandler;import javax.xml.stream.XMLStreamException;public class FilterEventHandler extends XPathEventHandler{    SxcFilteringOutboundRouter router;    SxcFilter filter;        public FilterEventHandler(SxcFilteringOutboundRouter router, SxcFilter filter)    {        super();        this.router = router;        this.filter = filter;    }        @Override    public void onMatch(XPathEvent event) throws XMLStreamException    {        try         {            MuleMessage msg = SxcFilteringOutboundRouter.getCurrentMessage();            msg.setProperty(filter.toString(), true);                        if (router.testMatch(msg))            {                throw new StopProcessingException();            }        }        catch (UndefinedMatchException e)         {        }        catch (RoutingException e)        {            // This shouldn't happen            throw new RuntimeException(e);        }    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?