org.mgif
Interface ApplicationInstance

All Known Subinterfaces:
MasterApplicationInstance

public interface ApplicationInstance

The application instance is the actual game played. It is the running instance of the Application object. For a game to be created there must be a new application instance created to manage the actual game and the players in it. In this way, multiple instances of an Application (game) can be run simultaneously, each controlling a different game and its players. A specific Tic-Tac-Toe board is an example of an Application Instance. Every Application Instance contains ApplicatioInstanceID needed to access the persistent state. Application instance is target for Application events and implements listeners for those events. An ActorSession is the actual representation of a user Session in a game. Application Instance - ActorSession Relations: ? An application instance can manage several actors simultaneously – optional for version 1.0 of MGIF standard platform. ? A user can be represented simultaneously in several application instances (games). A user can simultaneously play in all those game boards (optional for version 1.0 of MGIF standard platform) Note: The decision on whether a user can play simultaneously in several instances of the same game is a commercial production decision of the operator, and the application cannot make any assumptions to that effect.


Method Summary
 long createNewAppInstance(java.lang.String applicationName, java.util.Map params)
          Creates new application instance of a given type
 long createTimer(java.util.Date expirationTime, java.util.Map params)
          Creates a new timer for this ApplicationInstance.
 void end()
          Finishes the lifecycle of applicateion instance.
 java.util.Iterator enumerateActorSession()
          Enumerates all actor session associated with this application instance
 ActorSession getActorSession(long actorSesionID)
          Gets the ActorSession asociated with this sesion and provided ID.
 Application getApplication()
          Returns the Application object related to this ApplicationInstance
 long getApplicationInstanceId()
          Returns the system ID of this ApplicationInstance object
 Logger getLogger()
          Logger a logger used to log messages to the application log.
 MessageFactory getMessageFactory(java.lang.String msisdn)
          Return mesage factory to generate push messages.
 ScoreTableManager getScoreTableManager()
          Returns the ScoreTableManager
 void sendInterAppMessage(long targetApplicationInstance, java.util.Map params)
          Sends message to some existing ApplicationInstance object in the system.
 

Method Detail

createNewAppInstance

public long createNewAppInstance(java.lang.String applicationName,
                                 java.util.Map params)
Creates new application instance of a given type
Parameters:
applicationName - Name of desired application. The name should be unique and provided by installation of Application.
params - Set of params that will be transferred to newly created ApplicatioInstance object as part of org.mgif.event.CreateEvent object.
Returns:
The system ID of created ApplicationInstance object

createTimer

public long createTimer(java.util.Date expirationTime,
                        java.util.Map params)
Creates a new timer for this ApplicationInstance.

The method onApplicationInstanceTimer on the OnApplicationInstanceTimer interface is called when the timer expires.

Parameters:
expirationTime - the time when this timer is set to expire
params - Timer parameters
Returns:
the ID of the created timer.

end

public void end()
Finishes the lifecycle of applicateion instance. Invokes "delete" for all actor sessions.

enumerateActorSession

public java.util.Iterator enumerateActorSession()
Enumerates all actor session associated with this application instance
Returns:
Enumaration of all ActorSession objects related to this ApplicationInstance object

getActorSession

public ActorSession getActorSession(long actorSesionID)
Gets the ActorSession asociated with this sesion and provided ID. If ID is valid but ActorSession does not belong to this ApplicationInstance then null is returned.
Parameters:
actorSesionID - The system ID of desired ActorSession object.
Returns:
ActorSession object associated with this ID. If ID is valid but ActorSession does not belong to this ApplicationInstance then null is returned. If ID is invalid, then null is returned.

getApplication

public Application getApplication()
Returns the Application object related to this ApplicationInstance
Returns:
The Application object related to this ApplicationInstance

getApplicationInstanceId

public long getApplicationInstanceId()
Returns the system ID of this ApplicationInstance object
Returns:
The system ID of this ApplicationInstance object

getLogger

public Logger getLogger()
Logger a logger used to log messages to the application log.
Returns:
The application logger

getMessageFactory

public MessageFactory getMessageFactory(java.lang.String msisdn)
Return mesage factory to generate push messages.
Returns:
MessageFactory object.

getScoreTableManager

public ScoreTableManager getScoreTableManager()
Returns the ScoreTableManager
Returns:
The ScroreTableManager object

sendInterAppMessage

public void sendInterAppMessage(long targetApplicationInstance,
                                java.util.Map params)
Sends message to some existing ApplicationInstance object in the system. org.mgif.listener.OnInterAppMessage.onInterAppMessage() hook will be called at side of target ApplicationInstance object if it implements org.mgif.listener.OnInterAppMessage inteface.
Parameters:
targetApplicationInstance - The system ID of target
params - Set of object transferred to target ApplicationInstance object as part of org.mgif.event.InterAppMessageEvent


Copyright © 2002 Mobile Games Interoperability Forum. All rights reserved.
This source code is protected by the legal notice posted at http://www.mgif.org/docs/notice.html