Table of Contents

Providing Support for Extracting Concerns towards JAsCo Artifacts in the Concern Manipulation Environment

Type: Apprenticeship and Thesis

Assistant(s): Wim Vanderperren, Davy Suvee
Supervisor: Viviane Jonckers

Part of Thesis and/or Apprenticeship Projects 2004-2005

Student(s)

kbernole.jpg
Karel Bernolet
Program: Licentiaat Toegepaste Informatica
E-mail: kbernole@vub.ac.be

Apprenticeship

Description

The purpose of the apprenticeship is to support the extraction of concerns in the CME 1) towards JAsCo 2).
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 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 report

Result

Scenario

Here a simple scenario is demonstrated:

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;
        }
}

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;
        }
}
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();
}
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

Dissertation

Description

Not yet available

Current Status

Not yet available

Presentations or other documents

Links

1) Concern Manipulation Environment: http://www.eclipse.org/cme
2) Java Aspect Components: http://ssel.vub.ac.be/jasco