org.persvr.remote
Class EventStream

java.lang.Object
  extended by org.persvr.remote.EventStream
All Implemented Interfaces:
java.util.EventListener, PropertyChangeSetListener
Direct Known Subclasses:
ClientConnection

public class EventStream
extends java.lang.Object
implements PropertyChangeSetListener

This represents a stream of events. You can subscribe to the event stream with addCallback and publish events with the fire method.

Author:
Kris

Nested Class Summary
static interface EventStream.EventCallback
           
static class EventStream.Notification
           
 
Field Summary
 int bytesSent
           
 java.lang.String connectionId
           
protected  boolean finished
           
 boolean started
           
static java.util.Map<java.lang.String,ClientConnection> streams
           
 User user
           
 
Constructor Summary
EventStream()
           
 
Method Summary
 void addCallback(EventStream.EventCallback callback)
           
 void addSubscription(java.util.Map<java.lang.String,java.lang.String> headers)
           
 boolean eventAvailable()
           
 void finished()
           
 void fire(EventStream.Notification response)
           
 void propertyChange(java.util.List<ObservedCall> evts)
          This method gets called when bound properties are changed.
 void removeCallback()
           
 void removeSubscription(java.util.Map<java.lang.String,java.lang.String> headers)
           
 void setResponse(HttpServletResponse response)
           
 EventStream.Notification take(int timeoutInSeconds)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

user

public User user

streams

public static java.util.Map<java.lang.String,ClientConnection> streams

finished

protected boolean finished

started

public boolean started

connectionId

public java.lang.String connectionId

bytesSent

public int bytesSent
Constructor Detail

EventStream

public EventStream()
Method Detail

addSubscription

public void addSubscription(java.util.Map<java.lang.String,java.lang.String> headers)

removeSubscription

public void removeSubscription(java.util.Map<java.lang.String,java.lang.String> headers)

addCallback

public void addCallback(EventStream.EventCallback callback)

eventAvailable

public boolean eventAvailable()

removeCallback

public void removeCallback()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

take

public EventStream.Notification take(int timeoutInSeconds)

propertyChange

public void propertyChange(java.util.List<ObservedCall> evts)
Description copied from interface: PropertyChangeSetListener
This method gets called when bound properties are changed.

Specified by:
propertyChange in interface PropertyChangeSetListener
Parameters:
evts - A PropertyChangeEvent object describing the event source and the property that has changed.

setResponse

public void setResponse(HttpServletResponse response)

finished

public void finished()

fire

public void fire(EventStream.Notification response)
          throws java.io.IOException
Throws:
java.io.IOException