com.SecurePlay
Class SPAbstractTransactionAPIClass

java.lang.Object
  extended bycom.SecurePlay.SPAbstractTransactionAPIClass
All Implemented Interfaces:
SPAbstractTransactionAPIInterface
Direct Known Subclasses:
SPTBlastAPIClass, SPTMultiPartSecretAPIClass, SPTMultiPartSimultaneousAPIClass, SPTMultistepTurnAPIClass, SPTRandomAPIClass, SPTSecretAPIClass, SPTShipAPIClass, SPTSimultaneousAPIClass, SPTStrobeAPIClass

public class SPAbstractTransactionAPIClass
extends java.lang.Object
implements SPAbstractTransactionAPIInterface

API version of the SPAbstractTransactionClass

Author:
IT GlobalSecure
See Also:
com.SecurePlay.core.SPAbstractTransactionClass, SecurePlay License Information
 

Field Summary
protected  boolean librarytestmode
          This should be set to FALSE for production systems or all "rulesXXXX methods should be edited
protected  SPAbstractTransactionClass transactioninstance
          Instance of SPAbstractTransactionClass
 
Constructor Summary
SPAbstractTransactionAPIClass(SPAbstractTransactionClass abstractTransInstance)
          Overloaded Constructor
 
Method Summary
 boolean APIAddListener(SPEventInterface gameobj)
          This method adds a listener object for Game API events
 boolean APIbeginTransaction(java.lang.String pid)
          This action can only be initiated by the Transaction master.
 boolean APIClearListeners()
          This method clears the listener objects for Game API events
 boolean APIcompleteTransaction(java.lang.String pid)
          This method allows the Transaction Master ONLY to complete the transaction.
 boolean APIconfigureTransaction(java.lang.String pid, java.lang.String[] args)
          This method allows the Transaction Master ONLY to configure the transactions unique parameters.
 int APIGetListenerCount()
          This method returns the number of listener objects for Game API events
 java.lang.Object[] APIGetListeners()
          This method returns a list of listener objects for Game API events
 boolean APIRemoveListener(SPEventInterface gameobj)
          This method removes a listener object for Game API events
 boolean APIrequestbeginTransaction(java.lang.String pid)
          This method allows any transaction participant excluding the Transaction master to request that the transaction be begun.
 boolean APIrequestCompleteTransaction(java.lang.String pid)
          This method allows any player, excluding the Transaction master to request that the transactoin be completed.
 boolean APIrequestconfigureTransaction(java.lang.String pid, java.lang.String[] args)
          This method allows any player, excluding the Transaction master, to request that the transaction be configured as described in the configuration array.
 java.lang.String APISPawn(java.lang.String pid)
          This method creates a new transaction with the identical participants and configuration as the spawning transaction.
 SPAbstractTransactionInterface getTransactioninstance()
          Getter function that gets the transaction instance
 boolean rulesbeginTransaction(java.lang.String pid, SPAbstractTransactionInterface transobj)
          This shell method determines if an existing transaction object can be "begun" from a remote request.
 boolean rulescompleteTransaction(java.lang.String pid, SPAbstractTransactionInterface transobj)
          This shell method handles remote requests to complete an existing transaction.
 boolean rulesconfigureTransaction(java.lang.String pid, java.lang.String[] configarr, SPAbstractTransactionInterface transobj)
          This shell method supports remote requests to configure an existing transaction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

transactioninstance

protected SPAbstractTransactionClass transactioninstance
Instance of SPAbstractTransactionClass


librarytestmode

protected final boolean librarytestmode
This should be set to FALSE for production systems or all "rulesXXXX methods should be edited

See Also:
Constant Field Values
Constructor Detail

SPAbstractTransactionAPIClass

public SPAbstractTransactionAPIClass(SPAbstractTransactionClass abstractTransInstance)
Overloaded Constructor

Parameters:
abstractTransInstance - - SPAbstractTransactionClass - the abstract transaction instance
Method Detail

APIbeginTransaction

public boolean APIbeginTransaction(java.lang.String pid)
Description copied from interface: SPAbstractTransactionAPIInterface
This action can only be initiated by the Transaction master. It sends a "beginTransaction" message to all of the transaction participants. A Transaction can only be begun if it has been successfully configured.

Specified by:
APIbeginTransaction in interface SPAbstractTransactionAPIInterface
Parameters:
pid - String - id of the transaction beginner, must be the master and internal.
Returns:
result - Boolean: TRUE, if successful, FALSE, if not

APIcompleteTransaction

public boolean APIcompleteTransaction(java.lang.String pid)
Description copied from interface: SPAbstractTransactionAPIInterface
This method allows the Transaction Master ONLY to complete the transaction. Transactions that are in an error state cannot be cleared by completion.

Specified by:
APIcompleteTransaction in interface SPAbstractTransactionAPIInterface
Parameters:
pid - String - id of the player who is completing the transaction, must be the master and internal.
Returns:
result - Boolean: TRUE, if successful, FALSE, if not.

APIconfigureTransaction

public boolean APIconfigureTransaction(java.lang.String pid,
                                       java.lang.String[] args)
Description copied from interface: SPAbstractTransactionAPIInterface
This method allows the Transaction Master ONLY to configure the transactions unique parameters. NOTE, this method will be overridden for individual transaction types.

Specified by:
APIconfigureTransaction in interface SPAbstractTransactionAPIInterface
Parameters:
pid - String - id of the configurer, must be internal.
args - String[] - the configuration array, with configuration details inside.
Returns:
result - Boolean: TRUE if successful, FALSE, if unsuccessful

APIrequestbeginTransaction

public boolean APIrequestbeginTransaction(java.lang.String pid)
Description copied from interface: SPAbstractTransactionAPIInterface
This method allows any transaction participant excluding the Transaction master to request that the transaction be begun. This can only be done after the transaction has been configured.

Specified by:
APIrequestbeginTransaction in interface SPAbstractTransactionAPIInterface
Parameters:
pid - String - the id of the requestor, can not be master, must be internal
Returns:
result - Boolean: TRUE, if successful, FALSE, if not

APIrequestCompleteTransaction

public boolean APIrequestCompleteTransaction(java.lang.String pid)
Description copied from interface: SPAbstractTransactionAPIInterface
This method allows any player, excluding the Transaction master to request that the transactoin be completed.

Specified by:
APIrequestCompleteTransaction in interface SPAbstractTransactionAPIInterface
Parameters:
pid - String - id of the requestor, can not be the master, must be internal.
Returns:
result - Boolean: TRUE, if successful, FALSE, if not

APIrequestconfigureTransaction

public boolean APIrequestconfigureTransaction(java.lang.String pid,
                                              java.lang.String[] args)
Description copied from interface: SPAbstractTransactionAPIInterface
This method allows any player, excluding the Transaction master, to request that the transaction be configured as described in the configuration array.

Specified by:
APIrequestconfigureTransaction in interface SPAbstractTransactionAPIInterface
Parameters:
pid - String - the configure requestor, can not be the master, must be internal.
args - String[] - the configuration array, with configuration details.
Returns:
result - Boolean: TRUE, if successful, FALSE, if not

rulesbeginTransaction

public boolean rulesbeginTransaction(java.lang.String pid,
                                     SPAbstractTransactionInterface transobj)
Description copied from interface: SPAbstractTransactionAPIInterface
This shell method determines if an existing transaction object can be "begun" from a remote request.

Specified by:
rulesbeginTransaction in interface SPAbstractTransactionAPIInterface
Parameters:
pid - String - player id of the transaction beginner
transobj - SPAbstractTransactionInterface - the transaction object to be begun
Returns:
result - Boolean: TRUE, if allowed, FALSE, if not

rulescompleteTransaction

public boolean rulescompleteTransaction(java.lang.String pid,
                                        SPAbstractTransactionInterface transobj)
Description copied from interface: SPAbstractTransactionAPIInterface
This shell method handles remote requests to complete an existing transaction. Only the transaction master can actually complete the transaction.

Specified by:
rulescompleteTransaction in interface SPAbstractTransactionAPIInterface
Parameters:
pid - String - player id of the completer of the transaction
transobj - SPAbstractTransactionInterface - the transaction object to be completed
Returns:
result - Boolean: TRUE, if allowed, FALSE, if not

rulesconfigureTransaction

public boolean rulesconfigureTransaction(java.lang.String pid,
                                         java.lang.String[] configarr,
                                         SPAbstractTransactionInterface transobj)
Description copied from interface: SPAbstractTransactionAPIInterface
This shell method supports remote requests to configure an existing transaction. Only the transaction master can actually configure the transaction.

Specified by:
rulesconfigureTransaction in interface SPAbstractTransactionAPIInterface
Parameters:
pid - String - player id of the configurer, must be the master
configarr - String[] - the configuration array with the configuration details.
transobj - SPAbstractTransactionInterface - the transaction to be configured
Returns:
result - Boolean: TRUE, if allowed, FALSE, if not

APIAddListener

public boolean APIAddListener(SPEventInterface gameobj)
Description copied from interface: SPAbstractTransactionAPIInterface
This method adds a listener object for Game API events

Specified by:
APIAddListener in interface SPAbstractTransactionAPIInterface
Parameters:
gameobj - SPEventInterface - the object to be added, that inplement the listener interface
Returns:
Boolean - TRUE, if successful, FALSE, if not

APIRemoveListener

public boolean APIRemoveListener(SPEventInterface gameobj)
Description copied from interface: SPAbstractTransactionAPIInterface
This method removes a listener object for Game API events

Specified by:
APIRemoveListener in interface SPAbstractTransactionAPIInterface
Parameters:
gameobj - SPEventInterface - the object to be removed, that inplement the listener interface

APIGetListeners

public java.lang.Object[] APIGetListeners()
Description copied from interface: SPAbstractTransactionAPIInterface
This method returns a list of listener objects for Game API events

Specified by:
APIGetListeners in interface SPAbstractTransactionAPIInterface
Returns:
obj - Object[] - array of listener objects

APIClearListeners

public boolean APIClearListeners()
Description copied from interface: SPAbstractTransactionAPIInterface
This method clears the listener objects for Game API events

Specified by:
APIClearListeners in interface SPAbstractTransactionAPIInterface
Returns:
Boolean - TRUE, if successful, FALSE, if not

APIGetListenerCount

public int APIGetListenerCount()
Description copied from interface: SPAbstractTransactionAPIInterface
This method returns the number of listener objects for Game API events

Specified by:
APIGetListenerCount in interface SPAbstractTransactionAPIInterface
Returns:
count - int - the number of listeners

APISPawn

public java.lang.String APISPawn(java.lang.String pid)
Description copied from interface: SPAbstractTransactionAPIInterface
This method creates a new transaction with the identical participants and configuration as the spawning transaction.

Specified by:
APISPawn in interface SPAbstractTransactionAPIInterface
Parameters:
pid - String - player id must be master of the transaction
Returns:
tid - String - transaction id of the new spawned transaction.

getTransactioninstance

public SPAbstractTransactionInterface getTransactioninstance()
Description copied from interface: SPAbstractTransactionAPIInterface
Getter function that gets the transaction instance

Specified by:
getTransactioninstance in interface SPAbstractTransactionAPIInterface
Returns:
traninstance - SPAbstractTransactionInterface