Here comes some help from Johan Ovlinger. He did the ShowAccess example in Java. In /home/lieber/.www/com3362/sp99/hw/1/impl-exs.PDF I left 4 viewgraphs to explain Johan's solution based on Mira's solution. This should help you to do other more complex examples in http://www.ccs.neu.edu/research/demeter/biblio/aspectual-comps.html in Java. This is still a part of hw 1. -- Karl ============ Hi Johan: I have enjoyed studying your solution and have prepared some viewgraphs for my class. Very helpful. The first example you give that compiles and runs contains the seed to understand the more complex solution Mira came up with. Mira must have good reasons for her more complex solution and I think your initial solution allows us to motivate why we need a more complex solution in general and why your simple solution only works in special cases. You have now: 1 component, 1 participant A 1 method f, 1 host ->A (method g -> f) can you gradually make the example more complex: 1 component, 1 participant A 1 method f, 1 host ->A (method g,h -> f) 1 component, 1 participant A 1 method f, 2 hosts B,C ->A (method B.g,C.h -> f) etc. -- Karl ================== From johan@ccs.neu.edu Thu Apr 8 17:21:51 1999 To: Karl Lieberherr cc: johan@ccs.neu.edu, dougo@ccs.neu.edu, lblando@ccs.neu.edu, lorenz@ccs.neu.edu, mira@informatik.uni-siegen.de Subject: Re: aspectual components and views The component on p 5 looks like: package ShowAccess component ShowReadAccess { participant DataToAccess { expect Object readOp(); replace Object readOp() { System.out.println("Read access... "+this.toString()); return expected(); } } } This was an interesting challenge. The problem was that java has a super() call, but not an inner() call. Your component basically wants to use inner calls. Thus, the traditional (if we can call mira's inner classes that) solution is arguably upside down. Here it is, all the same. // This is the APPC. Compile this separately package ShowAccessAPPC; public abstract class DataToAccess { public abstract Object get_host(); public abstract Object expected_readOp(); public Object readOp() { System.out.println("Read access on "+get_host()); return expected_readOp(); } } // This is the Host class graph. Compile this separately package Host; public class SomeClass { public String str = "johan rulez!"; public String get_str() { return str; } // will be mapped to readOp } package Connector; public class MySomeClass extends Host.SomeClass { // How we'll get everyone to make MySomeClasses // is unclear to me but I continue anyway // an inner class to implement the inner_readOp() ShowAccessAPPC.DataToAccess dta = new ShowAccessAPPC.DataToAccess() { public Object expected_readOp() { return expected_get_str(); } public Object get_host() { return MySomeClass.this; } } ; // rename the old method public String expected_get_str() { return super.get_str(); } // override the replaced method. public String get_str() { return (String) dta.readOp(); } public static void main(String[] args) { System.err.println(new MySomeClass().get_str()); } } Ok. that compiles and runs. The expected_get_str() is ugly though.