SecurePlayLibray J2SE
v2.1

com.SecurePlay
Class SPGameClass

java.lang.Object
  extended bycom.SecurePlay.SPRootTransactionClass
      extended bycom.SecurePlay.SPGameClass
All Implemented Interfaces:
SPGameInterface

public class SPGameClass
extends SPRootTransactionClass
implements SPGameInterface

This is the general class that holds a game instance. It is also the transaction class for the basic game transaction.

Author:
IT GlobalSecure
See Also:
SecurePlay License Information
 

Field Summary
private  java.lang.String gamestatus
          This provides the current status of the game instance.
static java.lang.String mt_newTransaction
          This property is the message type for new transactions.
private  java.util.Vector opentransactionIDList
          This property provides access to the open transaction IDs.
private  int prBasicGameTransactionCount
           
private  SPMap propentransactionList
          This is the associative array that holds the transaction object pointers.
(package private)  java.lang.String releaseversion
          IT GlobalSecure release version.
 
Fields inherited from class com.SecurePlay.SPRootTransactionClass
comms, EventListenerList, gameID, insend, master, playerIDList, ReSend_altmessage, ReSend_encryptflag, ReSend_messagebody, ReSend_messageID, ReSend_messagetype, ReSend_privateflag, ReSend_receivers, ReSend_sender, secureplay, transactionID
 
Constructor Summary
private SPGameClass()
          Default Constructor Consructor
  SPGameClass(java.lang.String master, boolean signaturepolicy, boolean encryptionpolicy, SPLogInterface log, SPSecurityManagerInterface security)
          Constructs an overloaded SPGameClass()
  SPGameClass(java.lang.String gameID, java.lang.String master, boolean signaturepolicy, boolean encryptionpolicy, SecurePlayClass SPlibobj, SPLogInterface log, SPSecurityManagerInterface security)
          Constructs an overloaded SPGameClass()
 
Method Summary
 boolean addComms(java.lang.String commsID)
          This method associates a comms service specified by the commsID string to a game instance.
 boolean addPlayer(java.lang.String pid)
          This method safely adds an existing Player, specified by the playerID to the game instance.
 boolean addTransaction(SPAbstractTransactionInterface transObj)
          This safely adds a transaction to a game instance and appropriately updates the game state.
 int APIgetBasicTransactionCount()
          This method returns the basic transaction count - the total number of transactions that have been generated.
 SPLogInterface APIgetGameLog()
          Gets the messagelog object from the gameinstance
 java.lang.String APIgetGamestatus()
          Getter function that returns the property: gamestatus
 SPAbstractTransactionInterface APIgetGameTransaction(java.lang.String tid)
          This method returns a specific transaction associated with a given game instance.
 java.lang.String APIgetLicenseSummary()
          This method returns a summary of the licensee information for the current game instance.
 java.lang.String[] APIgetOpentransactionIDList()
          Getter function that returns the open transaction IDs
 boolean closeTransaction(java.lang.String transID)
          Safely removes a transaction from a game instance.
 SPCommsManagerClass getCommsManager()
          Gets the comms manager object
 SecurePlayClass getSecurePlay()
          This method returns the unique SecurePlay library object associated with the game instance object.
 SPAbstractTransactionInterface[] getTransactions()
          Getter function that returns the transactions from propentransactionlist
private  void initializegame(java.lang.String master, boolean signaturepolicy, boolean encryptionpolicy, SPLogInterface log, SPSecurityManagerInterface security)
          Configures a new game
 boolean isPlayerInternal(java.lang.String pid)
          Checks to see if the player is internal
 void onIncomingTransaction(SPMessageClass messObj)
          This method is the generic handler for incoming Game transaction methods.
private  boolean onnewTransaction(SPMessageClass incoming)
          This method handles messages for new incoming transactions.
private  java.lang.String prsetTransactionID(SPAbstractTransactionInterface transObj)
          This method generates a transactionID for a transaction object
private  void prUpdateGameStatus()
          This method does a self-check on the game instance object and updates its status appropriately.
 boolean removeComms(java.lang.String commsID)
          This method removes the association of a communications service with a game instance.
 boolean removePlayer(java.lang.String pid)
          This method safely removes a Player instance from an existing Game Instance.
 boolean setGameID(java.lang.String gid, SecurePlayClass spc)
          This method sets the internal ID for a comms service if it has not been set.
 boolean setPlayerComms(java.lang.String playerID, java.lang.String commsID)
          This method associates a specific player instance, specified by the playerID, with a specific communications service, specified by the commsID.
 boolean transactionincluded(java.lang.String tid)
          This method checks the specified transaction ID against the currently included transaction IDs in the game instance.
 
Methods inherited from class com.SecurePlay.SPRootTransactionClass
APIaddListener, APIclearListeners, APIgetGameID, APIgetGetReplayList, APIgetListenerCount, APIgetListeners, APIgetMaster, APIgetPlayerIDList, APIgetTransactionID, APIisPlayerIncluded, APIremoveListener, APIReplayRemoveOldSender, APIresendLastMessage, APIsetReplayList, APIsetSecurePlayClass, detectReplay, sendMessage, SPnotify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.SecurePlay.SPGameInterface
APIgetGameID, APIgetMaster, APIgetPlayerIDList, APIgetTransactionID, SPnotify
 

Field Detail

propentransactionList

private SPMap propentransactionList
This is the associative array that holds the transaction object pointers.


opentransactionIDList

private java.util.Vector opentransactionIDList
This property provides access to the open transaction IDs. This is the public method to access transactions.


gamestatus

private java.lang.String gamestatus
This provides the current status of the game instance. The currenlty supported status strings are: "new" is a newly instantiateed game instance "ready" is ready to play (create transactions) "updating" is changing player or comms information "complete" is game over "error" is a hung game


releaseversion

final java.lang.String releaseversion
IT GlobalSecure release version.

See Also:
Constant Field Values

mt_newTransaction

public static final java.lang.String mt_newTransaction
This property is the message type for new transactions.

See Also:
Constant Field Values

prBasicGameTransactionCount

private int prBasicGameTransactionCount
Constructor Detail

SPGameClass

private SPGameClass()
Default Constructor Consructor


SPGameClass

public SPGameClass(java.lang.String gameID,
                   java.lang.String master,
                   boolean signaturepolicy,
                   boolean encryptionpolicy,
                   SecurePlayClass SPlibobj,
                   SPLogInterface log,
                   SPSecurityManagerInterface security)
Constructs an overloaded SPGameClass()

Parameters:
gameID - String - id of the game
master - String - id of the player who will be the master of this game
signaturepolicy - boolean - signature policy
encryptionpolicy - boolean - encryption policy
SPlibobj - SecurePlayClass - secure play library in which the game will be created.

SPGameClass

public SPGameClass(java.lang.String master,
                   boolean signaturepolicy,
                   boolean encryptionpolicy,
                   SPLogInterface log,
                   SPSecurityManagerInterface security)
Constructs an overloaded SPGameClass()

Parameters:
master - String - id of the player who will be the master of this game
signaturepolicy - boolean - signature policy
encryptionpolicy - boolean - encryption policy
log - - SPLogInterface - game log object
security - - SPSecurityManagerInterface - security manager object
Method Detail

initializegame

private void initializegame(java.lang.String master,
                            boolean signaturepolicy,
                            boolean encryptionpolicy,
                            SPLogInterface log,
                            SPSecurityManagerInterface security)
Configures a new game

Parameters:
master -
signaturepolicy -
encryptionpolicy -
log -
security -

addPlayer

public boolean addPlayer(java.lang.String pid)
This method safely adds an existing Player, specified by the playerID to the game instance.

Specified by:
addPlayer in interface SPGameInterface
Parameters:
pid - String - the id of the player to be added
Returns:
result - Boolean: TRUE, if successful, FALSE, if no

removePlayer

public boolean removePlayer(java.lang.String pid)
This method safely removes a Player instance from an existing Game Instance.

Specified by:
removePlayer in interface SPGameInterface
Parameters:
pid - String - id of the player to be removed
Returns:
result - Boolean: TRUE, if successful, FALSE, if not.

setPlayerComms

public boolean setPlayerComms(java.lang.String playerID,
                              java.lang.String commsID)
This method associates a specific player instance, specified by the playerID, with a specific communications service, specified by the commsID. For certain remote players, a relay service is supported to allow messages to be forwarded. NOTE: there is a reserved comms service "internal" for player instances that are included in the local application session.

Specified by:
setPlayerComms in interface SPGameInterface
Parameters:
playerID - String - id of the player to be added
commsID - String - id of the comms object to be added
Returns:
result - Boolean: TRUE, if successful, FALSE, if not

prUpdateGameStatus

private void prUpdateGameStatus()
This method does a self-check on the game instance object and updates its status appropriately. Mainly, it is used to lock the game when changes are occuring or if an error has occured.


addComms

public boolean addComms(java.lang.String commsID)
This method associates a comms service specified by the commsID string to a game instance.

Specified by:
addComms in interface SPGameInterface
Parameters:
commsID - String - id of the comms to be added
Returns:
result - Boolean: TRUE, if gamestatus is "complete", FALSE, if not

removeComms

public boolean removeComms(java.lang.String commsID)
This method removes the association of a communications service with a game instance.

Specified by:
removeComms in interface SPGameInterface
Parameters:
commsID - String - id of the comms to be removed
Returns:
result - Boolean: TRUE, if successful, FALSE, if not

addTransaction

public boolean addTransaction(SPAbstractTransactionInterface transObj)
This safely adds a transaction to a game instance and appropriately updates the game state.

Specified by:
addTransaction in interface SPGameInterface
Parameters:
transObj - SPAbstractTransactionInterface - the transaction Object handler
Returns:
result - Boolean: TRUE, if successful, FALSE, if not

closeTransaction

public boolean closeTransaction(java.lang.String transID)
Safely removes a transaction from a game instance.

Specified by:
closeTransaction in interface SPGameInterface
Parameters:
transID - String - the id of the transaction to be closed
Returns:
result - Boolean: TRUE, if successful, FALSE, if not

APIgetGameTransaction

public SPAbstractTransactionInterface APIgetGameTransaction(java.lang.String tid)
This method returns a specific transaction associated with a given game instance.

Specified by:
APIgetGameTransaction in interface SPGameInterface
Parameters:
tid - String - identifier for transaction object
Returns:
result - Boolean: TRUE, if successful, FALSE, if not

prsetTransactionID

private java.lang.String prsetTransactionID(SPAbstractTransactionInterface transObj)
This method generates a transactionID for a transaction object

Parameters:
transObj - SPAbstractTransactionInterface - the transaction object from which the id is retrieved
Returns:
transactionID - String - the transaction id

transactionincluded

public boolean transactionincluded(java.lang.String tid)
This method checks the specified transaction ID against the currently included transaction IDs in the game instance.

Specified by:
transactionincluded in interface SPGameInterface
Parameters:
tid - String - the id of the transaction in question
Returns:
result Boolean: TRUE, if included, FALSE, if not

onIncomingTransaction

public void onIncomingTransaction(SPMessageClass messObj)
This method is the generic handler for incoming Game transaction methods.

Specified by:
onIncomingTransaction in interface SPGameInterface
Parameters:
messObj - SPMessageClass - incoming Message Object

isPlayerInternal

public boolean isPlayerInternal(java.lang.String pid)
Checks to see if the player is internal

Specified by:
isPlayerInternal in interface SPGameInterface
Parameters:
pid - String - id of the player to be checked
Returns:
result - Boolean: TRUE, if successful, FALSE, if not

getCommsManager

public SPCommsManagerClass getCommsManager()
Gets the comms manager object

Specified by:
getCommsManager in interface SPGameInterface
Returns:
comms - SPCommsManagerClass - the comms manager object

getSecurePlay

public SecurePlayClass getSecurePlay()
This method returns the unique SecurePlay library object associated with the game instance object.

Specified by:
getSecurePlay in interface SPGameInterface
Returns:
spc - SecurePlayLibrary - the secure play library

APIgetGamestatus

public java.lang.String APIgetGamestatus()
Getter function that returns the property: gamestatus

Specified by:
APIgetGamestatus in interface SPGameInterface
Returns:
gamestatus - String

APIgetOpentransactionIDList

public java.lang.String[] APIgetOpentransactionIDList()
Getter function that returns the open transaction IDs

Specified by:
APIgetOpentransactionIDList in interface SPGameInterface
Returns:
opentransactionIDList - String

getTransactions

public SPAbstractTransactionInterface[] getTransactions()
Getter function that returns the transactions from propentransactionlist

Returns:
prplayerList - SPHashtable

APIgetLicenseSummary

public java.lang.String APIgetLicenseSummary()
This method returns a summary of the licensee information for the current game instance. This information needs to be publicly available from any game instance, see SecurePlay license for details.

Specified by:
APIgetLicenseSummary in interface SPGameInterface
Returns:
fulllicensetext - String - this string contains full license information.

onnewTransaction

private boolean onnewTransaction(SPMessageClass incoming)
This method handles messages for new incoming transactions. It ensures that the new transactions are safely instantiated and loaed into the game.

Parameters:
incoming - SPMessageClass - the incoming message.
Returns:
result - Boolean: TRUE, if successful, FALSE, if not

APIgetGameLog

public SPLogInterface APIgetGameLog()
Gets the messagelog object from the gameinstance

Specified by:
APIgetGameLog in interface SPGameInterface
Returns:
messlog - SPLogInterface - this object contains the message logs of the game instance.

APIgetBasicTransactionCount

public int APIgetBasicTransactionCount()
This method returns the basic transaction count - the total number of transactions that have been generated.

Returns:
- int - the basic transaction count

setGameID

public boolean setGameID(java.lang.String gid,
                         SecurePlayClass spc)
This method sets the internal ID for a comms service if it has not been set. NOTE, this ID is not the public, network, or other ID for the communications service, but simply an internal handler.

Specified by:
setGameID in interface SPGameInterface
Parameters:
gid - String - game id
spc - - SecurePlayClass
Returns:
boolean: TRUE, if succesful, FALSE, if not

SecurePlayLibray J2SE
v2.1

2006 Copyright Filed by IT GlobalSecure, Inc. All Rights Reserved. Not to be used without authorization by Author. SecurePlay, IT GlobalSecure, and IT Armor are registered trademarks by IT GlobalSecure, Inc. Software protected by software license, and one or more the following U.S. and International patent numbers: U.S. Patent 6,030,288, U.S. Patent 6,165,072, European Patent Office EP1016049A1,and World Intellectual Property Organization WO9912135C1 and additional filings worldwide.