john j. sung ta consulting. motivation for traversalj kl enterprises identified aop enter into the...
TRANSCRIPT
![Page 1: John J. Sung TA Consulting. Motivation for TraversalJ KL Enterprises identified AOP Enter into the AOP market early Add value by adding traversals to](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649f155503460f94c2a408/html5/thumbnails/1.jpg)
John J. Sung
TA Consulting
![Page 2: John J. Sung TA Consulting. Motivation for TraversalJ KL Enterprises identified AOP Enter into the AOP market early Add value by adding traversals to](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649f155503460f94c2a408/html5/thumbnails/2.jpg)
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
![Page 3: John J. Sung TA Consulting. Motivation for TraversalJ KL Enterprises identified AOP Enter into the AOP market early Add value by adding traversals to](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649f155503460f94c2a408/html5/thumbnails/3.jpg)
High-Level System Overview
traversal.trv TraversalJ
traversal.java
AspectJtraversal.class
![Page 4: John J. Sung TA Consulting. Motivation for TraversalJ KL Enterprises identified AOP Enter into the AOP market early Add value by adding traversals to](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649f155503460f94c2a408/html5/thumbnails/4.jpg)
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
![Page 5: John J. Sung TA Consulting. Motivation for TraversalJ KL Enterprises identified AOP Enter into the AOP market early Add value by adding traversals to](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649f155503460f94c2a408/html5/thumbnails/5.jpg)
TraversalJ Overview
• Implement using DemterJ– class dictionary– traversals
• Obtain Class Graph using AspectJ & DJ– CreateClassGraph.java
• Output traversal java code– AspectJTraversal.java
![Page 6: John J. Sung TA Consulting. Motivation for TraversalJ KL Enterprises identified AOP Enter into the AOP market early Add value by adding traversals to](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649f155503460f94c2a408/html5/thumbnails/6.jpg)
TraversalJ System
traversal.trv
COM1205Middle-ware
CreateClassGraph
AspectJTraversal traversal.java
Main
ClassGraphEvent(args, cg)
![Page 7: John J. Sung TA Consulting. Motivation for TraversalJ KL Enterprises identified AOP Enter into the AOP market early Add value by adding traversals to](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649f155503460f94c2a408/html5/thumbnails/7.jpg)
AspectJTraversal
• Java code to translate class graph + strategy into AspectJ code
• Processes DJ classes to do most of the work
![Page 8: John J. Sung TA Consulting. Motivation for TraversalJ KL Enterprises identified AOP Enter into the AOP market early Add value by adding traversals to](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649f155503460f94c2a408/html5/thumbnails/8.jpg)
TraversalJ Syntax
• ClassGraph Specification– ClassGraph cgvar;– ClassGraph cgvar = new ClassGraph(cg,
“strategy”);
• Traversal Specification– declare traversal tvar : “strategy”;– declare traversal tvar(cgvar) : “strategy”;
![Page 9: John J. Sung TA Consulting. Motivation for TraversalJ KL Enterprises identified AOP Enter into the AOP market early Add value by adding traversals to](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649f155503460f94c2a408/html5/thumbnails/9.jpg)
TraversalJ Syntax
• Traversal Aspect Specification– aspect aspectName { – class graph declaration;– traversal declaration;– }
![Page 10: John J. Sung TA Consulting. Motivation for TraversalJ KL Enterprises identified AOP Enter into the AOP market early Add value by adding traversals to](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649f155503460f94c2a408/html5/thumbnails/10.jpg)
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 *”;}
![Page 11: John J. Sung TA Consulting. Motivation for TraversalJ KL Enterprises identified AOP Enter into the AOP market early Add value by adding traversals to](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649f155503460f94c2a408/html5/thumbnails/11.jpg)
Graphs and Traversals?
• Need to obtain Default Class Graph
• Keep track of declared Class Graphs
• Process traversal with specific Class Graph
![Page 12: John J. Sung TA Consulting. Motivation for TraversalJ KL Enterprises identified AOP Enter into the AOP market early Add value by adding traversals to](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649f155503460f94c2a408/html5/thumbnails/12.jpg)
TraversalJ System
traversal.trv
COM1205Middle-ware
CreateClassGraph
AspectJTraversal traversal.java
Main
ClassGraphEvent(args, cg)
![Page 13: John J. Sung TA Consulting. Motivation for TraversalJ KL Enterprises identified AOP Enter into the AOP market early Add value by adding traversals to](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649f155503460f94c2a408/html5/thumbnails/13.jpg)
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);
![Page 14: John J. Sung TA Consulting. Motivation for TraversalJ KL Enterprises identified AOP Enter into the AOP market early Add value by adding traversals to](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649f155503460f94c2a408/html5/thumbnails/14.jpg)
ClassGraphListener/Factory
ClassGraphFactory
ClassGraphListener
MyListener
getNew()
new MyListener()
ClassGraphListener
CreateClassGraph
![Page 15: John J. Sung TA Consulting. Motivation for TraversalJ KL Enterprises identified AOP Enter into the AOP market early Add value by adding traversals to](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649f155503460f94c2a408/html5/thumbnails/15.jpg)
ClassGraphListener/Factory
ClassGraphListener
MyListener
CreateClassGraph
ClassGraphEvent(args, cg)
Some Other Code
![Page 16: John J. Sung TA Consulting. Motivation for TraversalJ KL Enterprises identified AOP Enter into the AOP market early Add value by adding traversals to](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649f155503460f94c2a408/html5/thumbnails/16.jpg)
.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
![Page 17: John J. Sung TA Consulting. Motivation for TraversalJ KL Enterprises identified AOP Enter into the AOP market early Add value by adding traversals to](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649f155503460f94c2a408/html5/thumbnails/17.jpg)
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
![Page 18: John J. Sung TA Consulting. Motivation for TraversalJ KL Enterprises identified AOP Enter into the AOP market early Add value by adding traversals to](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649f155503460f94c2a408/html5/thumbnails/18.jpg)
Fun with Recursion
traversal.trv
COM1205Middle-ware
DemeterJ
traversal.java
AspectJ
TraversalJ
![Page 19: John J. Sung TA Consulting. Motivation for TraversalJ KL Enterprises identified AOP Enter into the AOP market early Add value by adding traversals to](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649f155503460f94c2a408/html5/thumbnails/19.jpg)
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
![Page 20: John J. Sung TA Consulting. Motivation for TraversalJ KL Enterprises identified AOP Enter into the AOP market early Add value by adding traversals to](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649f155503460f94c2a408/html5/thumbnails/20.jpg)
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
![Page 21: John J. Sung TA Consulting. Motivation for TraversalJ KL Enterprises identified AOP Enter into the AOP market early Add value by adding traversals to](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649f155503460f94c2a408/html5/thumbnails/21.jpg)
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
![Page 22: John J. Sung TA Consulting. Motivation for TraversalJ KL Enterprises identified AOP Enter into the AOP market early Add value by adding traversals to](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649f155503460f94c2a408/html5/thumbnails/22.jpg)
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
![Page 23: John J. Sung TA Consulting. Motivation for TraversalJ KL Enterprises identified AOP Enter into the AOP market early Add value by adding traversals to](https://reader036.vdocuments.us/reader036/viewer/2022062408/56649f155503460f94c2a408/html5/thumbnails/23.jpg)
Questions?
• Reaches both KLE and TAC.• http://www.ccs.neu.edu/home/lieber/com3362/w02/
CCS_AspectJ_Usage.html