vooga.network.gamelobby
Class VoogaLobbyServer

java.lang.Object
  extended by java.lang.Thread
      extended by vooga.network.VoogaServer
          extended by vooga.network.gamelobby.VoogaLobbyServer
All Implemented Interfaces:
java.lang.Runnable

public class VoogaLobbyServer
extends VoogaServer

VoogaLobbyServer handles requests from clients and updates clients that are listening to a game when activity happens whithin that game's lobby system.

Author:
tws10, tgr3, sam1

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class vooga.network.VoogaServer
SERVER
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
VoogaLobbyServer()
           
 
Method Summary
 void addUserAsListener(java.lang.String gameName, java.lang.String userName)
          Adds user as listener to particular game, so that the user is later notified of activity within the game's lobby system.
 void addUserToLobby(java.lang.String gameName, long lobbyID, java.lang.String userName)
          Adds user to lobby.
 void createLobby(java.lang.String gameName, java.lang.String lobbyName, int occupancy, java.lang.String userName)
          Creates a lobby for a network game session.
protected  void initialize()
          Allows subclasses to perform an additional initialization after the server has been constructed and started listening.
protected  void intializeConnection(java.lang.String clientName, java.net.Socket clientSocket)
          Allows server subclasses to implement additional initialization for a user connection, such as starting a server thread to receive input from that client.
static void main(java.lang.String[] args)
           
 void notifyLobbyIsFull(java.lang.String gameName, long lobbyID)
          Notifies users that lobby if full.
 void removeUserFromLobby(java.lang.String gameName, long lobbyID, java.lang.String userName)
          Removes user from lobby.
 void sendLobbies(java.lang.String gameName, java.lang.String userName)
          Sends a user's request to join a game session
 
Methods inherited from class vooga.network.VoogaServer
getAllConnectedUsers, getInStream, getMySocket, getOutStream, listeningToSocket, removeConnection, run
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VoogaLobbyServer

public VoogaLobbyServer()
                 throws java.io.IOException
Throws:
java.io.IOException
Method Detail

addUserAsListener

public void addUserAsListener(java.lang.String gameName,
                              java.lang.String userName)
Adds user as listener to particular game, so that the user is later notified of activity within the game's lobby system.

Parameters:
gameName - Particular game identifier
userName - User identifier

removeUserFromLobby

public void removeUserFromLobby(java.lang.String gameName,
                                long lobbyID,
                                java.lang.String userName)
Removes user from lobby.

Parameters:
gameName - Particular game identifier
lobbyID - Game session identifier
userName - User identifier

addUserToLobby

public void addUserToLobby(java.lang.String gameName,
                           long lobbyID,
                           java.lang.String userName)
Adds user to lobby.

Parameters:
gameID - Particular game identifier
lobbyID - Game session identifier
userName - User identifier

notifyLobbyIsFull

public void notifyLobbyIsFull(java.lang.String gameName,
                              long lobbyID)
Notifies users that lobby if full.

Parameters:
gameName - Particular game identifier
lobbyID - Game session identifier
userName - User identifier

createLobby

public void createLobby(java.lang.String gameName,
                        java.lang.String lobbyName,
                        int occupancy,
                        java.lang.String userName)
Creates a lobby for a network game session.

Parameters:
gameName - Particular game identifier
lobbyName - Name for particular lobby of the game session
occupancy - Number of users allowed in particular lobby for the game session

sendLobbies

public void sendLobbies(java.lang.String gameName,
                        java.lang.String userName)
Sends a user's request to join a game session

Parameters:
gameName - Particular game identifier
userName - User identifier

initialize

protected void initialize()
Description copied from class: VoogaServer
Allows subclasses to perform an additional initialization after the server has been constructed and started listening.

Specified by:
initialize in class VoogaServer

intializeConnection

protected void intializeConnection(java.lang.String clientName,
                                   java.net.Socket clientSocket)
Description copied from class: VoogaServer
Allows server subclasses to implement additional initialization for a user connection, such as starting a server thread to receive input from that client.

Specified by:
intializeConnection in class VoogaServer

main

public static void main(java.lang.String[] args)