View Javadoc

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