org.codehaus.aspectwerkz.xmldef.advice
Class AbstractAdvice

java.lang.Object
  extended byorg.codehaus.aspectwerkz.xmldef.advice.AbstractAdvice
All Implemented Interfaces:
Advice, java.io.Serializable
Direct Known Subclasses:
org.codehaus.aspectwerkz.xmldef.advice.AbstractPrePostAdvice, AroundAdvice, ThrowsAdvice

public abstract class AbstractAdvice
extends java.lang.Object
implements Advice

Abstract base class for all advice classes. Is invoked after that a specific join point has been executed.

Supports four different deployment models: PER_JVM, PER_CLASS, PER_INSTANCE A PER_THREAD.
The PER_JVM deployment model performance a bit better than the other models since no synchronization A object creation is needed.

Author:
Jonas Bonér
See Also:
Serialized Form

Constructor Summary
AbstractAdvice()
          Creates a new abstract advice.
 
Method Summary
 java.lang.Class getAdviceClass()
          Returns the class for the advice.
 AdviceContainer getContainer()
          Returns the container.
 int getDeploymentModel()
          Returns the deployment model for the advice.
 ContainerType getMemoryType()
          Returns the memory type.
 java.lang.String getName()
          Returns the name of the advice.
 java.lang.String getParameter(java.lang.String name)
          Returns the value of a parameter with the name specified.
 java.util.Map getParameters()
          Returns parameters.
 java.lang.Object getPerJvmAdvice(JoinPoint joinPoint)
          Returns the sole per JVM advice.
 System getSystem()
          Returns the AspectWerkz system housing this advice.
static Advice newInstance(AbstractAdvice prototype)
          Copy constructor - creates a clone of an advice.
 void setAdviceClass(java.lang.Class adviceClass)
          Sets the class for the advice.
 void setContainer(AdviceContainer container)
          Sets the container.
 void setDeploymentModel(int deploymentModel)
          Sets the deployment model for the advice.
 void setName(java.lang.String name)
          Sets the name of the advice.
 void setParameter(java.lang.String name, java.lang.String value)
          Sets a parameter for the advice.
 void setParameters(java.util.Map parameters)
          Sets the parameters for the advice.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.codehaus.aspectwerkz.xmldef.advice.Advice
doExecute
 

Constructor Detail

AbstractAdvice

public AbstractAdvice()
Creates a new abstract advice.

Method Detail

newInstance

public static Advice newInstance(AbstractAdvice prototype)
Copy constructor - creates a clone of an advice.

Returns:
a clone of the advice

getSystem

public System getSystem()
Returns the AspectWerkz system housing this advice.

Returns:
the system

setName

public void setName(java.lang.String name)
Sets the name of the advice.

Specified by:
setName in interface Advice
Parameters:
name - the name of the advice

getName

public java.lang.String getName()
Returns the name of the advice.

Specified by:
getName in interface Advice
Returns:
the name of the advice

setDeploymentModel

public void setDeploymentModel(int deploymentModel)
Sets the deployment model for the advice. Models available are PER_JVM, PER_CLASS, PER_INSTANCE A PER_THREAD.

Specified by:
setDeploymentModel in interface Advice
Parameters:
deploymentModel - the deployment model for the advice

getDeploymentModel

public int getDeploymentModel()
Returns the deployment model for the advice.

Specified by:
getDeploymentModel in interface Advice
Returns:
the deployment model for the advice

setContainer

public void setContainer(AdviceContainer container)
Sets the container.

Specified by:
setContainer in interface Advice
Parameters:
container - the container

getContainer

public AdviceContainer getContainer()
Returns the container.

Specified by:
getContainer in interface Advice
Returns:
the container

setAdviceClass

public void setAdviceClass(java.lang.Class adviceClass)
Sets the class for the advice.

Specified by:
setAdviceClass in interface Advice
Parameters:
adviceClass - the class

getAdviceClass

public java.lang.Class getAdviceClass()
Returns the class for the advice.

Specified by:
getAdviceClass in interface Advice
Returns:
the class

getMemoryType

public ContainerType getMemoryType()
Returns the memory type.

Specified by:
getMemoryType in interface Advice
Returns:
the memory type

setParameter

public void setParameter(java.lang.String name,
                         java.lang.String value)
Sets a parameter for the advice.

Specified by:
setParameter in interface Advice
Parameters:
name - the name of the parameter
value - the value of the parameter

getParameter

public java.lang.String getParameter(java.lang.String name)
Returns the value of a parameter with the name specified.

Specified by:
getParameter in interface Advice
Parameters:
name - the name of the parameter
Returns:
the value of the parameter

setParameters

public void setParameters(java.util.Map parameters)
Sets the parameters for the advice.

Specified by:
setParameters in interface Advice
Parameters:
parameters - the parameters as a map

getParameters

public java.util.Map getParameters()
Returns parameters.

Specified by:
getParameters in interface Advice
Returns:
the parameters

getPerJvmAdvice

public java.lang.Object getPerJvmAdvice(JoinPoint joinPoint)
Returns the sole per JVM advice.

Parameters:
joinPoint - the joint point
Returns:
the advice


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