org.mule.config.spring.parsers.generic
Class NameTransferDefinitionParser

java.lang.Object
  extended by org.springframework.beans.factory.xml.AbstractBeanDefinitionParser
      extended by org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser
          extended by org.mule.config.spring.parsers.AbstractHierarchicalDefinitionParser
              extended by org.mule.config.spring.parsers.generic.ParentDefinitionParser
                  extended by org.mule.config.spring.parsers.generic.NameTransferDefinitionParser
All Implemented Interfaces:
MuleDefinitionParser, MuleDefinitionParserConfiguration, org.springframework.beans.factory.xml.BeanDefinitionParser

public class NameTransferDefinitionParser
extends ParentDefinitionParser

This extends ParentDefinitionParser so that the "name" attribute is set locally, not on the parent.

It's easier to understand with an example. Consider a custom security provider, set with the following XML:

 <mule:security-manager>
     <mule:custom-security-provider name="dummySecurityProvider"
                                    provider-ref="dummySecurityProvider"/>
 </mule:security-manager>

What is happening here? First, the custom-security-provider is being handled by this class. Since this class extends ParentDefinitionParser, the provider value is set on the parent (the security manager). But we want the name attribute to be set on the provider (the referenced bean). So the "name" is set on the provider, not on the manager. Then the provider is set on the manager.


Field Summary
 
Fields inherited from class org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser
ATTRIBUTE_CLASS, ATTRIBUTE_ID, ATTRIBUTE_NAME, ATTRIBUTE_REF, ATTRIBUTE_REF_SUFFIX, ATTRIBUTE_REFS, ATTRIBUTE_REFS_SUFFIX, beanPropertyConfiguration, logger, ROOT_ELEMENT, singleton
 
Fields inherited from class org.springframework.beans.factory.xml.AbstractBeanDefinitionParser
ID_ATTRIBUTE
 
Constructor Summary
NameTransferDefinitionParser(String componentAttributeName)
           
 
Method Summary
protected  org.springframework.beans.factory.support.AbstractBeanDefinition parseInternal(Element element, org.springframework.beans.factory.xml.ParserContext parserContext)
          Creates a BeanDefinitionBuilder instance for the bean Class and passes it to the AbstractMuleBeanDefinitionParser.doParse(org.w3c.dom.Element, org.springframework.beans.factory.xml.ParserContext, org.springframework.beans.factory.support.BeanDefinitionBuilder) strategy method.
 
Methods inherited from class org.mule.config.spring.parsers.generic.ParentDefinitionParser
getBeanClass, postProcess
 
Methods inherited from class org.mule.config.spring.parsers.AbstractHierarchicalDefinitionParser
forceParent, getBeanAssembler, getOrphanBeanAssembler, getParentBeanDefinition, getParentBeanName, getTargetPropertyConfiguration, preProcess
 
Methods inherited from class org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser
addAlias, addBeanFlag, addCollection, addIgnored, addMapping, addMapping, addMapping, addReference, checkElementNameUnique, createBeanDefinitionBuilder, doParse, getBeanAssemblerFactory, getBeanClassFromAttribute, getBeanName, getClassConstraint, getClassInternal, getParserContext, getRegistry, isAllowClassAttribute, isSingleton, isTopLevel, muleParse, processProperty, registerPostProcessor, registerPreProcessor, removeIgnored, resolveId, setAllowClassAttribute, setBeanAssemblerFactory, setClassConstraint, setIgnoredDefault, setParserContext, setRegistry
 
Methods inherited from class org.springframework.beans.factory.xml.AbstractBeanDefinitionParser
parse, postProcessComponentDefinition, registerBeanDefinition, shouldFireEvents, shouldGenerateId, shouldGenerateIdAsFallback
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.beans.factory.xml.BeanDefinitionParser
parse
 

Constructor Detail

NameTransferDefinitionParser

public NameTransferDefinitionParser(String componentAttributeName)
Parameters:
componentAttributeName - The attribute name (after processing, which will strip "-ref", add plurals, etc) that identifies the service which will receive the "name".
Method Detail

parseInternal

protected org.springframework.beans.factory.support.AbstractBeanDefinition parseInternal(Element element,
                                                                                         org.springframework.beans.factory.xml.ParserContext parserContext)
Description copied from class: AbstractMuleBeanDefinitionParser
Creates a BeanDefinitionBuilder instance for the bean Class and passes it to the AbstractMuleBeanDefinitionParser.doParse(org.w3c.dom.Element, org.springframework.beans.factory.xml.ParserContext, org.springframework.beans.factory.support.BeanDefinitionBuilder) strategy method.

Overrides:
parseInternal in class ParentDefinitionParser
Parameters:
element - the element that is to be parsed into a single BeanDefinition
parserContext - the object encapsulating the current state of the parsing process
Returns:
the BeanDefinition resulting from the parsing of the supplied Element
See Also:
AbstractMuleBeanDefinitionParser.doParse(org.w3c.dom.Element, org.springframework.beans.factory.xml.ParserContext, org.springframework.beans.factory.support.BeanDefinitionBuilder)


Copyright © 2003-2009 MuleSource, Inc.. All Rights Reserved.