org.codehaus.aspectwerkz.aspect.management
Class AspectManager

java.lang.Object
  extended byorg.codehaus.aspectwerkz.aspect.management.AspectManager

public final class AspectManager
extends Object

Manages the aspects.

Handles deployment, redeployment, management, configuration or redefinition of the aspects.

Author:
Jonas Bonér , Alexandre Vasseur

Field Summary
 SystemDefinition m_definition
          The definition.
 AspectSystem m_system
          The system this AspectManager is defined in.
 
Constructor Summary
AspectManager(AspectSystem system, SystemDefinition definition)
          Creates a new aspect manager.
 
Method Summary
 void createAspect(String name, String aspectClassName, int deploymentModel, ClassLoader loader)
          Creates and registers new aspect at runtime.
 AdviceInfo getAdviceIndexFor(String name)
          Returns the index for a specific name to advice mapping.
 AspectContainer getAspectContainer(int index)
          Returns the aspect container by its index.
 AspectContainer getAspectContainer(String name)
          Returns the aspect container for a specific name.
 AspectContainer[] getAspectContainers()
          Returns an array with all the aspect containers.
 int getAspectIndexFor(String name)
          Returns the index for a specific name to aspect mapping.
 List getCflowPointcuts(ExpressionContext ctx)
          Returns the cflow pointcut list for the context specified.
 ConstructorTuple getConstructorTuple(Class klass, int constructorHash)
          Returns a specific constructor by the class and the constructor index.
 Object getCrossCuttingInfo(String name)
          Returns the aspect for a specific name, deployed as perJVM.
 CrossCuttingInfo[] getCrossCuttingInfos()
          Returns an array with all the cross-cutting infos.
 Field getField(Class klass, int fieldHash)
          Returns a specific field by the class and the field index.
 MethodTuple getMethodTuple(Class klass, int methodHash)
          Returns a specific method by the class and the method index.
 Mixin getMixin(int index)
          Retrieves a specific mixin based on its index.
 Mixin getMixin(String name)
          Returns the mixin implementation for a specific name.
 PointcutManager getPointcutManager(String name)
          Returns the pointcut manager for the name specified.
 Collection getPointcutManagers()
          Returns a list with all the pointcut managers.
 List getPointcuts(ExpressionContext ctx)
          Returns the pointcut list for the context specified.
 String getUuid()
          Returns the UUID for the system.
 boolean hasAspect(String name)
          Checks if a specific class has an aspect defined.
 void initialize()
          Initializes the manager.
 void register(AspectContainer container, PointcutManager aspectMetaData)
          Registers a new aspect.
 String toString()
          Returns the string representation of the manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_system

public final AspectSystem m_system
The system this AspectManager is defined in.


m_definition

public SystemDefinition m_definition
The definition.

Constructor Detail

AspectManager

public AspectManager(AspectSystem system,
                     SystemDefinition definition)
Creates a new aspect manager.

Parameters:
system - the system
definition - the system definition
Method Detail

initialize

public void initialize()
Initializes the manager. The initialization needs to be separated fromt he construction of the manager, and is triggered by the runtime system.


register

public void register(AspectContainer container,
                     PointcutManager aspectMetaData)
Registers a new aspect.

Parameters:
container - the containern for the aspect to register
aspectMetaData - the aspect meta-data

createAspect

public void createAspect(String name,
                         String aspectClassName,
                         int deploymentModel,
                         ClassLoader loader)
Creates and registers new aspect at runtime.

Parameters:
name - the name of the aspect
aspectClassName - the class name of the aspect
deploymentModel - the deployment model for the aspect (constants in the DeploymemtModel class, e.g. f.e. DeploymentModel.PER_JVM)
loader - an optional class loader (if null it uses the context classloader)

getUuid

public String getUuid()
Returns the UUID for the system.

Returns:
the UUID

getAspectContainer

public AspectContainer getAspectContainer(int index)
Returns the aspect container by its index.

Parameters:
index - the index of the aspect
Returns:
the aspect

getAspectContainer

public AspectContainer getAspectContainer(String name)
Returns the aspect container for a specific name.

Parameters:
name - the name of the aspect
Returns:
the the aspect prototype

getAspectContainers

public AspectContainer[] getAspectContainers()
Returns an array with all the aspect containers.

Returns:
the aspect containers

getCrossCuttingInfo

public Object getCrossCuttingInfo(String name)
Returns the aspect for a specific name, deployed as perJVM.

Parameters:
name - the name of the aspect
Returns:
the the aspect

getCrossCuttingInfos

public CrossCuttingInfo[] getCrossCuttingInfos()
Returns an array with all the cross-cutting infos.

Returns:
the cross-cutting infos

getMixin

public Mixin getMixin(int index)
Retrieves a specific mixin based on its index.

Parameters:
index - the index of the introduction (aspect in this case)
Returns:
the the mixin (aspect in this case)

getMixin

public Mixin getMixin(String name)
Returns the mixin implementation for a specific name.

Parameters:
name - the name of the introduction (aspect in this case)
Returns:
the the mixin (aspect in this case)

getAspectIndexFor

public int getAspectIndexFor(String name)
Returns the index for a specific name to aspect mapping.

Parameters:
name - the name of the aspect
Returns:
the index of the aspect

getAdviceIndexFor

public AdviceInfo getAdviceIndexFor(String name)
Returns the index for a specific name to advice mapping.

Parameters:
name - the name of the advice
Returns:
the index of the advice

getPointcutManager

public PointcutManager getPointcutManager(String name)
Returns the pointcut manager for the name specified.

Parameters:
name - the name of the aspect
Returns:
thepointcut manager

getPointcutManagers

public Collection getPointcutManagers()
Returns a list with all the pointcut managers.

Returns:
thepointcut managers

getPointcuts

public List getPointcuts(ExpressionContext ctx)
Returns the pointcut list for the context specified.

Caches the list, needed since the actual method call is expensive and is made each time a new instance of an advised class is created.

Parameters:
ctx - the expression context
Returns:
the pointcuts for this join point

getCflowPointcuts

public List getCflowPointcuts(ExpressionContext ctx)
Returns the cflow pointcut list for the context specified.

Caches the list, needed since the actual method call is expensive and is made each time a new instance of an advised class is created.

Parameters:
ctx - the expression context
Returns:
the pointcuts for this join point

hasAspect

public boolean hasAspect(String name)
Checks if a specific class has an aspect defined.

Parameters:
name - the name of the aspect
Returns:
boolean true if the class has an aspect defined

getMethodTuple

public MethodTuple getMethodTuple(Class klass,
                                  int methodHash)
Returns a specific method by the class and the method index.

Parameters:
klass - the class housing the method
methodHash - the method hash
Returns:
the method

getConstructorTuple

public ConstructorTuple getConstructorTuple(Class klass,
                                            int constructorHash)
Returns a specific constructor by the class and the constructor index.

Parameters:
klass - the class housing the method
constructorHash - the method hash
Returns:
the constructor

getField

public Field getField(Class klass,
                      int fieldHash)
Returns a specific field by the class and the field index.

Parameters:
klass - the class housing the method
fieldHash - the method hash
Returns:
the field

toString

public String toString()
Returns the string representation of the manager.

Returns:


Copyright © 2002-2004 Jonas Bonér, Alexandre Vasseur. All Rights Reserved.