C# Class Spring.Aop.Framework.AutoProxy.AbstractAdvisorAutoProxyCreator

Abstract IObjectPostProcessor implementation that creates AOP proxies. This class is completely generic; it contains no special code to handle any particular aspects, such as pooling aspects.

Subclasses must implement the abstract FindCandidateAdvisors() method to return a list of Advisors applying to any object. Subclasses can also override the inherited ShouldSkip() method to exclude certain objects from autoproxying, but they must be careful to invoke the ShouldSkip() method of this class, which tries to avoid circular reference problems and infinite loops.

Advisors or advices requiring ordering should implement the Ordered interface. This class sorts advisors by Ordered order value. Advisors that don't implement the Ordered interface will be considered to be unordered, and will appear at the end of the advisor chain in undefined order.

Inheritance: Spring.Aop.Framework.AutoProxy.AbstractAutoProxyCreator
显示文件 Open project: spring-projects/spring-net Class Usage Examples

Protected Methods

Method Description
AbstractAdvisorAutoProxyCreator ( ) : System

Initialize

CreateAdvisorRetrievalHelper ( IConfigurableListableObjectFactory objectFactory ) : IAdvisorRetrievalHelper

Create the IAdvisorRetrievalHelper for retrieving the list of applicable advisor objects. The default implementation calls back into IsEligibleAdvisorObject thus it usually is sufficient to just override IsEligibleAdvisorObject. Override CreateAdvisorRetrievalHelper only if you know what you are doing!

ExtendAdvisors ( IList advisors, Type objectType, string objectName ) : void

Extension hook that subclasses can override to add additional advisors for the given object, given the sorted advisors obtained to date.
The default implementation does nothing.
Typically used to add advisors that expose contextual information required by some of the later advisors.

The advisor list passed into this method is already reduced to advisors applying to this particular object. If you want to register additional common advisor candidates, override FindCandidateAdvisors.

FindAdvisorsThatCanApply ( IList candidateAdvisors, Type targetType, string targetName ) : IList

From the given list of candidate advisors, select the ones that are applicable to the given target specified by targetType and name.

FindCandidateAdvisors ( Type targetType, string targetName ) : IList

Find all possible advisor candidates to use in auto-proxying

FindEligibleAdvisors ( Type targetType, string targetName ) : IList

Find all eligible advices and for autoproxying this class.

GetAdvicesAndAdvisorsForObject ( Type targetType, string targetName, ITargetSource customTargetSource ) : IList

Return whether the given object is to be proxied, what additional advices (e.g. AOP Alliance interceptors) and advisors to apply.

The previous targetName of this method was "GetInterceptorAndAdvisorForObject". It has been renamed in the course of general terminology clarification in Spring 1.1. An AOP Alliance Interceptor is just a special form of Advice, so the generic Advice term is preferred now.

The third parameter, customTargetSource, is new in Spring 1.1; add it to existing implementations of this method.

InitObjectFactory ( IConfigurableListableObjectFactory objectFactory ) : void

An new IConfigurableListableObjectFactory was set. Initialize this creator instance according to the specified object factory.

IsEligibleAdvisorObject ( string advisorName, Type targetType, string targetName ) : bool

Whether the given advisor is eligible for the specified target. The default implementation always returns true.

SortAdvisors ( IList advisors ) : IList

Sorts the advisors.

Method Details

AbstractAdvisorAutoProxyCreator() protected method

Initialize
protected AbstractAdvisorAutoProxyCreator ( ) : System
return System

CreateAdvisorRetrievalHelper() protected method

Create the IAdvisorRetrievalHelper for retrieving the list of applicable advisor objects. The default implementation calls back into IsEligibleAdvisorObject thus it usually is sufficient to just override IsEligibleAdvisorObject. Override CreateAdvisorRetrievalHelper only if you know what you are doing!
protected CreateAdvisorRetrievalHelper ( IConfigurableListableObjectFactory objectFactory ) : IAdvisorRetrievalHelper
objectFactory IConfigurableListableObjectFactory
return IAdvisorRetrievalHelper

ExtendAdvisors() protected method

Extension hook that subclasses can override to add additional advisors for the given object, given the sorted advisors obtained to date.
The default implementation does nothing.
Typically used to add advisors that expose contextual information required by some of the later advisors.
The advisor list passed into this method is already reduced to advisors applying to this particular object. If you want to register additional common advisor candidates, override FindCandidateAdvisors.
protected ExtendAdvisors ( IList advisors, Type objectType, string objectName ) : void
advisors IList Advisors that have already been identified as applying to a given object
objectType System.Type the type of the object to be advised
objectName string the name of the object to be advised
return void

FindAdvisorsThatCanApply() protected method

From the given list of candidate advisors, select the ones that are applicable to the given target specified by targetType and name.
protected FindAdvisorsThatCanApply ( IList candidateAdvisors, Type targetType, string targetName ) : IList
candidateAdvisors IList the list of candidate advisors to date
targetType System.Type the target object's type
targetName string the target object's name
return IList

FindCandidateAdvisors() protected method

Find all possible advisor candidates to use in auto-proxying
protected FindCandidateAdvisors ( Type targetType, string targetName ) : IList
targetType System.Type the type of the object to be advised
targetName string the name of the object to be advised
return IList

FindEligibleAdvisors() protected method

Find all eligible advices and for autoproxying this class.
protected FindEligibleAdvisors ( Type targetType, string targetName ) : IList
targetType System.Type the type of the object to be advised
targetName string the name of the object to be advised
return IList

GetAdvicesAndAdvisorsForObject() protected method

Return whether the given object is to be proxied, what additional advices (e.g. AOP Alliance interceptors) and advisors to apply.

The previous targetName of this method was "GetInterceptorAndAdvisorForObject". It has been renamed in the course of general terminology clarification in Spring 1.1. An AOP Alliance Interceptor is just a special form of Advice, so the generic Advice term is preferred now.

The third parameter, customTargetSource, is new in Spring 1.1; add it to existing implementations of this method.

protected GetAdvicesAndAdvisorsForObject ( Type targetType, string targetName, ITargetSource customTargetSource ) : IList
targetType System.Type the type of the target object
targetName string the name of the target object
customTargetSource ITargetSource targetSource returned by TargetSource property: /// may be ignored. Will be null unless a custom target source is in use.
return IList

InitObjectFactory() protected method

An new IConfigurableListableObjectFactory was set. Initialize this creator instance according to the specified object factory.
protected InitObjectFactory ( IConfigurableListableObjectFactory objectFactory ) : void
objectFactory IConfigurableListableObjectFactory
return void

IsEligibleAdvisorObject() protected method

Whether the given advisor is eligible for the specified target. The default implementation always returns true.
protected IsEligibleAdvisorObject ( string advisorName, Type targetType, string targetName ) : bool
advisorName string the advisor name
targetType System.Type the target object's type
targetName string the target object's name
return bool

SortAdvisors() protected method

Sorts the advisors.
protected SortAdvisors ( IList advisors ) : IList
advisors IList The advisors.
return IList