public abstract class AbstractMuleBeanDefinitionParser extends org.springframework.beans.factory.xml.AbstractBeanDefinitionParser implements MuleDefinitionParser
AbstractBeanDefinitionParser to provide additional features for consistently
customizing bean representations for Mule bean definition parsers. Most custom bean definition parsers in Mule will use this
base class. The following enhancements are made -
For example, <bpm:connector bpms-ref="testBpms"/> will automatically set a property "bpms" on the
connector to reference a bean named "testBpms"
For example - addAlias("poolExhaustedAction", "poolExhaustedActionString"); Maps the 'poolExhaustedAction' to the
'poolExhaustedActionString' property on the bean being created.
For example - addMapping("action", "NONE=0,ALWAYS_BEGIN=1,BEGIN_OR_JOIN=2,JOIN_IF_POSSIBLE=3"); The first argument
is the bean name to set, the second argument is the set of possible key=value pairs
Note that this class is not multi-thread safe. The internal state is reset before each "use" by
preProcess(org.w3c.dom.Element) which assumes sequential access.
AbstractBeanDefinitionParser| Modifier and Type | Field and Description |
|---|---|
static String |
ATTRIBUTE_CLASS |
static String |
ATTRIBUTE_ID |
static String |
ATTRIBUTE_NAME |
static String |
ATTRIBUTE_REF |
static String |
ATTRIBUTE_REF_SUFFIX |
static String |
ATTRIBUTE_REFS |
static String |
ATTRIBUTE_REFS_SUFFIX |
protected ReusablePropertyConfiguration |
beanPropertyConfiguration |
static String |
DOMAIN_ROOT_ELEMENT |
protected org.slf4j.Logger |
logger
logger used by this class
|
static String |
ROOT_ELEMENT |
protected boolean |
singleton |
| Constructor and Description |
|---|
AbstractMuleBeanDefinitionParser() |
| Modifier and Type | Method and Description |
|---|---|
MuleDefinitionParserConfiguration |
addAlias(String alias,
String propertyName) |
MuleDefinitionParserConfiguration |
addBeanFlag(String flag) |
MuleDefinitionParserConfiguration |
addCollection(String propertyName) |
MuleDefinitionParserConfiguration |
addIgnored(String propertyName) |
MuleDefinitionParserConfiguration |
addMapping(String propertyName,
Map mappings) |
MuleDefinitionParserConfiguration |
addMapping(String propertyName,
String mappings) |
MuleDefinitionParserConfiguration |
addMapping(String propertyName,
ValueMap mappings) |
MuleDefinitionParserConfiguration |
addReference(String propertyName) |
protected void |
checkElementNameUnique(Element element) |
protected org.springframework.beans.factory.support.BeanDefinitionBuilder |
createBeanDefinitionBuilder(Element element,
Class<?> beanClass) |
protected void |
doParse(Element element,
org.springframework.beans.factory.xml.ParserContext context,
org.springframework.beans.factory.support.BeanDefinitionBuilder builder)
Parse the supplied
Element and populate the supplied BeanDefinitionBuilder as required. |
protected BeanAssembler |
getBeanAssembler(Element element,
org.springframework.beans.factory.support.BeanDefinitionBuilder bean)
Restricted use - does not include a target.
|
BeanAssemblerFactory |
getBeanAssemblerFactory() |
protected abstract Class<?> |
getBeanClass(Element element)
Determine the bean class corresponding to the supplied
Element. |
protected Class<?> |
getBeanClassFromAttribute(Element element)
Determine the bean class corresponding to the supplied
Element based on an explicit "class" attribute. |
String |
getBeanName(Element element) |
protected Class<?> |
getClassConstraint() |
protected Class<?> |
getClassInternal(Element element) |
static String |
getConfigFileIdentifier(org.springframework.core.io.Resource resource) |
protected org.springframework.beans.factory.xml.ParserContext |
getParserContext() |
protected org.springframework.beans.factory.support.BeanDefinitionRegistry |
getRegistry() |
protected boolean |
isAllowClassAttribute() |
protected boolean |
isSingleton() |
protected boolean |
isTopLevel(Element element) |
org.springframework.beans.factory.support.AbstractBeanDefinition |
muleParse(Element element,
org.springframework.beans.factory.xml.ParserContext context) |
protected org.springframework.beans.factory.support.AbstractBeanDefinition |
parseInternal(Element element,
org.springframework.beans.factory.xml.ParserContext context)
Creates a
BeanDefinitionBuilder instance for the bean Class and passes it to the
doParse(org.w3c.dom.Element, org.springframework.beans.factory.xml.ParserContext, org.springframework.beans.factory.support.BeanDefinitionBuilder) strategy method. |
protected void |
postProcess(org.springframework.beans.factory.xml.ParserContext context,
BeanAssembler assembler,
Element element)
Hook method that derived classes can implement to inspect/change a bean definition after parsing is complete.
|
protected void |
preProcess(Element element)
Hook method that derived classes can implement to modify internal state before processing.
|
protected void |
processMetadataAnnotations(Element element,
String configFileIdentifier,
org.springframework.beans.factory.support.BeanDefinitionBuilder builder) |
static Map<QName,Object> |
processMetadataAnnotationsHelper(Element element,
String configFileIdentifier,
org.springframework.beans.factory.support.BeanDefinitionBuilder builder) |
protected void |
processProperty(Attr attribute,
BeanAssembler assembler) |
MuleDefinitionParserConfiguration |
registerPostProcessor(PostProcessor postProcessor)
These are appended to existing processors
|
MuleDefinitionParserConfiguration |
registerPreProcessor(PreProcessor preProcessor)
These are prepended to existing processors
|
MuleDefinitionParserConfiguration |
removeIgnored(String propertyName) |
protected String |
resolveId(Element element,
org.springframework.beans.factory.support.AbstractBeanDefinition definition,
org.springframework.beans.factory.xml.ParserContext context) |
protected void |
setAllowClassAttribute(boolean allowClassAttribute) |
void |
setBeanAssemblerFactory(BeanAssemblerFactory beanAssemblerFactory) |
protected void |
setClassConstraint(Class<?> classConstraint) |
MuleDefinitionParserConfiguration |
setIgnoredDefault(boolean ignoreAll) |
protected void |
setParserContext(org.springframework.beans.factory.xml.ParserContext parserContext) |
protected void |
setRegistry(org.springframework.beans.factory.support.BeanDefinitionRegistry registry) |
parse, postProcessComponentDefinition, registerBeanDefinition, shouldFireEvents, shouldGenerateId, shouldGenerateIdAsFallback, shouldParseNameAsAliasespublic static final String ROOT_ELEMENT
public static final String DOMAIN_ROOT_ELEMENT
public static final String ATTRIBUTE_ID
public static final String ATTRIBUTE_NAME
public static final String ATTRIBUTE_CLASS
public static final String ATTRIBUTE_REF
public static final String ATTRIBUTE_REFS
public static final String ATTRIBUTE_REF_SUFFIX
public static final String ATTRIBUTE_REFS_SUFFIX
protected transient org.slf4j.Logger logger
protected ReusablePropertyConfiguration beanPropertyConfiguration
protected boolean singleton
public MuleDefinitionParserConfiguration addReference(String propertyName)
addReference in interface MuleDefinitionParserConfigurationpublic MuleDefinitionParserConfiguration addMapping(String propertyName, Map mappings)
addMapping in interface MuleDefinitionParserConfigurationpublic MuleDefinitionParserConfiguration addMapping(String propertyName, String mappings)
addMapping in interface MuleDefinitionParserConfigurationpublic MuleDefinitionParserConfiguration addMapping(String propertyName, ValueMap mappings)
addMapping in interface MuleDefinitionParserConfigurationpublic MuleDefinitionParserConfiguration addAlias(String alias, String propertyName)
addAlias in interface MuleDefinitionParserConfigurationalias - The attribute namepropertyName - The bean property namepublic MuleDefinitionParserConfiguration addCollection(String propertyName)
addCollection in interface MuleDefinitionParserConfigurationpropertyName - Property that is a collectionpublic MuleDefinitionParserConfiguration addIgnored(String propertyName)
addIgnored in interface MuleDefinitionParserConfigurationpropertyName - Property that is to be ignoredpublic MuleDefinitionParserConfiguration removeIgnored(String propertyName)
removeIgnored in interface MuleDefinitionParserConfigurationpublic MuleDefinitionParserConfiguration setIgnoredDefault(boolean ignoreAll)
setIgnoredDefault in interface MuleDefinitionParserConfigurationprotected void processProperty(Attr attribute, BeanAssembler assembler)
protected void postProcess(org.springframework.beans.factory.xml.ParserContext context,
BeanAssembler assembler,
Element element)
assembler - the parsed (and probably totally defined) bean definition being builtelement - the XML element that was the source of the bean definition's metadataprotected void preProcess(Element element)
protected org.springframework.beans.factory.support.AbstractBeanDefinition parseInternal(Element element, org.springframework.beans.factory.xml.ParserContext context)
BeanDefinitionBuilder instance for the bean Class and passes it to the
doParse(org.w3c.dom.Element, org.springframework.beans.factory.xml.ParserContext, org.springframework.beans.factory.support.BeanDefinitionBuilder) strategy method.parseInternal in class org.springframework.beans.factory.xml.AbstractBeanDefinitionParserelement - the element that is to be parsed into a single BeanDefinitioncontext - the object encapsulating the current state of the parsing processElementIllegalStateException - if the bean Class returned from getBeanClass(org.w3c.dom.Element) is
nulldoParse(org.w3c.dom.Element, org.springframework.beans.factory.xml.ParserContext, org.springframework.beans.factory.support.BeanDefinitionBuilder)protected void setRegistry(org.springframework.beans.factory.support.BeanDefinitionRegistry registry)
protected org.springframework.beans.factory.support.BeanDefinitionRegistry getRegistry()
protected void checkElementNameUnique(Element element)
protected org.springframework.beans.factory.support.BeanDefinitionBuilder createBeanDefinitionBuilder(Element element, Class<?> beanClass)
protected Class<?> getBeanClassFromAttribute(Element element)
Element based on an explicit "class" attribute.element - the Element that is being parsedClass of the bean that is being defined via parsing the supplied Element (must not be
null)parseInternal(org.w3c.dom.Element,ParserContext)protected abstract Class<?> getBeanClass(Element element)
Element.element - the Element that is being parsedClass of the bean that is being defined via parsing the supplied Element (must not be
null)parseInternal(org.w3c.dom.Element,ParserContext)protected void doParse(Element element, org.springframework.beans.factory.xml.ParserContext context, org.springframework.beans.factory.support.BeanDefinitionBuilder builder)
Element and populate the supplied BeanDefinitionBuilder as required.
The default implementation delegates to the doParse version without ParserContext argument.
element - the XML element being parsedcontext - the object encapsulating the current state of the parsing processbuilder - used to define the BeanDefinitionprotected void processMetadataAnnotations(Element element, String configFileIdentifier, org.springframework.beans.factory.support.BeanDefinitionBuilder builder)
public static String getConfigFileIdentifier(org.springframework.core.io.Resource resource)
public static Map<QName,Object> processMetadataAnnotationsHelper(Element element, String configFileIdentifier, org.springframework.beans.factory.support.BeanDefinitionBuilder builder)
protected String resolveId(Element element, org.springframework.beans.factory.support.AbstractBeanDefinition definition, org.springframework.beans.factory.xml.ParserContext context) throws org.springframework.beans.factory.BeanDefinitionStoreException
resolveId in class org.springframework.beans.factory.xml.AbstractBeanDefinitionParserorg.springframework.beans.factory.BeanDefinitionStoreExceptionprotected boolean isSingleton()
protected BeanAssembler getBeanAssembler(Element element, org.springframework.beans.factory.support.BeanDefinitionBuilder bean)
AbstractHierarchicalDefinitionParser.getBeanAssembler(org.w3c.dom.Element, org.springframework.beans.factory.support.BeanDefinitionBuilder)bean - The bean being constructedprotected boolean isAllowClassAttribute()
protected void setAllowClassAttribute(boolean allowClassAttribute)
protected Class<?> getClassConstraint()
protected void setClassConstraint(Class<?> classConstraint)
protected org.springframework.beans.factory.xml.ParserContext getParserContext()
protected void setParserContext(org.springframework.beans.factory.xml.ParserContext parserContext)
protected boolean isTopLevel(Element element)
element - The element to testpublic org.springframework.beans.factory.support.AbstractBeanDefinition muleParse(Element element, org.springframework.beans.factory.xml.ParserContext context)
muleParse in interface MuleDefinitionParserpublic MuleDefinitionParserConfiguration registerPreProcessor(PreProcessor preProcessor)
MuleDefinitionParserConfigurationregisterPreProcessor in interface MuleDefinitionParserConfigurationpublic MuleDefinitionParserConfiguration registerPostProcessor(PostProcessor postProcessor)
MuleDefinitionParserConfigurationregisterPostProcessor in interface MuleDefinitionParserConfigurationpublic BeanAssemblerFactory getBeanAssemblerFactory()
public void setBeanAssemblerFactory(BeanAssemblerFactory beanAssemblerFactory)
public String getBeanName(Element element)
getBeanName in interface MuleDefinitionParserpublic MuleDefinitionParserConfiguration addBeanFlag(String flag)
addBeanFlag in interface MuleDefinitionParserConfigurationCopyright © 2003–2017 MuleSoft, Inc.. All rights reserved.