org.codehaus.aspectwerkz.xmldef.definition
Class AspectWerkzDefinitionImpl

java.lang.Object
  extended byorg.codehaus.aspectwerkz.xmldef.definition.AspectWerkzDefinitionImpl
All Implemented Interfaces:
AspectWerkzDefinition, java.io.Serializable

public class AspectWerkzDefinitionImpl
extends java.lang.Object
implements AspectWerkzDefinition

Implementation of the AspectWerkz interface for the xmldef definition model.

Author:
Jonas Bonér, Alexandre Vasseur
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.codehaus.aspectwerkz.definition.AspectWerkzDefinition
CALLER_SIDE_DELIMITER, DEF_TYPE_ATTRIB_DEF, DEF_TYPE_XML_DEF, PER_CLASS, PER_INSTANCE, PER_JVM, PER_THREAD, SYSTEM_ASPECT, THROWS_DELIMITER
 
Constructor Summary
AspectWerkzDefinitionImpl()
          Creates a new instance, creates and sets the system aspect and the cflow advices
 
Method Summary
 void addAbstractAspect(AspectDefinition aspect)
          Adds an abstract aspect definition.
 void addAdvice(AdviceDefinition advice)
          Adds an advice definition.
 void addAdviceStack(AdviceStackDefinition adviceStackDef)
          Adds an advice stack definition.
 void addAspect(AspectDefinition aspect)
          Adds an aspect definition.
 void addAspectToUse(java.lang.String className)
          Adds a new aspect to use.
 void addExcludePackage(java.lang.String excludePackage)
          Adds a new exclude package.
 void addIncludePackage(java.lang.String includePackage)
          Adds a new include package.
 void addIntroduction(IntroductionDefinition introduction)
          Adds a new introductions definition.
 void buildMixinMetaDataRepository(java.util.Set repository, java.lang.ClassLoader loader)
          Builds up a meta-data repository for the mixins.
 AspectDefinition getAbstractAspectDefinition(java.lang.String name)
          Returns a specific abstract aspect definition.
 java.util.Collection getAbstractAspectDefinitions()
          Returns a collection with the abstract aspect definitions registered.
 AdviceDefinition getAdviceDefinition(java.lang.String name)
          Returns a specific advice definition.
 java.util.Collection getAdviceDefinitions()
          Returns a collection with the advice definitions registered.
 java.lang.String getAdviceNameByAttribute(java.lang.String attribute)
          Finds the name of an advice by its attribute.
 AdviceStackDefinition getAdviceStackDefinition(java.lang.String adviceStackName)
          Finds an advice stack definition by its name.
 AspectDefinition getAspectDefinition(java.lang.String name)
          Returns a specific aspect definition.
 java.util.Collection getAspectDefinitions()
          Returns a collection with the aspect definitions registered.
 java.util.Set getAspectsToUse()
          Returns a set with the aspects to use.
 java.lang.String[] getAspectTargetClassNames()
          Returns the names of the target classes.
 java.util.Set getExcludePackages()
          Returns the exclude packages.
 java.util.Set getIncludePackages()
          Returns the include packages.
 IntroductionDefinition getIntroductionDefinition(java.lang.String introductionName)
          Returns a specific introduction definition.
 java.util.Collection getIntroductionDefinitions()
          Returns a collection with the introduction definitions registered.
 java.lang.String getIntroductionImplName(java.lang.String introductionName)
          Returns the name of the implementation for an introduction.
 int getIntroductionIndex(java.lang.String introductionName)
          Returns the index for a specific introduction.
 gnu.trove.TObjectIntHashMap getIntroductionIndexes()
          Returns the indexes for the introductions.
 java.lang.String getIntroductionInterfaceName(java.lang.String introductionName)
          Returns the name of the interface for an introduction.
 java.lang.String getIntroductionNameByAttribute(java.lang.String attribute)
          Finds the name of an introduction by its attribute.
 java.util.List getIntroductionNames(ClassMetaData classMetaData)
          Returns the names of the introductions for a certain class.
 java.lang.String getJoinPointController(ClassMetaData classMetaData, MethodMetaData methodMetaData)
          Returns the class name for the join point controller, if there is a match.
 java.lang.String getUuid()
          Returns the UUID for the definition.
 boolean hasAdvice(java.lang.String name)
          Checks if there exists an advice with the name specified.
 boolean hasCallPointcut(ClassMetaData classMetaData)
          Checks if a class is invoking a method that is picked out by a call pointcut.
 boolean hasExecutionPointcut(ClassMetaData classMetaData)
          Checks if a method has an execution pointcut.
 boolean hasExecutionPointcut(ClassMetaData classMetaData, MethodMetaData methodMetaData)
          Checks if a method has an execution pointcut.
 boolean hasGetPointcut(ClassMetaData classMetaData)
          Checks if a class has a get pointcut.
 boolean hasGetPointcut(ClassMetaData classMetaData, FieldMetaData fieldMetaData)
          Checks if a class has a get pointcut.
 boolean hasIntroduction(java.lang.String name)
          Checks if there exists an introduction with the name specified.
 boolean hasIntroductions(ClassMetaData classMetaData)
          Checks if a class has an Mixin.
 boolean hasSetPointcut(ClassMetaData classMetaData)
          Checks if a class has a set pointcut.
 boolean hasSetPointcut(ClassMetaData classMetaData, FieldMetaData fieldMetaData)
          Checks if a class has a set pointcut.
 boolean hasThrowsPointcut(ClassMetaData classMetaData)
          Checks if a class has a throws pointcut.
 boolean hasThrowsPointcut(ClassMetaData classMetaData, MethodMetaData methodMetaData)
          Checks if a class has a throws pointcut.
 boolean inExcludePackage(java.lang.String className)
          Checks if a class has an AspectMetaData.
 boolean inIncludePackage(java.lang.String className)
          Checks if a class has an AspectMetaData.
 boolean isAttribDef()
          Checks if the definition is of type attribute definition.
 boolean isPickedOutByCallPointcut(ClassMetaData classMetaData, MethodMetaData methodMetaData)
          Checks if a method is a picked out by a call pointcut.
 boolean isXmlDef()
          Checks if the definition is of type XML definition.
 void loadAspects(java.lang.ClassLoader loader)
          Loads the aspects.
 void setUuid(java.lang.String uuid)
          Sets the UUID for the definition.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AspectWerkzDefinitionImpl

public AspectWerkzDefinitionImpl()
Creates a new instance, creates and sets the system aspect and the cflow advices

Method Detail

isAttribDef

public boolean isAttribDef()
Checks if the definition is of type attribute definition.

Specified by:
isAttribDef in interface AspectWerkzDefinition
Returns:
returns false for this definition

isXmlDef

public boolean isXmlDef()
Checks if the definition is of type XML definition.

Specified by:
isXmlDef in interface AspectWerkzDefinition
Returns:
returns true for this definition

setUuid

public void setUuid(java.lang.String uuid)
Sets the UUID for the definition.

Specified by:
setUuid in interface AspectWerkzDefinition
Parameters:
uuid - the UUID

getUuid

public java.lang.String getUuid()
Returns the UUID for the definition.

Specified by:
getUuid in interface AspectWerkzDefinition
Returns:
the UUID

getIncludePackages

public java.util.Set getIncludePackages()
Returns the include packages.

Specified by:
getIncludePackages in interface AspectWerkzDefinition
Returns:
the include packages

getExcludePackages

public java.util.Set getExcludePackages()
Returns the exclude packages.

Returns:
the exclude packages

getAbstractAspectDefinitions

public java.util.Collection getAbstractAspectDefinitions()
Returns a collection with the abstract aspect definitions registered.

Returns:
the abstract aspect definitions

getAspectDefinitions

public java.util.Collection getAspectDefinitions()
Returns a collection with the aspect definitions registered.

Specified by:
getAspectDefinitions in interface AspectWerkzDefinition
Returns:
the aspect definitions

getIntroductionDefinitions

public java.util.Collection getIntroductionDefinitions()
Returns a collection with the introduction definitions registered.

Specified by:
getIntroductionDefinitions in interface AspectWerkzDefinition
Returns:
the introduction definitions

getAdviceDefinitions

public java.util.Collection getAdviceDefinitions()
Returns a collection with the advice definitions registered.

Specified by:
getAdviceDefinitions in interface AspectWerkzDefinition
Returns:
the advice definitions

getAdviceStackDefinition

public AdviceStackDefinition getAdviceStackDefinition(java.lang.String adviceStackName)
Finds an advice stack definition by its name.

Parameters:
adviceStackName - the advice stack name
Returns:
the definition

getAbstractAspectDefinition

public AspectDefinition getAbstractAspectDefinition(java.lang.String name)
Returns a specific abstract aspect definition.

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

getAspectDefinition

public AspectDefinition getAspectDefinition(java.lang.String name)
Returns a specific aspect definition.

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

getAspectTargetClassNames

public java.lang.String[] getAspectTargetClassNames()
Returns the names of the target classes.

Returns:
the names of the target classes

getAdviceDefinition

public AdviceDefinition getAdviceDefinition(java.lang.String name)
Returns a specific advice definition.

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

getAdviceNameByAttribute

public java.lang.String getAdviceNameByAttribute(java.lang.String attribute)
Finds the name of an advice by its attribute.

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

getIntroductionNameByAttribute

public java.lang.String getIntroductionNameByAttribute(java.lang.String attribute)
Finds the name of an introduction by its attribute.

Parameters:
attribute - the attribute
Returns:
the name of the introduction

getIntroductionInterfaceName

public java.lang.String getIntroductionInterfaceName(java.lang.String introductionName)
Returns the name of the interface for an introduction.

Parameters:
introductionName - the name of the introduction
Returns:
the name of the interface

getIntroductionImplName

public java.lang.String getIntroductionImplName(java.lang.String introductionName)
Returns the name of the implementation for an introduction.

Specified by:
getIntroductionImplName in interface AspectWerkzDefinition
Parameters:
introductionName - the name of the introduction
Returns:
the name of the interface

getIntroductionDefinition

public IntroductionDefinition getIntroductionDefinition(java.lang.String introductionName)
Returns a specific introduction definition.

Parameters:
introductionName - the name of the introduction
Returns:
the introduction definition

getIntroductionIndex

public int getIntroductionIndex(java.lang.String introductionName)
Returns the index for a specific introduction.

Parameters:
introductionName - the name of the introduction
Returns:
the index

getIntroductionIndexes

public gnu.trove.TObjectIntHashMap getIntroductionIndexes()
Returns the indexes for the introductions.

Returns:
the indexes

getJoinPointController

public java.lang.String getJoinPointController(ClassMetaData classMetaData,
                                               MethodMetaData methodMetaData)
Returns the class name for the join point controller, if there is a match.

Specified by:
getJoinPointController in interface AspectWerkzDefinition
Parameters:
classMetaData - the class meta-data
methodMetaData - the method meta-data
Returns:
the controller class name

getAspectsToUse

public java.util.Set getAspectsToUse()
Returns a set with the aspects to use.

Specified by:
getAspectsToUse in interface AspectWerkzDefinition
Returns:
the aspects to use

addAspectToUse

public void addAspectToUse(java.lang.String className)
Adds a new aspect to use.

Specified by:
addAspectToUse in interface AspectWerkzDefinition
Parameters:
className - the class name of the aspect

addIncludePackage

public void addIncludePackage(java.lang.String includePackage)
Adds a new include package.

Specified by:
addIncludePackage in interface AspectWerkzDefinition
Parameters:
includePackage - the new include package

addExcludePackage

public void addExcludePackage(java.lang.String excludePackage)
Adds a new exclude package.

Specified by:
addExcludePackage in interface AspectWerkzDefinition
Parameters:
excludePackage - the new exclude package

addAbstractAspect

public void addAbstractAspect(AspectDefinition aspect)
Adds an abstract aspect definition.

Parameters:
aspect - a new abstract aspect definition

addAspect

public void addAspect(AspectDefinition aspect)
Adds an aspect definition.

Parameters:
aspect - a new aspect definition

addAdviceStack

public void addAdviceStack(AdviceStackDefinition adviceStackDef)
Adds an advice stack definition.

Parameters:
adviceStackDef - the advice stack definition

addAdvice

public void addAdvice(AdviceDefinition advice)
Adds an advice definition.

Parameters:
advice - the advice definition

addIntroduction

public void addIntroduction(IntroductionDefinition introduction)
Adds a new introductions definition.

Parameters:
introduction - the introduction definition

hasAdvice

public boolean hasAdvice(java.lang.String name)
Checks if there exists an advice with the name specified.

Specified by:
hasAdvice in interface AspectWerkzDefinition
Parameters:
name - the name of the advice
Returns:
boolean

hasIntroduction

public boolean hasIntroduction(java.lang.String name)
Checks if there exists an introduction with the name specified.

Specified by:
hasIntroduction in interface AspectWerkzDefinition
Parameters:
name - the name of the introduction
Returns:
boolean

inIncludePackage

public boolean inIncludePackage(java.lang.String className)
Checks if a class has an AspectMetaData.

Specified by:
inIncludePackage in interface AspectWerkzDefinition
Parameters:
className - the name or the class
Returns:
boolean

inExcludePackage

public boolean inExcludePackage(java.lang.String className)
Checks if a class has an AspectMetaData.

Specified by:
inExcludePackage in interface AspectWerkzDefinition
Parameters:
className - the name or the class
Returns:
boolean

hasIntroductions

public boolean hasIntroductions(ClassMetaData classMetaData)
Checks if a class has an Mixin.

Specified by:
hasIntroductions in interface AspectWerkzDefinition
Parameters:
classMetaData - the class meta-data
Returns:
boolean

hasExecutionPointcut

public boolean hasExecutionPointcut(ClassMetaData classMetaData)
Checks if a method has an execution pointcut. Only checks for a class match to allow early filtering.

Specified by:
hasExecutionPointcut in interface AspectWerkzDefinition
Parameters:
classMetaData - the class meta-data
Returns:
boolean

hasExecutionPointcut

public boolean hasExecutionPointcut(ClassMetaData classMetaData,
                                    MethodMetaData methodMetaData)
Checks if a method has an execution pointcut.

Specified by:
hasExecutionPointcut in interface AspectWerkzDefinition
Parameters:
classMetaData - the class meta-data
methodMetaData - the method meta-data
Returns:
boolean

hasGetPointcut

public boolean hasGetPointcut(ClassMetaData classMetaData)
Checks if a class has a get pointcut. Only checks for a class match to allow early filtering.

Specified by:
hasGetPointcut in interface AspectWerkzDefinition
Parameters:
classMetaData - the class meta-data
Returns:
boolean

hasGetPointcut

public boolean hasGetPointcut(ClassMetaData classMetaData,
                              FieldMetaData fieldMetaData)
Checks if a class has a get pointcut.

Specified by:
hasGetPointcut in interface AspectWerkzDefinition
Parameters:
classMetaData - the class meta-data
fieldMetaData - the name or the field
Returns:
boolean

hasSetPointcut

public boolean hasSetPointcut(ClassMetaData classMetaData)
Checks if a class has a set pointcut. Only checks for a class match to allow early filtering.

Specified by:
hasSetPointcut in interface AspectWerkzDefinition
Parameters:
classMetaData - the class meta-data
Returns:
boolean

hasSetPointcut

public boolean hasSetPointcut(ClassMetaData classMetaData,
                              FieldMetaData fieldMetaData)
Checks if a class has a set pointcut.

Specified by:
hasSetPointcut in interface AspectWerkzDefinition
Parameters:
classMetaData - the class meta-data
fieldMetaData - the name or the field
Returns:
boolean

hasThrowsPointcut

public boolean hasThrowsPointcut(ClassMetaData classMetaData)
Checks if a class has a throws pointcut. Only checks for a class match to allow early filtering.

Specified by:
hasThrowsPointcut in interface AspectWerkzDefinition
Parameters:
classMetaData - the class meta-data
Returns:
boolean

hasThrowsPointcut

public boolean hasThrowsPointcut(ClassMetaData classMetaData,
                                 MethodMetaData methodMetaData)
Checks if a class has a throws pointcut.

Specified by:
hasThrowsPointcut in interface AspectWerkzDefinition
Parameters:
classMetaData - the class meta-data
methodMetaData - the name or the method
Returns:
boolean

hasCallPointcut

public boolean hasCallPointcut(ClassMetaData classMetaData)
Checks if a class is invoking a method that is picked out by a call pointcut.

Specified by:
hasCallPointcut in interface AspectWerkzDefinition
Parameters:
classMetaData - the class meta-data
Returns:
boolean

isPickedOutByCallPointcut

public boolean isPickedOutByCallPointcut(ClassMetaData classMetaData,
                                         MethodMetaData methodMetaData)
Checks if a method is a picked out by a call pointcut. Cflow are turned in CALL pointcut as well.

Specified by:
isPickedOutByCallPointcut in interface AspectWerkzDefinition
Parameters:
classMetaData - the class meta-data
methodMetaData - the name or the method
Returns:
boolean

getIntroductionNames

public java.util.List getIntroductionNames(ClassMetaData classMetaData)
Returns the names of the introductions for a certain class.

Parameters:
classMetaData - the class meta-data
Returns:
the names

buildMixinMetaDataRepository

public void buildMixinMetaDataRepository(java.util.Set repository,
                                         java.lang.ClassLoader loader)
Builds up a meta-data repository for the mixins.

Specified by:
buildMixinMetaDataRepository in interface AspectWerkzDefinition
Parameters:
repository - the repository
loader - the class loader to use

loadAspects

public void loadAspects(java.lang.ClassLoader loader)
Loads the aspects.

Specified by:
loadAspects in interface AspectWerkzDefinition
Parameters:
loader - the class loader to use to load the aspects


Copyright (c) 2002-2004 The AspectWerkz Team. All Rights Reserved.