org.nanocontainer.aop.dynaop
Class DynaopAspectsManager

java.lang.Object
  extended by org.nanocontainer.aop.dynaop.DynaopAspectsManager
All Implemented Interfaces:
AspectsApplicator, AspectsContainer, AspectsManager

public class DynaopAspectsManager
extends Object
implements AspectsManager

An AspectsManager implemented using dynaop.

Version:
$Revision: 3144 $
Author:
Stephen Molitor

Constructor Summary
DynaopAspectsManager()
          Creates a new DynaopAspectsManager.
DynaopAspectsManager(dynaop.Aspects containerAspects)
          Creates a new DynaopAspectsManager that will used the given dynaop.Aspects object.
DynaopAspectsManager(dynaop.Aspects containerAspects, PointcutsFactory pointcutsFactory)
          Creates a new DynaopAspectsManager that will used the given dynaop.Aspects object and pointcuts factory.
DynaopAspectsManager(PointcutsFactory pointcutsFactory)
          Creates a new DynaopAspectsManager that will use the given pointcuts factory.
 
Method Summary
 Object applyAspects(Object componentKey, Object component, org.picocontainer.PicoContainer container)
           
 PointcutsFactory getPointcutsFactory()
          Produces a pointcuts factory that can be used to create pointcuts to be used in aspects registered with this AspectsContainer.
 void registerInterceptor(ClassPointcut classPointcut, MethodPointcut methodPointcut, org.aopalliance.intercept.MethodInterceptor interceptor)
          Registers container scoped interceptor advice.
 void registerInterceptor(ClassPointcut classPointcut, MethodPointcut methodPointcut, Object interceptorComponentKey)
          Registers container supplied container scoped interceptor advice.
 void registerInterceptor(ComponentPointcut componentPointcut, MethodPointcut methodPointcut, org.aopalliance.intercept.MethodInterceptor interceptor)
          Registers component scoped interceptor advice.
 void registerInterceptor(ComponentPointcut componentPointcut, MethodPointcut methodPointcut, Object interceptorComponentKey)
          Registers component scoped interceptor advice.
 void registerInterfaces(ClassPointcut classPointcut, Class[] interfaces)
          Adds interfaces to classes picked by the class pointcut.
 void registerInterfaces(ComponentPointcut componentPointcut, Class[] interfaces)
          Adds interfaces to components picked by the component pointcut.
 void registerMixin(ClassPointcut classPointcut, Class mixinClass)
          Registers container scoped mixin advice.
 void registerMixin(ClassPointcut classPointcut, Class[] interfaces, Class mixinClass)
          Registers container scoped mixin advice.
 void registerMixin(ComponentPointcut componentPointcut, Class mixinClass)
          Registers component scoped mixin advice.
 void registerMixin(ComponentPointcut componentPointcut, Class[] interfaces, Class mixinClass)
          Registers component scoped mixin advice.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DynaopAspectsManager

public DynaopAspectsManager(dynaop.Aspects containerAspects,
                            PointcutsFactory pointcutsFactory)
Creates a new DynaopAspectsManager that will used the given dynaop.Aspects object and pointcuts factory. This constructor might be useful if the containerAspects object contains aspects already configured via dynaop's API, perhaps using dynaop's BeanShell configuration mechanism.

Parameters:
containerAspects - the dyanop.Aspects object used to contain the aspects.
pointcutsFactory - the pointcuts factory.

DynaopAspectsManager

public DynaopAspectsManager(dynaop.Aspects containerAspects)
Creates a new DynaopAspectsManager that will used the given dynaop.Aspects object. This constructor might be useful if the containerAspects object contains aspects already configured via dynaop's API, perhaps using dynaop's BeanShell configuration mechanism.

Parameters:
containerAspects - the dyanop.Aspects object used to contain the aspects.

DynaopAspectsManager

public DynaopAspectsManager(PointcutsFactory pointcutsFactory)
Creates a new DynaopAspectsManager that will use the given pointcuts factory.

Parameters:
pointcutsFactory - the pointcuts factory.

DynaopAspectsManager

public DynaopAspectsManager()
Creates a new DynaopAspectsManager.

Method Detail

registerInterceptor

public void registerInterceptor(ClassPointcut classPointcut,
                                MethodPointcut methodPointcut,
                                Object interceptorComponentKey)
Description copied from interface: AspectsContainer
Registers container supplied container scoped interceptor advice. The interceptor advice object itself is a component in the container, specified by interceptorComponentKey. The advice will be applied to all components in the container whose class satisfies the classPointcut. The interceptor will only intercept methods that match the methodPointcut.

Specified by:
registerInterceptor in interface AspectsContainer
Parameters:
classPointcut - classes to apply the interceptor to.
methodPointcut - methods to apply the interceptor to.
interceptorComponentKey - the interceptor component key.

registerInterceptor

public void registerInterceptor(ClassPointcut classPointcut,
                                MethodPointcut methodPointcut,
                                org.aopalliance.intercept.MethodInterceptor interceptor)
Description copied from interface: AspectsContainer
Registers container scoped interceptor advice. The advice will be applied to all components in the container whose class satisfies the classPointcut. The interceptor will only intercept methods that match the methodPointcut.

Specified by:
registerInterceptor in interface AspectsContainer
Parameters:
classPointcut - classes to apply the interceptor to.
methodPointcut - methods to apply the interceptor to.
interceptor - the interceptor advice object.

registerInterceptor

public void registerInterceptor(ComponentPointcut componentPointcut,
                                MethodPointcut methodPointcut,
                                Object interceptorComponentKey)
Description copied from interface: AspectsContainer
Registers component scoped interceptor advice. The interceptor advice object itself is a component in the container, specified by the interceptorComponentKey. The advice will be applied to all components in the container whose key satisfies componentPointcut. The interceptor will only intercept methods that match the methodPointcut.

Specified by:
registerInterceptor in interface AspectsContainer
Parameters:
componentPointcut - components to apply the interceptor to.
methodPointcut - methods to apply the interceptor to.
interceptorComponentKey - the interceptor component key.

registerInterceptor

public void registerInterceptor(ComponentPointcut componentPointcut,
                                MethodPointcut methodPointcut,
                                org.aopalliance.intercept.MethodInterceptor interceptor)
Description copied from interface: AspectsContainer
Registers component scoped interceptor advice. The advice will be applied to all components in the container whose key satisfies componentPointcut. The interceptor will only intercept methods that match the methodPointcut.

Specified by:
registerInterceptor in interface AspectsContainer
Parameters:
componentPointcut - components to apply the interceptor to.
methodPointcut - methods to apply the interceptor to.
interceptor - the interceptor advice object.

registerMixin

public void registerMixin(ClassPointcut classPointcut,
                          Class mixinClass)
Description copied from interface: AspectsContainer
Registers container scoped mixin advice. The mixin will be added to all components in the container whose class satisfies the classPointcut. Convenience method that uses all interfaces implemented by the mixin class.

Specified by:
registerMixin in interface AspectsContainer
Parameters:
classPointcut - classes to add mixin to.
mixinClass - the mixin implementation.
See Also:
for details on how mixinClass gets instantiated.

registerMixin

public void registerMixin(ClassPointcut classPointcut,
                          Class[] interfaces,
                          Class mixinClass)
Description copied from interface: AspectsContainer
Registers container scoped mixin advice. The mixin will be added to all components in the container whose class satisfies the classPointcut.

If a component of type mixinClass has been registered in the container, that component will be used as the mixin. Otherwise a new object of type mixinClass will be instantiated each time the mixin is applied to a component. Any dependencies the mixin has will be supplied from components in the container, or, if there are no dependencies, the default constructor will be invoked to instantiate the mixin.

Specified by:
registerMixin in interface AspectsContainer
Parameters:
classPointcut - classes to add mixin to.
interfaces - interfaces the mixin implements.
mixinClass - the mixin implementation.

registerMixin

public void registerMixin(ComponentPointcut componentPointcut,
                          Class mixinClass)
Description copied from interface: AspectsContainer
Registers component scoped mixin advice. The mixin will be added to all components in the container whose key satisfies the componentPointcut. Convenience method that uses all interfaces implemented by the mixin class.

Specified by:
registerMixin in interface AspectsContainer
Parameters:
componentPointcut - classes to add mixin to.
mixinClass - the mixin implementation.
See Also:
for details on how mixinClass gets instantiated.

registerMixin

public void registerMixin(ComponentPointcut componentPointcut,
                          Class[] interfaces,
                          Class mixinClass)
Description copied from interface: AspectsContainer
Registers component scoped mixin advice. The mixin will be added to all components in the container whose key satisfies the componentPointcut.

Specified by:
registerMixin in interface AspectsContainer
Parameters:
componentPointcut - classes to add mixin to.
interfaces - interfaces the mixin implements.
mixinClass - the mixin implementation.
See Also:
for details on how mixinClass gets instantiated.

registerInterfaces

public void registerInterfaces(ClassPointcut classPointcut,
                               Class[] interfaces)
Description copied from interface: AspectsContainer
Adds interfaces to classes picked by the class pointcut.

This can be handy when you want to add an aggregate helper interface that extends all the mixin interfaces added, to avoid the need for casting. Note that the interfaces will not be added if no advice (interceptor or mixin) has been applied to the component.

Specified by:
registerInterfaces in interface AspectsContainer
Parameters:
classPointcut - classes to add interfaces to.
interfaces - the interfaces to add.

registerInterfaces

public void registerInterfaces(ComponentPointcut componentPointcut,
                               Class[] interfaces)
Description copied from interface: AspectsContainer
Adds interfaces to components picked by the component pointcut.

Specified by:
registerInterfaces in interface AspectsContainer
Parameters:
componentPointcut - components to add interfaces to.
interfaces - the interfaces to add.
See Also:
for notes on using this method.

getPointcutsFactory

public PointcutsFactory getPointcutsFactory()
Description copied from interface: AspectsContainer
Produces a pointcuts factory that can be used to create pointcuts to be used in aspects registered with this AspectsContainer. Note that you are not limited to pointcuts produced by this factory; any pointcut that implements the appropriate ClassPointcut, MethodPointcut or ComponentPointcut will work.

Specified by:
getPointcutsFactory in interface AspectsContainer
Returns:
a pointcuts factory.

applyAspects

public Object applyAspects(Object componentKey,
                           Object component,
                           org.picocontainer.PicoContainer container)
Specified by:
applyAspects in interface AspectsApplicator


Copyright © 2003-2009 Codehaus. All Rights Reserved.