Information Technology Reference
In-Depth Information
// Do nothing and continue for loop (this gives the next permutation a
// chance).
endcatch
endforeach
// permutation
if
finalMappingsList == Ø
then
throw new
NoMatchFound()
endif
return
finalMappingsList
end
// match
B
Composition Algorithm
A high level summary of the algorithm follows, showing how one aspect is woven
into the base model. The result of the algorithm is a list of UCMs that were changed
by the composition of the given aspect. In addition to the operation
composeAspect
,
threemoreoperationswereimplemented:
removePointcutStubs
,
scan
,and
insert-
Stub
. Descriptions of these operations can be found in the comments below.
Operation:
composeAspect
Input:
Aspect aspect, UCMmodel baseUCM, MappingsList mappingsList
Output:
UCMmapList
Exception:
MalformedAdviceMap, CompositionNotRequired
begin
// composeAspect
UCMmapList updatedMaps = Ø
foreach
UCMadviceMap am
of
aspect
// Removing all pointcut stubs from the advice map results in one or more
// disjoint paths on the advice map. In-paths are replaced by end points.
// Out-paths are replaced by start points. Empty paths are deleted before
// proceeding. For each new start and end point on the advice map, the
// following is created based on mappingsList:
// a) mapping(s) to the base model
// b) reference(s) to the closest path node in the base model with a mapping
// from the pointcut map (not necessary for start/end points mapped to
// named start/end points on pointcut map)
// In the simplest case, there is only one mapping and one reference because,
// there is only one pointcut map that is matched against one base map.
// However, several mappings and references may have to be established
// because one pointcut map may be matched against many base maps and
// also because one pointcut stub may contain several pointcut maps.
// In addition, a path that contains both (new start and end points) is marked
// as around advice. An around advice that contains a false branch leading
// directly to a new end point is marked as strong around advice.
MappedUCMmap disjointPaths = am.removePointcutStubs(mappingsList)
// Only consider this advice map if it was possible to match the pointcut
// expression (in this case a mapping to the base model exists)
if
disjointPaths.getNumberOfMappedPathNodes()
>
0
then
Search WWH ::
Custom Search