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
21
22
23 private static final long serialVersionUID = 201210291347L;
24
25 private final IAgentId id;
26 private EnvironmentServiceListener listener;
27
28 public EnvironmentServiceMediator(IAgentId id) throws RemoteException {
29 this.id = id;
30 }
31
32 public void setListener(EnvironmentServiceListener listener) {
33 this.listener = listener;
34 }
35
36 public void removeListener() {
37 listener = null;
38 }
39
40 @Override
41 public void addBot(AddBotCommand parameters) throws RemoteException,
42 ManagementException {
43 listener.addBot(parameters);
44 }
45
46 @Override
47 public IAgentId getAgentId() throws RemoteException {
48 return id;
49 }
50
51 public String toString(){
52 String name = id.getToken();
53 return name;
54 }
55 }