org.mega.gasp.platform
Interface MasterApplicationInstance

All Known Implementing Classes:
MasterApplicationInstanceImpl

public interface MasterApplicationInstance

MasterApplicationInstance represents the container of all ApplicationInstance of a specific application. So a MasterApplicationInstance contains a vector of ApplicationInstance. It contains also a vector of Session objects, representing the Actors currently using the Application. Finally it contains a vector of the Actor objects, representing a link User-Application.

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

Method Summary
 int actorSize()
          Return the current number of Actor objects in the Actor vector.
 void addActor(Actor actor)
          Add the Actor object actor to the vector of actors in the Master Application.
 int applicationInstanceSize()
          Returns the current size of the vector of ApplicationInstance objects.
 boolean containsApplicationInstance(int applicationInstanceID)
          Determine if the Application Instance associated with applicationInstanceID is hold by this Master Application.
 int createApplicationInstance(Session ownerSession, int minActors, int maxActors, java.lang.String[] actors)
          Create an Application Instance.
 int createNewSession(int aID)
          Create a new session associated with the actor ID.
 java.util.Iterator enumerateActor()
          Return the current number of Session objects in the Session vector.
 java.util.Iterator enumerateApplicationInstance()
          Returns an ApplicationInstance vector iterator.
 java.util.Iterator enumerateSession()
          Return the current number of Session objects in the Session vector.
 Actor getActor(int aID)
          Return the Actor object associated with the actorID.
 java.util.Vector getActors()
           
 ApplicationInstance getActorSessionAI(int aSID)
          Returns the ApplicationInstance object containing the ActorSession linked to the Session.
 Session getAIDAssociatedSession(int aID)
          Return the session associated to the aID.
 int getAnAIID()
          Returns a random ApplicationInstance currently not started.
 int getApplicationID()
          Returns the ID of the application managed by the Master Application Instance.
 ApplicationInstance getApplicationInstance(int applicationInstanceID)
          Returns the required ApplicationInstance object.
 byte getApplicationModel()
          Returns the model choosed for the application.
 Session getASIDAssociatedSession(int aSID)
          Return the session associated to the aSID.
 int getMasterApplicationID()
          Returns the ID of the Master Application Instance.
 Session getSession(int sID)
          Returns the corresponding session
 java.util.Vector getSessions()
          pas sūr que ces fonctions servent encore + fonctions de debuggage
 boolean isActorOwner(int aID)
          Determine if the Master Application is the owner of the Actor object associated with the actorID.
 boolean isApplicationInstanceEmpty()
          Determine if the vector of ApplicationInstance objects is currently empty or not.
 boolean isSessionOwner(int sID)
          Determine if the MasterApplicationInstance is the owner of the session associated with the SessionID.
 boolean removeActor(int aID)
          Remove the Actor object associated with the actorID.
 boolean removeApplicationInstance(int applicationInstanceID)
          Remove the required Application Instance.
 boolean removeSession(int sID)
          Remove the corresponding Session object.
 int sessionSize()
          Return the current number of Session objects in the Session vector.
 void unlog(int sid)
          Unlog the user represented by this session , delete Actor, Session, ActorSession objects linked to this user, and also the ApplicationInstance would created by this user.
 

Method Detail

getMasterApplicationID

public int getMasterApplicationID()
Returns the ID of the Master Application Instance.

Returns:
MasterApplicationID

getApplicationID

public int getApplicationID()
Returns the ID of the application managed by the Master Application Instance.

Returns:
MasterApplicationID

getApplicationModel

public byte getApplicationModel()
Returns the model choosed for the application.


createApplicationInstance

public int createApplicationInstance(Session ownerSession,
                                     int minActors,
                                     int maxActors,
                                     java.lang.String[] actors)
Create an Application Instance.

Parameters:
ownerSession - the Session object representing the actor who create the Application Instance.
minActors - represents the minimum number of actors required to start the Application Instance.
maxActors - represents the maximum number of actors can play this Application Instance.
actors - if the Application Instance is private this vector contains the required actors else if it is a public Application Instance this vector is empty.
Returns:
applicationInstanceID the ID of the Application Instance created.

getApplicationInstance

public ApplicationInstance getApplicationInstance(int applicationInstanceID)
Returns the required ApplicationInstance object.

Parameters:
applicationInstanceID - the ID of the required Application Instance
Returns:
applicationInstance the object representing the Application Instance

removeApplicationInstance

public boolean removeApplicationInstance(int applicationInstanceID)
Remove the required Application Instance.

Parameters:
applicationInstanceID -
Returns:
boolean telling us if the remove was correctly done or not.

isApplicationInstanceEmpty

public boolean isApplicationInstanceEmpty()
Determine if the vector of ApplicationInstance objects is currently empty or not.

Returns:
boolean telling us if the vector is empty or not.

applicationInstanceSize

public int applicationInstanceSize()
Returns the current size of the vector of ApplicationInstance objects.

Returns:
nbApplicationInstance

enumerateApplicationInstance

public java.util.Iterator enumerateApplicationInstance()
Returns an ApplicationInstance vector iterator.

Returns:
iterator

containsApplicationInstance

public boolean containsApplicationInstance(int applicationInstanceID)
Determine if the Application Instance associated with applicationInstanceID is hold by this Master Application.

Parameters:
applicationInstanceID -
Returns:
boolean

getAnAIID

public int getAnAIID()
Returns a random ApplicationInstance currently not started.

Returns:
the ID of an ApplicationInstance object

unlog

public void unlog(int sid)
Unlog the user represented by this session , delete Actor, Session, ActorSession objects linked to this user, and also the ApplicationInstance would created by this user.

Parameters:
sid -

getActorSessionAI

public ApplicationInstance getActorSessionAI(int aSID)
Returns the ApplicationInstance object containing the ActorSession linked to the Session.

Parameters:
aSID - the ActorSession ID
Returns:
the ApplicationInstance object

getAIDAssociatedSession

public Session getAIDAssociatedSession(int aID)
Return the session associated to the aID.

Parameters:
aID -
Returns:
the Session object associated

getASIDAssociatedSession

public Session getASIDAssociatedSession(int aSID)
Return the session associated to the aSID.

Parameters:
aSID -
Returns:
the Session object associated

createNewSession

public int createNewSession(int aID)
Create a new session associated with the actor ID.

Parameters:
aID - the actor ID
Returns:
the ID of the session created

getSession

public Session getSession(int sID)
Returns the corresponding session

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

removeSession

public boolean removeSession(int sID)
Remove the corresponding Session object.

Parameters:
sID -
Returns:
boolean

isSessionOwner

public boolean isSessionOwner(int sID)
Determine if the MasterApplicationInstance is the owner of the session associated with the SessionID.

Parameters:
sID - the Session ID
Returns:
boolean

sessionSize

public int sessionSize()
Return the current number of Session objects in the Session vector.

Returns:
the number of sessions

enumerateSession

public java.util.Iterator enumerateSession()
Return the current number of Session objects in the Session vector.

Returns:
iterator on Session vector

addActor

public void addActor(Actor actor)
Add the Actor object actor to the vector of actors in the Master Application.

Parameters:
actor - the Actor object to add

getActor

public Actor getActor(int aID)
Return the Actor object associated with the actorID.

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

removeActor

public boolean removeActor(int aID)
Remove the Actor object associated with the actorID.

Parameters:
aID - the actor ID
Returns:
boolean representing the success of the operation

isActorOwner

public boolean isActorOwner(int aID)
Determine if the Master Application is the owner of the Actor object associated with the actorID.

Parameters:
aID - the actor ID
Returns:
boolean

actorSize

public int actorSize()
Return the current number of Actor objects in the Actor vector.

Returns:
the number of actors

enumerateActor

public java.util.Iterator enumerateActor()
Return the current number of Session objects in the Session vector.

Returns:
iterator on Actor vector

getSessions

public java.util.Vector getSessions()
pas sūr que ces fonctions servent encore + fonctions de debuggage


getActors

public java.util.Vector getActors()