AspectPascal Weaver based on the GenAWeave Framework
The metamodel and various examples (including ATL specifications, intermediate models, generated RSL code) of the AspectPascal Weaver is organized as follows:
The metamodel for the AspectPascal Weaver is presented below. The metamodel is extended from the generic aspect metamodel (GAspect) and captures the commonalities that individual aspect weavers share among themselves.The part beneath the dotted rectangle shows the shared features.
AspectPascal Metamodel
The complete KM3 and TCS specification for AspectPascal is hyperlinked below.
[AspectPascal KM3 spec]   
[AspectPascal TCS spec]   
ProgressMeter Updating Example
|
The first example presented here is concerned with updating a processing dialog meter for a tool that manages a database schema. The updating of the progress meter represents a crosscutting concern because the code to increment the meter is spread across the methods that perform much of the functionality (e.g., deleting database triggers, compiling new stored procedures, and other evolution tasks). Lines 2-8 in the listing below contain a redundant code fragment that appears in 62 different places of the Schema Manager. This code is necessary to update the processing dialog after each database evolution task is completed. Technically, this happens after every call to the predefined Inc procedure.
Crosscutting in Progress Meter Updating
The following listing shows the ProgressMeter aspect that encapsulates the crosscutting concern shown above. The pointcut method_Inc captures all calls to procedure Increment. The advice code is weaved in once this procedure call join point is reached.
Aspect to capture Progress Meter Updating
However, it is the RSL that does the actual weaving and is generated using ATL transformation rules. The aspect model to represent the aspect program is shown below.
Aspect Model (Internal Representation of Progress Meter aspect)
The ATL transformation (a call join point) required to transform this Aspect Model to RSL Model is available below: Complete ATL Specification for Translating Primitive Call ExpressionThe ATL transformation translates the source aspect model to a target RSL model (conforming to RSL metamodel). The final RSL code is then extracted from the RSL model and processed by DMS to do the actual weaving. ALL the generated intermediate artifacts are internal to the system and are only shown here to describe the transformation process. However, the only artifact that is required as input is the aspect program.
|
Database Error Handler Example
|
Often, a commercial application must support databases from several different vendors (e.g., Oracle, Interbase, and SQL Server). In such a situation, exception handling of database errors is a major difficulty because each database has its own way of raising exceptions. The same conceptual error (e.g., a null value in a required field) may be raised in completely different ways with dissimilar error codes. Moreover, the exception handling code must be thread-safe because numerous clients may access the database at the same time. The addition of this concurrency concern resulted in a manual invasive change to over 20 classes in the Schema Manager utility. An example error handler is shown below.
Crosscutting in Database Error Handler Synchronization
In this listing, lines 3-4 and 6-8 represent this single synchronization concern. Furthermore, this exact code is replicated in all of the entry and exit points of each type of error handler. Line 5 represents the actual database error handing code which is omitted for brevity.
The Aspect program, the aspect model, the ATL specification for translating the Aspect model to RSL model and generated RSL code are all listed below for the above example.
|
Loop Example
|
According to our definition, the join point for a loop has the following signature:
(init::[val], exit::[val], stride::[val]).
Init specifies the loop initialization value, exit specifies the loop termination value and stride specifies the loop increment counter. An aspect for adding timing information within the body of an ObjectPascal function named SortByResourceIDClick and execution of for loops with an initialization value of 1 and exit condition any (*) is shown below. The aspect will match all for loops with the given signature and within the body of the named function.
Aspect to monitor Loops
Aspect Model (Internal Representation of Loop aspect)
The ATL specification for translating this Aspect model to a RSL model and generated RSL code are all listed below for the above example.
|
General Information
@Copyright 2008 - All Rights Reserved
Any information provided in this web page is copyright by the persons mentioned above, also
any source available for download is provided "as is" and any express or implied warranties are disclaimed
|