com.espertech.esper.view
Class ViewFactorySupport

java.lang.Object
  extended by com.espertech.esper.view.ViewFactorySupport
All Implemented Interfaces:
ViewFactory
Direct Known Subclasses:
EventRowRegexNFAViewFactory

public abstract class ViewFactorySupport
extends java.lang.Object
implements ViewFactory

Abstract base class for view factories that do not make re-useable views and that do not share view resources with expression nodes.


Constructor Summary
ViewFactorySupport()
           
 
Method Summary
static void assertReturnsNonConstant(java.lang.String viewName, ExprNode expression, int index)
          Assert and throws an exception if the expression passed returns a non-constant value.
 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.
static java.lang.Object evaluateAssertNoProperties(java.lang.String viewName, ExprNode expression, int index, ExprEvaluatorContext exprEvaluatorContext)
          Assert and throws an exception if the expression uses event property values.
static java.lang.String getViewParamMessageNumericOrTimePeriod(java.lang.String viewName)
           
static ExprNode[] validate(java.lang.String viewName, EventType eventType, StatementContext statementContext, java.util.List<ExprNode> expressions, boolean allowConstantResult)
          Validate the view parameter expressions and return the validated expression for later execution.
static java.lang.Object validateAndEvaluate(java.lang.String viewName, StatementContext statementContext, ExprNode expression)
          Validate the view parameter expression and evaluate the expression returning the result object.
static java.util.List<java.lang.Object> validateAndEvaluate(java.lang.String viewName, StatementContext statementContext, java.util.List<ExprNode> expressions)
          Validate the view parameter expressions and evaluate the expressions returning the result object.
static java.lang.Object validateAndEvaluateExpr(java.lang.String viewName, StatementContext statementContext, ExprNode expression, StreamTypeService streamTypeService, int expressionNumber)
           
static ExprNode validateExpr(java.lang.String viewName, StatementContext statementContext, ExprNode expression, StreamTypeService streamTypeService, int expressionNumber)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.espertech.esper.view.ViewFactory
attach, getEventType, getViewName, makeView, setViewParameters
 

Constructor Detail

ViewFactorySupport

public ViewFactorySupport()
Method Detail

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

validateAndEvaluate

public static java.lang.Object validateAndEvaluate(java.lang.String viewName,
                                                   StatementContext statementContext,
                                                   ExprNode expression)
                                            throws ViewParameterException
Validate the view parameter expression and evaluate the expression returning the result object.

Parameters:
viewName - textual name of view
statementContext - context with statement services
expression - view expression parameter to validate
Returns:
object result value of parameter expression
Throws:
ViewParameterException - if the expressions fail to validate

validateAndEvaluate

public static java.util.List<java.lang.Object> validateAndEvaluate(java.lang.String viewName,
                                                                   StatementContext statementContext,
                                                                   java.util.List<ExprNode> expressions)
                                                            throws ViewParameterException
Validate the view parameter expressions and evaluate the expressions returning the result object.

Parameters:
viewName - textual name of view
statementContext - context with statement services
expressions - view expression parameter to validate
Returns:
object result value of parameter expressions
Throws:
ViewParameterException - if the expressions fail to validate

validate

public static ExprNode[] validate(java.lang.String viewName,
                                  EventType eventType,
                                  StatementContext statementContext,
                                  java.util.List<ExprNode> expressions,
                                  boolean allowConstantResult)
                           throws ViewParameterException
Validate the view parameter expressions and return the validated expression for later execution.

Does not evaluate the expression.

Parameters:
viewName - textual name of view
eventType - is the event type of the parent view or stream attached.
statementContext - context with statement services
expressions - view expression parameter to validate
allowConstantResult - true to indicate whether expressions that return a constant result should be allowed; false to indicate that if an expression is known to return a constant result the expression is considered invalid
Returns:
object result value of parameter expressions
Throws:
ViewParameterException - if the expressions fail to validate

assertReturnsNonConstant

public static void assertReturnsNonConstant(java.lang.String viewName,
                                            ExprNode expression,
                                            int index)
                                     throws ViewParameterException
Assert and throws an exception if the expression passed returns a non-constant value.

Parameters:
viewName - textual name of view
expression - expression to check
index - number offset of expression in view parameters
Throws:
ViewParameterException - if assertion fails

evaluateAssertNoProperties

public static java.lang.Object evaluateAssertNoProperties(java.lang.String viewName,
                                                          ExprNode expression,
                                                          int index,
                                                          ExprEvaluatorContext exprEvaluatorContext)
                                                   throws ViewParameterException
Assert and throws an exception if the expression uses event property values.

Parameters:
viewName - textual name of view
expression - expression to check
index - number offset of expression in view parameters
exprEvaluatorContext - context for expression evaluation
Returns:
expression evaluation value
Throws:
ViewParameterException - if assertion fails

validateAndEvaluateExpr

public static java.lang.Object validateAndEvaluateExpr(java.lang.String viewName,
                                                       StatementContext statementContext,
                                                       ExprNode expression,
                                                       StreamTypeService streamTypeService,
                                                       int expressionNumber)
                                                throws ViewParameterException
Throws:
ViewParameterException

validateExpr

public static ExprNode validateExpr(java.lang.String viewName,
                                    StatementContext statementContext,
                                    ExprNode expression,
                                    StreamTypeService streamTypeService,
                                    int expressionNumber)
                             throws ViewParameterException
Throws:
ViewParameterException

getViewParamMessageNumericOrTimePeriod

public static java.lang.String getViewParamMessageNumericOrTimePeriod(java.lang.String viewName)

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