org.fosstrak.ale.client
Class ReportHandler

java.lang.Object
  extended by org.fosstrak.ale.client.ReportHandler
All Implemented Interfaces:
java.lang.Runnable

public class ReportHandler
extends java.lang.Object
implements java.lang.Runnable

This class listen to a specified port for ec reports and notifies his subscribers about new ec reports.

Author:
regli

Constructor Summary
ReportHandler(int port)
          Constructor opens the server socket and starts the thread.
 
Method Summary
 void addListener(ReportHandlerListener listener)
          This mehtod adds a new subscriber to the list of listeners.
static void main(java.lang.String[] args)
          This method starts the ReportHandler.
 void removeListener(ReportHandlerListener listener)
          This method removes a subscriber from the list of listeners.
 void run()
          This method contains the main loop of the thread, in which data is read from the socket and forwarded to the method notifyListeners().
 void stop()
          This method stops the thread and closes the socket
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReportHandler

public ReportHandler(int port)
              throws org.fosstrak.ale.wsdl.ale.epcglobal.ImplementationExceptionResponse
Constructor opens the server socket and starts the thread.

Parameters:
port - on which the ALE notifies
Throws:
org.fosstrak.ale.wsdl.ale.epcglobal.ImplementationException - if server socket could not be created on specified port.
org.fosstrak.ale.wsdl.ale.epcglobal.ImplementationExceptionResponse
Method Detail

addListener

public void addListener(ReportHandlerListener listener)
This mehtod adds a new subscriber to the list of listeners.

Parameters:
listener - to add to this ReportHandler

removeListener

public void removeListener(ReportHandlerListener listener)
This method removes a subscriber from the list of listeners.

Parameters:
listener - to remove from this ReportHandler

run

public void run()
This method contains the main loop of the thread, in which data is read from the socket and forwarded to the method notifyListeners().

Specified by:
run in interface java.lang.Runnable

stop

public void stop()
This method stops the thread and closes the socket


main

public static void main(java.lang.String[] args)
                 throws org.fosstrak.ale.wsdl.ale.epcglobal.ImplementationExceptionResponse
This method starts the ReportHandler.

Parameters:
args - command line arguments, which can contain the port number
Throws:
org.fosstrak.reader.rp.proxy.RPProxyException - if something goes wrong while creating the ReportHandler
org.fosstrak.ale.wsdl.ale.epcglobal.ImplementationExceptionResponse


Copyright © 2009. All Rights Reserved.