@@ -0,0 +1,1916 @@
+package vooga.request.forwarder;%0A%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0Aimport vooga.request.IRequest;%0Aimport vooga.request.receiver.IReceiver;%0Aimport vooga.request.receiver.UnknownSenderException;%0A%0A/**%0A * The main request manager class which forwards messages between game components%0A */%0Apublic class RequestMediator implements IForwarder%7B%0A    private Map%3CString, IReceiver%3E myAddresses;%0A%0A    public RequestMediator () %7B%0A        myAddresses = new HashMap%3C%3E();%0A    %7D%0A%0A    @Override%0A    public synchronized void forward (IRequest request) throws InvalidAddressException,%0A                                          ReceiverNotFoundException, DeliveryException %7B%0A        checkValidAddress(request.sender());%0A        checkKnownAddress(request.sender());%0A        checkValidAddress(request.receiver());%0A        checkKnownAddress(request.receiver());%0A        try %7B%0A            myAddresses.get(request.receiver()).receive(request);%0A        %7D%0A        catch (UnknownSenderException e) %7B%0A            throw new DeliveryException(request, e.getMessage());%0A        %7D%0A    %7D%0A%0A    @Override%0A    public synchronized void register (String address, IReceiver receiver) throws InvalidAddressException,%0A                                                             AddressConflictException %7B%0A        checkValidAddress(address);%0A        if (isKnownAddress(address))%7B%0A            throw new AddressConflictException(address, myAddresses.get(address));%0A        %7D%0A        myAddresses.put(address, receiver);%0A    %7D%0A%0A    private void checkValidAddress (String address) throws InvalidAddressException %7B%0A        return;%0A    %7D%0A    private void checkKnownAddress (String address) throws ReceiverNotFoundException %7B%0A        if (! isKnownAddress(address))%7B%0A            throw new ReceiverNotFoundException(address);%0A        %7D%0A    %7D%0A    private boolean isKnownAddress (String address) %7B%0A        return myAddresses.containsKey(address);%0A    %7D%0A%0A%7D%0A

implement a simple RequestMediator