|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.beans.factory.xml.AbstractBeanDefinitionParser
org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser
public abstract class AbstractMuleBeanDefinitionParser
This parser extends the Spring provided AbstractBeanDefinitionParser
to provide additional features for
consistently customising 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
Field Summary | |
---|---|
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
|
protected Log |
logger
logger used by this class |
static String |
ROOT_ELEMENT
|
protected boolean |
singleton
|
Fields inherited from class org.springframework.beans.factory.xml.AbstractBeanDefinitionParser |
---|
ID_ATTRIBUTE, NAME_ATTRIBUTE |
Constructor Summary | |
---|---|
AbstractMuleBeanDefinitionParser()
|
Method Summary | |
---|---|
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)
|
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 |
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)
|
void |
setDeprecationWarning(String deprecationWarning)
|
MuleDefinitionParserConfiguration |
setIgnoredDefault(boolean ignoreAll)
|
protected void |
setParserContext(org.springframework.beans.factory.xml.ParserContext parserContext)
|
protected void |
setRegistry(org.springframework.beans.factory.support.BeanDefinitionRegistry registry)
|
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 |
Field Detail |
---|
public static final String 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 Log logger
protected ReusablePropertyConfiguration beanPropertyConfiguration
protected boolean singleton
Constructor Detail |
---|
public AbstractMuleBeanDefinitionParser()
Method Detail |
---|
public MuleDefinitionParserConfiguration addReference(String propertyName)
addReference
in interface MuleDefinitionParserConfiguration
public MuleDefinitionParserConfiguration addMapping(String propertyName, Map mappings)
addMapping
in interface MuleDefinitionParserConfiguration
public MuleDefinitionParserConfiguration addMapping(String propertyName, String mappings)
addMapping
in interface MuleDefinitionParserConfiguration
public MuleDefinitionParserConfiguration addMapping(String propertyName, ValueMap mappings)
addMapping
in interface MuleDefinitionParserConfiguration
public MuleDefinitionParserConfiguration addAlias(String alias, String propertyName)
addAlias
in interface MuleDefinitionParserConfiguration
alias
- The attribute namepropertyName
- The bean property name
public MuleDefinitionParserConfiguration addCollection(String propertyName)
addCollection
in interface MuleDefinitionParserConfiguration
propertyName
- Property that is a collection
public MuleDefinitionParserConfiguration addIgnored(String propertyName)
addIgnored
in interface MuleDefinitionParserConfiguration
propertyName
- Property that is to be ignored
public MuleDefinitionParserConfiguration removeIgnored(String propertyName)
removeIgnored
in interface MuleDefinitionParserConfiguration
public MuleDefinitionParserConfiguration setIgnoredDefault(boolean ignoreAll)
setIgnoredDefault
in interface MuleDefinitionParserConfiguration
protected 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.AbstractBeanDefinitionParser
element
- the element that is to be parsed into a single BeanDefinitioncontext
- the object encapsulating the current state of the parsing
process
Element
IllegalStateException
- if the bean Class
returned from
getBeanClass(org.w3c.dom.Element)
is null
doParse(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<?> getClassInternal(Element element)
protected Class<?> getBeanClassFromAttribute(Element element)
Element
based on an
explicit "class" attribute.
element
- the Element
that is being parsed
Class
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 parsed
Class
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 BeanDefinition
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.AbstractBeanDefinitionParser
org.springframework.beans.factory.BeanDefinitionStoreException
protected 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 constructed
protected 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 test
public org.springframework.beans.factory.support.AbstractBeanDefinition muleParse(Element element, org.springframework.beans.factory.xml.ParserContext context)
muleParse
in interface MuleDefinitionParser
public MuleDefinitionParserConfiguration registerPreProcessor(PreProcessor preProcessor)
MuleDefinitionParserConfiguration
registerPreProcessor
in interface MuleDefinitionParserConfiguration
public MuleDefinitionParserConfiguration registerPostProcessor(PostProcessor postProcessor)
MuleDefinitionParserConfiguration
registerPostProcessor
in interface MuleDefinitionParserConfiguration
public BeanAssemblerFactory getBeanAssemblerFactory()
public void setBeanAssemblerFactory(BeanAssemblerFactory beanAssemblerFactory)
public String getBeanName(Element element)
getBeanName
in interface MuleDefinitionParser
public MuleDefinitionParserConfiguration addBeanFlag(String flag)
addBeanFlag
in interface MuleDefinitionParserConfiguration
public void setDeprecationWarning(String deprecationWarning)
setDeprecationWarning
in interface MuleDefinitionParser
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |