com.ibm.tspaces.examples.services
Class Pager

java.lang.Object
  |
  +--com.ibm.tspaces.examples.services.TService
        |
        +--com.ibm.tspaces.examples.services.Pager

public class Pager
extends TService
implements Callback, java.lang.Runnable

Pager accepts PAGER requests from the Service T Space, and pages the individual with a specified message, ala almpage.

Author:
Kevin Eustice
See Also:
TupleSpace, Serialized Form

Fields inherited from class com.ibm.tspaces.examples.services.TService
APPLICATION, OTHER, PRINT_FILE, PRINT_TEXT, READMAIL, SENDMAIL
 
Constructor Summary
Pager(java.lang.String name, java.lang.String description)
          Pager Constructor
 
Method Summary
 boolean call(java.lang.String eventName, java.lang.String tsName, int seqNum, SuperTuple tuple, boolean isException)
          Implementation for the Callback interface.
 void init()
          This will handle the initial processing It will do any backlog of requests by looking for unprocessed tuples It will set up RegisterEvent to process all future events
static void main(java.lang.String[] argv)
          Startup the SendMail Process
 void page(java.lang.String toaddr, java.lang.String msg)
          The page(toaddr,msg) method will send the msg to toaddr
 void run()
          The run() method will wait for pager Tuple to be queued The Tuple has the format: [ String name, String to-page-addr, String message ]
 
Methods inherited from class com.ibm.tspaces.examples.services.TService
enable, equals, getName, getQ, printQ, putQ, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Pager

public Pager(java.lang.String name,
             java.lang.String description)
Pager Constructor
Method Detail

init

public void init()
This will handle the initial processing It will do any backlog of requests by looking for unprocessed tuples It will set up RegisterEvent to process all future events

call

public boolean call(java.lang.String eventName,
                    java.lang.String tsName,
                    int seqNum,
                    SuperTuple tuple,
                    boolean isException)
Implementation for the Callback interface.
Specified by:
call in interface Callback
Parameters:
eventName_ - the name of the event command that caused this call, that is the name of the client side command of the thread that registered this call, e.g., in the case of a read, this would be TupleSpace.READ, **not** TupleSpace.WRITE which is the corresponding command that caused the actaul event.
tsName_ - the name of the tuple space this command was executed on.
sequenceNumber_ - the sequenceNumber for this event/command
tuple_ - the returned tuple or a Tuple with an exception inside
isException_ - was the command processed normaly or was there an exception
Returns:
true if this is the last call this sequence # should be getting otherwise false

run

public void run()
The run() method will wait for pager Tuple to be queued The Tuple has the format: [ String name, String to-page-addr, String message ]
Specified by:
run in interface java.lang.Runnable

page

public void page(java.lang.String toaddr,
                 java.lang.String msg)
The page(toaddr,msg) method will send the msg to toaddr

main

public static void main(java.lang.String[] argv)
Startup the SendMail Process