org.fosstrak.ale.server
Class EventCycle

java.lang.Object
  extended by org.fosstrak.ale.server.EventCycle
All Implemented Interfaces:
java.lang.Runnable, java.util.Observer

public class EventCycle
extends java.lang.Object
implements java.lang.Runnable, java.util.Observer

This class represents an event cycle. It collects the tags and manages the reports.

Author:
regli, sawielan

Constructor Summary
EventCycle(ReportsGenerator generator)
          Constructor sets parameter and starts thread.
 
Method Summary
 void addTag(Tag tag)
          This method adds a tag to this event cycle.
 void addTag(org.fosstrak.reader.rprm.core.msg.notification.TagType tag)
          compatibility reasons.
 java.util.Set<Tag> getLastEventCycleTags()
          returns the set of tags from the previous EventCycle run.
 java.lang.String getName()
          This method returns the name of this event cycle.
 int getRounds()
           
 java.util.Set<Tag> getTags()
          This method return all tags of this event cycle.
 boolean isTerminated()
          This method indicates if this event cycle is terminated or not.
 void join()
          thread synchronizer for the end of this event cycle. if the event cycle has already finished, then the method returns immediately. otherwise the thread waits for the finish.
 void launch()
          starts this EventCycle.
 void run()
          This method is the main loop of the event cycle in which the tags will be collected.
 void stop()
          This method stops the thread.
 void update(java.util.Observable o, java.lang.Object arg)
          implementation of the observer interface for tags.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventCycle

public EventCycle(ReportsGenerator generator)
           throws org.fosstrak.ale.wsdl.ale.epcglobal.ImplementationExceptionResponse
Constructor sets parameter and starts thread.

Parameters:
generator - to which this event cycle belongs to
Throws:
org.fosstrak.ale.wsdl.ale.epcglobal.ImplementationException - if an implementation exception occurs
org.fosstrak.ale.wsdl.ale.epcglobal.ImplementationExceptionResponse
Method Detail

getTags

public java.util.Set<Tag> getTags()
This method return all tags of this event cycle.

Returns:
set of tags

addTag

public void addTag(Tag tag)
            throws org.fosstrak.ale.wsdl.ale.epcglobal.ImplementationExceptionResponse,
                   org.fosstrak.ale.wsdl.ale.epcglobal.ECSpecValidationExceptionResponse
This method adds a tag to this event cycle.

Parameters:
tag - to add
Throws:
org.fosstrak.ale.wsdl.ale.epcglobal.ImplementationException - if an implementation exception occurs
org.fosstrak.ale.wsdl.ale.epcglobal.ECSpecValidationException - if the tag is not valid
org.fosstrak.ale.wsdl.ale.epcglobal.ImplementationExceptionResponse
org.fosstrak.ale.wsdl.ale.epcglobal.ECSpecValidationExceptionResponse

addTag

public void addTag(org.fosstrak.reader.rprm.core.msg.notification.TagType tag)
            throws org.fosstrak.ale.wsdl.ale.epcglobal.ImplementationExceptionResponse,
                   org.fosstrak.ale.wsdl.ale.epcglobal.ECSpecValidationExceptionResponse
compatibility reasons.

Parameters:
tag - to add
Throws:
org.fosstrak.ale.wsdl.ale.epcglobal.ImplementationException - if an implementation exception occures
org.fosstrak.ale.wsdl.ale.epcglobal.ECSpecValidationException - if the tag is not valid
org.fosstrak.ale.wsdl.ale.epcglobal.ImplementationExceptionResponse
org.fosstrak.ale.wsdl.ale.epcglobal.ECSpecValidationExceptionResponse

update

public void update(java.util.Observable o,
                   java.lang.Object arg)
implementation of the observer interface for tags.

Specified by:
update in interface java.util.Observer
Parameters:
o - an observable object that triggered the update
arg - the arguments passed by the observable

stop

public void stop()
This method stops the thread.


getName

public java.lang.String getName()
This method returns the name of this event cycle.

Returns:
name of event cycle

isTerminated

public boolean isTerminated()
This method indicates if this event cycle is terminated or not.

Returns:
true if this event cycle is terminated and false otherwise

run

public void run()
This method is the main loop of the event cycle in which the tags will be collected. At the end the reports will be generated and the subscribers will be notified.

Specified by:
run in interface java.lang.Runnable

launch

public void launch()
starts this EventCycle.


getLastEventCycleTags

public java.util.Set<Tag> getLastEventCycleTags()
returns the set of tags from the previous EventCycle run.

Returns:
a set of tags from the previous EventCycle run

getRounds

public int getRounds()
Returns:
the number of rounds this event cycle has already run through.

join

public void join()
          throws java.lang.InterruptedException
thread synchronizer for the end of this event cycle. if the event cycle has already finished, then the method returns immediately. otherwise the thread waits for the finish.

Throws:
java.lang.InterruptedException


Copyright © 2009. All Rights Reserved.