cz.cuni.amis.pogamut.ut2004.utils
Class UCCWrapper

java.lang.Object
  extended by cz.cuni.amis.pogamut.ut2004.utils.UCCWrapper

public class UCCWrapper
extends java.lang.Object

Wrapper of running instance of UCC server. Implements pooling of instances. Usage scenario is: UCCWrapper ucc = UCCWrapper.create(); ... ucc.release(); The location of UCC executabe will be determined by an environment variable pogamut.ut2004.home (e.g. c:\Games\UT2004). The property cam be set via java ... -Dpogamut.ut2004.home=c:\Games\UT2004. Another posibility is to set it by code System.setProperty("pogamut.ut2004.home", "c:\\Unreal Anthology\\UT2004");.


Nested Class Summary
 class UCCWrapper.ScannerSink
          Scanns the output of UCC for some specific srings (Ports bounded.
protected  class UCCWrapper.StreamSink
          Reads content of the stream and discards it.
static class UCCWrapper.UCCWrapperConf
          Configuration object of the UCC wrapper instance.
 
Field Summary
protected static int basePort
          First port assigned to a ucc instance.
protected  UCCWrapper.UCCWrapperConf configuration
           
protected  int controlPort
          Port for server connection.
protected static int fileCounter
           
protected  int gbPort
          Port for bots.
protected static java.lang.Integer nextUccWrapperUID
           
protected  int observerPort
          Port for observer connection.
static long stamp
           
protected  boolean stopped
          Was this instance already released?
protected  LogCategory uccLog
          Loger containing all output from running instance of UCC.
protected  int uccWrapperUID
          ID of the wrapper object.
protected  IUT2004Server utServer
           
 
Constructor Summary
UCCWrapper(UCCWrapper.UCCWrapperConf configuration)
           
 
Method Summary
 SocketConnectionAddress getBotAddress()
           
 int getBotPort()
           
 UCCWrapper.UCCWrapperConf getConfiguration()
           
 int getControlPort()
           
 java.lang.String getHost()
           
 java.util.logging.Logger getLogger()
           
 SocketConnectionAddress getObserverAddress()
           
 int getObserverPort()
           
 java.lang.Process getProcess()
          Process of the
 SocketConnectionAddress getServerAddress()
           
protected  java.lang.String getUnrealHome()
           
 IUT2004Server getUTServer()
           
protected  void initUCCWrapper()
           
 void stop()
          Stops the UCC server.
protected  void stopCheck()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

uccLog

protected LogCategory uccLog
Loger containing all output from running instance of UCC.


fileCounter

protected static int fileCounter

gbPort

protected int gbPort
Port for bots.


controlPort

protected int controlPort
Port for server connection.


observerPort

protected int observerPort
Port for observer connection.


utServer

protected IUT2004Server utServer

basePort

protected static final int basePort
First port assigned to a ucc instance.

See Also:
Constant Field Values

nextUccWrapperUID

protected static java.lang.Integer nextUccWrapperUID

uccWrapperUID

protected int uccWrapperUID
ID of the wrapper object. Useful for debuging.


configuration

protected UCCWrapper.UCCWrapperConf configuration

stamp

public static long stamp

stopped

protected boolean stopped
Was this instance already released?

Constructor Detail

UCCWrapper

public UCCWrapper(UCCWrapper.UCCWrapperConf configuration)
           throws UCCStartException
Throws:
UCCStartException
Method Detail

getLogger

public java.util.logging.Logger getLogger()
Returns:
Log with output of UCC. If you want to listen also for messages from the startup sequence then use UCCWrapper.create(Logger parent). Set Parent logger of this log and register listeners before creating this instance of UCCWrapper.

getConfiguration

public UCCWrapper.UCCWrapperConf getConfiguration()

getUTServer

public IUT2004Server getUTServer()
Returns:
Server connected to this UCC instance.

getUnrealHome

protected java.lang.String getUnrealHome()

initUCCWrapper

protected void initUCCWrapper()
                       throws UCCStartException
Throws:
UCCStartException

getProcess

public java.lang.Process getProcess()
Process of the

Returns:

stop

public void stop()
Stops the UCC server.


getBotPort

public int getBotPort()
Returns:
Port for GameBots connection.

getObserverPort

public int getObserverPort()
Returns:
Port of the Observer of GameBots2004.

getControlPort

public int getControlPort()
Returns:
Port for control connection.

stopCheck

protected void stopCheck()

getHost

public java.lang.String getHost()

getBotAddress

public SocketConnectionAddress getBotAddress()

getServerAddress

public SocketConnectionAddress getServerAddress()

getObserverAddress

public SocketConnectionAddress getObserverAddress()