advisor
tag you can configure an advisor
tag supports only referenced config
' tag.
aop
namespace tags.
<aop:config>
tag.
proxy-target-type
' attribute
This method is never invoked if the parser is namespace aware and was called to process the root node.
The only requirement for it to work is that it needs to be defined
in an application context along with any arbitrary "non-native" Spring.NET
Does nothing, simply returns the supplied
Registers the supplied
Implementors can create AOP Alliance
There is no need for most Spring.NET users to implement this interface;
do so only if you need to introduce more
Is it valid to invoke the
Don't worry about any
A more efficient alternative solution in cases where there is no
interception advice and therefore no need to create an
Used internally by the AOP framework: application developers should not need to use this class directly.
Such interceptions are nested "on top" of the target.
A generic interceptor can intercept runtime events that occur within a base program. Those events are materialized by (reified in) joinpoints. Runtime joinpoints can be invocations, field access, exceptions, etc.
This interface is not used directly. Use the various derived interfaces to intercept specific events.
Implementations can be any type of advice, such as interceptors.
Polite implementations would certainly like to invoke
Implementations must also automatically register adapters for
Don't worry about the pointcut associated with the
Note that it is not necessary to register adapters for
This constructor will also register the well-known
This contructor is marked as
In the future Spring.NET may also offer a more efficient alternative
solution in cases where there is no interception advice and therefore
no need to create an
Used internally by the Spring.NET AOP framework: application developers should not need to use this class directly.
Implementations of the
AfterThrowing([MethodInfo method, Object[] args, Object target], Exception subclass);
The method name is fixed (i.e. your methods must be named
Please note that the object encapsulating the throws advice does not
need to implement the
This is a framework class that should not normally need to be used directly by Spring.NET users.
Find below some examples of valid
public class GlobalExceptionHandlingAdvice : IThrowsAdvice
{
public void AfterThrowing(Exception ex) {
// handles absolutely any and every Exception...
}
}
public class RemotingExceptionHandlingAdvice : IThrowsAdvice
{
public void AfterThrowing(RemotingException ex) {
// handles any and every RemotingException (and subclasses of RemotingException)...
}
}
using System.Data;
public class DataExceptionHandlingAdvice
{
public void AfterThrowing(ConstraintException ex) {
// specialised handling of ConstraintExceptions
}
public void AfterThrowing(NoNullAllowedException ex) {
// specialised handling of NoNullAllowedExceptions
}
public void AfterThrowing(DataException ex) {
// handles all other DataExceptions...
}
}
Will return
AbstractAutoProxyCreator can support a number of TargetSourceCreators, which will be applied in order.
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.
This class distinguishes between "common" interceptors: shared for all proxies it creates, and "specific" interceptors: unique per object instance. There need not be any common interceptors. If there are, they are set using the interceptorNames property. As with ProxyFactoryObject, interceptors names in the current factory are used rather than object references to allow correct handling of prototype advisors and interceptors: for example, to support stateful mixins. Any advice type is supported for "interceptorNames" entries.
Such autoproxying is particularly useful if there's a large number of objects that need to be wrapped with similar proxies, i.e. delegating to the same interceptors. Instead of x repetitive proxy definitions for x target objects, you can register one single such post processor with the object factory to achieve the same effect.
Subclasses can apply any strategy to decide if a object is to be proxied, e.g. by type, by name, by definition details, etc. They can also return additional interceptors that should just be applied to the specific object instance. The default concrete implementation is ObjectNameAutoProxyCreator, identifying the objects to be proxied via a list of object names.
Any number of TargetSourceCreator implementations can be used with any subclass, to create a custom target source - for example, to pool prototype objects. Autoproxying will occur even if there is no advice if a TargetSourceCreator specifies a custom TargetSource. If there are no TargetSourceCreators set, or if none matches, a SingletonTargetSource will be used by default to wrap the object to be autoproxied.
Note that it is no longer possible to configure subclasses to
expose the
The exact meaning of agressive optimizations will differ between proxies, but there is usually some tradeoff.
For example, optimization will usually mean that advice changes
won't take effect after a proxy has been created. For this reason,
optimization is disabled by default. An optimize value of
The default is
The default is
This obviously allows one to customise the
The default is not frozen.
The previous name 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.
null
).
he relevant property infos for the target object (with ignored
dependency types - which the factory handles specifically - already filtered out)
The object instance created, but whose properties have not yet
been set.
Name of the object.
Overridden from the super class to prevent the proxy configuration from being frozen before the proxy is created. The default is not frozen.
Invoked after population of normal object properties but before an init
callback like
The previous name 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.
Invoked after population of normal object properties but before an init
callback like
If the object name matches, replaces the type by a AOP proxied type based on inheritance.
The default implementation checks for "xxx*", "*xxx" and "*xxx*" matches, as well as direct equality. Can be overridden in subclasses.
Invoked after population of normal object properties but before an init
callback like
This target will be invoked via reflection if no around advice chooses to end the interceptor chain itself.
If an
Application developers don't usually need to work with target sources directly: this is an AOP framework interface.
The default implementation checks for "xxx*", "*xxx" and "*xxx*" matches, as well as direct equality. Can be overridden in subclasses.
This configuration includes the
Any AOP proxy obtained from Spring.NET can be cast to this interface to allow the manipulation of said proxy's AOP advice.
Please be aware that Spring.NET's AOP implementation only supports
method advice (as encapsulated by the
Please be aware that Spring.NET's AOP implementation only supports
method advice (as encapsulated by the
The return value of this method can be used to index into
the
The return value of this method can be used to index into
the
This is useful if an advised object needs to call another advised
method on itself. (If it uses the
Will never return
Will never return
When a config is frozen, no advice changes can be made. This is
useful for optimization, and useful when we don't want callers
to be able to manipulate configuration after casting to
Caches against a key based on : - the base type - the target type - the interfaces to proxy
Creates a decorator-base proxy if one the following is true : - the "ProxyTargetType" property is set - no interfaces have been specified
In general, specify "ProxyTargetType" to enforce a decorator-based proxy, or specify one or more interfaces to use a composition-based proxy.
This implementation calls the base constructor.
This implementation creates a new instance
of the
This implementation creates instance of the AdvisedProxy object.
Subclasses can override the
A method invocation is a joinpoint and can be intercepted by a method interceptor.
An invocation is a joinpoint and can be intercepted by an interceptor. Typical examples would be a constructor invocation and a method call.
A runtime joinpoint is an event that occurs on a static
joinpoint (i.e. a location in a program). For instance, an
invocation is the runtime joinpoint on a method (static joinpoint).
The static part of a given joinpoint can be generically retrieved
using the
In the context of an interception framework, a runtime joinpoint is then the reification of an access to an accessible object (a method, a constructor, a field), i.e. the static part of the joinpoint. It is passed to the interceptors that are installed on the static joinpoint.
The implementation and semantics of this method depend on the actual joinpoint type. Consult the derived interfaces of this interface for specifics.
The static part is an accessible object on which a chain of interceptors are installed.
For instance, the target object for a method invocation.
It is of course possible to change element values within this array to change the arguments to an intercepted invocation.
This property is a friendly implementation of the
This is an abstract class, and as such exposes no publicly visible constructors.
Subclasses can override this to use custom invocation.
May or may not correspond with a method invoked on an underlying implementation of that interface.
May be
Instances of this class are not themselves AOP proxies, but subclasses of this class are normally factories from which AOP proxy instances are obtained directly.
This class frees subclasses of the housekeeping of
If an
If entry value is
Does nothing if the supplied (proxied)
The return value of this method can be used to index into
the
Acces is not synchronized
The return value of this method can be used to index into
the
An example of such a change would be when a new introduction is
added. Resetting
Subclasses must not create a proxy by any other means (at least without having a well thought out and cogent reason for doing so). This is because the implementation of this method performs some required housekeeping logic prior to creating an AOP proxy.
Useful when this instance has been created using the no-argument
constructor, and needs to get all of its confiuration data from
another
Will never return
This is a convenience write-only property that allows client code
to set the target object... the target object will be implicitly
wrapped within a new
If this property value is
Users will be able to add interceptors dynamically without proxy
regeneration, but if they add introductions the proxy
Not intended to be used directly by applications.
This is a utility class, and as such has no publicly visible constructors.
The
To expose the current proxy, set the
The functionality in this class might be used by a target object that needed access to resources on the invocation. However, this approach should not be used when there is a reasonable alternative, as it makes application code dependent on usage under AOP and the Spring.NET AOP framework.
This method is for internal use only, and should never be called by client code.
This method is for internal use only, and should never be called by client code.
This is a utility class, and as such exposes no public constructors.
Will be
The default value for the
Not intended to be used directly by applications.
This includes interfaces implemented by any superclasses.
This is an important test as it can be used to optimize out a pointcut for a class.
Invoking this method with a
This is an important test as it can be used to optimize out an advisor for a class.
This is a utility class, and as such has no publicly visible constructors.
Subclasses can override this to use custom invocation.
This implementation will release the target object when said object is disposed.
Allows
To be implemented by introduction aspects in order to obtain access to the target object.
This class provides a simple way of obtaining and configuring AOP proxies in code.
Interceptors must be added if this factory is to do anything useful.
Can be called repeatedly; the effect of repeated invocations will (of course) vary if interfaces have been added or removed.
This is a convenience method for creating a proxy for a single interceptor.
Global interceptors and advisors can be added at the factory level
(that is, outside the context of a
It is possible to cast a proxy obtained from this factory to an
If it's sourced from object name, it will need to be refreshed each time a new prototype instance is created.
Default is for globals expansion only.
Default is for globals expansion only.
Invoked when clients obtain objects from this factory object. The
(proxy) instance will be cached for a singleton, and created on each
call to
Only works when the
This property must always be set (configured) when using a
Only works when the
Subclasses can override this to use custom invocation.
Because the target source is static, the target object can be cached and simply returned as is.
This covers nearly all advisors except introduction advisors, for which method-level matching does not apply.
Spring.NET AOP is centered on around advice delivered via method
interception, compliant with the AOP Alliance interception API.
The
An advisor that was creating a mixin would be a per instance
operation and would thus return
Use
An advice may be an interceptor, a throws advice, before advice, introduction etc.
An advice may be an interceptor, a throws advice, before advice, introduction etc.
Not supported for dynamic advisors.
Invoked after population of normal object properties but before an init
callback like
An advice may be an interceptor, a throws advice, before advice, introduction etc.
The regular expressions must be a match. For example, the
.*Get.*
pattern will match Get.*
will not.
This base class is serializable. Subclasses should decorate all
fields with the
The
An
If the value of the
If an implementation returns
This is a static check. If this method invocation returns
In order for this method to have even been invoked, the supplied
Invoked immediately before any potential running of the advice, and after any advice earlier in the advice chain has run.
If
Note that this property can be checked when an AOP proxy is created, and implementations need not check the value of this property again before each method invocation.
Always throws a
Must be implemented by a derived class in order to specify matching rules.
Always returns
A pointcut is composed of
This is an abstract class, and as such has no publicly visible constructors.
Can be used as part of a pointcut, or for the entire targeting of an introduction.
This is an abstract class, and as such has no publicly visible constructors.
Can be invoked multiple times.
This method will be invoked from the
Try to match the regular expression against the fully qualified name
of the method's declaring
Note that the declaring
In this instance, simply returns
The default is
The default is
Must be implemented by a derived class in order to specify matching rules.
All methods return a
IPointcut pointcut = new ComposablePointcut()
.Union(typeFilter)
.Intersection(methodMatcher)
.Intersection(pointcut);
There is no
Evaluating such pointcuts is slower than evaluating normal pointcuts, but can nevertheless be useful in some cases. Of course, your mileage may vary as to what 'slower' actually means.
If the supplied
Subclasses are encouraged to override this method for greater filtering (and performance).
This, the default, implementation always matches (returns
Subclasses are encouraged to override this method if it is possible to filter out some candidate classes.
This, the default, implementation always matches (returns
Subclasses are encouraged to override this method if it is possible to filter out some candidate classes.
Useful as a debugging aid.
Note that this value is distinct from the number of times that this
pointcut sucessfully matches a target method, in that a
This implementation is a runtime pointcut, and so always returns
This interface cannot be implemented directly; subinterfaces must provide the advice type implementing the introduction.
Introduction is the implementation of additional interfaces (not implemented by a target) via AOP advice.
Invoked before adding an
This is the
This constructor adds all interfaces implemented by the supplied
This, the default, implementation always returns
Invoked before adding an
Default for an introduction is per-instance interception.
This is the most commonly used
This is an
Derived classes can override this method to add preconditions for dynamic matching.
This implementation always returns
Must be overriden by derived classes to provide criteria for dynamic matching.
This is an abstract class, and as such has no publicly visible constructors.
This is an abstract class, and as such has no publicly visible constructors.
Not supported for dynamic advisors.
This implementation always returns a filter that evaluates to
This implementation always returns itself (this object).
This implementation always returns itself (this object).
A method matcher may be evaluated statically (based on method and target class) or need further evaluation dynamically (based on arguments at the time of method invocation).
The newly created matcher will match all the methods that either of the two supplied matchers would match.
The newly created matcher will match only those methods that both of the supplied matchers would match.
This is a utility class, and as such has no publicly visible constructors.
The default implementation checks for "xxx*", "*xxx" and "*xxx*" matches, as well as direct equality. Can be overridden in subclasses.
Matching will be the union of all these; if any match, the pointcut matches.
Matching will be the union of all these; if any match, the pointcut matches.
These methods are particularly useful for composing pointcuts using the union and intersection methods.
This is a utility class, and as such has no publicly visible constructors.
Configure this class using the
Can delegate to any type of regular expression pointcut. Currently only
pointcuts based on the regular expression classes from the .NET Base
Class Library are supported. The
This should not normally be set directly.
Returns
Uses the regular expression classes from the .NET Base Class Library.
The regular expressions must be a match. For example, the
.*Get*
pattern will match Get.*
will not.
Can be invoked multiple times.
This method will be invoked from the
This is an abstract class, and as such has no publicly visible constructors.
This is an abstract class, and as such has no publicly visible constructors.
The filter arising from the union will match all of the
The filter arising from the intersection will match all of the
This is a utility class, and as such has no publicly visible constructors.
Such pointcut unions are tricky, because one cannot simply
Maintains a pool of target instances, acquiring and releasing a target object from the pool for each method invocation.
This class is independent of pooling technology.
Subclasses must implement the
This class implements the
All such
This is an
Ensures that the
This object should be a prototype, or the same instance will always
be obtained from the owning
Needed so that prototype instances can be created as necessary.
This is an
Disposes of the pool.
This class is exposed as a singleton.
This is a utility class, and as such has no publicly visible constructors.
The
If configuring an object of this class in a Spring IoC container, use constructor injection to supply the intial target.
No-op implementation.
Two invoker interceptors are equal if they have the same target or if the targets are equal.
Can return
Can only be used in an object factory.
No-op implementation.
Subclasses can, of course, override this method if they want to
return a different
Disposes of the pool.
This is the default implementation of the
No-op implementation.
Alternative to an object pool.
Application code is written as to a normal pool; callers can't assume they will be dealing with the same instance in invocations in different threads. However, state can be relied on during the operations of a single thread: for example, if one caller makes repeated calls on the AOP proxy.
This class act both as an introduction and as an interceptor, so it should be added twice, once as an introduction and once as an interceptor.
Unlike most thread local storage which is static, this variable is meant to be per thread per instance of this class.
Tries to locate the target from thread local storage. If no target is found, a target will be obtained and bound to the thread.
After returning advice is invoked only on a normal method return, but not if an exception is thrown. Such advice can see the return value of the advised method invocation, but cannot change it.
Possible uses for this type of advice would include performing access control checks on the return value of an advised method invocation, the ubiquitous logging of method invocation return values (useful during development), etc.
Note that the supplied
Before advice is advice that executes before a joinpoint, but
which does not have the ability to prevent execution flow proceeding to
the joinpoint (unless it throws an
Spring.NET only supports method before advice. Although this is unlikely to change, this API is designed to allow field before advice in future if desired.
This is a fundamental AOP concept called introduction.
Introductions are often mixins, enabling the building of composite objects that can achieve many of the goals of multiple inheritance.
Such advice cannot prevent the method call proceeding, short of
throwing an
The main advantage of
Possible uses for this type of advice would include performing class invariant checks prior to the actual method invocation, the ubiquitous logging of method invocations (useful during development), etc.
There are no methods on this interface, as methods are discovered and
invoked via reflection. Please do see read the API documentation for the
There are any number of possible uses for this type of advice. Some
examples would include the ubiquitous logging of any such exceptions,
monitoring the number and type of exceptions and sending emails to
a support desk once certain criteria have been met, wrapping generic
exceptions such as
It is not dynamic.
This is a utility class, and as such has no publicly visible constructors.
This is a utility class, and as such has no publicly visible constructors.
Only one canonical
This is a utility class, and as such has no publicly visible constructors.
Such interceptions are nested "on top" of the target.
Polite implementations would certainly like to invoke
A constructor invocation is a joinpoint and can be intercepted by a constructor interceptor.
This property is a friendly implementation of the
Normally this call will be used to initialize the object.
Invoked after population of normal object properties but before an
init callback such as
This advice can be used to cache the parameter of the method.
Information that determines where, how and for how long the return value
will be cached are retrieved from the
Parameter values are cached *after* the target method is invoked in order to capture any parameter state changes it might make (for example, it is common to set an object identifier within the save method for the persistent entity).
Note that the supplied
Normally this call will be used to initialize the object.
Invoked after population of normal object properties but before an
init callback such as
This advice can be used to cache the return value of the method.
Parameters that determine where, how and for how long the return value
will be cached are retrieved from the
This method tries to retrieve an object from the cache, using the supplied
If object does not exist in the cache, the advised method is called (using
Normally this call will be used to initialize the object.
Invoked after population of normal object properties but before an
init callback such as
This advice can be used to evict items from the cache.
Information that determines which items should be evicted and from which cache
are retrieved from the
Items are evicted *after* target method is invoked. Return value of the method,
as well as method arguments, can be used to determine a list of keys for the items
that should be evicted (return value will be passed as a context for
Note that the supplied
Normally this call will be used to initialize the object.
Invoked after population of normal object properties but before an
init callback such as
on FooException1 log 'My Message, Method Name ' + #method.Name
on FooException1 translate new BarException('My Message, Method Called = ' + #method.Name", #e)
on FooException2,Foo3Exception wrap BarException 'My Bar Message'
on FooException4 replace BarException 'My Bar Message'
on FooException5 return 32
on FooException6 swallow
Polite implementations would certainly like to invoke
This method allows the object instance to perform the kind of initialization only possible when all of it's dependencies have been injected (set), and to throw an appropriate exception in the event of misconfiguration.
Please do consult the class level documentation for the
Polite implementations would certainly like to invoke
This method allows the object instance to perform the kind of initialization only possible when all of it's dependencies have been injected (set), and to throw an appropriate exception in the event of misconfiguration.
Please do consult the class level documentation for the
ILog
instance used to write logging messages.
Normally this call will be used to initialize the object.
Invoked after population of normal object properties but before an
init callback such as
on exception name [ExceptionName1,ExceptionName2,...] retry [number of times] [delay|rate] [delay time|rate expression]
.
For example, on exception name ArithmeticException retry 3x delay 1s
Polite implementations would certainly like to invoke
This method allows the object instance to perform the kind of initialization only possible when all of it's dependencies have been injected (set), and to throw an appropriate exception in the event of misconfiguration.
Please do consult the class level documentation for the