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