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.generic.ChildDefinitionParser;
11  
12  import org.w3c.dom.Element;
13  
14  public class ComponentDefinitionParser extends ChildDefinitionParser
15  {
16  
17      public ComponentDefinitionParser(Class clazz)
18      {
19          super("messageProcessor", clazz);
20          this.singleton = false;
21          addIgnored(AbstractMuleBeanDefinitionParser.ATTRIBUTE_CLASS);
22      }
23  
24      @Override
25      public String getPropertyName(Element e)
26      {
27          String parent = e.getParentNode().getLocalName().toLowerCase();
28          if ("service".equals(parent) || "custom-service".equals(parent))
29          {
30              return "component";
31          }
32          else
33          {
34              return super.getPropertyName(e);
35          }
36      }
37  }