View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.config.spring.parsers.specific;
8   
9   import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser;
10  import org.mule.config.spring.parsers.PostProcessor;
11  import org.mule.config.spring.parsers.assembly.BeanAssembler;
12  import org.mule.routing.MessageFilter;
13  import org.springframework.beans.factory.xml.ParserContext;
14  import org.w3c.dom.Element;
15  
16  public class MessageFilterDefinitionParser extends MessageProcessorDefinitionParser implements PostProcessor
17  {
18      private static final String ATTRIBUTE_UNACCEPTED = "onUnaccepted";
19  
20      public MessageFilterDefinitionParser()
21      {
22          super(MessageFilter.class);
23          addIgnored(AbstractMuleBeanDefinitionParser.ATTRIBUTE_NAME);
24          addIgnored(ATTRIBUTE_UNACCEPTED);
25          registerPostProcessor(this);
26      }
27  
28      public void postProcess(ParserContext context, BeanAssembler assembler, Element element)
29      {
30          String onUnaccepted = element.getAttribute(ATTRIBUTE_UNACCEPTED);
31          if (onUnaccepted != null)
32          {
33              assembler.extendBean("unacceptedMessageProcessor", onUnaccepted, true);
34          }
35      }
36  }