- Tips and Tricks
Release date: Monday, 26.11.12 - Due date: Sunday, 02.12.12, 23:59
|11 = 7+4 points|
a) Formulate in 1-3 sentences a description in your own words for:
b) At the beginning of the lecture we enacted the possibilities of intercepting the communication between components (e.g. CORBA, Enterprise Java Beans).
You can find the source code for this assignment in the project A07T29_UntanglingBanking. 'BankSession' in the folder 'tangled' contains the example for tangled code from the lecture. 'untangled' contains already a new untangled version with aspects. Sadly the aspects still need to be implemented. Your task is to restore the functionality found in the tangled example code. Don't change anything except for the aspects. Make sure the test runs.
Implement the aspects
ContractChecking should contain all functionality that checks the input arguments, the supposed content of the aspects
Transactionality should be obvious.
If you are unsure about what code in the tangled application matches what concern take a look at the lecture slides (slides 21-24).
Check out the project
A07T30_UnscatteringSecurity. Your task is to de-scatter another banking example. Extract the permission checking (the calls to
AccessController.checkPermission(..)) into an aspect. Don’t forget to run the JUnit-tests after each step.
Before you can run the tests you will have to adapt the banking.policy file as described in
notes.jpage.1) As this is a bit tricky, you 2 points just for getting the tests run.
It should be possible to solve this just ad-hoc. If someone wants to learn a systematic way of doing this refactoring, she might want to read slide 15 and following of the refactoring class of the AOSD lecture, or the original article by Ramnivas Laddad on which the lecture is based.
The base code you find in
A07T31_DistributedReservation is not distributed, yet. We already anticipated that a distributed object must always be accessed via an interface and
all methods in the interface must throw the checked exception
RemoteException, see hotel.control.ReservationHandler.
Your task is to complete the aspect hotel.control.Distribution which should:
ReserverationHandlerinterface, see the AspectJ Quick Reference how this can be done (
declare parents ..).
hotel.control.StartTestServerclass, which is responsible for registering a remote reservation object.2)
ReserverationHandlerwith a remote object. Hint: You can look up RMI object directly from the Registry, e.g.
Registry registry = LocateRegistry.getRegistry(); return (ReservationHandler) registry.lookup("<registered name>");
|2 + 6 points|
a) Read through the last slides of the AOP lecture to understand how the
DisplayUpdating aspect can be optimized with the
cflowbelow pointcuts. Explain the solution in 2-4 sentences.
b) For those of you who like to play around with some algebraic equations, we have some cute challenges here. Nevertheless, the goal of this task is not start an axiomatic theory of pointcuts, but practice thinking in dynamic joinpoints:
Are the following equations true? The
== operator should be read as “has the same semantics as”.
01) cflow(cflow(ptc)) == cflow(ptc) 02) cflow(ptc1 || ptc2) == cflow(ptc1) || cflow(ptc2) 03) cflow(ptc1 && ptc2) == cflow(ptc1) && cflow(ptc2) 04) cflow(cflow(ptc1) || ptc2) == cflow(ptc1) || cflow(ptc2) 05) cflow(cflow(ptc1) && ptc2) == cflow(ptc1) && cflow(ptc2) 06) (cflow(ptc1) && !cflow(ptc2)) || (!cflow(ptc1) && cflow(ptc2)) == (cflow(ptc1) || cflow(ptc2)) && !(cflow(ptc1) && cflow(ptc2)) 07) cflowbelow(cflow(ptc)) == cflow(ptc) 08) cflowbelow(cflow(ptc)) == cflowbelow(ptc) 09) cflow(cflowbelow(ptc)) == cflow(ptc) 10) cflow(cflowbelow(ptc)) == cflowbelow(ptc) 11) !cflow(!cflowbelow(ptc1)) == !cflow(ptc2) && (cflowbelow(ptc2) || ptc2)