1 / 25

X-ASB: A Framework for Implementing Extensible AOPL

IPSJ SIG-PRO. X-ASB: A Framework for Implementing Extensible AOPL. Naoyasu Ubayashi (Kyushu Institute of Technology) Hidehiko Masuhara (University of Tokyo) Tetsuo Tamai (University of Tokyo) March 18, 2004. Overview. Motivation --Issues on implementing AOPL Masuhara & Kiczales Model

dagmar
Download Presentation

X-ASB: A Framework for Implementing Extensible AOPL

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. IPSJ SIG-PRO X-ASB:A Framework forImplementing Extensible AOPL Naoyasu Ubayashi (Kyushu Institute of Technology) Hidehiko Masuhara (University of Tokyo) Tetsuo Tamai (University of Tokyo) March 18, 2004

  2. Overview • Motivation --Issues on implementing AOPL • Masuhara & Kiczales Model • X-ASB: A framework for extending AOPL • Towards reflection • Related work • Conclusion

  3. 1. Motivation Issues on implementing AOPL

  4. What is the essence of AOP ? JPM (Join Point Model) ! consists of the join points a means of identifying the join points (pointcut) a means of raising effects at the join points (advice) HyperJ? AspectJ? Demeter?

  5. However … • Each of current AOP languages is based on a few fixed set of join point models. • Many different join point models have been proposed, and they are still evolving so that they could better modularize various crosscutting concerns. • There are crosscutting concerns that may not be modularized with current join point models.

  6. Example AspectJ Demeter aspect DisplayUpdating { pointcut move(FigureElement figElt): target(figElt) && (call(void FigureElement.moveBy(int, int)) || call(void Line.set*(Point)) || call(void Point.set*(int))) after(FigureElement fe) returning:move(fe){ Display.update(fe); } } class Company { static ClassGraph cg = new ClassGraph(); // class structure Double sumSalaries() { String s =''from Company to Salary''; // traversal strategy Visitor v = new Visitor(){ // adaptive visitor private double sum; public void start() { sum = 0.0;} public void before(Salary host) { sum += host.getValue();} public Object getReturnValue() { return new Double(sum);} }; return (Double)cg.traverse(this, s, v); } // ... rest of Company definition ... } drastically different

  7. Extensible AOPLs are needed! Our Final Goal computational reflection for AOP Initial Result -- Common implementation model for JPMs We propose a framework for implementing extensible AOPLs in which different JPMs can be provided as its extension.

  8. 2. Masuhara & Kiczales Model

  9. Weaving process • parses source code, and creates an internal data structure including an AST (Abstract Syntax Tree) in AspectJ, an object graph in Demeter, and so forth. • analyzes the internal data structure, creates a join point, checks if the join point satisfies conditions specified by pointcut designators, and execute advice if these conditions are true.

  10. Masuhara & Kiczales model(1) M & K (Masuhara & Kiczales) Model [ECOOP 2003] common framework for modeling different join point models including PA (pointcuts and advice as in), TRAV (traversal specifications as in Demeter), COMPOSITOR (class hierarchy composition as in Hyper/J), OC (open classes as in AspectJ), and QB (query-based browsing as in JQuery)

  11. EFFB - means ofeffecting B - program EFFA IDB IDA- means ofidentifying META -weavingparameter X - computation or program XJP- join point Masuhara & Kiczales model(2) <X, XJP, A, AID, AEFF, B, BID, BEFF, META>

  12. 3. X-ASB:A framework for extending AOPL

  13. Framework layer for implementing weaver

  14. Development process 1. define kindsof join points 2. define kinds of pointcuts 3. define a body of a weaver define computation at pointcuts X-ASB overview (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))))

  15. PA weaver & TRAV weaver

  16. Advantage- modular JPM extension - • Hot spots for adding new kinds of join points and pointcut constructs are better modularized in comparison with the original ASB implementation. (encapsulated in the code region for the framework adaptation) • In ASB, the code for adding them is scattered in several code regions.

  17. 4. Towards reflection --- Future work ---

  18. Reflective features of X-ASB (class sample-protocol-error-detection object (method int m1 () (...)) (method int m2 () (...)) (method int m2 () (...)) (after (calling-sequence (not (list 'm1 'm2 'm3))) (write 'invalid-calling-sequence) (newline))) extend PA weaver (class sample-calling-sequence object (method void register-user-defined-pcd () (meta register-one-pcd 'calling-sequence-pcd-check? 'calling-sequence-pcd-handler) (super register-user-defined-pcd)) (method boolean calling-sequence-pcd-check? ((pcd p)(jp j)) ...) (method void calling-sequence-pcd-handler ((pcd p)(jp j)) ...))

  19. A big problem • Although JPMs such as COMPOSITOR need compile-time weaving, JPMs such as TRAV need run-time weaving. PA can be implemented by either of them. • We must integrate compile-time weaving and run-time weaving into a single interpreter.

  20. Multi-stageweaving

  21. Example (jpm 'pa 'static) (jpm 'trav 'dynamic) (jpm 'compositor 'static) (jpm-precedence 'compositor 'pa 'trav) ;; COMPOSITOR (class foo object (method void init () (super init)) (method void test () (write 'foo) (newline))) (class bar object (method void init () (super init)) (method void test () (write 'bar) (newline))) (class main user-defined-jpm (method void main () (send (new foo) test)) ;pointcut & advice for compositor (pcd 'compositor 'merge-foo-and-bar '(foo NL bar NL)) (advice 'compositor 'merge-foo-and-bar 'merge-by-name)) ;; PA (class sample-fact user-defined-jpm (method int main () (send this fact 6)) (method int fact ((int n)) (if (< n 1) 1 (* n (send this fact (- n 1))))) (method void write-after () ...) ;pointcut & advice (pcd 'pa 'call-fact '(call fact)) (advice 'pa 'call-fact '(after 'write-after)))

  22. 5. Related Work

  23. Related Work • XAspect • CME (Concern Manipulation Environment) • Josh

  24. 6. Conclusion

  25. Summary • We proposed X-ASB, a framework for implementing extensible AOPLs. • The framework exposes programming interfaces for adding new kinds of JPMs. • Clarifying programming interfaces for extending JPMs is an important milestone towards computational reflection for AOP.

More Related