View Javadoc

1   /*
2    * $Id: MessageProcessorDefinitionParser.java 20781 2010-12-16 13:19:09Z dfeist $
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.delegate.ParentContextDefinitionParser;
14  import org.mule.config.spring.parsers.generic.ChildDefinitionParser;
15  import org.mule.config.spring.parsers.generic.MuleOrphanDefinitionParser;
16  
17  /**
18   * This allows a message processor to be defined globally, or embedded within an endpoint.
19   * (as either a normal or response processor).
20   */
21  public class MessageProcessorDefinitionParser extends ParentContextDefinitionParser
22  {
23  
24      public MessageProcessorDefinitionParser(Class messageProcessor)
25      {
26          super(MuleOrphanDefinitionParser.ROOT_ELEMENT, new MuleOrphanDefinitionParser(messageProcessor, false));
27          otherwise(new ChildDefinitionParser("messageProcessor", messageProcessor));
28      }
29  
30      /**
31       * For custom processors
32       */
33      public MessageProcessorDefinitionParser()
34      {
35          super(MuleOrphanDefinitionParser.ROOT_ELEMENT, new MuleOrphanDefinitionParser(false));
36          otherwise(new ChildDefinitionParser("messageProcessor"));
37      }
38  
39  }