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

Package class diagram package UCCWrapper
java.lang.Object
  extended by cz.cuni.amis.pogamut.ut2004.utils.UCCWrapper

public class UCCWrapper
extends 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");.

Author:
Ik

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.
 
Field Summary
protected static int basePort
          First port assigned to a ucc instance.
protected  UCCWrapperConf conf
           
protected  int controlPort
          Port for server connection.
protected static int fileCounter
           
protected  cz.cuni.amis.utils.flag.Flag<Boolean> gameEnding
          Tells whether UCC is in "IN END GAME" phase, which indicates that the FIRST MATCH has ended.
protected  int gbPort
          Port for bots.
protected static 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(UCCWrapperConf configuration)
           
 
Method Summary
 SocketConnectionAddress getBotAddress()
           
 int getBotPort()
           
 UCCWrapperConf getConfiguration()
           
 int getControlPort()
           
 cz.cuni.amis.utils.flag.Flag<Boolean> getGameEnding()
          Returns flag that is indicating FIRST GAME end.
 String getHost()
           
 Logger getLogger()
           
 SocketConnectionAddress getObserverAddress()
           
 int getObserverPort()
           
 Process getProcess()
          Process of the
 SocketConnectionAddress getServerAddress()
           
protected  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 Integer nextUccWrapperUID

uccWrapperUID

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


conf

protected UCCWrapperConf conf

gameEnding

protected cz.cuni.amis.utils.flag.Flag<Boolean> gameEnding
Tells whether UCC is in "IN END GAME" phase, which indicates that the FIRST MATCH has ended. DOES NOT WORK WHEN UCC IS USING MAP-SWITCHES! Determined by UCCWrapperPatterns.getGameEndingPattern().


stamp

public static long stamp

stopped

protected boolean stopped
Was this instance already released?

Constructor Detail

UCCWrapper

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

getLogger

public 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 UCCWrapperConf getConfiguration()

getUTServer

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

getUnrealHome

protected String getUnrealHome()

initUCCWrapper

protected void initUCCWrapper()
                       throws UCCStartException
Throws:
UCCStartException

getProcess

public 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 String getHost()

getBotAddress

public SocketConnectionAddress getBotAddress()

getServerAddress

public SocketConnectionAddress getServerAddress()

getObserverAddress

public SocketConnectionAddress getObserverAddress()

getGameEnding

public cz.cuni.amis.utils.flag.Flag<Boolean> getGameEnding()
Returns flag that is indicating FIRST GAME end.

Returns:


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