cz.cuni.amis.pogamut.udk.utils
Class UDKBotRunner<BOT extends IUDKBot,PARAMS extends UDKAgentParameters>

Package class diagram package UDKBotRunner
java.lang.Object
  extended by cz.cuni.amis.pogamut.base.agent.utils.runner.impl.AgentRunner<BOT,PARAMS>
      extended by cz.cuni.amis.pogamut.udk.utils.UDKBotRunner<BOT,PARAMS>
Type Parameters:
BOT -
PARAMS -
All Implemented Interfaces:
IAgentRunner<BOT,PARAMS>

public class UDKBotRunner<BOT extends IUDKBot,PARAMS extends UDKAgentParameters>
extends AgentRunner<BOT,PARAMS>

Class used for creating, connecting and starting servers with default settings that are taken from the properties.

The address where the instances will connect are defined either in the constructor or taken from the properties of the PogamutPlatform.

For more information about the class see AgentRunner.

Author:
ik, Jimmy

Field Summary
protected  String host
          Default host where the instances are going to be connected as defaults, see IAgentParameters.assignDefaults(IAgentParameters).
protected  String name
          Default name that will serve as a basis for IAgentId, see IAgentParameters.assignDefaults(IAgentParameters).
protected  int port
          Default port where the instances are going to be connected as defaults, see IAgentParameters.assignDefaults(IAgentParameters).
 
Fields inherited from class cz.cuni.amis.pogamut.base.agent.utils.runner.impl.AgentRunner
agents, consoleLogging, defaultLogLevel, factory, killed, killingAgents, killingAgentsMutex, latch, listener, log, main, mutex
 
Constructor Summary
UDKBotRunner(Class<? extends IUDKBotController> botControllerClass)
          Construct the runner without specifying anything as default.
UDKBotRunner(Class<? extends IUDKBotController> botControllerClass, String name)
          Construct the runner + specify the default name, host:port will be taken from the Pogamut platform properties.
UDKBotRunner(Class<? extends IUDKBotController> botControllerClass, String name, String host, int port)
          Construct the runner + specify all defaults.
UDKBotRunner(IAgentFactory<BOT,PARAMS> factory)
          Construct the runner without specifying anything as default.
UDKBotRunner(IAgentFactory<BOT,PARAMS> factory, String name)
          Construct the runner + specify the default name, host:port will be taken from the Pogamut platform properties.
UDKBotRunner(IAgentFactory<BOT,PARAMS> factory, String name, String host, int port)
          Construct the runner + specify all defaults.
UDKBotRunner(UDKBotModule module)
          Construct the runner without specifying anything as default.
UDKBotRunner(UDKBotModule module, String name)
          Construct the runner + specify the default name, host:port will be taken from the Pogamut platform properties.
UDKBotRunner(UDKBotModule module, String name, String host, int port)
          Construct the runner + specify all defaults.
 
Method Summary
 String getHost()
          Returns host, where newly launched bots will be connected to.
 String getName()
          Returns name that is going to be used to form new IAgentId of the bots.
 int getPort()
          Returns port, where newly launched bots will be connected to.
protected  IAgentParameters newDefaultAgentParameters()
          Provides default parameters that is, IAgentId using name and SocketConnectionAddress using host and port.
 UDKBotRunner<BOT,PARAMS> setHost(String host)
          Sets host, where newly launched bots will be connected to.
 UDKBotRunner<BOT,PARAMS> setName(String name)
          Sets name that is going to be used to form new IAgentId of the bots.
 UDKBotRunner<BOT,PARAMS> setPort(int port)
          Sets port, where newly launched bots will be connected to.
 BOT startAgent()
           
 List<BOT> startAgents(int count)
           
 List<BOT> startAgents(PARAMS... agentParameters)
           
 
Methods inherited from class cz.cuni.amis.pogamut.base.agent.utils.runner.impl.AgentRunner
createAgentWithParams, fillInDefaults, fillInDefaults, getLog, isMain, isPausing, killAgent, killAgents, newAgentId, postStartedHook, postStartHook, preInitHook, preResumeHook, preStartHook, setConsoleLogging, setLog, setLogLevel, setMain, setPausing, startAgent, startAgentWithParams, startAgentWithParamsMain
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

host

protected String host
Default host where the instances are going to be connected as defaults, see IAgentParameters.assignDefaults(IAgentParameters).


port

protected int port
Default port where the instances are going to be connected as defaults, see IAgentParameters.assignDefaults(IAgentParameters).


name

protected String name
Default name that will serve as a basis for IAgentId, see IAgentParameters.assignDefaults(IAgentParameters).

Constructor Detail

UDKBotRunner

public UDKBotRunner(IAgentFactory<BOT,PARAMS> factory,
                    String name,
                    String host,
                    int port)
Construct the runner + specify all defaults.

Parameters:
factory - to be used for creating new IUDKBot instances
name - default name that serve as a basis for IAgentId
host - default host where the instances are going to be connected
port - default port where the instances are going to be connected

UDKBotRunner

public UDKBotRunner(IAgentFactory<BOT,PARAMS> factory,
                    String name)
Construct the runner + specify the default name, host:port will be taken from the Pogamut platform properties.

Parameters:
factory - factory to be used for creating new IUDKBot instances
log - used to log stuff
name - default name that serve as a basis for IAgentId

UDKBotRunner

public UDKBotRunner(IAgentFactory<BOT,PARAMS> factory)
Construct the runner without specifying anything as default. Default name for bots will be "UDKBot" and host:port will be taken from the Pogamut platform properties.

Parameters:
factory - factory to be used for creating new IUDKBot instances

UDKBotRunner

public UDKBotRunner(UDKBotModule module,
                    String name,
                    String host,
                    int port)
Construct the runner + specify all defaults.

Parameters:
module - Guice module that is going to be used by the UDKBotFactory
name - default name that serve as a basis for IAgentId
host - default host where the instances are going to be connected
port - default port where the instances are going to be connected

UDKBotRunner

public UDKBotRunner(UDKBotModule module,
                    String name)
Construct the runner + specify the default name, host:port will be taken from the Pogamut platform properties.

Parameters:
module - Guice module that is going to be used by the UDKBotFactory
name - default name that serve as a basis for IAgentId

UDKBotRunner

public UDKBotRunner(UDKBotModule module)
Construct the runner without specifying anything as default. Default name for bots will be "UDKBot" and host:port will be taken from the Pogamut platform properties.

Parameters:
module - Guice module that is going to be used by the UDKBotFactory

UDKBotRunner

public UDKBotRunner(Class<? extends IUDKBotController> botControllerClass,
                    String name,
                    String host,
                    int port)
Construct the runner + specify all defaults.

Parameters:
botControllerClass - controller that will be used to instantiate UDKBotModule, i.e., it will control the UDKBot instance
name - default name that serve as a basis for IAgentId
host - default host where the instances are going to be connected
port - default port where the instances are going to be connected

UDKBotRunner

public UDKBotRunner(Class<? extends IUDKBotController> botControllerClass,
                    String name)
Construct the runner + specify the default name, host:port will be taken from the Pogamut platform properties.

Parameters:
botControllerClass - controller that will be used to instantiate UDKBotModule, i.e., it will control the UDKBot instance
name - default name that serve as a basis for IAgentId

UDKBotRunner

public UDKBotRunner(Class<? extends IUDKBotController> botControllerClass)
Construct the runner without specifying anything as default. Default name for bots will be "UDKBot" and host:port will be taken from the Pogamut platform properties.

Parameters:
botControllerClass - controller that will be used to instantiate UDKBotModule, i.e., it will control the UDKBot instance
Method Detail

startAgent

public BOT startAgent()
                               throws cz.cuni.amis.utils.exception.PogamutException
Specified by:
startAgent in interface IAgentRunner<BOT extends IUDKBot,PARAMS extends UDKAgentParameters>
Overrides:
startAgent in class AgentRunner<BOT extends IUDKBot,PARAMS extends UDKAgentParameters>
Throws:
cz.cuni.amis.utils.exception.PogamutException

startAgents

public List<BOT> startAgents(int count)
                                      throws cz.cuni.amis.utils.exception.PogamutException
Specified by:
startAgents in interface IAgentRunner<BOT extends IUDKBot,PARAMS extends UDKAgentParameters>
Overrides:
startAgents in class AgentRunner<BOT extends IUDKBot,PARAMS extends UDKAgentParameters>
Throws:
cz.cuni.amis.utils.exception.PogamutException

startAgents

public List<BOT> startAgents(PARAMS... agentParameters)
                                      throws cz.cuni.amis.utils.exception.PogamutException
Specified by:
startAgents in interface IAgentRunner<BOT extends IUDKBot,PARAMS extends UDKAgentParameters>
Overrides:
startAgents in class AgentRunner<BOT extends IUDKBot,PARAMS extends UDKAgentParameters>
Throws:
cz.cuni.amis.utils.exception.PogamutException

getName

public String getName()
Returns name that is going to be used to form new IAgentId of the bots.

Returns:
name used for the newly started bots

setName

public UDKBotRunner<BOT,PARAMS> setName(String name)
Sets name that is going to be used to form new IAgentId of the bots.

If null is passed, generic "UDKBot" will be set.

Parameters:
name - name used for the newly started bots
Returns:
this instance

getHost

public String getHost()
Returns host, where newly launched bots will be connected to.

Returns:
host running GBUDK server

setHost

public UDKBotRunner<BOT,PARAMS> setHost(String host)
Sets host, where newly launched bots will be connected to.

Parameters:
host - host running GBUDK server (can't be null)
Returns:
this instance

getPort

public int getPort()
Returns port, where newly launched bots will be connected to.

Returns:
port at the host where GBUDK server is listening for bot connections

setPort

public UDKBotRunner<BOT,PARAMS> setPort(int port)
Sets port, where newly launched bots will be connected to.

Parameters:
port - at the host where GBUDK server is listening for bot connections
Returns:
this instance

newDefaultAgentParameters

protected IAgentParameters newDefaultAgentParameters()
Provides default parameters that is, IAgentId using name and SocketConnectionAddress using host and port.

Specified by:
newDefaultAgentParameters in class AgentRunner<BOT extends IUDKBot,PARAMS extends UDKAgentParameters>


Copyright © 2014 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.