org.objectweb.jac.aspects.tracing
Class TracingAC

java.lang.Object
  |
  +--org.objectweb.jac.core.AspectComponent
        |
        +--org.objectweb.jac.aspects.tracing.TracingAC
All Implemented Interfaces:
BaseProgramListener, Serializable, TracingConf

public class TracingAC
extends AspectComponent
implements TracingConf

This sample aspect component traces the calls on all the objects of the program.

To be active this aspect component must be configured with the addTrace method.

See Also:
VerboseWrapper, 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
TracingAC()
           
 
Method Summary
 void addCounter(String name, String wrappeeExpr, String wrappeeClassExpr, String wrappeeMethodExpr)
          This configuration method makes all the matching methods invocations to be counted.
 void addNamedTrace(String wrappeeExpr, String wrappeeClassExpr, String wrappeeMethodExpr)
          This configuration method makes a method call to be traced.
 void addOptimizedCounter(String name, String wrappeeExpr, String wrappeeClassExpr, String wrappeeMethodExpr, String fieldName, String argNumber)
          This configuration method makes all the matching methods invocations to be counted in an optimized fashion.
 void addRecording(String wrappeeExpr, String wrappeeClassExpr, String wrappeeMethodExpr)
          This configuration method creates a new recording on a set of methods.
 void addStackTrace(String wrappeeExpr, String wrappeeClassExpr, String wrappeeMethodExpr)
          This configuration method makes a method call to be traced by a verbose wrapper.
 void addTrace(String wrappeeExpr, String wrappeeClassExpr, String wrappeeMethodExpr)
          This configuration method makes a method call to be traced by a verbose wrapper.
 void addWrappersTrace(String wrappeeExpr, String wrappeeClassExpr, String wrappeeMethodExpr)
          This configuration method makes a method call to be traced by a verbose wrapper.
 boolean beforeRunningWrapper(Wrapper wrapper, String wrappingMethod)
          Skips the counting wrapper if this call is part of a global conting optimization performed by an OptimizedCountingWrapper
 
Methods inherited from class org.objectweb.jac.core.AspectComponent
addWrapper, afterApplicationStarted, afterRunningWrapper, afterWrap, afterWrappeeInit, attr, attrdef, beforeConfiguration, beforeReload, beforeWrappeeInit, configure, defines, defineTimer, doRegister, doUnregister, 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

TracingAC

public TracingAC()
Method Detail

addTrace

public void addTrace(String wrappeeExpr,
                     String wrappeeClassExpr,
                     String wrappeeMethodExpr)
Description copied from interface: TracingConf
This configuration method makes a method call to be traced by a verbose wrapper. By default no method is verbose.

Specified by:
addTrace in interface TracingConf
Parameters:
wrappeeExpr - a regular expression that matches the wrappee(s) name(s) that contain the method(s) to be traced
wrappeeClassExpr - a regular expression that matches the wrappee(s) class(es) name(s) that contain the method(s) to be traced
wrappeeMethodExpr - a regular expression that matches the method(s) to be traced (within the classes or objects denoted by the previous parameters)
See Also:
VerboseWrapper

addNamedTrace

public void addNamedTrace(String wrappeeExpr,
                          String wrappeeClassExpr,
                          String wrappeeMethodExpr)
Description copied from interface: TracingConf
This configuration method makes a method call to be traced. The names of parameters are printed if configured by the Gui aspect.

Specified by:
addNamedTrace in interface TracingConf
Parameters:
wrappeeExpr - a regular expression that matches the wrappee(s) name(s) that contain the method(s) to be traced
wrappeeClassExpr - a regular expression that matches the wrappee(s) class(es) name(s) that contain the method(s) to be traced
wrappeeMethodExpr - a regular expression that matches the method(s) to be traced (within the classes or objects denoted by the previous parameters)
See Also:
VerboseWrapper

addStackTrace

public void addStackTrace(String wrappeeExpr,
                          String wrappeeClassExpr,
                          String wrappeeMethodExpr)
Description copied from interface: TracingConf
This configuration method makes a method call to be traced by a verbose wrapper. For each call, the stack is dumped. By default no method is verbose.

Specified by:
addStackTrace in interface TracingConf
Parameters:
wrappeeExpr - a regular expression that matches the wrappee(s) name(s) that contain the method(s) to be traced
wrappeeClassExpr - a regular expression that matches the wrappee(s) class(es) name(s) that contain the method(s) to be traced
wrappeeMethodExpr - a regular expression that matches the method(s) to be traced (within the classes or objects denoted by the previous parameters)
See Also:
VerboseWrapper

addWrappersTrace

public void addWrappersTrace(String wrappeeExpr,
                             String wrappeeClassExpr,
                             String wrappeeMethodExpr)
Description copied from interface: TracingConf
This configuration method makes a method call to be traced by a verbose wrapper. For each call, the wrapping methods are printed. By default no method is verbose.

Specified by:
addWrappersTrace in interface TracingConf
Parameters:
wrappeeExpr - a regular expression that matches the wrappee(s) name(s) that contain the method(s) to be traced
wrappeeClassExpr - a regular expression that matches the wrappee(s) class(es) name(s) that contain the method(s) to be traced
wrappeeMethodExpr - a regular expression that matches the method(s) to be traced (within the classes or objects denoted by the previous parameters)
See Also:
VerboseWrapper

addRecording

public void addRecording(String wrappeeExpr,
                         String wrappeeClassExpr,
                         String wrappeeMethodExpr)
Description copied from interface: TracingConf
This configuration method creates a new recording on a set of methods.

Specified by:
addRecording in interface TracingConf
Parameters:
wrappeeExpr - a pointcut expression that matches the wrappee(s) name(s) that contain the method(s) to be traced
wrappeeClassExpr - a pointcut expression that matches the wrappee(s) class(es) name(s) that contain the method(s) to be traced
wrappeeMethodExpr - a pointcut expression that matches the method(s) to be traced (within the classes or objects denoted by the previous parameters)

addCounter

public void addCounter(String name,
                       String wrappeeExpr,
                       String wrappeeClassExpr,
                       String wrappeeMethodExpr)
Description copied from interface: TracingConf
This configuration method makes all the matching methods invocations to be counted.

Specified by:
addCounter in interface TracingConf
Parameters:
name - the name of the counter that is used (can be shared)
wrappeeExpr - a regular expression that matches the wrappee(s) name(s) that contain the method(s) to be counted
wrappeeClassExpr - a regular expression that matches the wrappee(s) class(es) name(s) that contain the method(s) to be counted
wrappeeMethodExpr - a regular expression that matches the method(s) to be counted (within the classes or objects denoted by the previous parameters)
See Also:
SimpleCountingWrapper

addOptimizedCounter

public void addOptimizedCounter(String name,
                                String wrappeeExpr,
                                String wrappeeClassExpr,
                                String wrappeeMethodExpr,
                                String fieldName,
                                String argNumber)
Description copied from interface: TracingConf
This configuration method makes all the matching methods invocations to be counted in an optimized fashion.

Specified by:
addOptimizedCounter in interface TracingConf
Parameters:
name - the name of the counter that is used (can be shared)
wrappeeExpr - a regular expression that matches the wrappee(s) name(s) that contain the method(s) to be counted
wrappeeClassExpr - a regular expression that matches the wrappee(s) class(es) name(s) that contain the method(s) to be counted
wrappeeMethodExpr - a regular expression that matches the method(s) to be counted (within the classes or objects denoted by the previous parameters)
fieldName - the name of the field that is used to optimize the counting (the counter is incremented with its value), an empty string has no effect
argNumber - the argument's index that is used to optimize the counting (the counter is incremented with its value), an empty string has no effect
See Also:
OptimizedCountingWrapper

beforeRunningWrapper

public boolean beforeRunningWrapper(Wrapper wrapper,
                                    String wrappingMethod)
Skips the counting wrapper if this call is part of a global conting optimization performed by an OptimizedCountingWrapper

Specified by:
beforeRunningWrapper in interface BaseProgramListener
Overrides:
beforeRunningWrapper in class AspectComponent
Parameters:
wrapper - the wrapper
wrappingMethod - the wrapping method that is about to be run
Returns:
a boolean that tells if the wrapper has to be runned (true) or not (false)
See Also:
OptimizedCountingWrapper