Introduction


Application scale aspects affect significant areas of your software and are often characteristics of your software that affect many, even all, of the classes within your application. This chapter focuses on a set of these system scale cross-cutting concerns where AspectJ can be used to implement their characteristics better. The recipes in this chapter can be split into two categories: passive and active aspects.

Passive aspects are interceptors, or observers, or your application's logic and do not affect or feedback into this logic in an obvious way. One of the key characteristics of a passive aspect is that it will usually only contain before( ) and after( ) advice, and if around( ) advice is used, it will still always call the proceed( ) method.

Active aspects affect the application to which they are applied in ways such as changing logical paths through the software. Although both aspects affect your application's code when they are compiled and woven, active aspects will change the behavior of your application. Active aspects often contain around( ) advice that may not call the proceed( ) method and can override the triggering join point that was part of the original business logic.

This chapter begins by showing two passive application scale aspects that implement tracing and logging . Tracing and logging are almost the "Hello World" use cases for AspectJ, partially because they are good examples of flexible and modularized application-wide cross-cutting behavior. Although tracing and logging are not the most interesting of aspects, they are powerful examples of passive aspect implementation in AspectJ.

In the category of more active aspects, this chapter ends by showing how an application's properties can be managed better by modularizing how they are stored and how they are applied and updated using aspects. A property management aspect interacts directly with any classes that use those properties and can monitor the internals of those classes to register when a property has been updated.



AspectJ Cookbook
Aspectj Cookbook
ISBN: 0596006543
EAN: 2147483647
Year: 2006
Pages: 203
Authors: Russ Miles

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net