The AspectJ AOP Engine

In AspectJ, advice is bound to pointcuts in special constructs to the Java programming language contributed by the AspectJ compiler known as aspects. An aspect is defined much like a Java class, except that the keyword aspect is used in place of class or interface and aspects support the definition of pointcut expressions using the pointcut keyword. (For more information on the AspectJ language, see the Eclipse AspectJ project.)

The ACTF Java Validation Component is packaged with a base AspectJ aspect, org.eclipse.actf.validation.javapp.aspects.AspectJValidationAspect. This aspect contains the abstract pointcut definitions, which should be over-ridden by clients. The instantiationPointcut expression is used to capture all instantiations of GUI components so that creation contexts can be generated whereas the validationPointcut expression is used to denote those points in an application at which validations are to be performed.

Note: Notice that the superclass of org.eclipse.actf.validation.javapp.aspects.AspectJValidationAspect is org.eclipse.actf.validation.javapp.aspects.InterJvmValidationAspect, which is the type of all aspects to be used during inter-JVM (or External) validations. On the other hand, org.eclipse.actf.validation.javapp.aspects.IntraJvmValidationAspect, which is used for all intra-JVM ( or Internal) validations, is itself an AspectJ aspect. This inconsistency will be fixed in a future release. Clients are advised to subclass org.eclipse.actf.validation.javapp.aspects.AspectJValidationAspect. The superclass of all aspect-related classes in ACTF, corg.eclipse.actf.validation.javapp.aspects.BaseValidationAspect, contains the mechanics of accessibility validation that can be invoked by subclassing aspects. See the ACTF Validation API documentation for more details.

For example, consider the following pointcut definition from org.eclipse.actf.validation.javapp.aspects.SwingAspectJValidationAspect:


pointcut validationPointcut(Object component):
  target(Component) && target(component)
    && (call(public void *.setVisible(boolean)) || call(public void *.show()));

Here, we capture all executions of java.awt.Component.setVisible and java.awt.Component.show. The target object is captured in the 'component' parameter and passed to the validation advice, found in the AspectJValidationAspect class, whose advice can also be overwritten.