Top Banner
An Approach for Supporting Aspect-Oriented Domain Modeling GPCE 2003 – Erfurt, Germany September 24, 2003 Jeff Gray, Ted Bapty, Sandeep Neema, Doug Schmidt, Andy Gokhale and Bala Natarajan gray (at) cis.uab.edu http://www.gray-area.org This research is funded by DARPA/IXO, under the PCES program. University of Alabama at Birmingham Vanderbilt University
31

An Approach for Supporting Aspect-Oriented Domain Modeling

Feb 23, 2016

Download

Documents

Kendall Rogers

University of Alabama at Birmingham. Vanderbilt University. An Approach for Supporting Aspect-Oriented Domain Modeling. GPCE 2003 – Erfurt, Germany September 24, 2003 Jeff Gray, Ted Bapty, Sandeep Neema, Doug Schmidt, Andy Gokhale and Bala Natarajan - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: An Approach for Supporting  Aspect-Oriented Domain Modeling

An Approach for Supporting Aspect-Oriented Domain

ModelingGPCE 2003 – Erfurt, GermanySeptember 24, 2003

Jeff Gray, Ted Bapty, Sandeep Neema, Doug Schmidt, Andy Gokhale and Bala Natarajan

gray (at) cis.uab.eduhttp://www.gray-area.org

This research is funded by DARPA/IXO, under the PCES program.

University of Alabamaat Birmingham

VanderbiltUniversity

Page 2: An Approach for Supporting  Aspect-Oriented Domain Modeling

Multiple Levels

of HierarchyReplicatedStructures

ContextSensitive

Motivating Problem – Crossccuting Constraints in Real-Time/Embedded Models

Base models become constrained to capture a particular design

A

B

c d eB

c d e

F

B

c d e

Changeability???

Crosscutting Constraints

Constraints that are related to some global property are dispersed across the model

Page 3: An Approach for Supporting  Aspect-Oriented Domain Modeling

Importance of Changeability in Modeling Modeling’s key advantage: Ability to rapidly explore “what-if” design alternatives

Changeability a metric for modularity:“The way to evaluate a modular decomposition…is to ask what changes it accommodates.”David Weiss, chapter preface in Software Fundamentals

Ensure benefit of model-driven approach:“Small changes in requirements entail large changes in the structure and configuration”

Gerald Jay Sussman, “Robust Design through Diversity,” DARPA Amorphous Computing Workshop, 1999.

Page 4: An Approach for Supporting  Aspect-Oriented Domain Modeling

Motivation Summary Key Problems:

Difficult to specify and manage cross-cutting concerns (e.g., constraints) in model-based systems

Lack of tool support for automatically weaving concerns into models

Our Solution: A meta framework that assists in the

construction of model weavers, capable of rapidly dispersing global concerns across a design space; not just notational

Constraint-Specification Aspect Weaverhttp://www.gray-area.org/Research/C-SAW

Page 5: An Approach for Supporting  Aspect-Oriented Domain Modeling

Modeling Context: MIC/GME

META-MODEL

Meta-Model of Stateflow using UML/OCL as meta-modeling language.

DOMAIN-MODEL

Model instance of Stateflow

C++

Model interpreter 2

FPGA

Model interpreter 3

Key focus of this paper: Weaving of high-level concerns

into domain model Framework for creating new

weavers for each meta-model

Matlab

Model interpreter 1

Page 6: An Approach for Supporting  Aspect-Oriented Domain Modeling

Process of Using a Model Weaver

GME

Domain-Specific

Weaver

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE project SYSTEM "mga.dtd">

<project guid="{00000000-0000-0000-0000-000000000000}" cdate="Thu Nov 30 14:15:40 2000" mdate="Thu Nov 30 14:15:40 2000" metaguid="{00000000-0000-0000-0000-000000000000}" metaname="PCES"><name>bit1</name><comment></comment><author></author><folder id="id-006a-00000001" kind="RootFolder"><name>bit1</name><folder id="id-006a-00000002" kind="Structural"><name>Structural</name><model id="id-0065-00000001" kind="ProcessingCompound"><name>ProcessingCompound</name><attribute kind="Description" status="meta"><value></value></attribute><atom id="id-0066-00000007" kind="Attribute" role="Attrib"><name>GatesPerBit</name><regnode name="PartRegs"><value></value><regnode name="StructuralAspect"><value></value><regnode name="Position" isopaque="yes"><value>37,153</value></regnode></regnode></regnode><attribute kind="Value" status="meta"><value></value></attribute></atom><atom id="id-0066-00000006" kind="Attribute" role="Attrib"><name>NomBits</name><regnode name="PartRegs"><value></value><regnode name="StructuralAspect"><value></value><regnode name="Position" isopaque="yes"><value>205,76</value></regnode></regnode></regnode><attribute kind="Value" status="meta"><value></value></attribute></atom><atom id="id-0066-00000005" kind="Attribute" role="Attrib"><name>MaxBits</name><regnode name="PartRegs"><value></value><regnode name="StructuralAspect"><value></value><regnode name="Position" isopaque="yes"><value>128,76</value></regnode></regnode></regnode>

Enhanced

FOO.XML

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE project SYSTEM "mga.dtd">

<project guid="{00000000-0000-0000-0000-000000000000}" cdate="Thu Nov 30 14:15:40 2000" mdate="Thu Nov 30 14:15:40 2000" metaguid="{00000000-0000-0000-0000-000000000000}" metaname="PCES"><name>bit1</name><comment></comment><author></author><folder id="id-006a-00000001" kind="RootFolder"><name>bit1</name><folder id="id-006a-00000002" kind="Structural"><name>Structural</name><model id="id-0065-00000001" kind="ProcessingCompound"><name>ProcessingCompound</name><attribute kind="Description" status="meta"><value></value></attribute><atom id="id-0066-00000007" kind="Attribute" role="Attrib"><name>GatesPerBit</name><regnode name="PartRegs"><value></value><regnode name="StructuralAspect"><value></value><regnode name="Position" isopaque="yes"><value>37,153</value></regnode></regnode></regnode><attribute kind="Value" status="meta"><value></value></attribute></atom><atom id="id-0066-00000006" kind="Attribute" role="Attrib"><name>NomBits</name><regnode name="PartRegs"><value></value><regnode name="StructuralAspect"><value></value><regnode name="Position" isopaque="yes"><value>205,76</value></regnode></regnode></regnode><attribute kind="Value" status="meta"><value></value></attribute></atom><atom id="id-0066-00000005" kind="Attribute" role="Attrib"><name>MaxBits</name><regnode name="PartRegs"><value></value><regnode name="StructuralAspect"><value></value><regnode name="Position" isopaque="yes"><value>128,76</value></regnode></regnode></regnode>

FOO.XML

constraint FOOB2{ // apply a specific constraint to “B2” only in Structural models("ProcessingCompound")->

select(p | p.name() == "B2")->PowerStrategy(1, 100); }

constraint FOOBStar{ // apply a specific constraint to all nodes beginning with “B” - use wildcard in Structural models("ProcessingCompound")->

select(p | p.name() == "B*")->PowerStrategy(1, 100); }

ModelingPointcuts

Page 7: An Approach for Supporting  Aspect-Oriented Domain Modeling

Comp1package org.apache.tomcat.session;

import org.apache.tomcat.core.*;import org.apache.tomcat.util.StringManager;import java.io.*;import java.net.*;import java.util.*;import javax.servlet.*;import javax.servlet.http.*;

/** * Core implementation of a server session * * @author James Duncan Davidson [[email protected]] * @author James Todd [[email protected]] */

public class ServerSession {

private StringManager sm = StringManager.getManager("org.apache.tomcat.session"); private Hashtable values = new Hashtable(); private Hashtable appSessions = new Hashtable(); private String id; private long creationTime = System.currentTimeMillis();; private long thisAccessTime = creationTime; private long lastAccessed = creationTime; private int inactiveInterval = -1; ServerSession(String id) { this.id = id; }

public String getId() { return id; }

public long getCreationTime() { return creationTime; }

public long getLastAccessedTime() { return lastAccessed; } public ApplicationSession getApplicationSession(Context context, boolean create) { ApplicationSession appSession = (ApplicationSession)appSessions.get(context);

if (appSession == null && create) {

// XXX // sync to ensure valid? appSession = new ApplicationSession(id, this, context); appSessions.put(context, appSession); }

// XXX // make sure that we haven't gone over the end of our // inactive interval -- if so, invalidate and create // a new appSession return appSession; } void removeApplicationSession(Context context) { appSessions.remove(context); }

/** * Called by context when request comes in so that accesses and * inactivities can be dealt with accordingly. */

void accessed() { // set last accessed to thisAccessTime as it will be left over // from the previous access

lastAccessed = thisAccessTime; thisAccessTime = System.currentTimeMillis(); }

void validate()

void validate() { // if we have an inactive interval, check to see if // we've exceeded it

if (inactiveInterval != -1) { int thisInterval = (int)(System.currentTimeMillis() - lastAccessed) / 1000;

if (thisInterval > inactiveInterval) { invalidate();

ServerSessionManager ssm = ServerSessionManager.getManager();

ssm.removeSession(this); } } }

synchronized void invalidate() { Enumeration enum = appSessions.keys();

while (enum.hasMoreElements()) { Object key = enum.nextElement(); ApplicationSession appSession = (ApplicationSession)appSessions.get(key);

appSession.invalidate(); } } public void putValue(String name, Object value) { if (name == null) { String msg = sm.getString("serverSession.value.iae");

throw new IllegalArgumentException(msg); }

removeValue(name); // remove any existing binding values.put(name, value); }

public Object getValue(String name) { if (name == null) { String msg = sm.getString("serverSession.value.iae");

throw new IllegalArgumentException(msg); }

return values.get(name); }

public Enumeration getValueNames() { return values.keys(); }

public void removeValue(String name) { values.remove(name); }

public void setMaxInactiveInterval(int interval) { inactiveInterval = interval; }

public int getMaxInactiveInterval() { return inactiveInterval; }

// XXX // sync'd for safty -- no other thread should be getting something // from this while we are reaping. This isn't the most optimal // solution for this, but we'll determine something else later. synchronized void reap() { Enumeration enum = appSessions.keys();

while (enum.hasMoreElements()) { Object key = enum.nextElement(); ApplicationSession appSession = (ApplicationSession)appSessions.get(key);

appSession.validate(); } }}

Quantification Over Base Code

pointcut pubIntf(Object o): call(public * com.borland.*.*(..)) && target(o);

after(Object o) throwing (Error e): pubIntf(o) { log.write(o, e); … }

Comp2package org.apache.tomcat.session;

import org.apache.tomcat.util.*;import org.apache.tomcat.core.*;import java.io.*;import java.net.*;import java.util.*;import javax.servlet.http.*;

/** * * @author James Duncan Davidson [[email protected]] * @author Jason Hunter [[email protected]] * @author James Todd [[email protected]] */

public class ServerSessionManager implements SessionManager {

private StringManager sm = StringManager.getManager("org.apache.tomcat.session"); private static ServerSessionManager manager; // = new ServerSessionManager();

protected int inactiveInterval = -1;

static { manager = new ServerSessionManager(); }

public static ServerSessionManager getManager() { return manager; }

private Hashtable sessions = new Hashtable(); private Reaper reaper;

private ServerSessionManager() { reaper = Reaper.getReaper(); reaper.setServerSessionManager(this); reaper.start(); }

public void accessed( Context ctx, Request req, String id ) { ApplicationSession apS=(ApplicationSession)findSession( ctx, id); if( apS==null) return;

ServerSession servS=apS.getServerSession(); servS.accessed(); apS.accessed();

// cache it - no need to compute it again req.setSession( apS ); }

public HttpSession createSession(Context ctx) { String sessionId = SessionIdGenerator.generateId(); ServerSession session = new ServerSession(sessionId); sessions.put(sessionId, session);

if(-1 != inactiveInterval) { session.setMaxInactiveInterval(inactiveInterval); } return session.getApplicationSession( ctx, true ); }

public HttpSession findSession(Context ctx, String id) { ServerSession sSession=(ServerSession)sessions.get(id); if(sSession==null) return null;

return sSession.getApplicationSession(ctx, false); }

// XXX // sync'd for safty -- no other thread should be getting something // from this while we are reaping. This isn't the most optimal // solution for this, but we'll determine something else later.

synchronized void reap() { Enumeration enum = sessions.keys();

while (enum.hasMoreElements()) { Object key = enum.nextElement(); ServerSession session = (ServerSession)sessions.get(key);

session.reap(); session.validate(); } }

synchronized void removeSession(ServerSession session) { String id = session.getId();

session.invalidate(); sessions.remove(id); }

public void removeSessions(Context context) { Enumeration enum = sessions.keys();

while (enum.hasMoreElements()) { Object key = enum.nextElement(); ServerSession session = (ServerSession)sessions.get(key); ApplicationSession appSession = session.getApplicationSession(context, false);

if (appSession != null) { appSession.invalidate(); } } }

/** * Used by context to configure the session manager's inactivity timeout. * * The SessionManager may have some default session time out, the * Context on the other hand has it's timeout set by the deployment * descriptor (web.xml). This method lets the Context conforgure the * session manager according to this value. * * @param minutes The session inactivity timeout in minutes. */ public void setSessionTimeOut(int minutes) { if(-1 != minutes) { // The manager works with seconds... inactiveInterval = (minutes * 60); } }}

Comp1package org.apache.tomcat.session;

import org.apache.tomcat.core.*;import org.apache.tomcat.util.StringManager;import java.io.*;import java.net.*;import java.util.*;import javax.servlet.*;import javax.servlet.http.*;

/** * Core implementation of a server session * * @author James Duncan Davidson [[email protected]] * @author James Todd [[email protected]] */

public class ServerSession {

private StringManager sm = StringManager.getManager("org.apache.tomcat.session"); private Hashtable values = new Hashtable(); private Hashtable appSessions = new Hashtable(); private String id; private long creationTime = System.currentTimeMillis();; private long thisAccessTime = creationTime; private long lastAccessed = creationTime; private int inactiveInterval = -1; ServerSession(String id) { this.id = id; }

public String getId() { return id; }

public long getCreationTime() { return creationTime; }

public long getLastAccessedTime() { return lastAccessed; } public ApplicationSession getApplicationSession(Context context, boolean create) { ApplicationSession appSession = (ApplicationSession)appSessions.get(context);

if (appSession == null && create) {

// XXX // sync to ensure valid? appSession = new ApplicationSession(id, this, context); appSessions.put(context, appSession); }

// XXX // make sure that we haven't gone over the end of our // inactive interval -- if so, invalidate and create // a new appSession return appSession; } void removeApplicationSession(Context context) { appSessions.remove(context); }

/** * Called by context when request comes in so that accesses and * inactivities can be dealt with accordingly. */

void accessed() { // set last accessed to thisAccessTime as it will be left over // from the previous access

lastAccessed = thisAccessTime; thisAccessTime = System.currentTimeMillis(); }

void validate()

void validate() { // if we have an inactive interval, check to see if // we've exceeded it

if (inactiveInterval != -1) { int thisInterval = (int)(System.currentTimeMillis() - lastAccessed) / 1000;

if (thisInterval > inactiveInterval) { invalidate();

ServerSessionManager ssm = ServerSessionManager.getManager();

ssm.removeSession(this); } } }

synchronized void invalidate() { Enumeration enum = appSessions.keys();

while (enum.hasMoreElements()) { Object key = enum.nextElement(); ApplicationSession appSession = (ApplicationSession)appSessions.get(key);

appSession.invalidate(); } } public void putValue(String name, Object value) { if (name == null) { String msg = sm.getString("serverSession.value.iae");

throw new IllegalArgumentException(msg); }

removeValue(name); // remove any existing binding values.put(name, value); }

public Object getValue(String name) { if (name == null) { String msg = sm.getString("serverSession.value.iae");

throw new IllegalArgumentException(msg); }

return values.get(name); }

public Enumeration getValueNames() { return values.keys(); }

public void removeValue(String name) { values.remove(name); }

public void setMaxInactiveInterval(int interval) { inactiveInterval = interval; }

public int getMaxInactiveInterval() { return inactiveInterval; }

// XXX // sync'd for safty -- no other thread should be getting something // from this while we are reaping. This isn't the most optimal // solution for this, but we'll determine something else later. synchronized void reap() { Enumeration enum = appSessions.keys();

while (enum.hasMoreElements()) { Object key = enum.nextElement(); ApplicationSession appSession = (ApplicationSession)appSessions.get(key);

appSession.validate(); } }}

Comp2package org.apache.tomcat.session;

import org.apache.tomcat.util.*;import org.apache.tomcat.core.*;import java.io.*;import java.net.*;import java.util.*;import javax.servlet.http.*;

/** * * @author James Duncan Davidson [[email protected]] * @author Jason Hunter [[email protected]] * @author James Todd [[email protected]] */

public class ServerSessionManager implements SessionManager {

private StringManager sm = StringManager.getManager("org.apache.tomcat.session"); private static ServerSessionManager manager; // = new ServerSessionManager();

protected int inactiveInterval = -1;

static { manager = new ServerSessionManager(); }

public static ServerSessionManager getManager() { return manager; }

private Hashtable sessions = new Hashtable(); private Reaper reaper;

private ServerSessionManager() { reaper = Reaper.getReaper(); reaper.setServerSessionManager(this); reaper.start(); }

public void accessed( Context ctx, Request req, String id ) { ApplicationSession apS=(ApplicationSession)findSession( ctx, id); if( apS==null) return;

ServerSession servS=apS.getServerSession(); servS.accessed(); apS.accessed();

// cache it - no need to compute it again req.setSession( apS ); }

public HttpSession createSession(Context ctx) { String sessionId = SessionIdGenerator.generateId(); ServerSession session = new ServerSession(sessionId); sessions.put(sessionId, session);

if(-1 != inactiveInterval) { session.setMaxInactiveInterval(inactiveInterval); } return session.getApplicationSession( ctx, true ); }

public HttpSession findSession(Context ctx, String id) { ServerSession sSession=(ServerSession)sessions.get(id); if(sSession==null) return null;

return sSession.getApplicationSession(ctx, false); }

// XXX // sync'd for safty -- no other thread should be getting something // from this while we are reaping. This isn't the most optimal // solution for this, but we'll determine something else later.

synchronized void reap() { Enumeration enum = sessions.keys();

while (enum.hasMoreElements()) { Object key = enum.nextElement(); ServerSession session = (ServerSession)sessions.get(key);

session.reap(); session.validate(); } }

synchronized void removeSession(ServerSession session) { String id = session.getId();

session.invalidate(); sessions.remove(id); }

public void removeSessions(Context context) { Enumeration enum = sessions.keys();

while (enum.hasMoreElements()) { Object key = enum.nextElement(); ServerSession session = (ServerSession)sessions.get(key); ApplicationSession appSession = session.getApplicationSession(context, false);

if (appSession != null) { appSession.invalidate(); } } }

/** * Used by context to configure the session manager's inactivity timeout. * * The SessionManager may have some default session time out, the * Context on the other hand has it's timeout set by the deployment * descriptor (web.xml). This method lets the Context conforgure the * session manager according to this value. * * @param minutes The session inactivity timeout in minutes. */ public void setSessionTimeOut(int minutes) { if(-1 != minutes) { // The manager works with seconds... inactiveInterval = (minutes * 60); } }}

An AspectJ example

Advice

Pointcut

Page 8: An Approach for Supporting  Aspect-Oriented Domain Modeling

Quantification Over a Domain Model

Apply AO Weaving concepts to Model-based systems Weavers ‘Decorate’ Models with attributes & constraints Weavers compose new model constructs

…select(p | p.name() == “Model*” && p.kind() == “StateFlow”)->Strategy3();…

Strategy1

Strategy2

Strategy3

StrategyN

Modeling Pointcut

Domain-specificStrategies

Model

Page 10: An Approach for Supporting  Aspect-Oriented Domain Modeling

Domain-Specific Weavers

+

General Motors Factory

GM specific weaver DuPont specific weaver

DuPont Chemical Factory

Boeing Bold Stroke

Bold Stroke specific weaver

+ +

Example: Evidence of “meta” in the corresponding XML of each of the above models

Page 11: An Approach for Supporting  Aspect-Oriented Domain Modeling

The Metaweaver Framework

Strategy Code

Generator

Strategies (C++)

Strategies

ModelingPointcuts

strategy ApplyConstraint(constraintName : string, expression : string)

{

addAtom("OCLConstraint", "Constraint", constraintName).addAttribute("Expression", expression);

}

 

strategy RemoveConstraint(constraintName : string)

{

findAtom(constraintName).removeChild();

}

 

strategy ReplaceConstraint(constraintName : string, expression : string)

{

RemoveConstraint(constraintName);

ApplyConstraint(constraintName, expression);

}

XML

(Model Hierarchy)

Page 12: An Approach for Supporting  Aspect-Oriented Domain Modeling

Embedded Constraint Language

Arithmetic Operators +, -, *, /, =, <, >, <=, >=, <>

Logical Operators and, or, xor, not, implies, if/then/else

Collection Operator ->

Property Operator .

Standard OCL Collection Operators

collection->size() : integercollection->forAll( x | f(x) ) : Booleancollection->select( x | f(x) ) : collectioncollection->exists( x | f(x) ) : Boolean

Included OCL Operators

Page 13: An Approach for Supporting  Aspect-Oriented Domain Modeling

Embedded Constraint Language

Traditional OCL has been strictly a declarative query language

New uses require an imperative procedural style Addition of side effects into model

Examples: addAtom(…), findAtom(…) addAttribute(…), findAttribute(…) removeNode(…)

Support for recursion Chaining of strategies (procedure calls)

Inlined C++ code

Page 14: An Approach for Supporting  Aspect-Oriented Domain Modeling

List of ECL Operators

Aggregatesfolders, models, atoms, attributes, connections

Connectionsconnpoint, target, refs, resolveRefeeredID, resolveIDReferred

TransformationaddAttribute, addAtom, addModel, addConnection, removeNode

SelectionfindFolder, findModel, findAtom, findAttributeNode

General id, parent, getID, getInt, getStr

Page 15: An Approach for Supporting  Aspect-Oriented Domain Modeling

Example: Processor Assignment

Weapons deployment

WCET=150ms

Latency < 20ms

Sensor

Update

Map

MapDB

Σ(x,y,z)

(x,y,z)Display

(x,y,z)

100 Hz

WCET=1ms

WCET=1ms

Latency < 5msWCET=2ms

WCET=4ms

Weapon Release

Latency < 10msLatency < 2ms

Page 16: An Approach for Supporting  Aspect-Oriented Domain Modeling

Processor Assignment:Component Interaction Model

Page 17: An Approach for Supporting  Aspect-Oriented Domain Modeling

Processor Assignment:Component Internals

Page 18: An Approach for Supporting  Aspect-Oriented Domain Modeling

Processor Assignment:Modeling Pointcut

aspect ProcessorAssignment{ models("")->select(m | m.kind() == “Comp*")->Assign(10);}

Page 19: An Approach for Supporting  Aspect-Oriented Domain Modeling

Processor Assignment: Strategy

strategy Assign(limit : integer){ declare static accumulateWCET, processNum : integer; declare currentWCET : integer; self.compute.WCET.getInt(currentWCET); accumulateWCET := accumulateWCET + currentWCET;

if (limit < accumulateWCET) then accumulateWCET := currentWCET; processNum := processNum + 1; endif;

<<CComBSTR aConstraint = "self.assignTo()=processor" + XMLParser::itos(processNum); >>

AddConstraint("ProcessConstraint", aConstraint);}

Page 20: An Approach for Supporting  Aspect-Oriented Domain Modeling

Processor Assignment:Weaved Constraint

self.assignTo() = processor0

strategy Assign(limit : integer){ declare static accumulateWCET, processNum : integer; declare currentWCET : integer; self.compute.WCET.getInt(currentWCET); accumulateWCET := accumulateWCET + currentWCET;

if (limit < accumulateWCET) then accumulateWCET := currentWCET; processNum := processNum + 1; endif;

<<CComBSTR aConstraint = "self.assignTo()=processor" + XMLParser::itos(processNum); >>

AddConstraint("ProcessConstraint", aConstraint);}

Page 21: An Approach for Supporting  Aspect-Oriented Domain Modeling

Code Generation Example

Consider the following, which appears in an EagerLazy strategy:

…components.models()->select(c | c.id() == refID)->eagerLazy(…);…

Page 22: An Approach for Supporting  Aspect-Oriented Domain Modeling

Code Generation Example

CComPtr<IXMLDOMNodeList> models0 = XMLParser::models(components, ""); nodeTypeVector selectVec1 = XMLParser::ConvertDomList(models0); nodeTypeVector selectVecTrue1 = new std::vector<nodeType>; vector<nodeType>::iterator itrSelect1; for(itrSelect1 = selectVec1->begin(); itrSelect1 != selectVec1->end(); itrSelect1++) { nodeType selectNode1 = (*itrSelect1); nodeType c; c = selectNode1; CComBSTR id0 = XMLParser::id(c);

ClData varforward1(id0); ClData varforward2(referredID); bool varforward3 = varforward1 == varforward2; if(varforward3) selectVecTrue1->push_back(*itrSelect1); }

vector<nodeType>::iterator itrCollCall1; for(itrCollCall1 = selectVecTrue1->begin(); itrCollCall1 != selectVecTrue1->end(); itrCollCall1++) eagerLazy::apply(…);

Page 23: An Approach for Supporting  Aspect-Oriented Domain Modeling

Sample XMLParser Methods

nodeType XMLParser::addAtom(nodeType self, CComBSTR kind, CComBSTR role, CComBSTR name){ return addNode(self, "atom", kind, role, name);}

nodeType XMLParser::findModel(nodeType aNode, CComBSTR name){ CComBSTR bstrFind(L"./model[name=\""); bstrFind.Append(name); bstrFind.Append("\"]"); return submitXPath(aNode, bstrFind);}

CComBSTR XMLParser::id(nodeType aNode){ CComBSTR res; CComPtr<IXMLDOMNode> attr = XMLParser::findAttribute (aNode, "id"); XMLParser::getStr(attr, res); return res;}

Page 24: An Approach for Supporting  Aspect-Oriented Domain Modeling

Summary

Strategies (C++)

Meta-weaverFramework

Domain-SpecificStrategies

strategy ApplyConstraint(constraintName : string, expression : string)

{

addAtom("OCLConstraint", "Constraint", constraintName).addAttribute("Expression", expression);

}

 

strategy RemoveConstraint(constraintName : string)

ApplyConstraint(constraintName, expression);

}

Domain-specific strategies (encoded in a DSL) are used to instantiate a new model weaver

ModelingPointcuts

Domain-specific Models

B

c d e

constraint FOOB2{ // apply a specific constraint to “B2” only

in Structural models("ProcessingCompound")->

// apply a specific constraint to all nodes beginning with “B” - use wildcard

in Structural models("ProcessingCompound")->

select(p | p.name() == "B*")->PowerStrategy(1, 100); }

Specification aspects and base model are sent through the weaver

ConstrainedModels

B

c d e1

3

2

The weaver distributes constraints across the base model

NewTwo-level aspect weaving(see upcoming AOSD book)

Page 25: An Approach for Supporting  Aspect-Oriented Domain Modeling

Summary Benefits of this Approach The modeler can now perform various “what-if”

scenarios using modeling constraints Impossible in previous approach Constraints can be plugged/unplugged in model

Because much of the redundancy of constraint application is removed, the effect of each constraint on the global system can be better understood. This localization of constraints improves modular reasoning.

Allows for the rapid construction of new domain-specific weavers Strategies are specified using a DSL Generated code is at a much lower level

Page 26: An Approach for Supporting  Aspect-Oriented Domain Modeling

For more information Please give us another week to upgrade site:

gray (at) cis.uab.edu http://www.gray-area.org/Research/C-SAW

GME (freely available): http://www.isis.vanderbilt.edu/Projects/gme/

OMG MIC PSIG: http://mic.omg.org

Page 27: An Approach for Supporting  Aspect-Oriented Domain Modeling

A Concluding Quote

“Even for this let us divided live…That by this separation I may give that due to thee which thou deservest alone.”

William Shakespeare, Sonnet XXXIX

Page 28: An Approach for Supporting  Aspect-Oriented Domain Modeling

Extra slides

Page 29: An Approach for Supporting  Aspect-Oriented Domain Modeling

Tool Independence

Requires an exposed API for accessing internal model data structures

Tool-specific adapters written for each new supported tool

Cadena

GME

MetaEdit

Rose

Page 30: An Approach for Supporting  Aspect-Oriented Domain Modeling

Adaptive Core Weaving Engine

Page 31: An Approach for Supporting  Aspect-Oriented Domain Modeling

Not unlike AspectJ AJDT

JBuilderEclipse

emacs

Netbeans/FORTE

AJDT