com.espertech.esper.client.soda
Class EPStatementObjectModel

java.lang.Object
  extended by com.espertech.esper.client.soda.EPStatementObjectModel
All Implemented Interfaces:
java.io.Serializable

public class EPStatementObjectModel
extends java.lang.Object
implements java.io.Serializable

Object model of an EPL statement.

Applications can create an object model by instantiating this class and then setting the various clauses. When done, use EPAdministrator to create a statement from the model.

Alternativly, a given textual EPL can be compiled into an object model representation via the compile method on EPAdministrator.

Use the toEPL method to generate a textual EPL from an object model.

Minimally, and EPL statement consists of the select-clause and the where-clause. These are represented by SelectClause and FromClause respectively.

Here is a short example that create a simple EPL statement such as "select page, responseTime from PageLoad" :

 EPStatementObjectModel model = new EPStatementObjectModel();
 model.setSelectClause(SelectClause.create("page", "responseTime"));
 model.setFromClause(FromClause.create(FilterStream.create("PageLoad")));
 

The select-clause and from-clause must be set for the statement object model to be useable by the administrative API. All other clauses a optional.

Please see the documentation set for further examples.

See Also:
Serialized Form

Constructor Summary
EPStatementObjectModel()
          Ctor.
 
Method Summary
 EPStatementObjectModel fromClause(FromClause fromClause)
          Specify a from-clause.
 java.util.List<AnnotationPart> getAnnotations()
          Returns annotations.
 java.lang.String getContextName()
          Returns the context name if context dimensions apply to statement.
 CreateContextClause getCreateContext()
          Returns the create-context clause.
 CreateDataFlowClause getCreateDataFlow()
          Returns the "create dataflow" part, if present.
 CreateExpressionClause getCreateExpression()
          Returns the create-expression clause, if any
 CreateIndexClause getCreateIndex()
          Returns create-index clause.
 CreateSchemaClause getCreateSchema()
          Returns the create-schema clause.
 CreateTableClause getCreateTable()
          Returns the create-table clause if present or null if not present
 CreateVariableClause getCreateVariable()
          Returns the create-variable clause if this is a statement creating a variable, or null if not.
 CreateWindowClause getCreateWindow()
          Returns the create-window clause for creating named windows, or null if this statement does not create a named window.
 java.util.List<ExpressionDeclaration> getExpressionDeclarations()
          Returns the expression declarations, if any.
 FireAndForgetClause getFireAndForgetClause()
          Returns fire-and-forget (on-demand) query information for FAF select, insert, update and delete.
 ForClause getForClause()
          Returns the for-clause.
 FromClause getFromClause()
          Return the from-clause.
 GroupByClause getGroupByClause()
          Return the group-by-clause, or null to indicate that the clause is absent.
 Expression getHavingClause()
          Return the having-clause, or null to indicate that the clause is absent.
 InsertIntoClause getInsertInto()
          Return the insert-into-clause, or null to indicate that the clause is absent.
 IntoTableClause getIntoTableClause()
          Returns the into-table clause, or null if none found.
 MatchRecognizeClause getMatchRecognizeClause()
          Match-recognize clause.
 OnClause getOnExpr()
          Returns the on-delete clause for deleting from named windows, or null if this statement does not delete from a named window
 OrderByClause getOrderByClause()
          Return the order-by-clause, or null to indicate that the clause is absent.
 OutputLimitClause getOutputLimitClause()
          Return the output-rate-limiting-clause, or null to indicate that the clause is absent.
 RowLimitClause getRowLimitClause()
          Returns the row limit specification, or null if none supplied.
 java.util.List<ScriptExpression> getScriptExpressions()
          Returns the scripts defined.
 SelectClause getSelectClause()
          Return the select-clause.
 java.lang.String getTreeObjectName()
          Returns the internal expression id assigned for tools to identify the expression.
 UpdateClause getUpdateClause()
          Returns the update specification.
 Expression getWhereClause()
          Return the where-clause, or null to indicate that the clause is absent.
 EPStatementObjectModel groupByClause(GroupByClause groupByClause)
          Specify a group-by-clause.
 EPStatementObjectModel havingClause(Expression havingClause)
          Specify a having-clause.
 EPStatementObjectModel insertInto(InsertIntoClause insertInto)
          Specify an insert-into-clause.
 EPStatementObjectModel orderByClause(OrderByClause orderByClause)
          Specify an order-by-clause.
 EPStatementObjectModel outputLimitClause(OutputLimitClause outputLimitClause)
          Specify an output-rate-limiting-clause.
 EPStatementObjectModel selectClause(SelectClause selectClause)
          Specify a select-clause.
 void setAnnotations(java.util.List<AnnotationPart> annotations)
          Sets annotations.
 void setContextName(java.lang.String contextName)
          Sets the context name if context dimensions apply to statement.
 void setCreateContext(CreateContextClause createContext)
          Sets the create-context clause.
 void setCreateDataFlow(CreateDataFlowClause createDataFlow)
          Sets the "create dataflow" part,.
 void setCreateExpression(CreateExpressionClause createExpression)
          Sets the create-expression clause, if any
 void setCreateIndex(CreateIndexClause createIndex)
          Sets create-index clause.
 void setCreateSchema(CreateSchemaClause createSchema)
          Sets the create-schema clause.
 void setCreateTable(CreateTableClause createTable)
          Sets the create-table clause if present or null if not present
 void setCreateVariable(CreateVariableClause createVariable)
          Sets the create-variable clause if this is a statement creating a variable, or null if not.
 void setCreateWindow(CreateWindowClause createWindow)
          Sets the create-window clause for creating named windows, or null if this statement does not create a named window.
 void setExpressionDeclarations(java.util.List<ExpressionDeclaration> expressionDeclarations)
          Sets the expression declarations, if any.
 void setFireAndForgetClause(FireAndForgetClause fireAndForgetClause)
          Sets fire-and-forget (on-demand) query information for FAF select, insert, update and delete.
 void setForClause(ForClause forClause)
          Sets the for-clause.
 void setFromClause(FromClause fromClause)
          Specify a from-clause.
 void setGroupByClause(GroupByClause groupByClause)
          Specify a group-by-clause.
 void setHavingClause(Expression havingClause)
          Specify a having-clause.
 void setInsertInto(InsertIntoClause insertInto)
          Specify an insert-into-clause.
 void setIntoTableClause(IntoTableClause intoTableClause)
          Sets the into-table clause, or null if none found.
 void setMatchRecognizeClause(MatchRecognizeClause clause)
          Sets match-recognize clause.
 void setOnExpr(OnClause onExpr)
          Sets the on-delete or on-select clause for selecting or deleting from named windows, or null if this statement does not on-select or on-delete from a named window
 void setOrderByClause(OrderByClause orderByClause)
          Specify an order-by-clause.
 void setOutputLimitClause(OutputLimitClause outputLimitClause)
          Specify an output-rate-limiting-clause.
 void setRowLimitClause(RowLimitClause rowLimitClause)
          Sets the row limit specification, or null if none applicable.
 void setScriptExpressions(java.util.List<ScriptExpression> scriptExpressions)
          Sets the scripts.
 void setSelectClause(SelectClause selectClause)
          Specify a select-clause.
 void setTreeObjectName(java.lang.String treeObjectName)
          Sets an internal expression id assigned for tools to identify the expression.
 void setUpdateClause(UpdateClause updateClause)
          Sets the update specification.
 void setWhereClause(Expression whereClause)
          Specify a where-clause.
 java.lang.String toEPL()
          Renders the object model in it's EPL syntax textual representation.
 java.lang.String toEPL(EPStatementFormatter formatter)
          Rendering using the provided formatter.
 void toEPL(EPStatementFormatter formatter, java.io.StringWriter writer)
          Renders the object model in it's EPL syntax textual representation, using a whitespace-formatter as provided.
 void toEPL(java.io.StringWriter writer)
          Rendering using the provided writer.
 EPStatementObjectModel whereClause(Expression whereClause)
          Specify a where-clause.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EPStatementObjectModel

public EPStatementObjectModel()
Ctor.

Method Detail

setInsertInto

public void setInsertInto(InsertIntoClause insertInto)
Specify an insert-into-clause.

Parameters:
insertInto - specifies the insert-into-clause, or null to indicate that the clause is absent

insertInto

public EPStatementObjectModel insertInto(InsertIntoClause insertInto)
Specify an insert-into-clause.

Parameters:
insertInto - specifies the insert-into-clause, or null to indicate that the clause is absent
Returns:
model

getInsertInto

public InsertIntoClause getInsertInto()
Return the insert-into-clause, or null to indicate that the clause is absent.

Returns:
specification of the insert-into-clause, or null if none present

setSelectClause

public void setSelectClause(SelectClause selectClause)
Specify a select-clause.

Parameters:
selectClause - specifies the select-clause, the select-clause cannot be null and must be set

selectClause

public EPStatementObjectModel selectClause(SelectClause selectClause)
Specify a select-clause.

Parameters:
selectClause - specifies the select-clause, the select-clause cannot be null and must be set
Returns:
model

getSelectClause

public SelectClause getSelectClause()
Return the select-clause.

Returns:
specification of the select-clause

setFromClause

public void setFromClause(FromClause fromClause)
Specify a from-clause.

Parameters:
fromClause - specifies the from-clause, the from-clause cannot be null and must be set

fromClause

public EPStatementObjectModel fromClause(FromClause fromClause)
Specify a from-clause.

Parameters:
fromClause - specifies the from-clause, the from-clause cannot be null and must be set
Returns:
model

getWhereClause

public Expression getWhereClause()
Return the where-clause, or null to indicate that the clause is absent.

Returns:
specification of the where-clause, or null if none present

setWhereClause

public void setWhereClause(Expression whereClause)
Specify a where-clause.

Parameters:
whereClause - specifies the where-clause, which is optional and can be null

whereClause

public EPStatementObjectModel whereClause(Expression whereClause)
Specify a where-clause.

Parameters:
whereClause - specifies the where-clause, which is optional and can be null
Returns:
model

getFromClause

public FromClause getFromClause()
Return the from-clause.

Returns:
specification of the from-clause

getGroupByClause

public GroupByClause getGroupByClause()
Return the group-by-clause, or null to indicate that the clause is absent.

Returns:
specification of the group-by-clause, or null if none present

setGroupByClause

public void setGroupByClause(GroupByClause groupByClause)
Specify a group-by-clause.

Parameters:
groupByClause - specifies the group-by-clause, which is optional and can be null

groupByClause

public EPStatementObjectModel groupByClause(GroupByClause groupByClause)
Specify a group-by-clause.

Parameters:
groupByClause - specifies the group-by-clause, which is optional and can be null
Returns:
model

getHavingClause

public Expression getHavingClause()
Return the having-clause, or null to indicate that the clause is absent.

Returns:
specification of the having-clause, or null if none present

setHavingClause

public void setHavingClause(Expression havingClause)
Specify a having-clause.

Parameters:
havingClause - specifies the having-clause, which is optional and can be null

havingClause

public EPStatementObjectModel havingClause(Expression havingClause)
Specify a having-clause.

Parameters:
havingClause - specifies the having-clause, which is optional and can be null
Returns:
model

getOrderByClause

public OrderByClause getOrderByClause()
Return the order-by-clause, or null to indicate that the clause is absent.

Returns:
specification of the order-by-clause, or null if none present

setOrderByClause

public void setOrderByClause(OrderByClause orderByClause)
Specify an order-by-clause.

Parameters:
orderByClause - specifies the order-by-clause, which is optional and can be null

orderByClause

public EPStatementObjectModel orderByClause(OrderByClause orderByClause)
Specify an order-by-clause.

Parameters:
orderByClause - specifies the order-by-clause, which is optional and can be null
Returns:
model

getOutputLimitClause

public OutputLimitClause getOutputLimitClause()
Return the output-rate-limiting-clause, or null to indicate that the clause is absent.

Returns:
specification of the output-rate-limiting-clause, or null if none present

setOutputLimitClause

public void setOutputLimitClause(OutputLimitClause outputLimitClause)
Specify an output-rate-limiting-clause.

Parameters:
outputLimitClause - specifies the output-rate-limiting-clause, which is optional and can be null

outputLimitClause

public EPStatementObjectModel outputLimitClause(OutputLimitClause outputLimitClause)
Specify an output-rate-limiting-clause.

Parameters:
outputLimitClause - specifies the output-rate-limiting-clause, which is optional and can be null
Returns:
model

toEPL

public java.lang.String toEPL()
Renders the object model in it's EPL syntax textual representation.

Returns:
EPL representing the statement object model
Throws:
java.lang.IllegalStateException - if required clauses do not exist

toEPL

public void toEPL(java.io.StringWriter writer)
Rendering using the provided writer.

Parameters:
writer - to use

toEPL

public java.lang.String toEPL(EPStatementFormatter formatter)
Rendering using the provided formatter.

Parameters:
formatter - to use
Returns:
rendered string

toEPL

public void toEPL(EPStatementFormatter formatter,
                  java.io.StringWriter writer)
Renders the object model in it's EPL syntax textual representation, using a whitespace-formatter as provided.

Parameters:
formatter - the formatter to use
writer - writer to use
Throws:
java.lang.IllegalStateException - if required clauses do not exist

getCreateWindow

public CreateWindowClause getCreateWindow()
Returns the create-window clause for creating named windows, or null if this statement does not create a named window.

Returns:
named window creation clause

setCreateWindow

public void setCreateWindow(CreateWindowClause createWindow)
Sets the create-window clause for creating named windows, or null if this statement does not create a named window.

Parameters:
createWindow - is the named window creation clause

getOnExpr

public OnClause getOnExpr()
Returns the on-delete clause for deleting from named windows, or null if this statement does not delete from a named window

Returns:
on delete clause

setOnExpr

public void setOnExpr(OnClause onExpr)
Sets the on-delete or on-select clause for selecting or deleting from named windows, or null if this statement does not on-select or on-delete from a named window

Parameters:
onExpr - is the on-expression (on-select and on-delete) clause to set

getCreateVariable

public CreateVariableClause getCreateVariable()
Returns the create-variable clause if this is a statement creating a variable, or null if not.

Returns:
create-variable clause

setCreateVariable

public void setCreateVariable(CreateVariableClause createVariable)
Sets the create-variable clause if this is a statement creating a variable, or null if not.

Parameters:
createVariable - create-variable clause

getRowLimitClause

public RowLimitClause getRowLimitClause()
Returns the row limit specification, or null if none supplied.

Returns:
row limit spec if any

setRowLimitClause

public void setRowLimitClause(RowLimitClause rowLimitClause)
Sets the row limit specification, or null if none applicable.

Parameters:
rowLimitClause - row limit spec if any

getUpdateClause

public UpdateClause getUpdateClause()
Returns the update specification.

Returns:
update spec if defined

setUpdateClause

public void setUpdateClause(UpdateClause updateClause)
Sets the update specification.

Parameters:
updateClause - update spec if defined

getAnnotations

public java.util.List<AnnotationPart> getAnnotations()
Returns annotations.

Returns:
annotations

setAnnotations

public void setAnnotations(java.util.List<AnnotationPart> annotations)
Sets annotations.

Parameters:
annotations - to set

getMatchRecognizeClause

public MatchRecognizeClause getMatchRecognizeClause()
Match-recognize clause.

Returns:
clause

setMatchRecognizeClause

public void setMatchRecognizeClause(MatchRecognizeClause clause)
Sets match-recognize clause.

Parameters:
clause - to set

getCreateIndex

public CreateIndexClause getCreateIndex()
Returns create-index clause.

Returns:
clause

setCreateIndex

public void setCreateIndex(CreateIndexClause createIndex)
Sets create-index clause.

Parameters:
createIndex - to set

getCreateSchema

public CreateSchemaClause getCreateSchema()
Returns the create-schema clause.

Returns:
clause

setCreateSchema

public void setCreateSchema(CreateSchemaClause createSchema)
Sets the create-schema clause.

Parameters:
createSchema - clause to set

getCreateContext

public CreateContextClause getCreateContext()
Returns the create-context clause.

Returns:
clause

setCreateContext

public void setCreateContext(CreateContextClause createContext)
Sets the create-context clause.

Parameters:
createContext - clause to set

getForClause

public ForClause getForClause()
Returns the for-clause.

Returns:
for-clause

setForClause

public void setForClause(ForClause forClause)
Sets the for-clause.

Parameters:
forClause - for-clause

getExpressionDeclarations

public java.util.List<ExpressionDeclaration> getExpressionDeclarations()
Returns the expression declarations, if any.

Returns:
expression declarations

setExpressionDeclarations

public void setExpressionDeclarations(java.util.List<ExpressionDeclaration> expressionDeclarations)
Sets the expression declarations, if any.

Parameters:
expressionDeclarations - expression declarations to set

getContextName

public java.lang.String getContextName()
Returns the context name if context dimensions apply to statement.

Returns:
context name

setContextName

public void setContextName(java.lang.String contextName)
Sets the context name if context dimensions apply to statement.

Parameters:
contextName - context name

getScriptExpressions

public java.util.List<ScriptExpression> getScriptExpressions()
Returns the scripts defined.

Returns:
scripts

setScriptExpressions

public void setScriptExpressions(java.util.List<ScriptExpression> scriptExpressions)
Sets the scripts.

Parameters:
scriptExpressions - to set

getCreateDataFlow

public CreateDataFlowClause getCreateDataFlow()
Returns the "create dataflow" part, if present.

Returns:
create dataflow clause

setCreateDataFlow

public void setCreateDataFlow(CreateDataFlowClause createDataFlow)
Sets the "create dataflow" part,.

Parameters:
createDataFlow - create dataflow clause

getTreeObjectName

public java.lang.String getTreeObjectName()
Returns the internal expression id assigned for tools to identify the expression.

Returns:
object name

setTreeObjectName

public void setTreeObjectName(java.lang.String treeObjectName)
Sets an internal expression id assigned for tools to identify the expression.

Parameters:
treeObjectName - object name

getCreateExpression

public CreateExpressionClause getCreateExpression()
Returns the create-expression clause, if any

Returns:
clause

setCreateExpression

public void setCreateExpression(CreateExpressionClause createExpression)
Sets the create-expression clause, if any

Parameters:
createExpression - clause

getFireAndForgetClause

public FireAndForgetClause getFireAndForgetClause()
Returns fire-and-forget (on-demand) query information for FAF select, insert, update and delete.

Returns:
fire and forget query information

setFireAndForgetClause

public void setFireAndForgetClause(FireAndForgetClause fireAndForgetClause)
Sets fire-and-forget (on-demand) query information for FAF select, insert, update and delete.

Parameters:
fireAndForgetClause - fire and forget query information

getIntoTableClause

public IntoTableClause getIntoTableClause()
Returns the into-table clause, or null if none found.

Returns:
into-table clause

setIntoTableClause

public void setIntoTableClause(IntoTableClause intoTableClause)
Sets the into-table clause, or null if none found.

Parameters:
intoTableClause - into-table clause

getCreateTable

public CreateTableClause getCreateTable()
Returns the create-table clause if present or null if not present

Returns:
create-table clause

setCreateTable

public void setCreateTable(CreateTableClause createTable)
Sets the create-table clause if present or null if not present

Parameters:
createTable - create-table clause

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