====== Providing Support for Extracting Concerns towards JAsCo Artifacts in the Concern Manipulation Environment ====== **Type:** Apprenticeship and Thesis **Assistant(s):** [[SSELMember>wvdperre|Wim Vanderperren]], [[SSELMember>dsuvee|Davy Suvee]]\\ **Supervisor:** [[SSELMember>VivianeJonckers|Viviane Jonckers]] Part of [[thesis0405:overview|Thesis and/or Apprenticeship Projects 2004-2005]] ===== Student(s) ===== {{thesis0405:kbernole.jpg}}\\ Karel Bernolet\\ **Program:** Licentiaat Toegepaste Informatica\\ **E-mail:** ===== Apprenticeship ===== ==== Description ==== The purpose of the apprenticeship is to support the extraction of concerns in the CME ((Concern Manipulation Environment: http://www.eclipse.org/cme)) towards JAsCo ((Java Aspect Components: http://ssel.vub.ac.be/jasco)).\\ Since the CME itself has no support yet for extraction, the main goal is to provide a framework to extract concerns. The CME will be used to identify and encapsulate a concern. Those concerns will be extracted towards JAsCo artifacts.\\ Len Feremans, an other student, provides [[thesis0405:aop2a|support for JAsCo artifacts]] within the CME.\\ ==== Current Status ==== | ^ Subject ^ Detailed Work ^ ^begin October | JAsCo plugin for Eclipse 3.0 | porting the Eclipse 2.1 plugin to Eclipse 3.0\\ purpose is to gain experience with the Eclipse API's|| ^middle of October | Literature | reading information about the CME and JAsCo|| ^end of October | Exploring the CME | playing around with the tools and looking to the finished code|| ^middle of November | Developping the Tool | exploring the internal CME objects algorithmically|| ^end of November | | adapting the existing JascoCodeGenerator from the \\eclipse plugin|| ^begin of December | | resolving unresolved variablis in the aspect originated \\ by the refactoring|| ^middle of December | | physically manipulating the original code: \\ generating getMethods\\removing the crosscutting concern\\moving certain variables to the aspect|| ^end of December |The apprenticeship is finished.| writing the [[http://wilma.vub.ac.be/~kbernole/stage/documents/stageverslag.pdf| report]] || ==== Result ==== === Scenario === Here a simple scenario is demonstrated: * We start with a regular java class containg a crosscutting concern. package stock; import logging.Logger; public class Stock { public int counter; public Stock(int begin) { counter = begin; } public void add(int num) { counter += num; Logger.log("added " + num + counter); } public void remove(int num) { counter -= num; Logger.log("removed " + num + counter); } public int getStock() { int tmptmp = 3; int tmp = 20 + tmptmp; Logger.log("tmp var is:" + tmp+ " requested counter is: "+counter); return counter; } } * The CME query engine is used to identify all artifacts of the concern: {{http://wilma.vub.ac.be/~kbernole/stage/screenshots/query.png?800}} * and to construct the concern: {{http://wilma.vub.ac.be/~kbernole/stage/screenshots/concern.png?400}} * the context menu of the concern is expanded with an option to extract the concern to JasCo artifacts: {{http://wilma.vub.ac.be/~kbernole/stage/screenshots/jasco.png?400}} * next a wizard pops up, allowing the developper to name the aspect, connector and a prefix of the generated hooks: {{http://wilma.vub.ac.be/~kbernole/stage/screenshots/wizard.png?500}} * the result of the refactoring is the same old class without the crosscutting concern: package stock; import logging.Logger; public class Stock { public int counter; public Stock(int begin) { counter = begin; } public void add(int num) { counter += num; } public void remove(int num) { counter -= num; } public int getStock() { return counter; } public int getCounter() { return counter; } } * a connector describing where the aspect has to be applied: static connector LogConnector { LogAspect.LogHook0 hook0 = new LogAspect.LogHook0(int stock.Stock.getStock()); LogAspect.LogHook1 hook1 = new LogAspect.LogHook1(void stock.Stock.remove(int)); LogAspect.LogHook2 hook2 = new LogAspect.LogHook2(void stock.Stock.add(int)); hook0.after(); hook1.after(); hook2.after(); } * and the aspect itself: package aspects; class LogAspect { hook LogHook0 { LogHook0(method(..args)) { execute(method); } after() { int tmptmp = 3; int tmp = 20 + tmptmp; Logger.log( "tmp var is:" + tmp + " requested calledobject.getCounter() is: " + calledobject.getCounter()); } } hook LogHook1 { LogHook1(method(..args)) { execute(method); } after() { Logger.log( "removed " + arg[0] + calledobject.getCounter()); } } hook LogHook2 { LogHook2(method(..args)) { execute(method); } after() { Logger().log( "added " + arg[0] + calledobject.getCounter()); } } } === shortcomings === * since the CME query engine only supports artifacts of 1 line, this system is limited to 1 line concerns as well * at the moment only method calls are supported as an artifact * the system only generates after() advices no matter where the concern is situated in the original code * when a variable is and needed in the advice and needed in the original code, the system causes code duplication ===== Dissertation ===== ==== Description ==== //Not yet available// ==== Current Status ==== //Not yet available// ===== Presentations or other documents ===== * [[http://wilma.vub.ac.be/~kbernole/stage/documents/stage2.pdf|Intermediate Presentation]] * [[http://wilma.vub.ac.be/~kbernole/stage/documents/stageverslag.pdf|Apprenticeship Report]] * [[http://wilma.vub.ac.be/~kbernole/stage/documents/verdediging.pdf|Apprenticeship Presentation]] ===== Links ===== * [[SSELSite>./Thesis/2004-2005/JAsCoCME.html|Original proposal]] (in Dutch) * [[http://www.research.ibm.com/cme/|Concern Manipulation Environment]] * [[SSELSec>jasco|JAsCo: An Aspect-Oriented approach tailored for Component Based Software Development]]