com.espertech.esper.epl.core
Class MethodPollingViewable

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

public class MethodPollingViewable
extends java.lang.Object
implements HistoricalEventViewable

Polling-data provider that calls a static method on a class and passed parameters, and wraps the results as POJO events.


Constructor Summary
MethodPollingViewable(boolean isStaticMethod, java.lang.Class methodProviderClass, MethodStreamSpec methodStreamSpec, int myStreamNumber, java.util.List<ExprNode> inputParameters, PollExecStrategy pollExecStrategy, DataCache dataCache, EventType eventType, ExprEvaluatorContext exprEvaluatorContext)
          Ctor.
 
Method Summary
 View addView(View view)
          Add a view to the viewable object.
 java.lang.ThreadLocal<DataCache> getDataCacheThreadLocal()
          Historical views are expected to provide a thread-local data cache for use in keeping row (EventBean references) returned during iteration stable, since the concept of a primary key does not exist.
 EventType getEventType()
          Provides metadata information about the type of object the event collection contains.
 java.util.SortedSet<java.lang.Integer> getRequiredStreams()
          Returns the a set of stream numbers of all streams that provide property values in any of the parameter expressions to the stream.
 View[] getViews()
          Returns all added views.
 boolean hasRequiredStreams()
          Returns true if the parameters expressions to the historical require other stream's data, or false if there are no parameters or all parameter expressions are only contants and variables without properties of other stream events.
 boolean hasViews()
          Test is there are any views to the Viewable.
 java.util.Iterator<EventBean> iterator()
          Allows iteration through all elements in this event collection.
 EventTable[][] poll(EventBean[][] lookupEventsPerStream, PollResultIndexingStrategy indexingStrategy, ExprEvaluatorContext exprEvaluatorContext)
          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.
 void removeAllViews()
          Remove all views.
 boolean removeView(View view)
          Remove a view.
 void stop()
          Stops the underlying resources.
 void validate(EngineImportService engineImportService, StreamTypeService streamTypeService, MethodResolutionService methodResolutionService, TimeProvider timeProvider, VariableService variableService, TableService tableService, ExprEvaluatorContext exprEvaluatorContext, ConfigurationInformation configSnapshot, SchedulingService schedulingService, java.lang.String engineURI, java.util.Map<java.lang.Integer,java.util.List<ExprNode>> sqlParameters, EventAdapterService eventAdapterService, java.lang.String statementName, java.lang.String statementId, java.lang.annotation.Annotation[] annotations)
          Validate the view.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MethodPollingViewable

public MethodPollingViewable(boolean isStaticMethod,
                             java.lang.Class methodProviderClass,
                             MethodStreamSpec methodStreamSpec,
                             int myStreamNumber,
                             java.util.List<ExprNode> inputParameters,
                             PollExecStrategy pollExecStrategy,
                             DataCache dataCache,
                             EventType eventType,
                             ExprEvaluatorContext exprEvaluatorContext)
Ctor.

Parameters:
methodStreamSpec - defines class and method names
myStreamNumber - is the stream number
inputParameters - the input parameter expressions
pollExecStrategy - the execution strategy
dataCache - the cache to use
eventType - the type of event returned
exprEvaluatorContext - expression evaluation context
Method Detail

stop

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

Specified by:
stop in interface StopCallback

getDataCacheThreadLocal

public java.lang.ThreadLocal<DataCache> getDataCacheThreadLocal()
Description copied from interface: HistoricalEventViewable
Historical views are expected to provide a thread-local data cache for use in keeping row (EventBean references) returned during iteration stable, since the concept of a primary key does not exist.

Specified by:
getDataCacheThreadLocal in interface HistoricalEventViewable
Returns:
thread-local cache, can be null for any thread to indicate no caching

validate

public void validate(EngineImportService engineImportService,
                     StreamTypeService streamTypeService,
                     MethodResolutionService methodResolutionService,
                     TimeProvider timeProvider,
                     VariableService variableService,
                     TableService tableService,
                     ExprEvaluatorContext exprEvaluatorContext,
                     ConfigurationInformation configSnapshot,
                     SchedulingService schedulingService,
                     java.lang.String engineURI,
                     java.util.Map<java.lang.Integer,java.util.List<ExprNode>> sqlParameters,
                     EventAdapterService eventAdapterService,
                     java.lang.String statementName,
                     java.lang.String statementId,
                     java.lang.annotation.Annotation[] annotations)
              throws ExprValidationException
Description copied from interface: ValidatedView
Validate the view.

Specified by:
validate in interface ValidatedView
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
exprEvaluatorContext - context for expression evaluation
Throws:
ExprValidationException - is thrown to indicate an exception in validating the view

poll

public EventTable[][] poll(EventBean[][] lookupEventsPerStream,
                           PollResultIndexingStrategy indexingStrategy,
                           ExprEvaluatorContext exprEvaluatorContext)
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
exprEvaluatorContext - context for expression evalauation
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 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

removeAllViews

public void removeAllViews()
Description copied from interface: Viewable
Remove all views.

Specified by:
removeAllViews in interface Viewable

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 java.util.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 java.lang.Iterable<EventBean>
Returns:
an iterator which will go through all current elements in the collection.

getRequiredStreams

public java.util.SortedSet<java.lang.Integer> getRequiredStreams()
Description copied from interface: HistoricalEventViewable
Returns the a set of stream numbers of all streams that provide property values in any of the parameter expressions to the stream.

Specified by:
getRequiredStreams in interface HistoricalEventViewable
Returns:
set of stream numbers

hasRequiredStreams

public boolean hasRequiredStreams()
Description copied from interface: HistoricalEventViewable
Returns true if the parameters expressions to the historical require other stream's data, or false if there are no parameters or all parameter expressions are only contants and variables without properties of other stream events.

Specified by:
hasRequiredStreams in interface HistoricalEventViewable
Returns:
indicator whether properties are required for parameter evaluation

© 2006-2015 EsperTech Inc.
All rights reserved.
Visit us at espertech.com