Title: Aspectual Component Implementation
1Aspectual Component Implementation
2ConnectorPackage
ComponentPackage
MyHost toModify()part.Op()// override
aux()super.toModify() part
Component
Participant expectedOp() Op()expectedOp()
getHost() getHost()
ParticipantAnonymousExtended expectedOp()aux()
getHost()MyHost.this main()new
MyHost().toModify()
outer.super.toModify() simulated with aux() is
not elegant
Johans solution 1 based on Miras inner class
solution. Modification interface is represented
also by abstract class, not by Method argument
as proposed by Mira.
HostPackage
Host // to play role of participant
toModify() // to be mapped to Op()
3ConnectorPackage
ComponentPackage
MyHost toModify()part.Op()
aux()super.toModify() part
Component
Participant expectedOp() Op()expectedOp()
getHost() getHost()
ParticipantAnonymousExtended expectedOp()aux()
getHost()MyHost.this main()new
MyHost().toModify()
Problem when we have a Host-object and want to
get modified behavior, need to create a MyHost
object.
Does it work with multiple participants? With
multiple hosts? Looks like.
HostPackage
Host toModify()
4ConnectorPackage
ComponentPackage
MyHost toModify1()part1.Op()//overrride
aux1()super.toModify1() part1
Component
Participant expectedOp() Op()expectedOp???()
getHost() getHost()
ParticipantAnonymousExtended expectedOp1()aux1(
) getHost()MyHost.this main()new
MyHost().toModify1()
part2
ParticipantAnonymousExtended expectedOp2()aux2(
) getHost()MyHost.this main()new
MyHost().toModify2()
More complex connector one host but multiple
methods are modified. Which expectedOp should be
called in the participant? Is this why Miras
implementation is more complex?
toModify2()part2.Op()//override aux2()super.to
Modify2()
5ConnectorPackage
ComponentPackage
MyHost toModify()part.rOp(toModify)
part
Component
Participant rOp(Method expOp)
expOp.invoke() getHost() getHost()
ParticipantAnonymousExtended getHost()MyHost.th
is main()new MyHost().toModify()
HostPackage
Host // to play role of participant
toModify() // to be mapped to rOp()
Miras modified inner class solution.
6Implementations
- Implement Datastructure/Counter/Lock example
- without reflection
- with reflection
- apply to both Queue and Stack
- Implement ShowRWAccess example simulate
inheritance between components and connectors in
Java - without reflection
- with reflection
- map readOp to two methods of two different
application classes