net.sf.freecol.metaserver
Class MetaRegister

java.lang.Object
  extended by net.sf.freecol.metaserver.MetaRegister

public final class MetaRegister
extends java.lang.Object

The MetaRegister stores information about running servers. Each server has it's own MetaItem object.


Constructor Summary
MetaRegister()
           
 
Method Summary
 void addServer(java.lang.String name, java.lang.String address, int port, int slotsAvailable, int currentlyPlaying, boolean isGameStarted, java.lang.String version, int gameState)
          Adds a new server with the given attributes.
 org.w3c.dom.Element createServerList()
          Creates a server list.
 void removeDeadServers()
          Removes servers that have not sent an update for some time.
 void removeServer(java.lang.String address, int port)
          Removes a server from the register.
 void updateServer(java.lang.String name, java.lang.String address, int port, int slotsAvailable, int currentlyPlaying, boolean isGameStarted, java.lang.String version, int gameState)
          Updates a server with the given attributes.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetaRegister

public MetaRegister()
Method Detail

removeDeadServers

public void removeDeadServers()
Removes servers that have not sent an update for some time.


addServer

public void addServer(java.lang.String name,
                      java.lang.String address,
                      int port,
                      int slotsAvailable,
                      int currentlyPlaying,
                      boolean isGameStarted,
                      java.lang.String version,
                      int gameState)
               throws java.io.IOException
Adds a new server with the given attributes.

Parameters:
name - The name of the server.
address - The IP-address of the server.
port - The port number in which clients may connect.
slotsAvailable - Number of players that may conncet.
currentlyPlaying - Number of players that are currently connected.
isGameStarted - true if the game has started.
version - The version of the server.
gameState - The current state of the game.
Throws:
java.io.IOException

updateServer

public void updateServer(java.lang.String name,
                         java.lang.String address,
                         int port,
                         int slotsAvailable,
                         int currentlyPlaying,
                         boolean isGameStarted,
                         java.lang.String version,
                         int gameState)
                  throws java.io.IOException
Updates a server with the given attributes.

Parameters:
name - The name of the server.
address - The IP-address of the server.
port - The port number in which clients may connect.
slotsAvailable - Number of players that may conncet.
currentlyPlaying - Number of players that are currently connected.
isGameStarted - true if the game has started.
version - The version of the server.
gameState - The current state of the game.
Throws:
java.io.IOException

removeServer

public void removeServer(java.lang.String address,
                         int port)
Removes a server from the register.

Parameters:
address - The IP-address of the server to remove.
port - The port number of the server to remove.

createServerList

public org.w3c.dom.Element createServerList()
Creates a server list.

Returns:
The server list as an XML DOM Element.