org.jboss.aop.advice
Class AspectDefinition

java.lang.Object
  extended by org.jboss.aop.advice.AspectDefinition

public class AspectDefinition
extends Object

Definition of an aspect or interceptor.
This class is used by JBoss AOP to manage all configured informations regarding aspects and interceptors, and can be used to define new aspects and interceptors dynamically.

Version:
$Revision: 70826 $
Author:
Bill Burke
See Also:
AspectManager.addAspectDefinition(AspectDefinition)

Field Summary
 Map<Advisor,Boolean> advisors
          Deprecated. should not call this directly
protected  boolean deployed
          Indicates whether this definition has been deployed in the domain.
protected  AspectFactory factory
          Aspect's factory, responsible for creating the aspect instances.
protected  String name
          Name of the aspect.
protected  Scope scope
          Scope of the aspect, defines how many times it must be created during execution.
 
Constructor Summary
AspectDefinition()
           
AspectDefinition(String name, Scope scope, AspectFactory factory)
          Creates an aspect definition.
 
Method Summary
 boolean equals(Object obj)
          Compares this aspect definition with obj for equality.
 AspectFactory getFactory()
          Returns the factory of this aspect definition, responsible for providing the instances at runtime.
 String getName()
          Returns the name of this aspect definition.
 Scope getScope()
          Returns the scope of this aspect definition.
 int hashCode()
           
 boolean isDeployed()
          Returns true if this aspect definition is deployed in its domain.An aspect definition is considered to be deployed if it is active in the domain, and can intercept joinpoints.
 void registerAdvisor(Advisor advisor)
          Registers advisor as being a client of this definition.
 void setFactory(AspectFactory factory)
          Sets the factory of this aspect definition, responsible for providing the instances at runtime.
 void setName(String name)
          Sets the name of this aspect definition.
 void setScope(Scope scope)
          Sets the scope of this aspect definition.
 void undeploy()
          Undeploys the aspect definition from its domain.
 void unregisterAdvisor(Advisor advisor)
          Unregisters advisor as being a client of this definition.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected String name
Name of the aspect. Identifies this aspect in its domain.


scope

protected Scope scope
Scope of the aspect, defines how many times it must be created during execution.


factory

protected AspectFactory factory
Aspect's factory, responsible for creating the aspect instances.


deployed

protected boolean deployed
Indicates whether this definition has been deployed in the domain.


advisors

public Map<Advisor,Boolean> advisors
Deprecated. should not call this directly
Constructor Detail

AspectDefinition

public AspectDefinition(String name,
                        Scope scope,
                        AspectFactory factory)
Creates an aspect definition.

Parameters:
name - the name of the aspect. This name is used by the domain to identify the aspect, so it must be unique in the AOP domain.
scope - the aspect scope, indicates how many aspects instances must be created during execution. Defaults to PER_VM if null.
factory - factory responsible for creating the aspect instances
See Also:
AspectFactory, GenericAspectFactory

AspectDefinition

public AspectDefinition()
Method Detail

undeploy

public void undeploy()
Undeploys the aspect definition from its domain.


isDeployed

public boolean isDeployed()
Returns true if this aspect definition is deployed in its domain.An aspect definition is considered to be deployed if it is active in the domain, and can intercept joinpoints. It is not deployed when it is inactive and won't intercept any joinpoints.

Returns:
true if this aspect definition is active in its domain

setName

public void setName(String name)
Sets the name of this aspect definition. This name must be unique inside the domain.

Parameters:
name - the new name of this aspect definition.

setScope

public void setScope(Scope scope)
Sets the scope of this aspect definition. The scope defines the lifecycle of the aspect instances.

Parameters:
scope - the new scope of this aspect definition.

setFactory

public void setFactory(AspectFactory factory)
Sets the factory of this aspect definition, responsible for providing the instances at runtime.

Parameters:
factory - the new factory of this aspect definition

getFactory

public AspectFactory getFactory()
Returns the factory of this aspect definition, responsible for providing the instances at runtime.

Returns:
the factory of this aspect definition

getName

public String getName()
Returns the name of this aspect definition. This name is unique inside the domain.

Returns:
name the name that identifies this definition in its domain

registerAdvisor

public void registerAdvisor(Advisor advisor)
Registers advisor as being a client of this definition. This means that advisor uses an instance of the defined aspect for interception of one or more joinpoints.

For internal use only

Parameters:
advisor - an advisor responsible for managing joinpoints and their interception execution

unregisterAdvisor

public void unregisterAdvisor(Advisor advisor)
Unregisters advisor as being a client of this definition. This means that advisor no more uses an instance of the defined aspect for interception.

For internal use only

Parameters:
advisor - responsible for managing a set of joinpoints and their interception execution

getScope

public Scope getScope()
Returns the scope of this aspect definition. The scope defines how many instances of the aspect are necessary at runtime.

Returns:
scope the scope of this aspect definition.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Compares this aspect definition with obj for equality. Returns true if and only if obj is an aspect definition with the same name as this one.

Overrides:
equals in class Object
Parameters:
obj - the obj for comparison.
Returns:
true if obj is an aspect definition with the same name as this one.


Copyright © 2008 JBoss, a division of Red Hat, Inc.. All Rights Reserved.