org.objectweb.jac.core
Class CompositeAspectComponent

java.lang.Object
  |
  +--org.objectweb.jac.core.AspectComponent
        |
        +--org.objectweb.jac.core.CompositeAspectComponent
All Implemented Interfaces:
BaseProgramListener, Serializable

public class CompositeAspectComponent
extends AspectComponent

This class is the root class for the composite aspect components defined by JAC aspect programmers.

A composite aspect is a kind of facade that factorizes and simplifies the use of a set of sub-aspects (called chidren aspects). For instance, the user and authentication aspects of JAC can be factorized in on unique aspect in order to simplify the use (factorization) and to eliminate useless dependencies.

Author:
Renaud Pawlak
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.objectweb.jac.core.AspectComponent
application, blockKeywords, cr, currentConfigMethod, currentImports, firstCall, NOT_SHARED, SHARED, startWeavingCCount, startWeavingCount, startWeavingMethod, startWeavingType, systemListener, wrappers
 
Fields inherited from interface org.objectweb.jac.core.BaseProgramListener
FOUND_OBJECT
 
Constructor Summary
CompositeAspectComponent()
          The default constructor.
 
Method Summary
protected  void addChild(String name, Class acClass)
          Declares a new child for this composite (should be invoked from the constructor).
 void beforeConfiguration()
          This method is upcalled by the system when the composite aspect is about to be configured.
protected  void disableDefaultConfigs(String childName)
          Invoke this method in the constructor in order to disable the application of the default configuration for a given child aspect component.
 void doRegister()
          This method is upcalled by the system when the composite aspect is actually registered in the AC manager.
 void doUnregister()
          This method is upcalled by the system when the composite aspect is actually unregistered in the AC manager.
protected  AspectComponent getChild(String name)
          Returns a child aspect component from its name.
protected  String getChildActualName(String name)
          Returns the internal name of a child (applicationName.name).
protected  String getChildRegisteredName(String name)
          Returns the internal name of a child, as it is registered in the JAC ACManager.
protected  void removeChild(String name)
          Removes a child for this composite (do not use unless you know what you are doing).
 
Methods inherited from class org.objectweb.jac.core.AspectComponent
addWrapper, afterApplicationStarted, afterRunningWrapper, afterWrap, afterWrappeeInit, attr, attrdef, beforeReload, beforeRunningWrapper, beforeWrappeeInit, configure, defines, defineTimer, error, getAC, getApplication, getBlockKeywords, getConfigurationMethods, getConfigurationMethodsName, getConfigurationMethodsName, getDefaultConfigs, getName, getNameCounters, getWrappers, init, isConfigurationMethod, isSystemListener, onExit, pointcut, pointcut, pointcut, pointcut, pointcut, pointcut, pointcut, pointcut, setApplication, setAttribute, setAttribute, setAttribute, setSystemListener, simulateUsingNewInstance, unweave, unwrapAll, updateNameCounters, warning, weave, whenClone, whenCloseDisplay, whenConfigured, whenDeleted, whenDeserialized, whenFree, whenGetObjects, whenNameObject, whenObjectMiss, whenReload, whenRemoteInstantiation, whenSerialized, whenTopologyChanged, whenUsingNewClass, whenUsingNewInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompositeAspectComponent

public CompositeAspectComponent()
The default constructor.

Should be redefined be the programmer in order to declare the child aspects.

See Also:
addChild(String,Class)
Method Detail

disableDefaultConfigs

protected void disableDefaultConfigs(String childName)
Invoke this method in the constructor in order to disable the application of the default configuration for a given child aspect component.

Note that the default configs are defined by the getDefaultConfig method. By default, all the children's default configs are applied.


addChild

protected void addChild(String name,
                        Class acClass)
Declares a new child for this composite (should be invoked from the constructor).

Parameters:
name - the child's name (can be any unique id)
acClass - the aspect component's class of the child

removeChild

protected void removeChild(String name)
Removes a child for this composite (do not use unless you know what you are doing).

Parameters:
name - the child's name as given in the addChild(String,Class) method

getChild

protected AspectComponent getChild(String name)
Returns a child aspect component from its name.

This method should be used in configuration methods of the composite to delegate the configuration to the child aspects.


getChildActualName

protected String getChildActualName(String name)
Returns the internal name of a child (applicationName.name).

Parameters:
name - the child's name

getChildRegisteredName

protected String getChildRegisteredName(String name)
Returns the internal name of a child, as it is registered in the JAC ACManager.

Note that this method will return null if the child is not yet registered in the AC manager. This is the case at configuration time. Thus, getChildActualName(String) should be prefered.

Parameters:
name - the child's name

beforeConfiguration

public void beforeConfiguration()
                         throws Exception
This method is upcalled by the system when the composite aspect is about to be configured.

This method instantiates all the declared children (with addChild(String,Class) method.

Overrides:
beforeConfiguration in class AspectComponent
Exception

doRegister

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

It symply registers all the children with the right names.

Overrides:
doRegister in class AspectComponent

doUnregister

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

It symply unregisters all the children.

Overrides:
doUnregister in class AspectComponent