1 / 23

John J. Sung TA Consulting

TraversalJ. John J. Sung TA Consulting. Motivation for TraversalJ. KL Enterprises identified AOP Enter into the AOP market early Add value by adding traversals to Java Contract COM 1205 Inc. TA Consulting Recommendations. High-Level System Overview. traversal.trv. TraversalJ.

feo
Download Presentation

John J. Sung TA Consulting

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. TraversalJ John J. Sung TA Consulting

  2. Motivation for TraversalJ • KL Enterprises identified AOP • Enter into the AOP market early • Add value by adding traversals to Java • Contract COM 1205 Inc. • TA Consulting Recommendations

  3. High-Level System Overview traversal.trv TraversalJ traversal.java traversal.class AspectJ

  4. System Components • traversal.trv – TraversalJ file with class graph and traversal declarations • TraversalJ – DemeterJ program by COM1205 • traversal.java – Traversal code in AspectJ • AspectJ – Aspect Oriented Programming Tool

  5. TraversalJ Overview • Implement using DemterJ • class dictionary • traversals • Obtain Class Graph using AspectJ & DJ • CreateClassGraph.java • Output traversal java code • AspectJTraversal.java

  6. TraversalJ System Main CreateClassGraph traversal.trv ClassGraphEvent(args, cg) COM1205 Middle-ware AspectJTraversal traversal.java

  7. AspectJTraversal • Java code to translate class graph + strategy into AspectJ code • Processes DJ classes to do most of the work

  8. TraversalJ Syntax • ClassGraph Specification • ClassGraph cgvar; • ClassGraph cgvar = new ClassGraph(cg, “strategy”); • Traversal Specification • declare traversal tvar : “strategy”; • declare traversal tvar(cgvar) : “strategy”;

  9. TraversalJ Syntax • Traversal Aspect Specification • aspect aspectName { • class graph declaration; • traversal declaration; • }

  10. TraversalJ Syntax Example aspect MyTraversal { ClassGraph defaultCG; ClassGraph cg1 = new ClassGraph(defaultCG, “from * bypassing {java.lang.String} to *”); declare traversal t1: “from CompoundFile to SimpleFile”; declare traversal t2(cg1): “from CompoundFile to *”; }

  11. Graphs and Traversals? • Need to obtain Default Class Graph • Keep track of declared Class Graphs • Process traversal with specific Class Graph

  12. TraversalJ System Main CreateClassGraph traversal.trv ClassGraphEvent(args, cg) COM1205 Middle-ware AspectJTraversal traversal.java

  13. ClassGraphListener/Factory • ClassGraphListenerFactory • Need a way to obtain an instance of Middle-ware code • ClassGraphListener getNew(); • ClassGraphListener • need a way to pass ClassGraph and arguments • abstract void ClassGraphEvent(String [] args, ClassGraph cg);

  14. ClassGraphListener/Factory CreateClassGraph ClassGraphListener ClassGraphListener getNew() MyListener ClassGraphFactory new MyListener()

  15. ClassGraphListener/Factory CreateClassGraph ClassGraphEvent(args, cg) ClassGraphListener MyListener Some Other Code

  16. .prj File • Copy CreateClassGraph.java and AspectJTravearsal.java into a directory • Add the directory for the JAVADIR option in .prj file • COMPILER = ajc • TEST_ARGS = -d trav some.trv • TEST_INPUT = some.trv

  17. Testing TraversalJ • Create some traversal file that implements a traversal that’s used in TraversalJ. • Generate the .java file into a directory • Add the directory for JAVADIRS • Add code to call the traversal method in .beh files. • Compile with traversal code and test

  18. Fun with Recursion COM1205 Middle-ware DemeterJ traversal.trv AspectJ TraversalJ traversal.java

  19. Debugging Strategy • Traversals • You can use DJ to output traversal graphs • Look for error messages from demeterj • General Debugging • have some variable debug to turn on debug output • AspectJTraversal • debug : outputs processing information • addPrintingAdvice : Outputs code for printing traversal method calls

  20. TraversalJ Project Phases • Phase1 – Generate Class Dictionary for the traversal language • Phase 2 – Implement –d directory option, basic traversal with default Class Graph • Phase 3 – Implement Class Graph declaration and definition • Phase 4 – Test code by generating a traversal used in TraversalJ

  21. Project Submission • Use ~jser/submit-proj • README • How to compile your program • How to generate traversal code • How to test traversal code • Due Date: March 8, 2002

  22. Project Write Up • Class Graph UML Diagram • Document Traversals • Document Testing of Traversal Code • Evaluate software design and usefulness of TraversalJ • Drop it off in class or mail box of TA • Due Date: March 11, 2002

  23. Questions? • com1205-grader@ccs.neu.edu • Reaches both KLE and TAC. • http://www.ccs.neu.edu/home/lieber/com3362/w02/CCS_AspectJ_Usage.html

More Related