|Due at Thursday, December 17th, 11:00 am (before the lecture starts)|
You can find the sourcecode for this assignment in the project A07T17_UntanglingBanking. 'BankSession' in the folder 'tangled' contains the example for tangled code from the lecture. 'untangled' contains already a new untangeld 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 (slide 20,21).
Check out the project A07T18_RefactoringExercise. 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
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 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>");