1 package nl.tudelft.goal.ut2004.visualizer.connection;
2
3 import java.rmi.RemoteException;
4 import java.rmi.server.UnicastRemoteObject;
5
6 import cz.cuni.amis.pogamut.base.agent.IAgentId;
7 import eis.exceptions.ManagementException;
8
9
10
11
12
13
14
15
16
17 public final class EnvironmentServiceMediator extends UnicastRemoteObject
18 implements EnvironmentService {
19
20 private final IAgentId id;
21 private EnvironmentServiceListener listener;
22
23 public EnvironmentServiceMediator(IAgentId id) throws RemoteException {
24 this.id = id;
25 }
26
27 public void setListener(EnvironmentServiceListener listener) {
28 this.listener = listener;
29 }
30
31 public void removeListener() {
32 listener = null;
33 }
34
35 @Override
36 public void addBot(AddBotCommand parameters) throws RemoteException,
37 ManagementException {
38 listener.addBot(parameters);
39 }
40
41 @Override
42 public IAgentId getAgentId() throws RemoteException {
43 return id;
44 }
45
46 public String toString(){
47 String name = id.getToken();
48 return name;
49 }
50 }