Information Technology Reference
In-Depth Information
below by binding the one in-path to the one start point, one of the out-paths to
one of the end points, and the other out-path to the other end point.
By keeping advice and pointcut expressions on separate UCMs (advice maps
and pointcut maps, respectively), it is possible to reuse advice and pointcut
expressions separately. For example, the same advice can be reused in a differ-
ent UCM model with different pointcut maps plugged into the pointcut stub.
Similarly, the same pointcut map can be used for different aspects.
Pointcut
P
Pointcut
endReturning
endReturning
startBefore
startBefore
[success]
Advice.after_returning
[false]
[success]
P
Advice.before
[true]
[fail]
[fail]
Advice.after_throwing
endThrowing
endThrowing
Advice.around
Fig. 13. Pointcut stub
The two advice maps in Fig. 13 show how advice and pointcuts are linked to
each other. The requirements engineer can understand in one glance the rela-
tionship of the advice to the base system due to the visual representation. For
example, the left map shows advice being executed before and after the point-
cuts specified on the pointcut maps bound to the pointcut stub. The right map
shows very clearly that advice is being executed around the specified pointcuts,
allowing a situation to be modeled which occurs frequently in aspect-oriented
modeling. The aspect in the right map overrides the behavior of the base. In
more detail, the left map shows that before the specified pointcuts the responsi-
bility Advice.before is executed and after the specified pointcuts the responsibility
Advice.after returning is executed in the success case and the responsibility Ad-
vice.after throwing is executed in the fail case. The right map shows that the path
elements defined by the specified pointcuts are never executed in the composed
system because the [false] branch is never taken. The [true] branch is always
taken and therefore the responsibility Advice.around is executed instead of the
path elements matched by the pointcuts.
Note that many more composition rules (such as concurrency, loops, and
interleaving) than the ones mentioned here (before/after/around) can easily be
modeled with AoUCM (see [31] for details).
There are a number of observations to be pointed out regarding the use of the
pointcut stub. First, the number of in-paths and out-paths for the pointcut stub
is flexible. This makes it possible to take into account path nodes with more
than one before or after location (e.g., stubs, forks, and joins — see Sect. 3.1).
Advice can be specified individually for such locations. Second, the pointcut stub
is a dynamic stub which may contain multiple plug-in maps, each of which may
describe a different pointcut expression. Therefore, as many different pointcut
expressions as necessary can be described for the aspect. Finally, each advice
Search WWH ::




Custom Search