cz.cuni.amis.pogamut.ut2004.utils
Class UT2004BotRunner<BOT extends IUT2004Bot,PARAMS extends UT2004BotParameters>

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

public class UT2004BotRunner<BOT extends IUT2004Bot,PARAMS extends UT2004BotParameters>
extends UTBotRunner<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
 
Fields inherited from class cz.cuni.amis.pogamut.ut2004.utils.UTBotRunner
host, name, port
 
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
UT2004BotRunner(Class<? extends IUT2004BotController> botControllerClass)
          Construct the runner without specifying anything as default.
UT2004BotRunner(Class<? extends IUT2004BotController> botControllerClass, String name)
          Construct the runner + specify the default name, host:port will be taken from the Pogamut platform properties.
UT2004BotRunner(Class<? extends IUT2004BotController> botControllerClass, String name, String host, int port)
          Construct the runner + specify all defaults.
UT2004BotRunner(IAgentFactory<BOT,PARAMS> factory)
          Construct the runner without specifying anything as default.
UT2004BotRunner(IAgentFactory<BOT,PARAMS> factory, String name)
          Construct the runner + specify the default name, host:port will be taken from the Pogamut platform properties.
UT2004BotRunner(IAgentFactory<BOT,PARAMS> factory, String name, String host, int port)
          Construct the runner + specify all defaults.
UT2004BotRunner(UT2004BotModule module)
          Construct the runner without specifying anything as default.
UT2004BotRunner(UT2004BotModule module, String name)
          Construct the runner + specify the default name, host:port will be taken from the Pogamut platform properties.
UT2004BotRunner(UT2004BotModule module, String name, String host, int port)
          Construct the runner + specify all defaults.
 
Method Summary
protected  IAgentParameters newDefaultAgentParameters()
          Provides default parameters that is, IAgentId using UTBotRunner.name and SocketConnectionAddress using UTBotRunner.host and UTBotRunner.port.
 UT2004BotRunner<BOT,PARAMS> setConsoleLogging(boolean enabled)
           
 UT2004BotRunner<BOT,PARAMS> setHost(String host)
          Sets host, where newly launched bots will be connected to.
 UT2004BotRunner<BOT,PARAMS> setMain(boolean state)
           
 UT2004BotRunner<BOT,PARAMS> setName(String name)
          Sets name that is going to be used to form new IAgentId of the bots.
 UT2004BotRunner<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.ut2004.utils.UTBotRunner
getHost, getName, getPort
 
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, setLog, setLogLevel, setPausing, startAgent, startAgentWithParams, startAgentWithParamsMain
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UT2004BotRunner

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

Parameters:
factory - to be used for creating new IUT2004Bot 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

UT2004BotRunner

public UT2004BotRunner(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 IUT2004Bot instances
log - used to log stuff
name - default name that serve as a basis for IAgentId

UT2004BotRunner

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

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

UT2004BotRunner

public UT2004BotRunner(UT2004BotModule 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 UT2004BotFactory
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

UT2004BotRunner

public UT2004BotRunner(UT2004BotModule 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 UT2004BotFactory
name - default name that serve as a basis for IAgentId

UT2004BotRunner

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

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

UT2004BotRunner

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

Parameters:
botControllerClass - controller that will be used to instantiate UT2004BotModule, i.e., it will control the UT2004Bot 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

UT2004BotRunner

public UT2004BotRunner(Class<? extends IUT2004BotController> 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 UT2004BotModule, i.e., it will control the UT2004Bot instance
name - default name that serve as a basis for IAgentId

UT2004BotRunner

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

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

startAgent

public BOT startAgent()
                                  throws cz.cuni.amis.utils.exception.PogamutException
Specified by:
startAgent in interface IAgentRunner<BOT extends IUT2004Bot,PARAMS extends UT2004BotParameters>
Overrides:
startAgent in class AgentRunner<BOT extends IUT2004Bot,PARAMS extends UT2004BotParameters>
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 IUT2004Bot,PARAMS extends UT2004BotParameters>
Overrides:
startAgents in class AgentRunner<BOT extends IUT2004Bot,PARAMS extends UT2004BotParameters>
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 IUT2004Bot,PARAMS extends UT2004BotParameters>
Overrides:
startAgents in class AgentRunner<BOT extends IUT2004Bot,PARAMS extends UT2004BotParameters>
Throws:
cz.cuni.amis.utils.exception.PogamutException

setName

public UT2004BotRunner<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 "UT2004Bot" will be set.

Overrides:
setName in class UTBotRunner<BOT extends IUT2004Bot,PARAMS extends UT2004BotParameters>
Parameters:
name - name used for the newly started bots
Returns:
this instance

setHost

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

Overrides:
setHost in class UTBotRunner<BOT extends IUT2004Bot,PARAMS extends UT2004BotParameters>
Parameters:
host - host running GB2004 server (can't be null)
Returns:
this instance

setPort

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

Overrides:
setPort in class UTBotRunner<BOT extends IUT2004Bot,PARAMS extends UT2004BotParameters>
Parameters:
port - at the host where GB2004 server is listening for bot connections
Returns:
this instance

newDefaultAgentParameters

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

Specified by:
newDefaultAgentParameters in class UTBotRunner<BOT extends IUT2004Bot,PARAMS extends UT2004BotParameters>

setMain

public UT2004BotRunner<BOT,PARAMS> setMain(boolean state)
Specified by:
setMain in interface IAgentRunner<BOT extends IUT2004Bot,PARAMS extends UT2004BotParameters>
Overrides:
setMain in class AgentRunner<BOT extends IUT2004Bot,PARAMS extends UT2004BotParameters>

setConsoleLogging

public UT2004BotRunner<BOT,PARAMS> setConsoleLogging(boolean enabled)
Overrides:
setConsoleLogging in class AgentRunner<BOT extends IUT2004Bot,PARAMS extends UT2004BotParameters>


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