org.mega.gasp.platform
Interface Platform

All Known Implementing Classes:
PlatformImpl

public interface Platform

Platform is the base of the GAming Services Platform (GASP), the container of all GP representing objects. So it contains all MasterApplicationInstance objects in a vector. It hold all of the service instances (Lobby,...) and system instances (DB manager, ID manager, ...).

Author:
PELLERIN Romain (pellerin@cnam.fr) - MEGA Project

Method Summary
 boolean containsMasterApplicationInstance(int applicationID)
          Determine if the MasterApplicationInstance of the application associated with the application ID is initialized or not.
 int createAI(int sID, int minActors, int maxActors, java.lang.String[] actors)
          Provide to a user with a valid session ID to create an ApplicationInstance with a minimum start number of actors and a maximum number of actors.
 java.util.Iterator enumerateMasterApplicationInstance()
          Returns an iterator on the MasterApplicationInstance vector.
 MasterApplicationInstance getActorOwner(int aID)
          Return the MasterApplicationInstance containing the aID.
 ApplicationInstance getActorSessionOwner(int aSID)
          Return the ApplicationInstance containing the aSID.
 DBManager getDBManager()
          Return the platform DB manager .
 IDManager getIDManager()
          Return the platform ID manager .
 Lobby getLobby()
          Return the Lobby service.
 MasterApplicationInstance getMasterApplicationInstance(int applicationID)
          Returns the MasterApplicationInstance associated with the application ID or if it is not already instantiates, initialize it.
 PropertiesReader getPropertiesReader()
          Return the platform DB manager .
 MasterApplicationInstance getSessionOwner(int sID)
          Return the MasterApplicationInstance containing the sID.
 boolean isMasterApplicationInstanceEmpty()
          Determine if the vector of MasterApplicationInstance is empty or not.
 int joinAI(int sID, int aIID)
          Provide to a user with a valid session ID to join a specific ApplicationInstance of the application open by the user.
 int joinAIRnd(int sID)
          Provide to a user with a valid session ID to join a random ApplicationInstance corresponded to tbe application opened by the user.
 int login(int aID, java.lang.String username, java.lang.String password)
          Log a user in the platform, authentified by actorID, username and password.
 int masterApplicationInstanceSize()
          Return the number of MasterApplicationInstance currently instantiated.
 void quit(int sID)
          This method is called when a user quit the application.
 boolean removeMasterApplicationInstance(int applicationID)
          Remove the MasterApplicationInstance associated with the application ID.
 

Method Detail

getMasterApplicationInstance

public MasterApplicationInstance getMasterApplicationInstance(int applicationID)
Returns the MasterApplicationInstance associated with the application ID or if it is not already instantiates, initialize it.

Parameters:
applicationID - the application ID
Returns:
the MasterApplicationInstance object

removeMasterApplicationInstance

public boolean removeMasterApplicationInstance(int applicationID)
Remove the MasterApplicationInstance associated with the application ID.

Parameters:
applicationID - the application ID
Returns:
boolean of the operation success

isMasterApplicationInstanceEmpty

public boolean isMasterApplicationInstanceEmpty()
Determine if the vector of MasterApplicationInstance is empty or not.

Returns:
boolean

masterApplicationInstanceSize

public int masterApplicationInstanceSize()
Return the number of MasterApplicationInstance currently instantiated.

Returns:
the number of MasterApplication instances.

enumerateMasterApplicationInstance

public java.util.Iterator enumerateMasterApplicationInstance()
Returns an iterator on the MasterApplicationInstance vector.

Returns:
iterator

containsMasterApplicationInstance

public boolean containsMasterApplicationInstance(int applicationID)
Determine if the MasterApplicationInstance of the application associated with the application ID is initialized or not.

Parameters:
applicationID -
Returns:
boolean

getLobby

public Lobby getLobby()
Return the Lobby service.

Returns:
the Lobby object

getIDManager

public IDManager getIDManager()
Return the platform ID manager .

Returns:
the IDManager object

getDBManager

public DBManager getDBManager()
Return the platform DB manager .

Returns:
the DBManager object

getPropertiesReader

public PropertiesReader getPropertiesReader()
Return the platform DB manager .

Returns:
the DBManager object

getSessionOwner

public MasterApplicationInstance getSessionOwner(int sID)
Return the MasterApplicationInstance containing the sID.

Parameters:
sID - the session ID
Returns:
the MasterApplicationInstance object

getActorSessionOwner

public ApplicationInstance getActorSessionOwner(int aSID)
Return the ApplicationInstance containing the aSID.

Parameters:
aSID - the actor session ID
Returns:
the MasterApplicationInstance object

getActorOwner

public MasterApplicationInstance getActorOwner(int aID)
Return the MasterApplicationInstance containing the aID.

Parameters:
aID - the actor ID
Returns:
the MasterApplicationInstance object

login

public int login(int aID,
                 java.lang.String username,
                 java.lang.String password)
Log a user in the platform, authentified by actorID, username and password. It consists of creating a new Session in the correct MasterApplicationInstance and return the session ID.

Parameters:
aID - the Actor ID attributed at the first login
username -
password -
Returns:
the SessionID of the session created or 0 if the authentification informations are not valid

joinAI

public int joinAI(int sID,
                  int aIID)
Provide to a user with a valid session ID to join a specific ApplicationInstance of the application open by the user. Then create un ActorSession in the ApplicationInstance and return the ActorSessionID.

Parameters:
sID - the Session ID
aIID - the ApplicationInstance ID
Returns:
the ActorSession ID

joinAIRnd

public int joinAIRnd(int sID)
Provide to a user with a valid session ID to join a random ApplicationInstance corresponded to tbe application opened by the user.

Parameters:
sID - the Session ID
Returns:
the ActorSession ID

createAI

public int createAI(int sID,
                    int minActors,
                    int maxActors,
                    java.lang.String[] actors)
Provide to a user with a valid session ID to create an ApplicationInstance with a minimum start number of actors and a maximum number of actors. The ApplicationInstance status is: "public": if the table of actors is empty. "private": if the table of actors contains some Actor ID. Returns the ID of the ApplicationInstance created.

Parameters:
sID - the Session ID
minActors - minimum number of actors for starting
maxActors - maximum number of actors
actors - a table of Actor ID
Returns:
the ApplicationInstance ID

quit

public void quit(int sID)
This method is called when a user quit the application. ActorSession, Session, Actor instances corresponding to the user are removed.

Parameters:
sID - the Session ID