Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 An AOP Implementation Framework for Extending Join Point Models Naoyasu Ubayashi(Kyushu Institute of Technology, Japan) Hidehiko Masuhara(University.

Similar presentations


Presentation on theme: "1 An AOP Implementation Framework for Extending Join Point Models Naoyasu Ubayashi(Kyushu Institute of Technology, Japan) Hidehiko Masuhara(University."— Presentation transcript:

1 1 An AOP Implementation Framework for Extending Join Point Models Naoyasu Ubayashi(Kyushu Institute of Technology, Japan) Hidehiko Masuhara(University of Tokyo, Japan) Tetsuo Tamai(University of Tokyo, Japan) June 15, 2004 RAM-SE’04 ECOOP 2004 Workshop on Reflection, AOP and Meta- Data for Software Evolution

2 2 Overview 1. Motivation -- Join Point Model evolution 2. MOPs for Join Point Model extensions 3. Towards reflection for AOP 4. Related work 5. Conclusion

3 3 1. Motivation

4 4 Software evolution in AOP AOP is effective in unanticipated software evolution because crosscutting concerns can be added or removed without making invasive modifications to original programs. core concerns added removed core concerns core concerns concern space evolution crosscutting concerns

5 5 But, … Software evolution would be restricted if new crosscutting concerns cannot be described with the existing JPMs (join point models). core concerns new type of crosscutting concerns cannot be added core concerns core concerns concern space evolution crosscutting concerns

6 6 JPM --- Essence of AOP Join points Means of identifying the join points (pointcut) Means of raising effects at the join points (advice)

7 7 When do we need new kinds of JPMs? We want to extend the existing JPMs slightly in order to adapt to application-specific purposes. We want to use more than one JPM simultaneously.

8 8 Motivating example aspect ProtocolCheck { pointcut someProtocol(): call(void *.someMethod*()) ; before() : someProtocol() { code for logging } } Version 1 classA someMethodA() aspect ProtocolCheck AspectJ JPM classB someMethodB() classC someMethodC()

9 9 Motivating example (cont.) aspect ProtocolCheck { pointcut someProtocol(): call(void *.someMethod*()) ; before() : someProtocol() { code for logging } pointcut someProtocolError(): !calling-sequence(void *.{someMethodA(), someMethodB(), someMethodC()}) ; before() : someProtocolError() { code for error handling } } Version 2 AspectJ JPM classA someMethodA() aspect ProtocolCheck classB someMethodB() classC someMethodC() we want to add a checking for calling sequence (someMethodA -> someMethodB -> someMethodC) But, we cannot add a new pointcut because we cannot extend AspectJ JPM. But, we cannot add a new pointcut because we cannot extend AspectJ JPM.

10 10 Current AOP languages … Each of current AOP languages is based on a few fixed set of JPMs. Many different JPMs have been proposed, and they are still evolving so that they better modularize various crosscutting concerns. There are crosscutting concerns that may not be modularized with current JPMs.

11 11 Our research Goal: Computational Reflection for AOP Base level (program based on JPM) Meta level (implementation of JPM) reify reflect MOPs for JPM extensions This talk focuses on MOPs for JPM extensions (our initial result). We developed X-ASB (eXtensible Aspect Sand Box), a framework for rapid-prototyping new JPMs.

12 12 2. MOPs for Join Point Model extensions

13 13 eval-program MOPs for JPM extensions [Program execution model] policy of program execution (AspectJ-like policy, traversal policy, etc.) [Join point model] join point pointcut (evaluator for selecting join point) advice (computation at a join point) lookup-A-ID lookup-B-ID effect-A A-ID effect-B B-ID MOP B - program X - computation or program X JP - join point ID A - means of identifying ID B EFF A EFF B - means of effecting META - weaving parameter register-pcd register-jp AOP Language Model Masuhara & Kiczales model [ECOOP 2003]

14 14 Steps for modular weaver construction Step 1: define kinds of join points Step 2: define kinds of pointcuts Step 3: define a body of weaver, and computation at join points

15 15 Construction of AspectJ-like weaver eval-program register-jp register-pcd lookup-A-ID lookup-B-ID effect-A effect-B call-method join point program execution tree weaver MOPs Weaver [written in Scheme] (define weaver (lambda (pgm meta) (register-jp) (register-pcd) (eval-program pgm meta))) Step 1: define kinds of join points (define register-jp (lambda () (register-one-jp 'call-method generate-call-jp))) Step 2: define kinds of pointcuts (define register-pcd (lambda () (register-one-pcd 'call call-pcd?))) Step 3: define a body of weaver, and computation at join points (define call-method (lambda (mname obj args) (computation-at-jp ((lookup-jp-generator 'call-method) mname obj args) null))) (define computation-at-jp (lambda (jp param) (let* ((A-ID (lookup-A-ID jp param)) (B-ID (lookup-B-ID jp param))) (effect-B B-ID jp (lambda () (effect-A A-ID jp param)) param))))

16 16 Extension of AspectJ-like weaver (define register-pcd (lambda () (register-one-pcd 'calling-sequence calling-sequence-pcd?))) A new pointcut designator (calling-sequence) can be added to AspectJ-like weaver eval-program register-jp register-pcd lookup-A-ID lookup-B-ID effect-A effect-B call-method join point program execution tree weaver MOPs

17 17 3. Towards reflection for AOP

18 18 Evolution of JPMs Evolution by language developers Evolution by application developers The effectiveness in software evolution would be restricted if language developers must extend JPMs whenever application programmers need new kinds of JPMs. Reflection for AOP It would be better for application programmers to be able to add new JPMs using MOPs within the base language.

19 19 Reflection in X-ASB (class sample-protocol-error-detection object (method int m1 () (...)) (method int m2 () (...)) (after (calling-sequence (not (list 'm1 'm2 'm3))) (write 'invalid-calling-sequence) (newline))) (class sample-calling-sequence object (method void register-pcd () (meta register-one-pcd 'calling-sequence 'calling-sequence-pcd?) (super register-pcd)) (method boolean calling-sequence-pcd?...)) Scheme-based language Base level Meta level --- power of reflection is still limited

20 20 4. Related Work

21 21 Related Work XAspect [Shonle, Lieberherr, and Shah, 2003]: extensible domain-specific AOP language that adopts plug-in mechanisms. Adding a new plug-in module, we can use a new kind of aspect-oriented facility. Josh [Chiba and Nakagawa, 2004]: open weaver that can define a new pointcut construct as a boolean function. Using X-ASB, we can add not only new pointcut constructs but also new kinds of join points and advice.

22 22 5. Conclusion

23 23 Conclusion We proposed mechanisms for extending JPMs in order to support unanticipated software evolution. Using X-ASB, we can introduce new kinds of JPMs when we face new kinds of crosscutting concerns that cannot be handled by existing JPMs.


Download ppt "1 An AOP Implementation Framework for Extending Join Point Models Naoyasu Ubayashi(Kyushu Institute of Technology, Japan) Hidehiko Masuhara(University."

Similar presentations


Ads by Google