1 package cz.cuni.amis.pogamut.ut2004.utils;
2
3 import java.util.List;
4
5 import cz.cuni.amis.pogamut.base.agent.IAgentId;
6 import cz.cuni.amis.pogamut.base.agent.params.IAgentParameters;
7 import cz.cuni.amis.pogamut.base.agent.utils.runner.impl.AgentRunner;
8 import cz.cuni.amis.pogamut.base.communication.connection.impl.socket.SocketConnectionAddress;
9 import cz.cuni.amis.pogamut.base.factory.IAgentFactory;
10 import cz.cuni.amis.pogamut.base.utils.Pogamut;
11 import cz.cuni.amis.pogamut.base.utils.PogamutPlatform;
12 import cz.cuni.amis.pogamut.ut2004.analyzer.IUT2004Analyzer;
13 import cz.cuni.amis.pogamut.ut2004.analyzer.UT2004AnalyzerParameters;
14 import cz.cuni.amis.pogamut.ut2004.analyzer.stats.UT2004AnalyzerObsStatsModule;
15 import cz.cuni.amis.pogamut.ut2004.server.IUT2004Server;
16 import cz.cuni.amis.utils.exception.PogamutException;
17
18
19
20
21
22
23
24
25
26
27
28
29 public class UT2004AnalyzerRunner<SERVER extends IUT2004Analyzer, PARAMS extends UT2004AnalyzerParameters> extends AgentRunner<SERVER, PARAMS> {
30
31
32
33
34 protected String host;
35
36
37
38
39 protected int port;
40
41
42
43
44 protected String name;
45
46
47
48
49
50
51
52
53
54 public UT2004AnalyzerRunner(IAgentFactory<SERVER, PARAMS> factory, String name, String host, int port) {
55 super(factory);
56 this.name = name;
57 this.port = port;
58 this.host = host;
59 }
60
61
62
63
64
65
66
67 public UT2004AnalyzerRunner(IAgentFactory<SERVER, PARAMS> factory, String name) {
68 this(
69 factory,
70 name,
71 Pogamut.getPlatform().getProperty(PogamutUT2004Property.POGAMUT_UT2004_SERVER_HOST.getKey()),
72 Pogamut.getPlatform().getIntProperty(PogamutUT2004Property.POGAMUT_UT2004_SERVER_PORT.getKey())
73 );
74 }
75
76 @Override
77 public SERVER startAgent() throws PogamutException {
78 return super.startAgent();
79 }
80
81 @Override
82 public List<SERVER> startAgents(int count) throws PogamutException {
83 return super.startAgents(count);
84 }
85
86 @Override
87 public List<SERVER> startAgents(PARAMS... agentParameters) throws PogamutException {
88 return super.startAgents(agentParameters);
89 };
90
91
92
93
94
95
96
97 public UT2004AnalyzerRunner(IAgentFactory<SERVER, PARAMS> factory) {
98 this(factory, "UT2004Analyzer");
99 }
100
101
102
103
104
105 @Override
106 protected IAgentParameters newDefaultAgentParameters() {
107 return new UT2004AnalyzerParameters().setAgentId(newAgentId(name)).setWorldAddress(new SocketConnectionAddress(host, port)).setObserverModule(new UT2004AnalyzerObsStatsModule());
108 }
109
110 }