Presentation is loading. Please wait.

Presentation is loading. Please wait.

Generating Aspect Code from Models OOPSLA 2002 Workshop on Generative Techniques in the Context of the MDA November 5 th, 2002 Seattle, WA This work is.

Similar presentations


Presentation on theme: "Generating Aspect Code from Models OOPSLA 2002 Workshop on Generative Techniques in the Context of the MDA November 5 th, 2002 Seattle, WA This work is."— Presentation transcript:

1 Generating Aspect Code from Models OOPSLA 2002 Workshop on Generative Techniques in the Context of the MDA November 5 th, 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 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

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 Concretizing aspects AspectJ Component LibraryAspect Library Generated Concrete Aspects

4 Component modeling in GME

5 Two levels of weaving Weapon Release Sensor LocDisplay Compute Position Processor #1 Eager UpdateMap Eager Lazy bit1 bit1 Structural ProcessingCompound GatesPerBit Aspect Code Generation Processor #2 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(..)); }


Download ppt "Generating Aspect Code from Models OOPSLA 2002 Workshop on Generative Techniques in the Context of the MDA November 5 th, 2002 Seattle, WA This work is."

Similar presentations


Ads by Google