cz.cuni.pogamut.Client
Class BotLauncher

java.lang.Object
  extended by cz.cuni.pogamut.Client.BotLauncher

public class BotLauncher
extends java.lang.Object

Utilility for launching bots in various scenarios e.g. loading from jars.


Constructor Summary
BotLauncher()
           
 
Method Summary
static void launchRMI(Agent agent)
           
static Agent loadBot(java.lang.String className)
          Creates agent instance from given FCN, tryes to load the agent by current context classloader.
static Agent loadBot(java.lang.String className, java.lang.ClassLoader cl)
          Creates agent instance from given FCN and classloader.
static java.lang.Class<Agent> loadBotClass(java.lang.String className)
          Loads agent class by the context classloader.
static java.lang.Class<Agent> loadBotClass(java.lang.String className, java.lang.ClassLoader cl)
          Loads agent class from given classloader.
static java.lang.Class<Agent> loadBotClass(java.lang.String className, java.lang.String classPath, java.lang.ClassLoader parent)
          Loads and bot from *.class or *.jar file.
static java.lang.Class<Agent> loadBotClassFromPogamutJar(java.lang.String pathToJar)
          Loads class from jar file with special Pogamut entry in it's manifest file.
static Agent loadBotFromPogamutJar(java.lang.String pathToJar)
          Creates agent instance from *.jar file with Bot-class manifest entry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BotLauncher

public BotLauncher()
Method Detail

loadBotClass

public static java.lang.Class<Agent> loadBotClass(java.lang.String className,
                                                  java.lang.ClassLoader cl)
                                           throws BotLoadingException
Loads agent class from given classloader.

Throws:
BotLoadingException

loadBotClass

public static java.lang.Class<Agent> loadBotClass(java.lang.String className)
                                           throws BotLoadingException
Loads agent class by the context classloader.

Throws:
BotLoadingException

loadBot

public static Agent loadBot(java.lang.String className,
                            java.lang.ClassLoader cl)
                     throws BotLoadingException
Creates agent instance from given FCN and classloader.

Parameters:
className -
cl -
Throws:
BotLoadingException

loadBot

public static Agent loadBot(java.lang.String className)
                     throws BotLoadingException
Creates agent instance from given FCN, tryes to load the agent by current context classloader.

Parameters:
className -
Throws:
BotLoadingException

loadBotFromPogamutJar

public static Agent loadBotFromPogamutJar(java.lang.String pathToJar)
                                   throws BotLoadingException
Creates agent instance from *.jar file with Bot-class manifest entry. classloader.

Parameters:
pathToJar -
Throws:
BotLoadingException

loadBotClass

public static java.lang.Class<Agent> loadBotClass(java.lang.String className,
                                                  java.lang.String classPath,
                                                  java.lang.ClassLoader parent)
                                           throws BotLoadingException
Loads and bot from *.class or *.jar file.

Parameters:
className - Fully qualified name of class representing bot. eg cz.cuni.pogamut.client.Killer
classPath - Classpath to the class. eg. MyBot.jar
parent - parent classloader of newly created URL classloader
Throws:
java.lang.Exception - Class not found
BotLoadingException

loadBotClassFromPogamutJar

public static java.lang.Class<Agent> loadBotClassFromPogamutJar(java.lang.String pathToJar)
                                                         throws BotLoadingException
Loads class from jar file with special Pogamut entry in it's manifest file. "Bot-class" entry is simillar to the "Main-class" entry, it points to the main bot class of this jar.

Parameters:
pathToJar -
Returns:
Throws:
PogamutException
java.io.IOException
BotLoadingException

launchRMI

public static void launchRMI(Agent agent)
                      throws java.rmi.RemoteException,
                             java.rmi.AlreadyBoundException
Throws:
java.rmi.RemoteException
java.rmi.AlreadyBoundException