org.springframework.aop.config
Class ConfigBeanDefinitionParser

java.lang.Object
  extended by org.springframework.aop.config.ConfigBeanDefinitionParser
All Implemented Interfaces:
BeanDefinitionParser

 class ConfigBeanDefinitionParser
extends java.lang.Object
implements BeanDefinitionParser

BeanDefinitionParser for the <aop:config> tag.

Since:
2.0
Author:
Rob Harrop, Juergen Hoeller, Adrian Colyer, Mark Fisher, Ramnivas Laddad

Field Summary
private static java.lang.String ADVICE_BEAN_NAME
           
private static java.lang.String ADVICE_REF
           
private static java.lang.String ADVISOR
           
private static java.lang.String AFTER
           
private static java.lang.String AFTER_RETURNING_ELEMENT
           
private static java.lang.String AFTER_THROWING_ELEMENT
           
private static java.lang.String ARG_NAMES
           
private static java.lang.String ARG_NAMES_PROPERTY
           
private static java.lang.String AROUND
           
private static java.lang.String ASPECT
           
private static int ASPECT_INSTANCE_FACTORY_INDEX
           
private static java.lang.String ASPECT_NAME_PROPERTY
           
private static java.lang.String BEFORE
           
private static java.lang.String DECLARATION_ORDER_PROPERTY
           
private static java.lang.String DECLARE_PARENTS
           
private static java.lang.String DEFAULT_IMPL
           
private static java.lang.String DELEGATE_REF
           
private static java.lang.String EXPRESSION
           
private static java.lang.String ID
           
private static java.lang.String IMPLEMENT_INTERFACE
           
private static int METHOD_INDEX
           
private static java.lang.String ORDER_PROPERTY
           
private  ParseState parseState
           
private static java.lang.String POINTCUT
           
private static int POINTCUT_INDEX
           
private static java.lang.String POINTCUT_REF
           
private static java.lang.String REF
           
private static java.lang.String RETURNING
           
private static java.lang.String RETURNING_PROPERTY
           
private static java.lang.String THROWING
           
private static java.lang.String THROWING_PROPERTY
           
private static java.lang.String TYPE_PATTERN
           
 
Constructor Summary
ConfigBeanDefinitionParser()
           
 
Method Summary
private  void configureAutoProxyCreator(ParserContext parserContext, org.w3c.dom.Element element)
          Configures the auto proxy creator needed to support the BeanDefinitions created by the '<aop:config/>' tag.
private  AbstractBeanDefinition createAdviceDefinition(org.w3c.dom.Element adviceElement, ParserContext parserContext, java.lang.String aspectName, int order, RootBeanDefinition methodDef, RootBeanDefinition aspectFactoryDef, java.util.List<BeanDefinition> beanDefinitions, java.util.List<BeanReference> beanReferences)
          Creates the RootBeanDefinition for a POJO advice bean.
private  AbstractBeanDefinition createAdvisorBeanDefinition(org.w3c.dom.Element advisorElement, ParserContext parserContext)
          Create a RootBeanDefinition for the advisor described in the supplied.
private  AspectComponentDefinition createAspectComponentDefinition(org.w3c.dom.Element aspectElement, java.lang.String aspectId, java.util.List<BeanDefinition> beanDefs, java.util.List<BeanReference> beanRefs, ParserContext parserContext)
           
protected  AbstractBeanDefinition createPointcutDefinition(java.lang.String expression)
          Creates a BeanDefinition for the AspectJExpressionPointcut class using the supplied pointcut expression.
private  java.lang.Class getAdviceClass(org.w3c.dom.Element adviceElement, ParserContext parserContext)
          Gets the advice implementation class corresponding to the supplied Element.
private  boolean isAdviceNode(org.w3c.dom.Node aNode, ParserContext parserContext)
          Return true if the supplied node describes an advice type.
 BeanDefinition parse(org.w3c.dom.Element element, ParserContext parserContext)
          Parse the specified Element and register the resulting BeanDefinition(s) with the BeanDefinitionRegistry embedded in the supplied ParserContext.
private  AbstractBeanDefinition parseAdvice(java.lang.String aspectName, int order, org.w3c.dom.Element aspectElement, org.w3c.dom.Element adviceElement, ParserContext parserContext, java.util.List<BeanDefinition> beanDefinitions, java.util.List<BeanReference> beanReferences)
          Parses one of 'before', 'after', 'after-returning', 'after-throwing' or 'around' and registers the resulting BeanDefinition with the supplied BeanDefinitionRegistry.
private  void parseAdvisor(org.w3c.dom.Element advisorElement, ParserContext parserContext)
          Parses the supplied <advisor> element and registers the resulting Advisor and any resulting Pointcut with the supplied BeanDefinitionRegistry.
private  void parseAspect(org.w3c.dom.Element aspectElement, ParserContext parserContext)
           
private  AbstractBeanDefinition parseDeclareParents(org.w3c.dom.Element declareParentsElement, ParserContext parserContext)
          Parse a 'declare-parents' element and register the appropriate DeclareParentsAdvisor with the BeanDefinitionRegistry encapsulated in the supplied ParserContext.
private  AbstractBeanDefinition parsePointcut(org.w3c.dom.Element pointcutElement, ParserContext parserContext)
          Parses the supplied <pointcut> and registers the resulting Pointcut with the BeanDefinitionRegistry.
private  java.lang.Object parsePointcutProperty(org.w3c.dom.Element element, ParserContext parserContext)
          Parses the pointcut or pointcut-ref attributes of the supplied Element and add a pointcut property as appropriate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ASPECT

private static final java.lang.String ASPECT
See Also:
Constant Field Values

EXPRESSION

private static final java.lang.String EXPRESSION
See Also:
Constant Field Values

ID

private static final java.lang.String ID
See Also:
Constant Field Values

POINTCUT

private static final java.lang.String POINTCUT
See Also:
Constant Field Values

ADVICE_BEAN_NAME

private static final java.lang.String ADVICE_BEAN_NAME
See Also:
Constant Field Values

ADVISOR

private static final java.lang.String ADVISOR
See Also:
Constant Field Values

ADVICE_REF

private static final java.lang.String ADVICE_REF
See Also:
Constant Field Values

POINTCUT_REF

private static final java.lang.String POINTCUT_REF
See Also:
Constant Field Values

REF

private static final java.lang.String REF
See Also:
Constant Field Values

BEFORE

private static final java.lang.String BEFORE
See Also:
Constant Field Values

DECLARE_PARENTS

private static final java.lang.String DECLARE_PARENTS
See Also:
Constant Field Values

TYPE_PATTERN

private static final java.lang.String TYPE_PATTERN
See Also:
Constant Field Values

DEFAULT_IMPL

private static final java.lang.String DEFAULT_IMPL
See Also:
Constant Field Values

DELEGATE_REF

private static final java.lang.String DELEGATE_REF
See Also:
Constant Field Values

IMPLEMENT_INTERFACE

private static final java.lang.String IMPLEMENT_INTERFACE
See Also:
Constant Field Values

AFTER

private static final java.lang.String AFTER
See Also:
Constant Field Values

AFTER_RETURNING_ELEMENT

private static final java.lang.String AFTER_RETURNING_ELEMENT
See Also:
Constant Field Values

AFTER_THROWING_ELEMENT

private static final java.lang.String AFTER_THROWING_ELEMENT
See Also:
Constant Field Values

AROUND

private static final java.lang.String AROUND
See Also:
Constant Field Values

RETURNING

private static final java.lang.String RETURNING
See Also:
Constant Field Values

RETURNING_PROPERTY

private static final java.lang.String RETURNING_PROPERTY
See Also:
Constant Field Values

THROWING

private static final java.lang.String THROWING
See Also:
Constant Field Values

THROWING_PROPERTY

private static final java.lang.String THROWING_PROPERTY
See Also:
Constant Field Values

ARG_NAMES

private static final java.lang.String ARG_NAMES
See Also:
Constant Field Values

ARG_NAMES_PROPERTY

private static final java.lang.String ARG_NAMES_PROPERTY
See Also:
Constant Field Values

ASPECT_NAME_PROPERTY

private static final java.lang.String ASPECT_NAME_PROPERTY
See Also:
Constant Field Values

DECLARATION_ORDER_PROPERTY

private static final java.lang.String DECLARATION_ORDER_PROPERTY
See Also:
Constant Field Values

ORDER_PROPERTY

private static final java.lang.String ORDER_PROPERTY
See Also:
Constant Field Values

METHOD_INDEX

private static final int METHOD_INDEX
See Also:
Constant Field Values

POINTCUT_INDEX

private static final int POINTCUT_INDEX
See Also:
Constant Field Values

ASPECT_INSTANCE_FACTORY_INDEX

private static final int ASPECT_INSTANCE_FACTORY_INDEX
See Also:
Constant Field Values

parseState

private ParseState parseState
Constructor Detail

ConfigBeanDefinitionParser

ConfigBeanDefinitionParser()
Method Detail

parse

public BeanDefinition parse(org.w3c.dom.Element element,
                            ParserContext parserContext)
Description copied from interface: BeanDefinitionParser
Parse the specified Element and register the resulting BeanDefinition(s) with the BeanDefinitionRegistry embedded in the supplied ParserContext.

Implementations must return the primary BeanDefinition that results from the parse if they will ever be used in a nested fashion (for example as an inner tag in a <property/> tag). Implementations may return null if they will not be used in a nested fashion.

Specified by:
parse in interface BeanDefinitionParser
Parameters:
element - the element that is to be parsed into one or more BeanDefinitions
parserContext - the object encapsulating the current state of the parsing process; provides access to a BeanDefinitionRegistry
Returns:
the primary BeanDefinition

configureAutoProxyCreator

private void configureAutoProxyCreator(ParserContext parserContext,
                                       org.w3c.dom.Element element)
Configures the auto proxy creator needed to support the BeanDefinitions created by the '<aop:config/>' tag. Will force class proxying if the 'proxy-target-class' attribute is set to 'true'.

See Also:
AopNamespaceUtils

parseAdvisor

private void parseAdvisor(org.w3c.dom.Element advisorElement,
                          ParserContext parserContext)
Parses the supplied <advisor> element and registers the resulting Advisor and any resulting Pointcut with the supplied BeanDefinitionRegistry.


createAdvisorBeanDefinition

private AbstractBeanDefinition createAdvisorBeanDefinition(org.w3c.dom.Element advisorElement,
                                                           ParserContext parserContext)
Create a RootBeanDefinition for the advisor described in the supplied. Does not parse any associated 'pointcut' or 'pointcut-ref' attributes.


parseAspect

private void parseAspect(org.w3c.dom.Element aspectElement,
                         ParserContext parserContext)

createAspectComponentDefinition

private AspectComponentDefinition createAspectComponentDefinition(org.w3c.dom.Element aspectElement,
                                                                  java.lang.String aspectId,
                                                                  java.util.List<BeanDefinition> beanDefs,
                                                                  java.util.List<BeanReference> beanRefs,
                                                                  ParserContext parserContext)

isAdviceNode

private boolean isAdviceNode(org.w3c.dom.Node aNode,
                             ParserContext parserContext)
Return true if the supplied node describes an advice type. May be one of: 'before', 'after', 'after-returning', 'after-throwing' or 'around'.


parseDeclareParents

private AbstractBeanDefinition parseDeclareParents(org.w3c.dom.Element declareParentsElement,
                                                   ParserContext parserContext)
Parse a 'declare-parents' element and register the appropriate DeclareParentsAdvisor with the BeanDefinitionRegistry encapsulated in the supplied ParserContext.


parseAdvice

private AbstractBeanDefinition parseAdvice(java.lang.String aspectName,
                                           int order,
                                           org.w3c.dom.Element aspectElement,
                                           org.w3c.dom.Element adviceElement,
                                           ParserContext parserContext,
                                           java.util.List<BeanDefinition> beanDefinitions,
                                           java.util.List<BeanReference> beanReferences)
Parses one of 'before', 'after', 'after-returning', 'after-throwing' or 'around' and registers the resulting BeanDefinition with the supplied BeanDefinitionRegistry.

Returns:
the generated advice RootBeanDefinition

createAdviceDefinition

private AbstractBeanDefinition createAdviceDefinition(org.w3c.dom.Element adviceElement,
                                                      ParserContext parserContext,
                                                      java.lang.String aspectName,
                                                      int order,
                                                      RootBeanDefinition methodDef,
                                                      RootBeanDefinition aspectFactoryDef,
                                                      java.util.List<BeanDefinition> beanDefinitions,
                                                      java.util.List<BeanReference> beanReferences)
Creates the RootBeanDefinition for a POJO advice bean. Also causes pointcut parsing to occur so that the pointcut may be associate with the advice bean. This same pointcut is also configured as the pointcut for the enclosing Advisor definition using the supplied MutablePropertyValues.


getAdviceClass

private java.lang.Class getAdviceClass(org.w3c.dom.Element adviceElement,
                                       ParserContext parserContext)
Gets the advice implementation class corresponding to the supplied Element.


parsePointcut

private AbstractBeanDefinition parsePointcut(org.w3c.dom.Element pointcutElement,
                                             ParserContext parserContext)
Parses the supplied <pointcut> and registers the resulting Pointcut with the BeanDefinitionRegistry.


parsePointcutProperty

private java.lang.Object parsePointcutProperty(org.w3c.dom.Element element,
                                               ParserContext parserContext)
Parses the pointcut or pointcut-ref attributes of the supplied Element and add a pointcut property as appropriate. Generates a BeanDefinition for the pointcut if necessary and returns its bean name, otherwise returns the bean name of the referred pointcut.


createPointcutDefinition

protected AbstractBeanDefinition createPointcutDefinition(java.lang.String expression)
Creates a BeanDefinition for the AspectJExpressionPointcut class using the supplied pointcut expression.