|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.freecol.metaserver.MetaRegister
public final class MetaRegister
The MetaRegister stores information about running servers.
Each server has it's own MetaItem object.
| Field Summary | |
|---|---|
private java.util.ArrayList<MetaItem> |
items
|
private static java.util.logging.Logger |
logger
|
| 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. |
private MetaItem |
getItem(java.lang.String address,
int port)
Gets the server entry with the diven address and port. |
private int |
indexOf(java.lang.String address,
int port)
Gets the index of the server entry with the diven address and port. |
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. |
private void |
updateServer(MetaItem mi,
java.lang.String name,
java.lang.String address,
int port,
int slotsAvailable,
int currentlyPlaying,
boolean isGameStarted,
java.lang.String version,
int gameState)
Updates a given MetaItem. |
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 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static java.util.logging.Logger logger
private java.util.ArrayList<MetaItem> items
| Constructor Detail |
|---|
public MetaRegister()
| Method Detail |
|---|
private MetaItem getItem(java.lang.String address,
int port)
address - The IP-address of the server.port - The port number of the server.
null if the given
entry could not be found.
private int indexOf(java.lang.String address,
int port)
address - The IP-address of the server.port - The port number of the server.
-1 if the given entry could not be found.public void removeDeadServers()
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
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.
java.io.IOException
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
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.
java.io.IOException
public void removeServer(java.lang.String address,
int port)
address - The IP-address of the server to remove.port - The port number of the server to remove.public org.w3c.dom.Element createServerList()
private void updateServer(MetaItem mi,
java.lang.String name,
java.lang.String address,
int port,
int slotsAvailable,
int currentlyPlaying,
boolean isGameStarted,
java.lang.String version,
int gameState)
MetaItem.
mi - The MetaItem that should be updated.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: FreeColServer.GameState.STARTING_GAME,
FreeColServer.GameState.IN_GAME or
FreeColServer.GameState.ENDING_GAME.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||