org.codehaus.aspectwerkz.aspect.management
Class AspectRegistry

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

public class AspectRegistry
extends Object

Stores the aspects, advices, pointcuts etc. Manages the method, advice and aspect indexing.

Author:
Jonas Bonér , Alexandre Vasseur

Constructor Summary
AspectRegistry(AspectManager aspectManager, SystemDefinition definition)
          Creates a new aspect registry.
 
Method Summary
protected static void createConstructorRepository(Class klass)
          Creates a new constructor repository for the class specified.
protected static void createFieldRepository(Class klass)
          Creates a new field repository for the class specified.
protected static void createMethodRepository(Class klass)
          Creates a new method repository for the class specified.
 AdviceInfo getAdviceIndexFor(String name)
          Returns the index for a specific name to advice mapping.
 AspectContainer getAspectContainer(int index)
          Retrieves a specific aspect container based on 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.
static Constructor getConstructor(Class klass, int constructorHash)
          Returns a specific constructor by the class and the constructor hash.
static ConstructorTuple getConstructorTuple(Class klass, int constructorHash)
          Returns a specific constructor by the class and the method hash.
 CrossCuttingInfo getCrossCuttingInfo(String name)
          Returns the aspect for a specific name, deployed as perJVM.
static Field getField(Class klass, int fieldHash)
          Returns a specific field by the class and the field hash.
static MethodTuple getMethodTuple(Class klass, int methodHash)
          Returns a specific method by the class and the method hash.
 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 managers 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.
 boolean hasAspect(String name)
          Checks if a specific class has an aspect defined.
 void initialize()
          Initializes the aspect registry.
 void register(AspectContainer aspectContainer, PointcutManager pointcutManager)
          Registers a new aspect.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AspectRegistry

public AspectRegistry(AspectManager aspectManager,
                      SystemDefinition definition)
Creates a new aspect registry.

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

initialize

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


register

public void register(AspectContainer aspectContainer,
                     PointcutManager pointcutManager)
Registers a new aspect.

Parameters:
aspectContainer - the aspectContainer for the aspect to register
pointcutManager - the pointcut manager

getAspectContainer

public AspectContainer getAspectContainer(int index)
Retrieves a specific aspect container based on index.

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

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 container

getCrossCuttingInfo

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

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

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 managers for the name specified.

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

getPointcutManagers

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

Returns:
the pointcut managers

getAspectContainers

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

Returns:
the aspect containers

getPointcuts

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

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.

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 static MethodTuple getMethodTuple(Class klass,
                                         int methodHash)
Returns a specific method by the class and the method hash.

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

getConstructorTuple

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

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

getField

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

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

getConstructor

public static Constructor getConstructor(Class klass,
                                         int constructorHash)
Returns a specific constructor by the class and the constructor hash.

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

createMethodRepository

protected static void createMethodRepository(Class klass)
Creates a new method repository for the class specified.

Parameters:
klass - the class

createConstructorRepository

protected static void createConstructorRepository(Class klass)
Creates a new constructor repository for the class specified.

Parameters:
klass - the class

createFieldRepository

protected static void createFieldRepository(Class klass)
Creates a new field repository for the class specified.

Parameters:
klass - the class


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