org.objectweb.jac.core
Class AspectComponent

java.lang.Object
  extended byorg.objectweb.jac.core.AspectComponent
All Implemented Interfaces:
BaseProgramListener, Serializable
Direct Known Subclasses:
AuthenticationAC, BindingAC, BroadcastingAC, CacheAC, CompositeAspectComponent, CompositionAspect, ConfirmationAC, ConsistencyAC, DebuggingAC, DeploymentAC, DisTransAC, ExportAC, GuiAC, HibernateAC, I18nAC, IdGenAC, IntegrityAC, LoadBalancingAC, MessageQueueAC, NamingAC, PersistenceAC, PersistenceAC, RemoteAccessAC, RttiAC, SessionAC, SynchronizationAC, TimestampAC, TracingAC, TransactionAC, UserAC

public class AspectComponent
extends Object
implements Serializable, BaseProgramListener

This class is the root class for the aspect components defined by a Jac application programmers.

When programming a new aspect, the programmer must extends this class and define new pointcuts to link a set of base method invocation to a wrapping method. If necessary, the programmer can also redefine the methods of the interface BaseProgramListener to be able to react on several events happenning in the base programm such as object (de)serialization, object instantiation, object naming, object cloning, or wrappers execution.

Author:
Renaud Pawlak
See Also:
Pointcut, Serialized Form

Field Summary
protected  String application
           
protected  String[] blockKeywords
          Block keywords which can be used instead of "block"
protected static ClassRepository cr
           
protected  ConfigMethod currentConfigMethod
           
protected  Imports currentImports
           
 int firstCall
          Memorize how many calls have been performed on start_weaving_type.start_weaving_method.
protected static boolean NOT_SHARED
           
protected static boolean SHARED
           
 int startWeavingCCount
          The number of instance of startWeavingType where the weaving has to start.
 int startWeavingCount
          The number of calls of startWeavingType.startWeavingMethod where the weaving has to start.
 String startWeavingMethod
          The method where the weaving has to start.
 Class startWeavingType
          The type where the weaving has to start.
protected  boolean systemListener
          Tells if this aspect component is a system listener one so that it can receive events from the org.objectweb.jac.core objects.
protected  WeakHashSet wrappers
          The wrappers handled by this aspect component.
 
Fields inherited from interface org.objectweb.jac.core.BaseProgramListener
FOUND_OBJECT
 
Constructor Summary
AspectComponent()
          The default constructor of the aspect component.
 
Method Summary
 void addWrapper(Wrapper wrapper)
          Add a wrapper to the wrappers handled by this aspect component.
 void afterApplicationStarted()
          Upcalled after a new application is started on the JAC system.
 void afterRunningWrapper(Wrapper wrapper, String wrappingMethod)
          This method is called after the application of the wrapper.
 void afterWrap(Wrappee wrappee, Wrapper wrapper, String[] wrapping_methods, String[][] wrapped_methods)
          This method is called after a new wrapper wraps a wrappee.
 void afterWrappeeInit(Wrappee wrappee)
          This method should be called by the GUI system after an object has been created and initialized (tells the other aspects that the object is now regular).
 Object attr(String name)
           
 void attrdef(String name, Object value)
           
 void beforeConfiguration()
          To overload in order to perform some treatements before the configuration.
 void beforeReload()
           
 boolean beforeRunningWrapper(Wrapper wrapper, String wrappingMethod)
          This method is called when a wrapper is going to be applied to a wrappee.
 void beforeWrappeeInit(Wrappee wrappee)
          This method should be called by the GUI system before an object is being created and initialized (but the process is not finished yet).
 void configure(String name, String filePath)
          Configures this aspect component with a given configuration file.
static boolean defines(String methodName)
          Returns true if the method is defined in the aspect component class.
 void defineTimer(long period, MethodItem callback, Object[] args)
          A common configuration method that defines a timer and its callback.
 void doRegister()
          This method is upcalled by the system when the aspect is actually registered in the AC manager.
 void doUnregister()
          This method is upcalled by the system when the aspect is actually registered in the AC manager.
protected  void error(String message)
          Issue an error containing the file, line number and configuration method name (if available)
protected  AspectComponent getAC(String name)
          Returns a named aspect component in the same application
 String getApplication()
          Gets the application that declares this aspect component.
 Set getBlockKeywords()
           
 Collection getConfigurationMethods()
          Returns all the configuration methods of the aspect
 Collection getConfigurationMethodsName()
          Returns all the name of the configuration methods of the aspect
 List getConfigurationMethodsName(Class firstParamType)
          Returns all the configuration methods of the aspect whose first parameter is compatible with a given type.
 String[] getDefaultConfigs()
          Returns defaults configuration files that must be loaded before the user's configuration
 String getName()
           
 void getNameCounters(Map counters)
           
 Collection getWrappers()
          Returns the wrappers handled by this aspect component.
 void init()
          Initializes the aspect component so that its state is resetted to the default state.
 boolean isConfigurationMethod(Method method)
          Tells wether a method is configuration method of this aspect
 boolean isSystemListener()
          Tells if this aspect component is a system listener.
 void onExit()
          This method is upcalled when the system exits.
 Pointcut pointcut(String wrappeeExpr, String wrappeeClassExpr, String methodName, Object[] methodArgs, String exceptionHandler)
          Defines and adds a new pointcut that upcalls an aspect method when the matching object is created.
 Pointcut pointcut(String wrappeeExpr, String wrappeeClassExpr, String methodName, Object[] methodArgs, String hostExpr, String exceptionHandler)
          Defines and adds a new localized pointcut that upcalls an aspect method when the matching object is created.
 Pointcut pointcut(String wrappeeExpr, String wrappeeClassExpr, String wrappeeMethodExpr, String wrappingClassName, Object[] initParameters, String exceptionHandler, boolean one2One)
          Defines and adds a new method pointcut.
 Pointcut pointcut(String wrappeeExpr, String wrappeeClassExpr, String wrappeeMethodExpr, String wrappingClassName, Object[] initParameters, String hostExpr, String exceptionHandler, boolean one2One)
          Defines and adds a new localized method pointcut.
 Pointcut pointcut(String wrappeeExpr, String wrappeeClassExpr, String wrappeeMethodExpr, String wrappingClassName, String exceptionHandler, boolean one2one)
          Defines and adds a new method pointcut.
 Pointcut pointcut(String wrappeeExpr, String wrappeeClassExpr, String wrappeeMethodExpr, String wrappingClassName, String hostExpr, String exceptionHandler, boolean one2One)
          Defines and adds a new localized method pointcut.
 Pointcut pointcut(String wrappeeExpr, String wrappeeClassExpr, String wrappeeMethodExpr, Wrapper wrapper, String exceptionHandler)
          Defines and adds a new method pointcut.
 Pointcut pointcut(String wrappeeExpr, String wrappeeClassExpr, String wrappeeMethodExpr, Wrapper wrapper, String hostExpr, String exceptionHandler)
          Defines and adds a new localized method pointcut.
 void setApplication(String application)
          Gets the application that declares this aspect component.
 void setAttribute(AbstractMethodItem method, String name, String value)
          Generic config method to set an attribute on a method
 void setAttribute(ClassItem cli, String name, String value)
          Generic config method to set an attribute on a class
 void setAttribute(FieldItem field, String name, String value)
          Generic config method to set an attribute on a class
 void setSystemListener(boolean systemListener)
          Sets this aspect component to be a system or non-system listener.
protected  void simulateUsingNewInstance(Wrappee wrappee)
          This method simulates an instance first use so that the system upcalls whenUsingNewInstance() with a fake collaboration point (method() is null and args is null too).
 void unweave()
          The programmer should overload this method to unwrap all the currently wrapped Jac objects so that it unplugs a given aspect.
protected  void unwrapAll()
          This method unwraps all the instances that have been wrapped by the aspect component.
 void updateNameCounters(Map counters)
           
protected  void warning(String message)
          Issue a warning containing the file, line number and configuration method name (if available)
 void weave()
          The programmer should define this method to wrap all the currently instantiated Jac objects so that it plugs a given aspect.
 void whenClone(Wrappee cloned, Wrappee clone)
          This method is automatically called when a Jac Object is cloned.
 void whenCloseDisplay(Display display)
          Upcalled when a display is closing.
 void whenConfigured()
          This method should be defined by the programmer when specific actions are needed once the aspect component has be configured.
 void whenDeleted(Wrappee object)
          Upcalled when an object is deleted.
 Wrappee whenDeserialized(SerializedJacObject orgObject, Wrappee finalObject)
          This method is called when a base object is deserialized and can parametrize the deserialization by reading the SerializedJacObject instance to get some extra infos on the aspects.
 void whenFree(Wrappee object)
          Upcalled when an object is freed from the memory.
 void whenGetObjects(Collection objects, ClassItem cl)
          This method is called when a program gets a set of object from the object repository.
 String whenNameObject(Object object, String name)
          Upcalled when the naming aspect names an object.
 void whenObjectMiss(String name)
          This method is upcalled by JAC when an object was seeked into the name repository and was not found.
 void whenReload()
          Called when the aspect's configuration is reloaded
 void whenRemoteInstantiation(Wrappee newInstance, String name)
          This method is upcalled when a new object is instanciated from a remote site.
 Wrappee whenSerialized(Wrappee orgObject, SerializedJacObject finalObject)
          This method is called when a JAC object is serialized and can parametrize the serialization by filling the finalObject parameter.
 void whenTopologyChanged()
          This method is upcalled when a topological change occurs whithin the distributed application.
 void whenUsingNewClass(ClassItem cli)
          This method is upcalled by JAC when a static method is called for the first time.
 void whenUsingNewInstance(Interaction interaction)
          This method is called when a new instance (that has not been wrapped by the aspect component yet) is used by a peer object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SHARED

protected static final boolean SHARED
See Also:
Constant Field Values

NOT_SHARED

protected static final boolean NOT_SHARED
See Also:
Constant Field Values

cr

protected static final ClassRepository cr

firstCall

public int firstCall
Memorize how many calls have been performed on start_weaving_type.start_weaving_method. The weaving will start when this number reaches start_weaving_count.

See Also:
weave()

startWeavingType

public Class startWeavingType
The type where the weaving has to start.

See Also:
weave()

startWeavingMethod

public String startWeavingMethod
The method where the weaving has to start.

See Also:
weave()

startWeavingCount

public int startWeavingCount
The number of calls of startWeavingType.startWeavingMethod where the weaving has to start.

See Also:
weave()

startWeavingCCount

public int startWeavingCCount
The number of instance of startWeavingType where the weaving has to start.

See Also:
weave()

wrappers

protected transient WeakHashSet wrappers
The wrappers handled by this aspect component.

See Also:
getWrappers(), addWrapper(Wrapper)

systemListener

protected boolean systemListener
Tells if this aspect component is a system listener one so that it can receive events from the org.objectweb.jac.core objects.


application

protected String application

blockKeywords

protected String[] blockKeywords
Block keywords which can be used instead of "block"


currentConfigMethod

protected ConfigMethod currentConfigMethod

currentImports

protected Imports currentImports
Constructor Detail

AspectComponent

public AspectComponent()
The default constructor of the aspect component. By default, there is no start weaving type or method so that the weave() is called as the aspect component is registering to the aspect component manager
.

See Also:
weave(), ACManager.register(String,Object)
Method Detail

defines

public static boolean defines(String methodName)
Returns true if the method is defined in the aspect component class.

Parameters:
methodName - the method to test
Returns:
true if aspect component method

defineTimer

public void defineTimer(long period,
                        MethodItem callback,
                        Object[] args)
A common configuration method that defines a timer and its callback.

The method mi is invoked every period ms. The method is defined in the aspect component.

Parameters:
period - the timer's period (in ms)
callback - the method that is called every period
args - the arguments the callback is called with

setSystemListener

public void setSystemListener(boolean systemListener)
Sets this aspect component to be a system or non-system listener.

Parameters:
systemListener - if true, the component can receive events from the JAC core objects (e.g. whenUsingNewInstance) ; if false, these events are filtered

isSystemListener

public boolean isSystemListener()
Tells if this aspect component is a system listener.

Returns:
true if system listener
See Also:
setSystemListener(boolean)

init

public void init()
Initializes the aspect component so that its state is resetted to the default state.


getApplication

public String getApplication()
Gets the application that declares this aspect component.

Returns:
the application's name
See Also:
Application, ApplicationRepository

setApplication

public void setApplication(String application)
Gets the application that declares this aspect component.

This method is invoked by the system and should not be directly used.

Parameters:
application - the application's name
See Also:
Application, ApplicationRepository

getWrappers

public Collection getWrappers()
Returns the wrappers handled by this aspect component. When you have a reference on a wrapper, you can also know which aspect component is currently handling it by using Wrapper.getAspectComponent().

Returns:
a vector containing the handdled wrappers
See Also:
addWrapper(Wrapper), Wrapper.getAspectComponent()

addWrapper

public void addWrapper(Wrapper wrapper)
Add a wrapper to the wrappers handled by this aspect component.

The programmer should not call this method explicitly unless s/he really hnows what s/he is doing. In fact, this method is automatically upcalled when the aspect component wraps a base program object (see Wrappee.wrap()).

Parameters:
wrapper - the wrapper to add to the handdled wrappers
See Also:
getWrappers(), Wrapping.wrap(Wrappee,Wrapper,AbstractMethodItem)

weave

public void weave()
The programmer should define this method to wrap all the currently instantiated Jac objects so that it plugs a given aspect. Since the objects might allready be wrapped by other weavers, the programmer should be careful that it does not wrap the same object with the same wrapper several times. This can be done in the weave function by using the Wrappee.isExtendedBy() method. When a new AC is registered the weave method is automatically called. In the jac.prop file, the time when it is called can be parametrized with the org.objectweb.jac.startWeavingPlaces property.

This method is only called once. For the objects that are created after the weaving, the programmer must define the whenUsingNewInstance method to wrap them.

The default implementation of the weave method is the following. In most of the case, it will work if the whenUsingNewInstance() is correctly defined (thus, the programer do not have to redefine the weave method).

IMPORTANT NOTE: this method is not deprecated but the programmer should not overload it since it is much cleaner to define the whenUsingNewInstance() to implement the weaving.

See Also:
whenUsingNewInstance(Interaction), simulateUsingNewInstance(Wrappee), Wrapping.isExtendedBy(Wrappee,ClassItem,Class)

whenUsingNewInstance

public void whenUsingNewInstance(Interaction interaction)
This method is called when a new instance (that has not been wrapped by the aspect component yet) is used by a peer object.

By default, this method check out all the pointcuts that have been defined within this aspect component and accordingly wraps the wrappee.

However, for performance or flexibility reasons, the programmer can also define it from scratch so that the aspects can dynamically apply while the base program creates new base objects. The aspect component is notified only once for each new instance.

Here is a typical implementation of this method for a many-to-one wrappees-wrapper relationship:

The same but with one-to-one wrappees-wrappers relationship:

NOTE: this method is not upcalled until the aspect component is woven.

Specified by:
whenUsingNewInstance in interface BaseProgramListener
Parameters:
interaction - the interaction that triggered the whenUsingNewInstance event (usually a constructor invocation)
See Also:
weave()

whenUsingNewClass

public void whenUsingNewClass(ClassItem cli)
Description copied from interface: BaseProgramListener
This method is upcalled by JAC when a static method is called for the first time.

Specified by:
whenUsingNewClass in interface BaseProgramListener
Parameters:
cli - the class that is used for the first time.
See Also:
CollaborationParticipant, BaseProgramListener.whenUsingNewInstance(Interaction)

simulateUsingNewInstance

protected void simulateUsingNewInstance(Wrappee wrappee)
This method simulates an instance first use so that the system upcalls whenUsingNewInstance() with a fake collaboration point (method() is null and args is null too).

Parameters:
wrappee - the wrappe on which the call is simulated.
See Also:
whenUsingNewInstance(Interaction)

whenRemoteInstantiation

public void whenRemoteInstantiation(Wrappee newInstance,
                                    String name)
This method is upcalled when a new object is instanciated from a remote site.

The name that is passed is the name of the remote reference that has been used to create the object. Typically, it is the name that will be used by the naming aspect to name the new object.

Specified by:
whenRemoteInstantiation in interface BaseProgramListener
Parameters:
newInstance - the instance that have been created by a remote host
name - the name of the new instance
See Also:
NamingAC.whenRemoteInstantiation(Wrappee,String)

unwrapAll

protected final void unwrapAll()
This method unwraps all the instances that have been wrapped by the aspect component.

This is done in a generic way that is not very efficient. To optimize this process, the user may overload the unweave() method to change its default behavior.

See Also:
unweave()

unweave

public void unweave()
The programmer should overload this method to unwrap all the currently wrapped Jac objects so that it unplugs a given aspect.

By default, calls the unwrapAll method but the programmer can implement the unveaving process in a more efficient way.

See Also:
unwrapAll()

whenClone

public void whenClone(Wrappee cloned,
                      Wrappee clone)
This method is automatically called when a Jac Object is cloned.

Specified by:
whenClone in interface BaseProgramListener
Parameters:
cloned - the object that is being cloned
clone - the new object (the clone of cloned)

whenSerialized

public Wrappee whenSerialized(Wrappee orgObject,
                              SerializedJacObject finalObject)
This method is called when a JAC object is serialized and can parametrize the serialization by filling the finalObject parameter.

IMPORTANT: this method is upcalled only if the serialization is done with a JacObjectOutputStream. To ensure the correct use of this class, only use JacObject.serialize() to serialize an object.

Specified by:
whenSerialized in interface BaseProgramListener
Parameters:
orgObject - the object being serialized
finalObject - the corresponding serialized structure
Returns:
the object being serialized (usually orgObject, but not necessarily).
See Also:
SerializedJacObject, JacObjectOutputStream

whenDeserialized

public Wrappee whenDeserialized(SerializedJacObject orgObject,
                                Wrappee finalObject)
This method is called when a base object is deserialized and can parametrize the deserialization by reading the SerializedJacObject instance to get some extra infos on the aspects.

IMPORTANT: this method is upcalled only if the deserialization is done with a JacObjectInputStream. To ensure the correct use of this class, only use JacObject.deserialize() to deserialize an object.

Specified by:
whenDeserialized in interface BaseProgramListener
Parameters:
orgObject - the corresponding serialized structure
finalObject - the object being deserialized
Returns:
the object being deserialized (usually finalObject but not necessarily)
See Also:
SerializedJacObject, JacObjectInputStream

onExit

public void onExit()
Description copied from interface: BaseProgramListener
This method is upcalled when the system exits.

Specified by:
onExit in interface BaseProgramListener

beforeRunningWrapper

public boolean beforeRunningWrapper(Wrapper wrapper,
                                    String wrappingMethod)
This method is called when a wrapper is going to be applied to a wrappee.

By overloading this method, the aspect component can skip the wrapper, for instance if the current collaboration shows that the wrapper has allready been applied.

If the method returns true, then the wrapper is run, else it is skipped. Default: return true.

Specified by:
beforeRunningWrapper in interface BaseProgramListener
Parameters:
wrapper - the wrapper that is going to be runned
wrappingMethod - the name of the may-be runned wrapping method
Returns:
a boolean that tells if the wrapper has to be runned (true) or not (false)
See Also:
Wrappee, Wrapping.wrap(Wrappee,Wrapper,AbstractMethodItem), Wrapper, Wrapper.proceed(Invocation)

afterRunningWrapper

public void afterRunningWrapper(Wrapper wrapper,
                                String wrappingMethod)
This method is called after the application of the wrapper.

Typically, the aspect component can set an attribute to the collaboration that indicates that the wrapper has been applied (and that can be used by the beforeRunningWrapper method).

Specified by:
afterRunningWrapper in interface BaseProgramListener
Parameters:
wrapper - the wrapper that has just been runned
wrappingMethod - the name of the runned wrapping method
See Also:
Wrappee, Wrapping.wrap(Wrappee,Wrapper,AbstractMethodItem), Wrapper, Wrapper.proceed(Invocation)

afterWrap

public void afterWrap(Wrappee wrappee,
                      Wrapper wrapper,
                      String[] wrapping_methods,
                      String[][] wrapped_methods)
This method is called after a new wrapper wraps a wrappee.

Specified by:
afterWrap in interface BaseProgramListener
See Also:
Wrapper, Wrappee, Wrapping.wrap(Wrappee,Wrapper,AbstractMethodItem)

whenGetObjects

public void whenGetObjects(Collection objects,
                           ClassItem cl)
This method is called when a program gets a set of object from the object repository.

At this step, the aspect can change the returned list so that the program will see the right set of objects (for instance a security aspect may filter this set so that the user will not see the objects s/he is not allowed to see or a persistance aspect may force the load of a set of objects from the storage and add them to the list).

Specified by:
whenGetObjects in interface BaseProgramListener
Parameters:
objects - the returned list (can be modified)
cl - the class that was used by the program to filter its instances (can be null for all the objects)
See Also:
ObjectRepository

whenNameObject

public String whenNameObject(Object object,
                             String name)
Description copied from interface: BaseProgramListener
Upcalled when the naming aspect names an object.

Specified by:
whenNameObject in interface BaseProgramListener
Parameters:
object - the object to name
name - current name of the object or null
Returns:
the proposed name for the object

getNameCounters

public void getNameCounters(Map counters)

updateNameCounters

public void updateNameCounters(Map counters)

whenObjectMiss

public void whenObjectMiss(String name)
This method is upcalled by JAC when an object was seeked into the name repository and was not found.

The reason of this miss can be multiple. For instance, the persistence aspect may have not already load the object from the storage, or the distribution aspect may need to bind to a remote object. Thus, this method allows the aspects to resolve the object.

By default, this method does nothing.

The final choosen name is a contextual attribute called FOUND_OBJECT.

Specified by:
whenObjectMiss in interface BaseProgramListener
Parameters:
name - the name of the object
See Also:
BaseProgramListener.FOUND_OBJECT

whenDeleted

public void whenDeleted(Wrappee object)
Description copied from interface: BaseProgramListener
Upcalled when an object is deleted.

Specified by:
whenDeleted in interface BaseProgramListener
Parameters:
object - the deleted object

whenFree

public void whenFree(Wrappee object)
Description copied from interface: BaseProgramListener
Upcalled when an object is freed from the memory.

Specified by:
whenFree in interface BaseProgramListener
Parameters:
object - the deleted object

afterApplicationStarted

public void afterApplicationStarted()
Description copied from interface: BaseProgramListener
Upcalled after a new application is started on the JAC system.

Specified by:
afterApplicationStarted in interface BaseProgramListener

whenCloseDisplay

public void whenCloseDisplay(Display display)
Description copied from interface: BaseProgramListener
Upcalled when a display is closing.

Specified by:
whenCloseDisplay in interface BaseProgramListener
Parameters:
display - the closing display

whenTopologyChanged

public void whenTopologyChanged()
Description copied from interface: BaseProgramListener
This method is upcalled when a topological change occurs whithin the distributed application.

Specified by:
whenTopologyChanged in interface BaseProgramListener

whenReload

public void whenReload()
Called when the aspect's configuration is reloaded


beforeReload

public void beforeReload()

whenConfigured

public void whenConfigured()
This method should be defined by the programmer when specific actions are needed once the aspect component has be configured.


beforeConfiguration

public void beforeConfiguration()
                         throws Exception
To overload in order to perform some treatements before the configuration.

Throws:
Exception

getName

public String getName()

doRegister

public void doRegister()
This method is upcalled by the system when the aspect is actually registered in the AC manager.

Here it does nothing.


doUnregister

public void doUnregister()
This method is upcalled by the system when the aspect is actually registered in the AC manager.

Here it does nothing.


pointcut

public Pointcut pointcut(String wrappeeExpr,
                         String wrappeeClassExpr,
                         String wrappeeMethodExpr,
                         String wrappingClassName,
                         String exceptionHandler,
                         boolean one2one)
Defines and adds a new method pointcut.

For more details on how to use pointcuts, see the MethodPointcut class.

Parameters:
wrappeeExpr - the wrappee definition that matches the names as defined by the naming aspect
wrappeeClassExpr - the wrappee class expression (matches the fully qualified class name)
wrappeeMethodExpr - the wrappee method expression (matches the full method name as defined by the rtti)
wrappingClassName - the name of the wrapper class
one2one - true if each new wrapped instance corresponds to one different wrapper
See Also:
MethodPointcut

pointcut

public Pointcut pointcut(String wrappeeExpr,
                         String wrappeeClassExpr,
                         String wrappeeMethodExpr,
                         String wrappingClassName,
                         Object[] initParameters,
                         String exceptionHandler,
                         boolean one2One)
Defines and adds a new method pointcut.

For more details on how to use pointcuts, see the MethodPointcut class.

Parameters:
wrappeeExpr - the wrappee definition that matches the names as defined by the naming aspect
wrappeeClassExpr - the wrappee class expression (matches the fully qualified class name)
wrappeeMethodExpr - the wrappee method expression (matches the full method name as defined by the rtti)
wrappingClassName - the name of the wrapper class
initParameters - the initialization parameters of the wrapper (passed to the wrappers constructor that matches the parameters types)
one2One - true if each new wrapped instance corresponds to one different wrapper
See Also:
MethodPointcut

pointcut

public Pointcut pointcut(String wrappeeExpr,
                         String wrappeeClassExpr,
                         String wrappeeMethodExpr,
                         String wrappingClassName,
                         String hostExpr,
                         String exceptionHandler,
                         boolean one2One)
Defines and adds a new localized method pointcut.

For more details on how to use pointcuts, see the MethodPointcut class.

Parameters:
wrappeeExpr - the wrappee definition that matches the names as defined by the naming aspect
wrappeeClassExpr - the wrappee class expression (matches the fully qualified class name)
wrappeeMethodExpr - the wrappee method expression (matches the full method name as defined by the rtti)
wrappingClassName - the name of the wrapper class
hostExpr - a regular expression that macthes the hosts where the pointcut has to be applied (if null or empty string, default is ".*" which means that the pointcut will be applied on all the hosts)
one2One - true if each new wrapped instance corresponds to one different wrapper
See Also:
MethodPointcut

pointcut

public Pointcut pointcut(String wrappeeExpr,
                         String wrappeeClassExpr,
                         String wrappeeMethodExpr,
                         String wrappingClassName,
                         Object[] initParameters,
                         String hostExpr,
                         String exceptionHandler,
                         boolean one2One)
Defines and adds a new localized method pointcut.

For more details on how to use pointcuts, see the MethodPointcut class.

Parameters:
wrappeeExpr - the wrappee definition that matches the names as defined by the naming aspect
wrappeeClassExpr - the wrappee class expression (matches the fully qualified class name)
wrappeeMethodExpr - the wrappee method expression (matches the full method name as defined by the rtti)
wrappingClassName - the name of the wrapper class
initParameters - the initialization parameters of the wrapper (passed to the wrappers constructor that matches the parameters types)
hostExpr - a regular expression that macthes the hosts where the pointcut has to be applied (if null or empty string, default is ".*" which means that the pointcut will be applied on all the hosts)
one2One - true if each new wrapped instance corresponds to one different wrapper
See Also:
MethodPointcut

pointcut

public Pointcut pointcut(String wrappeeExpr,
                         String wrappeeClassExpr,
                         String wrappeeMethodExpr,
                         Wrapper wrapper,
                         String exceptionHandler)
Defines and adds a new method pointcut.

For more details on how to use pointcuts, see the MethodPointcut class.

Parameters:
wrappeeExpr - the wrappee definition that matches the names as defined by the naming aspect
wrappeeClassExpr - the wrappee class expression (matches the fully qualified class name)
wrappeeMethodExpr - the wrappee method expression (matches the full method name as defined by the rtti)
wrapper - the wrapper that contains the wrapping method, cannot be null
See Also:
MethodPointcut

pointcut

public Pointcut pointcut(String wrappeeExpr,
                         String wrappeeClassExpr,
                         String wrappeeMethodExpr,
                         Wrapper wrapper,
                         String hostExpr,
                         String exceptionHandler)
Defines and adds a new localized method pointcut.

For more details on how to use pointcuts, see the MethodPointcut class.

Parameters:
wrappeeExpr - the wrappee definition that matches the names as defined by the naming aspect
wrappeeClassExpr - the wrappee class expression (matches the fully qualified class name)
wrappeeMethodExpr - the wrappee method expression (matches the full method name as defined by the rtti)
wrapper - the wrapper that contains the wrapping method, cannot be null
hostExpr - a regular expression that macthes the hosts where the pointcut has to be applied (if null or empty string, default is ".*" which means that the pointcut will be applied on all the hosts)
See Also:
MethodPointcut

pointcut

public Pointcut pointcut(String wrappeeExpr,
                         String wrappeeClassExpr,
                         String methodName,
                         Object[] methodArgs,
                         String exceptionHandler)
Defines and adds a new pointcut that upcalls an aspect method when the matching object is created.

For more details on how to use pointcuts, see the MethodPointcut class.

Parameters:
wrappeeExpr - the wrappee definition that matches the names as defined by the naming aspect
wrappeeClassExpr - the wrappee class expression (matches the fully qualified class name)
methodName - a method of the aspect component to call
methodArgs - the arguments of this methods when called
See Also:
MethodPointcut

pointcut

public Pointcut pointcut(String wrappeeExpr,
                         String wrappeeClassExpr,
                         String methodName,
                         Object[] methodArgs,
                         String hostExpr,
                         String exceptionHandler)
Defines and adds a new localized pointcut that upcalls an aspect method when the matching object is created.

For more details on how to use pointcuts, see the MethodPointcut class.

Parameters:
wrappeeExpr - the wrappee definition that matches the names as defined by the naming aspect
wrappeeClassExpr - the wrappee class expression (matches the fully qualified class name)
methodName - a method of the aspect component to call
methodArgs - the arguments of this methods when called
See Also:
MethodPointcut

setAttribute

public void setAttribute(ClassItem cli,
                         String name,
                         String value)
Generic config method to set an attribute on a class

Parameters:
cli - the class to set an attribute on
name - name of the attribute
value - string value of the attribute

setAttribute

public void setAttribute(FieldItem field,
                         String name,
                         String value)
Generic config method to set an attribute on a class

Parameters:
field - the field to set an attribute on
name - name of the attribute
value - string value of the attribute

setAttribute

public void setAttribute(AbstractMethodItem method,
                         String name,
                         String value)
Generic config method to set an attribute on a method

Parameters:
method - the method to set an attribute on
name - name of the attribute
value - string value of the attribute

attrdef

public final void attrdef(String name,
                          Object value)

attr

public final Object attr(String name)

getBlockKeywords

public Set getBlockKeywords()

getDefaultConfigs

public String[] getDefaultConfigs()
Returns defaults configuration files that must be loaded before the user's configuration


getConfigurationMethods

public Collection getConfigurationMethods()
Returns all the configuration methods of the aspect

Returns:
Collection of MethodItem

getConfigurationMethodsName

public Collection getConfigurationMethodsName()
Returns all the name of the configuration methods of the aspect

Returns:
Collection of String

getConfigurationMethodsName

public List getConfigurationMethodsName(Class firstParamType)
Returns all the configuration methods of the aspect whose first parameter is compatible with a given type.

Parameters:
firstParamType - the type the first parameter must be compatible with
Returns:
a collection of MethodItem with at least one parameter, and whose first parameter can be of type firstParamType or a subclass of firstParamType

isConfigurationMethod

public boolean isConfigurationMethod(Method method)
Tells wether a method is configuration method of this aspect

Parameters:
method -
Returns:
true if the method was a configuration method.

configure

public void configure(String name,
                      String filePath)
Configures this aspect component with a given configuration file.

Parameters:
name - name of the aspect component (informative)
filePath - path to a resource of file containing the configuration

beforeWrappeeInit

public void beforeWrappeeInit(Wrappee wrappee)
Description copied from interface: BaseProgramListener
This method should be called by the GUI system before an object is being created and initialized (but the process is not finished yet).

Then, some aspects should deal differently with this object thant with already created objects (for instance, the GUI aspect should not show the object to other users, or a remote access aspect should disable forwarding.

Specified by:
beforeWrappeeInit in interface BaseProgramListener

afterWrappeeInit

public void afterWrappeeInit(Wrappee wrappee)
Description copied from interface: BaseProgramListener
This method should be called by the GUI system after an object has been created and initialized (tells the other aspects that the object is now regular).

Specified by:
afterWrappeeInit in interface BaseProgramListener

warning

protected void warning(String message)
Issue a warning containing the file, line number and configuration method name (if available)

Parameters:
message - the warning message to print
See Also:
error(String)

error

protected void error(String message)
Issue an error containing the file, line number and configuration method name (if available)

Parameters:
message - the warning message to print
See Also:
warning(String)

getAC

protected AspectComponent getAC(String name)
Returns a named aspect component in the same application