com.espertech.esper.view.window
Class TimeLengthBatchViewFactory

java.lang.Object
  extended by com.espertech.esper.view.window.TimeLengthBatchViewFactory
All Implemented Interfaces:
DataWindowViewFactory, ViewFactory

public class TimeLengthBatchViewFactory
extends Object
implements DataWindowViewFactory

Factory for TimeLengthBatchView.


Field Summary
protected  boolean isForceUpdate
          Indicate whether to output only if there is data, or to keep outputing empty batches.
protected  boolean isStartEager
          Indicate whether to output only if there is data, or to keep outputing empty batches.
protected  long millisecondsBeforeExpiry
          Number of msec before batch fires (either interval or number of events).
protected  long numberOfEvents
          Number of events to collect before batch fires.
protected  RelativeAccessByEventNIndexGetter relativeAccessGetterImpl
          The access into the data window.
 
Constructor Summary
TimeLengthBatchViewFactory()
           
 
Method Summary
 void attach(EventType parentEventType, StatementContext statementContext, ViewFactory optionalParentFactory, List<ViewFactory> parentViewFactories)
          Attaches the factory to a parent event type such that the factory can validate attach requirements and determine an event type for resulting views.
 boolean canProvideCapability(ViewCapability viewCapability)
          Returns true if the view factory can make views that provide a view resource with the given capability.
 boolean canReuse(View view)
          Determines if the given view could be used instead of creating a new view, requires the view factory to compare view type, parameters and other capabilities provided.
 EventType getEventType()
          Returns the event type that the view that is created by the view factory would create for events posted by the view.
 View makeView(StatementContext statementContext)
          Create a new view.
 void setProvideCapability(ViewCapability viewCapability, ViewResourceCallback resourceCallback)
          Indicates to the view factory to provide the view resource indicated.
 void setViewParameters(ViewFactoryContext viewFactoryContext, List<Object> viewParameters)
          Indicates user EPL query view parameters to the view factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

numberOfEvents

protected long numberOfEvents
Number of events to collect before batch fires.


millisecondsBeforeExpiry

protected long millisecondsBeforeExpiry
Number of msec before batch fires (either interval or number of events).


isForceUpdate

protected boolean isForceUpdate
Indicate whether to output only if there is data, or to keep outputing empty batches.


isStartEager

protected boolean isStartEager
Indicate whether to output only if there is data, or to keep outputing empty batches.


relativeAccessGetterImpl

protected RelativeAccessByEventNIndexGetter relativeAccessGetterImpl
The access into the data window.

Constructor Detail

TimeLengthBatchViewFactory

public TimeLengthBatchViewFactory()
Method Detail

setViewParameters

public void setViewParameters(ViewFactoryContext viewFactoryContext,
                              List<Object> viewParameters)
                       throws ViewParameterException
Description copied from interface: ViewFactory
Indicates user EPL query view parameters to the view factory.

Specified by:
setViewParameters in interface ViewFactory
Parameters:
viewFactoryContext - supplied context information for the view factory
viewParameters - is the objects representing the view parameters
Throws:
ViewParameterException - if the parameters don't match view parameter needs

attach

public void attach(EventType parentEventType,
                   StatementContext statementContext,
                   ViewFactory optionalParentFactory,
                   List<ViewFactory> parentViewFactories)
            throws ViewAttachException
Description copied from interface: ViewFactory
Attaches the factory to a parent event type such that the factory can validate attach requirements and determine an event type for resulting views.

Specified by:
attach in interface ViewFactory
Parameters:
parentEventType - is the parent event stream's or view factory's event type
statementContext - contains the services needed for creating a new event type
optionalParentFactory - is null when there is no parent view factory, or contains the parent view factory
parentViewFactories - is a list of all the parent view factories or empty list if there are none
Throws:
ViewAttachException - is thrown to indicate that this view factories's view would not play with the parent view factories view

canProvideCapability

public boolean canProvideCapability(ViewCapability viewCapability)
Description copied from interface: ViewFactory
Returns true if the view factory can make views that provide a view resource with the given capability.

Specified by:
canProvideCapability in interface ViewFactory
Parameters:
viewCapability - is the view resource needed
Returns:
true to indicate that the view can provide the resource, or false if not

setProvideCapability

public void setProvideCapability(ViewCapability viewCapability,
                                 ViewResourceCallback resourceCallback)
Description copied from interface: ViewFactory
Indicates to the view factory to provide the view resource indicated.

Specified by:
setProvideCapability in interface ViewFactory
Parameters:
viewCapability - is the required resource descriptor
resourceCallback - is the callback to use to supply the resource needed

makeView

public View makeView(StatementContext statementContext)
Description copied from interface: ViewFactory
Create a new view.

Specified by:
makeView in interface ViewFactory
Parameters:
statementContext - contains view services
Returns:
new view

getEventType

public EventType getEventType()
Description copied from interface: ViewFactory
Returns the event type that the view that is created by the view factory would create for events posted by the view.

Specified by:
getEventType in interface ViewFactory
Returns:
event type of view's created by the view factory

canReuse

public boolean canReuse(View view)
Description copied from interface: ViewFactory
Determines if the given view could be used instead of creating a new view, requires the view factory to compare view type, parameters and other capabilities provided.

Specified by:
canReuse in interface ViewFactory
Parameters:
view - is the candidate view to compare to
Returns:
true if the given view can be reused instead of creating a new view, or false to indicate the view is not right for reuse

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