SecurePlayLibray J2SE
v2.1

com.SecurePlay.Comms.SPCGenericCommsServer
Class SPCGenericCommsServerClass

java.lang.Object
  extended bycom.SecurePlay.Comms.SPCGenericCommsServer.SPCGenericCommsServerClass
All Implemented Interfaces:
SPAbstractCommsInterface

public class SPCGenericCommsServerClass
extends java.lang.Object
implements SPAbstractCommsInterface

Generic Comms server class. This class is a generic comms server.

Author:
IT GlobalSecure
See Also:
SecurePlay License Information
 

Field Summary
private  SPCGenericCommsDriverClass commsDriver
          Comms driver associated with this server.
private  java.lang.String commsID
          Comms id of this comms class.
private  SPMap gamePlayerAddress
          Property that stores the player id associated with an address.
private  SPMap internalRelayList
          map
private  SPMap printernalGameList
          Property that stores the game id associated with a comms manager of the game.
 
Constructor Summary
SPCGenericCommsServerClass(SPCGenericCommsDriverClass driver)
          Constructor
 
Method Summary
 boolean addGame(java.lang.String gid, SPCommsManagerCommsInterface game)
          This method adds an internal game to a specific comms service.
 boolean addPlayer(java.lang.String gid, java.lang.String pid)
          This method adds a player ID of a remote player serviced by this comm service.
 java.lang.String[] getAddresses(java.lang.String gid, java.lang.String[] playerIDs)
          Returns a list of addresses that are associated with the player id list.
 SPCGenericCommsDriverClass getCommsDriver()
          Returns the comms driver.
 java.lang.String getCommsID()
          Gets the comms id.
 java.lang.String getCommsServiceType()
          This method returns a unique identifier for the type of comms service instance.
 SPMap getGameplayerList()
          Getter function that returns the property: gameplayerList
 java.lang.String[] getInternalGameIDList()
          Getter function that returns the property: internalGameIDList
 java.lang.String getOneInternalGameID()
          Returns the first game id of internal games.
 java.lang.String getOneInternalPlayerID(java.lang.String gid)
          Returns the first player id of the specified game.
 java.lang.String getPlayerAddress(java.lang.String gid, java.lang.String pid)
          Gets the address of a player in a game.
 java.lang.String[] getPlayerList(java.lang.String gid)
          Gets the player list of a game.
 SPMap getPrinternalGameList()
          Getter function that returns the property: printernalGameList
 int includedPlayerCount(java.lang.String[] playerarray, java.lang.String gid)
          Checks to see how many players in the player id list are in the game.
 boolean isAddressUsed(java.lang.String address)
          Checks to see if the address is used by any player.
 boolean isGameInternal(java.lang.String gid)
          This method returns whether a game is handled internally by a comms service
 boolean isReady()
          Goes through every player and checks to see if everyone has an address set.
 void processincoming(SPMessageClass inmess)
          This method processes the incoming message.
protected  boolean prreceive(SPMessageClass[] message)
          This standard method handles incoming serialized messages that have been separated out of incoming data streams by the incoming method.
 boolean removeGame(java.lang.String gid)
          This method removes the association of a game with the comms service.
 boolean removePlayer(java.lang.String gid, java.lang.String pid)
          This method removes a player from the list of remote players served by this comm service.
 int sendMessage(SPMessageClass clearmessage, SPMessageClass alternatemessage)
          This method returns a number based on the input array to indicate how many of the input array's player IDs are included in the comms service playerIDList (This method takes the message and sends it over the network, if they are served by this comms service.)
 int sendMessage(java.lang.String[] receivers, SPMessageClass clearmessage, SPMessageClass alternatemessage)
          This method returns a number based on the input array to indicate how many of the input array's player IDs are included in the comms service playerIDList This method is depreceated and will be removed in a future version of the software (This method takes the message and sends it over the network, if they are served by this comms service.)
 boolean setcommsID(java.lang.String cid)
          This method sets the internal ID for a comms service if it has not been set.
 boolean setGamePlayerAddress(java.lang.String gid, java.lang.String pid, java.lang.String address, boolean relay)
          Sets a player of a game to an address.
 void SPdeserializeProcessDouble(byte[] doubleMessages)
          Deserializes and processes double messages not single or multiple.
 void SPdeserializeProcessMess(byte[] messages)
          Deserializes amd processes multiple or single messages not doubple.
 boolean unsetGamePlayerAddress(java.lang.String gid, java.lang.String pid)
          Unsets an address of a player in a game.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

commsDriver

private SPCGenericCommsDriverClass commsDriver
Comms driver associated with this server.


commsID

private java.lang.String commsID
Comms id of this comms class.


gamePlayerAddress

private SPMap gamePlayerAddress
Property that stores the player id associated with an address. map


printernalGameList

private SPMap printernalGameList
Property that stores the game id associated with a comms manager of the game. map


internalRelayList

private SPMap internalRelayList
map

Constructor Detail

SPCGenericCommsServerClass

public SPCGenericCommsServerClass(SPCGenericCommsDriverClass driver)
Constructor

Method Detail

setcommsID

public boolean setcommsID(java.lang.String cid)
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:
setcommsID in interface SPAbstractCommsInterface
Parameters:
cid - String - comms id
Returns:
boolean: TRUE, if succesful, FALSE, if not

addGame

public boolean addGame(java.lang.String gid,
                       SPCommsManagerCommsInterface game)
This method adds an internal game to a specific comms service. The connection is to the SPComms class associated with the game to allow incoming messages to be serviced.

Specified by:
addGame in interface SPAbstractCommsInterface
Parameters:
gid - String - game id
game - SPCommsManagerCommsInterface - the comms object to be added to a game
Returns:
boolean - TRUE, if successful, FALSE, if not

removeGame

public boolean removeGame(java.lang.String gid)
This method removes the association of a game with the comms service. NOTE: actually the association that is removed is with the game instance's SPComms class instance.

Specified by:
removeGame in interface SPAbstractCommsInterface
Parameters:
gid - String - game id
Returns:
boolean - TRUE, if successful, FALSE, if not

addPlayer

public boolean addPlayer(java.lang.String gid,
                         java.lang.String pid)
This method adds a player ID of a remote player serviced by this comm service.

Specified by:
addPlayer in interface SPAbstractCommsInterface
Parameters:
pid - String - player id to be added
gid - String - game id for the player to be added
Returns:
boolean - TRUE, if successful, FALSE, if not

removePlayer

public boolean removePlayer(java.lang.String gid,
                            java.lang.String pid)
This method removes a player from the list of remote players served by this comm service.

Specified by:
removePlayer in interface SPAbstractCommsInterface
Parameters:
pid - String - player id to ber removed.
gid - String - game id from which the player is to be removed.
Returns:
result - Boolean: TRUE, if successful, FALSE, if not

setGamePlayerAddress

public boolean setGamePlayerAddress(java.lang.String gid,
                                    java.lang.String pid,
                                    java.lang.String address,
                                    boolean relay)
Sets a player of a game to an address.

Parameters:
gid - String - game id
pid - String - player id
address - String - address
relay - boolean - relay flag
Returns:
boolean

unsetGamePlayerAddress

public boolean unsetGamePlayerAddress(java.lang.String gid,
                                      java.lang.String pid)
Unsets an address of a player in a game.

Parameters:
gid - String - game id
pid - String - player id
Returns:
boolean

isReady

public boolean isReady()
Goes through every player and checks to see if everyone has an address set.

Returns:
boolean

getCommsDriver

public SPCGenericCommsDriverClass getCommsDriver()
Returns the comms driver.

Returns:
SPCGenericCommsDriverClass

getCommsID

public java.lang.String getCommsID()
Gets the comms id.

Specified by:
getCommsID in interface SPAbstractCommsInterface
Returns:
commsid - String - comms id.

getCommsServiceType

public java.lang.String getCommsServiceType()
This method returns a unique identifier for the type of comms service instance.

Specified by:
getCommsServiceType in interface SPAbstractCommsInterface
Returns:
String - unique identifier for type of comms service

getGameplayerList

public SPMap getGameplayerList()
Getter function that returns the property: gameplayerList

Specified by:
getGameplayerList in interface SPAbstractCommsInterface
Returns:
gameplayerList - SPMap

getPlayerAddress

public java.lang.String getPlayerAddress(java.lang.String gid,
                                         java.lang.String pid)
Gets the address of a player in a game.

Parameters:
gid - String - game id
pid - String - player id
Returns:
String

getAddresses

public java.lang.String[] getAddresses(java.lang.String gid,
                                       java.lang.String[] playerIDs)
Returns a list of addresses that are associated with the player id list. NOTE: However this method considered the possibility that in one location there might be more than one player thus includes the address once avoiding multiple copies of messages sent to the same address or location.

Parameters:
gid -
playerIDs -
Returns:
String[]

getPlayerList

public java.lang.String[] getPlayerList(java.lang.String gid)
Gets the player list of a game.

Parameters:
gid - String - game id.
Returns:
String[]

getInternalGameIDList

public java.lang.String[] getInternalGameIDList()
Getter function that returns the property: internalGameIDList

Specified by:
getInternalGameIDList in interface SPAbstractCommsInterface
Returns:
internalGameIDList - String[]

getOneInternalGameID

public java.lang.String getOneInternalGameID()
Returns the first game id of internal games. Used to send relay messages to indicate that the messages are from this location.

Returns:
String

getOneInternalPlayerID

public java.lang.String getOneInternalPlayerID(java.lang.String gid)
Returns the first player id of the specified game. Used with the method getOneInternalGameID() to send relay messages to indicate that the messages are from this location.

Parameters:
gid - String - game id
Returns:
String

getPrinternalGameList

public SPMap getPrinternalGameList()
Getter function that returns the property: printernalGameList

Specified by:
getPrinternalGameList in interface SPAbstractCommsInterface
Returns:
printernalGameList - SPMap

isGameInternal

public boolean isGameInternal(java.lang.String gid)
This method returns whether a game is handled internally by a comms service

Specified by:
isGameInternal in interface SPAbstractCommsInterface
Parameters:
gid - - String
Returns:
boolean - True if game is internal and supported by Comms Service

isAddressUsed

public boolean isAddressUsed(java.lang.String address)
Checks to see if the address is used by any player.

Parameters:
address - String - the address to be checked.
Returns:
boolean

includedPlayerCount

public int includedPlayerCount(java.lang.String[] playerarray,
                               java.lang.String gid)
Checks to see how many players in the player id list are in the game.

Parameters:
playerarray - String[] - player id list
gid - String - game id.
Returns:
int

prreceive

protected boolean prreceive(SPMessageClass[] message)
This standard method handles incoming serialized messages that have been separated out of incoming data streams by the incoming method. It parses them into Message Objects and passes them on to the Game Instance.

Parameters:
message - String - the incoming message
Returns:
result - Boolean: TRUE, if successfully handled, FALSE, if not.

processincoming

public void processincoming(SPMessageClass inmess)
This method processes the incoming message.

Parameters:
inmess - SPMessageClass - the incoming message void

sendMessage

public int sendMessage(SPMessageClass clearmessage,
                       SPMessageClass alternatemessage)
This method returns a number based on the input array to indicate how many of the input array's player IDs are included in the comms service playerIDList (This method takes the message and sends it over the network, if they are served by this comms service.)

Specified by:
sendMessage in interface SPAbstractCommsInterface
Parameters:
clearmessage - SPMessageClass - message for receivers
alternatemessage - SPMessageClass - message or other game players
Returns:
integer - int - Number of remote players that were handled by this comm service for the message (or the number of players supported by the Comms Service in the input playerID array.)

sendMessage

public int sendMessage(java.lang.String[] receivers,
                       SPMessageClass clearmessage,
                       SPMessageClass alternatemessage)
This method returns a number based on the input array to indicate how many of the input array's player IDs are included in the comms service playerIDList This method is depreceated and will be removed in a future version of the software (This method takes the message and sends it over the network, if they are served by this comms service.)

Parameters:
receivers - String[] - array of playerIDs
clearmessage - SPMessageClass - message for receivers
alternatemessage - SPMessageClass - message or other game players
Returns:
integer - int - Number of remote players that were handled by this comm service for the message (or the number of players supported by the Comms Service in the input playerID array.)

SPdeserializeProcessDouble

public void SPdeserializeProcessDouble(byte[] doubleMessages)
Deserializes and processes double messages not single or multiple.

Parameters:
doubleMessages - void

SPdeserializeProcessMess

public void SPdeserializeProcessMess(byte[] messages)
Deserializes amd processes multiple or single messages not doubple.

Parameters:
messages - void

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.