com.espertech.esper.epl.db
Class DatabasePollingViewable

java.lang.Object
  extended by com.espertech.esper.epl.db.DatabasePollingViewable
All Implemented Interfaces:
StopCallback, EventCollection, HistoricalEventViewable, ValidatedView, Viewable, Iterable<EventBean>

public class DatabasePollingViewable
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
DatabasePollingViewable(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.
 EventTable[] poll(EventBean[][] lookupEventsPerStream, PollResultIndexingStrategy indexingStrategy)
          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, MethodResolutionService methodResolutionService, TimeProvider timeProvider, VariableService variableService)
          Validate the view.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatabasePollingViewable

public DatabasePollingViewable(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,
                     MethodResolutionService methodResolutionService,
                     TimeProvider timeProvider,
                     VariableService variableService)
              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
methodResolutionService - for resolving imports and classes and methods
timeProvider - for providing current time
variableService - for access to variables
Throws:
ExprValidationException - is thrown to indicate an exception in validating the view

poll

public EventTable[] poll(EventBean[][] lookupEventsPerStream,
                         PollResultIndexingStrategy indexingStrategy)
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.
indexingStrategy - the strategy to use for converting poll results into a indexed table for fast lookup
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 EventCollection
Specified by:
iterator in interface Iterable<EventBean>
Returns:
an iterator which will go through all current elements in the collection.

© 2007 EsperTech Inc.
All rights reserved.
Visit us at espertech.com