edu.washington.cs.rfid.gateway
Class ReaderGateway

java.lang.Object
  extended by java.lang.Thread
      extended by edu.washington.cs.rfid.gateway.ReaderGateway
All Implemented Interfaces:
ReaderConnectionListener, RFIDSignalListener, java.lang.Runnable

public class ReaderGateway
extends java.lang.Thread
implements ReaderConnectionListener, RFIDSignalListener

The reader gateway. The gateway connects to a set of readers, receives streams of compressed TREs from the reader, and forwards the aggregated streams to the RFID cleaning services.

Author:
Evan

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ReaderGateway(ReaderGatewayParameters params)
          Creates a new ReaderGateway with the specified parameters.
 
Method Summary
 void addListener(ReaderGatewayListener l)
          Adds a ReaderGatewayListener to the list of listeners.
 boolean handle(java.lang.String s)
          The handle method from interface RFIDSignalHandler
static void main(java.lang.String[] args)
          Parses command line arguments and config file, then creates and launches a new ReaderGateway.
 void newMsg(java.lang.String msg)
          The newMsg method from the ReaderConnectionListener interface.
 void newTRE(TRE t)
          The newTRE method from the ReaderConnectionListener interface.
 void run()
          Main loop for processing TREs.
 void shutdown()
          Gracefully shuts down the ReaderGateway.
static void usage()
          Prints a usage message for the reader gateway and then exits.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReaderGateway

public ReaderGateway(ReaderGatewayParameters params)
Creates a new ReaderGateway with the specified parameters.

Parameters:
params - The parameters for creating this ReaderGateway
Method Detail

handle

public boolean handle(java.lang.String s)
The handle method from interface RFIDSignalHandler

Specified by:
handle in interface RFIDSignalListener
Parameters:
s - The signal to handle
Returns:
True if successful, false o/w.

shutdown

public void shutdown()
Gracefully shuts down the ReaderGateway.


addListener

public void addListener(ReaderGatewayListener l)
Adds a ReaderGatewayListener to the list of listeners.

Parameters:
l - The ReaderGatewayListener to add

newTRE

public void newTRE(TRE t)
The newTRE method from the ReaderConnectionListener interface. Handles a newly received TRE by inserting it in the TRE queue.

Specified by:
newTRE in interface ReaderConnectionListener
Parameters:
t - The new TRE

newMsg

public void newMsg(java.lang.String msg)
The newMsg method from the ReaderConnectionListener interface. Handles a newly message by inserting it in the message queue.

Specified by:
newMsg in interface ReaderConnectionListener
Parameters:
msg - The new message

run

public void run()
Main loop for processing TREs.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

usage

public static void usage()
Prints a usage message for the reader gateway and then exits.


main

public static void main(java.lang.String[] args)
Parses command line arguments and config file, then creates and launches a new ReaderGateway.

Parameters:
args - The command line arguments