SecurePlayLibray J2SE
v2.1

com.SecurePlay.Comms.SPCLocalCommsFile
Class SPCLocalCommsFileClass

java.lang.Object
  extended bycom.SecurePlay.Comms.SPAbstractCommsClass
      extended bycom.SecurePlay.Comms.SPCLocalCommsFile.SPCLocalCommsFileClass
All Implemented Interfaces:
java.lang.Runnable, SPAbstractCommsInterface

public class SPCLocalCommsFileClass
extends SPAbstractCommsClass
implements java.lang.Runnable

This class handles communications between multiple instances of the SecurePlay library on a single computer. This is an easy way to test or implement multiplayer games with a single design. This version uses files to exchange data rather than simply instances so that it can be used with different sessions or different languages, if message encodings are uniform.

Author:
IT GlobalSecure
See Also:
SecurePlay License Information
 

Nested Class Summary
(package private)  class SPCLocalCommsFileClass.polldir
          Internal Class that pulls and writes messages to the directory in timed periods.
 
Field Summary
(package private)  boolean activated
          Flag for activated or deactivated
private  java.lang.String DcommsID
          The Comms id
(package private) static java.lang.String dirpath
          This is the directory path for the shared local comms
(package private)  java.lang.String extendedversion
          Developer extended version.
(package private)  boolean initialized
          Flag for initialized or not
(package private)  long pollingperiod
          this holds the default update interval - this is needed to handle
(package private)  java.lang.String releaseversion
          IT GlobalSecure release version.
(package private)  java.lang.Thread t1
          The thread that carries the instances of this class.
(package private)  java.util.Timer tracker
          timer for outgoing activities
 
Fields inherited from class com.SecurePlay.Comms.SPAbstractCommsClass
commstype
 
Constructor Summary
SPCLocalCommsFileClass()
          Default Constructor
 
Method Summary
 boolean APIactivate()
          This method adds the Local Comms instance to the set of active Local Comms objects so it will receive incoming messages
 boolean APIconfigureCommService(int pollp)
          Configures the comms service.
 boolean APIdeactivate()
          This method removes the Local Comms instance from the set of active local Comms objects so it can no longer send or receive messages NOTE: Deactivate for threads does not actually delete the thread.
 boolean APIsetDirPath(java.lang.String str)
          This method sets the directory path for the various local comms classes that communicate via shared files
 java.lang.String getCommsServiceType()
          This method gets the comms service type
(package private)  void incoming(byte[] message)
          This method handles incoming messages and passes them on for processing by the various games associated with the Local Comms instance.
(package private)  boolean initializetest()
          Tests to see if everything is set for intialization
(package private)  boolean isCommsIncluded(java.lang.String cid)
          Checks to see if the Comms id specified is already included.
 boolean prsend(byte[] message)
          This method sends messages to each of the registered Local Comms instances
 void run()
           
 
Methods inherited from class com.SecurePlay.Comms.SPAbstractCommsClass
addGame, addPlayer, APIconfigureCommService, getCommsID, getGameplayerList, getInternalGameIDList, getPrinternalGameList, isGameInternal, logError, processincoming, prreceive, removeGame, removePlayer, sendMessage, setcommsID
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

extendedversion

final java.lang.String extendedversion
Developer extended version.

See Also:
Constant Field Values

releaseversion

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

See Also:
Constant Field Values

dirpath

static java.lang.String dirpath
This is the directory path for the shared local comms


activated

boolean activated
Flag for activated or deactivated


initialized

boolean initialized
Flag for initialized or not


t1

java.lang.Thread t1
The thread that carries the instances of this class.


pollingperiod

long pollingperiod
this holds the default update interval - this is needed to handle


tracker

java.util.Timer tracker
timer for outgoing activities


DcommsID

private java.lang.String DcommsID
The Comms id

Constructor Detail

SPCLocalCommsFileClass

public SPCLocalCommsFileClass()
Default Constructor

Method Detail

getCommsServiceType

public java.lang.String getCommsServiceType()
This method gets the comms service type

Specified by:
getCommsServiceType in interface SPAbstractCommsInterface
Overrides:
getCommsServiceType in class SPAbstractCommsClass
Returns:
"local" - String - local

prsend

public boolean prsend(byte[] message)
This method sends messages to each of the registered Local Comms instances

Overrides:
prsend in class SPAbstractCommsClass
Parameters:
message - String - the message to be sent.
Returns:
boolean - true, if successful

APIactivate

public boolean APIactivate()
This method adds the Local Comms instance to the set of active Local Comms objects so it will receive incoming messages

Overrides:
APIactivate in class SPAbstractCommsClass
Returns:
boolean - Boolean: TRUE, if successful, FALSE, if not successful

APIdeactivate

public boolean APIdeactivate()
This method removes the Local Comms instance from the set of active local Comms objects so it can no longer send or receive messages NOTE: Deactivate for threads does not actually delete the thread.

Overrides:
APIdeactivate in class SPAbstractCommsClass
Returns:
boolean - Boolean: TRUE, if successful, FALSE, if not successful

incoming

void incoming(byte[] message)
This method handles incoming messages and passes them on for processing by the various games associated with the Local Comms instance.

Parameters:
message - - String - message

run

public void run()
Specified by:
run in interface java.lang.Runnable

isCommsIncluded

boolean isCommsIncluded(java.lang.String cid)
Checks to see if the Comms id specified is already included.

Parameters:
cid - String - comms id to be checked
Returns:
boolean Boolean: TRUE, if included, FALSE if not included

APIsetDirPath

public boolean APIsetDirPath(java.lang.String str)
This method sets the directory path for the various local comms classes that communicate via shared files

Parameters:
str - - proposed directory path
Returns:
boolean - true, if successful

APIconfigureCommService

public boolean APIconfigureCommService(int pollp)
Configures the comms service.

Parameters:
pollp - int - the polling period to be scheduled to.
Returns:
boolean Boolean: TRUE, if successful, FALSE, if not successful

initializetest

boolean initializetest()
Tests to see if everything is set for intialization

Returns:
boolean Boolean: TRUE, if successful, FALSE, if not successful

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.