net.esper.eql.db
Class PollingViewable

java.lang.Object
  extended by net.esper.eql.db.PollingViewable
All Implemented Interfaces:
Iterable<EventBean>, StopCallback, EventCollection, HistoricalEventViewable, ValidatedView, Viewable

public class PollingViewable
extends Object
implements HistoricalEventViewable

Implements a poller viewable that uses a polling strategy, a cache and some input parameters extracted from event streams to perform the polling.


Constructor Summary
PollingViewable(int myStreamNumber, List<String> inputParameters, PollExecStrategy pollExecStrategy, DataCache dataCache, EventType eventType)
          Ctor.
 
Method Summary
 View addView(View view)
          Add a view to the viewable object.
 EventType getEventType()
          Provides metadata information about the type of object the event collection contains.
 List<View> getViews()
          Returns all added views.
 boolean hasViews()
          Test is there are any views to the Viewable.
 Iterator<EventBean> iterator()
          Allows iteration through all elements in this event collection.
 List<EventBean>[] poll(EventBean[][] lookupEventsPerStream)
          Poll for stored historical or reference data using events per stream and returing for each event-per-stream row a separate list with events representing the poll result.
 boolean removeView(View view)
          Remove a view.
 void stop()
          Stops the underlying resources.
 void validate(StreamTypeService streamTypeService)
          Validate the view.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PollingViewable

public PollingViewable(int myStreamNumber,
                       List<String> inputParameters,
                       PollExecStrategy pollExecStrategy,
                       DataCache dataCache,
                       EventType eventType)
Ctor.

Parameters:
myStreamNumber - is the stream number of the view
inputParameters - are the event property names providing input parameter keys
pollExecStrategy - is the strategy to use for retrieving results
dataCache - is looked up before using the strategy
eventType - is the type of events generated by the view
Method Detail

stop

public void stop()
Description copied from interface: StopCallback
Stops the underlying resources.

Specified by:
stop in interface StopCallback

validate

public void validate(StreamTypeService streamTypeService)
              throws ExprValidationException
Description copied from interface: ValidatedView
Validate the view.

Specified by:
validate in interface ValidatedView
Parameters:
streamTypeService - supplies the types of streams against which to validate
Throws:
ExprValidationException - is thrown to indicate an exception in validating the view

poll

public List<EventBean>[] poll(EventBean[][] lookupEventsPerStream)
Description copied from interface: HistoricalEventViewable
Poll for stored historical or reference data using events per stream and returing for each event-per-stream row a separate list with events representing the poll result.

Specified by:
poll in interface HistoricalEventViewable
Parameters:
lookupEventsPerStream - is the events per stream where the first dimension is a number of rows (often 1 depending on windows used) and the second dimension is the number of streams participating in a join.
Returns:
array of lists with one list for each event-per-stream row

addView

public View addView(View view)
Description copied from interface: Viewable
Add a view to the viewable object.

Specified by:
addView in interface Viewable
Parameters:
view - to add
Returns:
view to add

getViews

public List<View> getViews()
Description copied from interface: Viewable
Returns all added views.

Specified by:
getViews in interface Viewable
Returns:
list of added views

removeView

public boolean removeView(View view)
Description copied from interface: Viewable
Remove a view.

Specified by:
removeView in interface Viewable
Parameters:
view - to remove
Returns:
true to indicate that the view to be removed existed within this view, false if the view to remove could not be found

hasViews

public boolean hasViews()
Description copied from interface: Viewable
Test is there are any views to the Viewable.

Specified by:
hasViews in interface Viewable
Returns:
true indicating there are child views, false indicating there are no child views

getEventType

public EventType getEventType()
Description copied from interface: EventCollection
Provides metadata information about the type of object the event collection contains.

Specified by:
getEventType in interface EventCollection
Returns:
metadata for the objects in the collection

iterator

public Iterator<EventBean> iterator()
Description copied from interface: EventCollection
Allows iteration through all elements in this event collection. The iterator will return the elements in the collection in their natural order, or, if there is no natural ordering, in some unpredictable order.

Specified by:
iterator in interface Iterable<EventBean>
Specified by:
iterator in interface EventCollection
Returns:
an iterator which will go through all current elements in the collection.