1 / 9

Generating Aspect Code from Models

Generating Aspect Code from Models. 1 Jeff Gray, 2 Ted Bapty, 2 Sandeep Neema, 2 Aniruddha Gokhale, 2 Balachandran Natarajan 1 University of Alabama at Birmingham (UAB) 2 Vanderbilt University/ISIS. OOPSLA 2002 Workshop on Generative Techniques in the Context of the MDA

aduck
Download Presentation

Generating Aspect Code from Models

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Generating Aspect Code from Models 1Jeff Gray, 2Ted Bapty, 2Sandeep Neema, 2Aniruddha Gokhale, 2Balachandran Natarajan 1University of Alabama at Birmingham (UAB) 2Vanderbilt University/ISIS OOPSLA 2002 Workshop on Generative Techniques in the Context of the MDA November 5th, 2002 Seattle, WA This work is supported by the DARPA IXO, under the Program Composition for Embedded Systems (PCES) program, Contract Number: F33615-00-C-1695

  2. An argument for generating aspect code from models • Often, generators have knowledge of pre-existing libraries of components • Generation of “glue code” (high reuse) vs. generation of whole system (little reuse) • If not originally templatized, component library can become closed to modification during generation • Granularity of reuse at the interface level; internal implementation of method bodies not open for change • Customizing the component to monitor/adapt to QoS requirements specified in the model may not be possible • An AOP approach could offer some benefit, whereby the points of customization are weaved into library components

  3. Component Library Aspect Library Concretizing aspects AspectJ Generated Concrete Aspects

  4. Component modeling in GME

  5. <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE project SYSTEM "mga.dtd"> <project guid="{00000000-0000-0000-0000-000000000000}" cdate="Thu Nov 30 14:15:40 2000" mdate="Thu Nov 30 14:15:40 2000" metaguid="{00000000-0000-0000-0000-000000000000}" metaname="PCES"> <name>bit1</name> <comment></comment> <author></author> <folder id="id-006a-00000001" kind="RootFolder"> <name>bit1</name> <folder id="id-006a-00000002" kind="Structural"> <name>Structural</name> <model id="id-0065-00000001" kind="ProcessingCompound"> <name>ProcessingCompound</name> <attribute kind="Description" status="meta"> <value></value> </attribute> <atom id="id-0066-00000007" kind="Attribute" role="Attrib"> <name>GatesPerBit</name> <regnode name="PartRegs"> <value></value> </regnode> Eager Eager Eager Sensor Compute Position Weapon Release Aspect Code Generation Processor #1 Lazy Lazy UpdateMap LocDisplay Processor #2 Two levels of weaving Aspect Model Weaving Aspect Code Weaving

  6. Abstract Component public abstract class Component{ public abstract void call_back(); public abstract int get_data(); public abstract void init(); public abstract void data_retrieve(); public abstract void compute(); public abstract void notify_availability(); protected int _data; }

  7. Stubbed LocDisplay library component public class LocDisplay extends Component{ public void call_back(){ System.out.println("This was LocDisplay.call_back"); }; public int get_data() { return _data; }; public void init() { }; public void data_retrieve() { System.out.println("This is LocDisplay.data_retrieve!"); UpdateMap map = new UpdateMap(); map.get_data(); }; public void compute() { System.out.println("This is LocDisplay.compute!"); }; public void notify_availability() { System.out.println("This is LocDisplay.notify_availability!");}; }

  8. Lazy abstract library aspect abstract aspect Lazy { abstract pointcut call_back(Component c); abstract pointcut get_data(Component c); after(Component c): call_back(c) { System.out.println("after:call_back (Lazy)!"); c.notify_availability(); } before(Component c): get_data(c) { System.out.println("before:get_data (Lazy)!"); c.data_retrieve(); c.compute(); } }

  9. Generated code for concrete aspect aspect LocDisplayLazy extends Lazy { pointcut call_back(Component c) : this(c) && executions(void LocDisplay.call_back(..)); pointcut get_data(Component c) : this(c) && executions(int LocDisplay.get_data(..)); }

More Related