|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.espertech.esper.core.service.StatementLifecycleSvcImpl
public class StatementLifecycleSvcImpl
Provides statement lifecycle services.
Nested Class Summary | |
---|---|
static class |
StatementLifecycleSvcImpl.EPStatementDesc
Statement information. |
Field Summary | |
---|---|
protected EPServicesContext |
services
Services context for statement lifecycle management. |
protected java.util.Map<java.lang.String,StatementLifecycleSvcImpl.EPStatementDesc> |
stmtIdToDescMap
Maps of statement id to descriptor. |
protected java.util.Map<java.lang.String,EPStatement> |
stmtNameToStmtMap
Map of statement name to statement. |
Constructor Summary | |
---|---|
StatementLifecycleSvcImpl(EPServiceProvider epServiceProvider,
EPServicesContext services)
Ctor. |
Method Summary | |
---|---|
void |
addObserver(StatementLifecycleObserver observer)
Add an observer to be called back when statement-state or listener/subscriber changes are registered. |
protected static StatementSpecCompiled |
compile(StatementSpecRaw spec,
java.lang.String eplStatement,
StatementContext statementContext,
boolean isSubquery,
boolean isOnDemandQuery,
java.lang.annotation.Annotation[] annotations,
java.util.List<ExprSubselectNode> subselectNodes,
java.util.List<ExprDeclaredNode> declaredNodes,
EPServicesContext servicesContext)
Compiles a statement returning the compile (verified, non-serializable) form of a statement. |
static SelectClauseSpecCompiled |
compileSelectAllowSubselect(SelectClauseSpecRaw spec)
Compile a select clause allowing subselects. |
EPStatement |
createAndStart(StatementSpecRaw statementSpec,
java.lang.String expression,
boolean isPattern,
java.lang.String optStatementName,
java.lang.Object userObject,
EPIsolationUnitServices isolationUnitServices,
java.lang.String statementId,
EPStatementObjectModel optionalModel)
Create and start the statement. |
protected StatementLifecycleSvcImpl.EPStatementDesc |
createStopped(StatementSpecRaw statementSpec,
java.lang.annotation.Annotation[] annotations,
java.lang.String expression,
boolean isPattern,
java.lang.String statementName,
boolean nameProvided,
java.lang.String statementId,
java.util.Map<java.lang.String,java.lang.Object> optAdditionalContext,
java.lang.Object statementUserObject,
EPIsolationUnitServices isolationUnitServices,
boolean isFailed,
EPStatementObjectModel optionalModel)
Create stopped statement. |
protected StatementLifecycleSvcImpl.EPStatementDesc |
createStoppedAssignName(StatementSpecRaw statementSpec,
java.lang.String expression,
boolean isPattern,
java.lang.String optStatementName,
java.lang.String statementId,
java.util.Map<java.lang.String,java.lang.Object> optAdditionalContext,
java.lang.Object userObject,
EPIsolationUnitServices isolationUnitServices,
EPStatementObjectModel optionalModel)
Creates and starts statement. |
void |
destroy()
Destroy the service. |
void |
destroy(java.lang.String statementId)
Destroy statement by statement id. |
void |
destroyAllStatements()
Destroys all started statements. |
void |
dispatchStatementLifecycleEvent(StatementLifecycleEvent theEvent)
Dispatch event to observers. |
EPStatementSPI |
getStatementById(java.lang.String id)
Returns the statement given a statement id. |
EPStatement |
getStatementByName(java.lang.String name)
Returns the statement by the given name, or null if no such statement exists. |
java.lang.String |
getStatementNameById(java.lang.String id)
|
java.lang.String[] |
getStatementNames()
Returns an array of statement names. |
StatementSpecCompiled |
getStatementSpec(java.lang.String statementId)
|
java.util.Map<java.lang.String,EPStatement> |
getStmtNameToStmt()
|
void |
init()
Initialized the service before use. |
void |
removeObserver(StatementLifecycleObserver observer)
Remove an observer to be called back when statement-state or listener/subscriber changes are registered. |
void |
start(java.lang.String statementId)
Start statement by statement id. |
void |
start(java.lang.String statementId,
StatementLifecycleSvcImpl.EPStatementDesc desc,
boolean isNewStatement,
boolean isRecoveringStatement,
boolean isResilient)
Start the given statement. |
void |
startAllStatements()
Starts all stopped statements. |
void |
stop(java.lang.String statementId)
Stop statement by statement id. |
void |
stopAllStatements()
Stops all started statements. |
void |
updatedListeners(EPStatement statement,
EPStatementListenerSet listeners,
boolean isRecovery)
Statements indicate that listeners have been added through this method. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final EPServicesContext services
protected final java.util.Map<java.lang.String,StatementLifecycleSvcImpl.EPStatementDesc> stmtIdToDescMap
protected final java.util.Map<java.lang.String,EPStatement> stmtNameToStmtMap
Constructor Detail |
---|
public StatementLifecycleSvcImpl(EPServiceProvider epServiceProvider, EPServicesContext services)
epServiceProvider
- is the engine instance to hand to statement-aware listenersservices
- is engine servicesMethod Detail |
---|
public void addObserver(StatementLifecycleObserver observer)
StatementLifecycleSvc
The observers list is backed by a Set.
addObserver
in interface StatementLifecycleSvc
observer
- to addpublic void removeObserver(StatementLifecycleObserver observer)
StatementLifecycleSvc
removeObserver
in interface StatementLifecycleSvc
observer
- to removepublic void destroy()
StatementLifecycleSvc
destroy
in interface StatementLifecycleSvc
public void init()
StatementLifecycleSvc
init
in interface StatementLifecycleSvc
public java.util.Map<java.lang.String,EPStatement> getStmtNameToStmt()
getStmtNameToStmt
in interface StatementLifecycleSvc
public EPStatement createAndStart(StatementSpecRaw statementSpec, java.lang.String expression, boolean isPattern, java.lang.String optStatementName, java.lang.Object userObject, EPIsolationUnitServices isolationUnitServices, java.lang.String statementId, EPStatementObjectModel optionalModel)
StatementLifecycleSvc
createAndStart
in interface StatementLifecycleSvc
statementSpec
- is the statement definition in bean object form, raw unvalidated and unoptimized.expression
- is the expression textisPattern
- is an indicator on whether this is a pattern statement and thus the iterator must return the last result,
versus for non-pattern statements the iterator returns view content.optStatementName
- is an optional statement name, null if none was supplieduserObject
- the application define user object associated to each statement, if suppliedisolationUnitServices
- isolated service services
protected StatementLifecycleSvcImpl.EPStatementDesc createStoppedAssignName(StatementSpecRaw statementSpec, java.lang.String expression, boolean isPattern, java.lang.String optStatementName, java.lang.String statementId, java.util.Map<java.lang.String,java.lang.Object> optAdditionalContext, java.lang.Object userObject, EPIsolationUnitServices isolationUnitServices, EPStatementObjectModel optionalModel)
statementSpec
- defines the statementexpression
- is the EPLisPattern
- is true for patternsoptStatementName
- is the optional statement namestatementId
- is the statement idoptAdditionalContext
- additional context for use by the statement contextuserObject
- the application define user object associated to each statement, if suppliedisolationUnitServices
- isolated service services
protected StatementLifecycleSvcImpl.EPStatementDesc createStopped(StatementSpecRaw statementSpec, java.lang.annotation.Annotation[] annotations, java.lang.String expression, boolean isPattern, java.lang.String statementName, boolean nameProvided, java.lang.String statementId, java.util.Map<java.lang.String,java.lang.Object> optAdditionalContext, java.lang.Object statementUserObject, EPIsolationUnitServices isolationUnitServices, boolean isFailed, EPStatementObjectModel optionalModel)
statementSpec
- - statement definitionexpression
- is the expression textisPattern
- is true for patterns, false for non-patternsstatementName
- is the statement name assigned or givenstatementId
- is the statement idoptAdditionalContext
- additional context for use by the statement contextstatementUserObject
- the application define user object associated to each statement, if suppliedisolationUnitServices
- isolated service servicesisFailed
- to start the statement in failed statenameProvided
- true when an explicit statement name is provided
public void start(java.lang.String statementId)
StatementLifecycleSvc
start
in interface StatementLifecycleSvc
statementId
- of the statement to start.public void start(java.lang.String statementId, StatementLifecycleSvcImpl.EPStatementDesc desc, boolean isNewStatement, boolean isRecoveringStatement, boolean isResilient)
statementId
- is the statement iddesc
- is the cached statement infoisNewStatement
- indicator whether the statement is new or a stop-restart statementisRecoveringStatement
- if the statement is recovering or newisResilient
- true if recovering a resilient stmtpublic void stop(java.lang.String statementId)
StatementLifecycleSvc
stop
in interface StatementLifecycleSvc
statementId
- of the statement to stop.public void destroy(java.lang.String statementId)
StatementLifecycleSvc
destroy
in interface StatementLifecycleSvc
statementId
- statementId of the statement to destroypublic EPStatement getStatementByName(java.lang.String name)
StatementLifecycleSvc
getStatementByName
in interface StatementLifecycleSvc
name
- is the statement name
public StatementSpecCompiled getStatementSpec(java.lang.String statementId)
getStatementSpec
in interface StatementLifecycleSvc
public EPStatementSPI getStatementById(java.lang.String id)
getStatementById
in interface StatementLifecycleSvc
id
- is the statement id
public java.lang.String[] getStatementNames()
StatementLifecycleSvc
Only returns started and stopped statements.
getStatementNames
in interface StatementLifecycleSvc
public void startAllStatements() throws EPException
StatementLifecycleSvc
startAllStatements
in interface StatementLifecycleSvc
EPException
- to indicate a start error.public void stopAllStatements() throws EPException
StatementLifecycleSvc
stopAllStatements
in interface StatementLifecycleSvc
EPException
- to indicate a start error.public void destroyAllStatements() throws EPException
StatementLifecycleSvc
destroyAllStatements
in interface StatementLifecycleSvc
EPException
- to indicate a start error.public java.lang.String getStatementNameById(java.lang.String id)
getStatementNameById
in interface StatementLifecycleSvc
public void updatedListeners(EPStatement statement, EPStatementListenerSet listeners, boolean isRecovery)
StatementLifecycleSvc
updatedListeners
in interface StatementLifecycleSvc
statement
- is the statement for which listeners were addedlisteners
- is the set of listeners after adding the new listenerprotected static StatementSpecCompiled compile(StatementSpecRaw spec, java.lang.String eplStatement, StatementContext statementContext, boolean isSubquery, boolean isOnDemandQuery, java.lang.annotation.Annotation[] annotations, java.util.List<ExprSubselectNode> subselectNodes, java.util.List<ExprDeclaredNode> declaredNodes, EPServicesContext servicesContext) throws EPStatementException
spec
- is the statement specificationeplStatement
- the statement to compilestatementContext
- the statement servicesisSubquery
- is true for subquery compilation or false for statement compileannotations
- statement annotations
EPStatementException
- if the statement cannot be compiledpublic static SelectClauseSpecCompiled compileSelectAllowSubselect(SelectClauseSpecRaw spec) throws ExprValidationException
spec
- to compile
ExprValidationException
- when validation failspublic void dispatchStatementLifecycleEvent(StatementLifecycleEvent theEvent)
StatementLifecycleSvc
dispatchStatementLifecycleEvent
in interface StatementLifecycleSvc
theEvent
- to dispatch
|
© 2006-2015 EsperTech Inc. All rights reserved. Visit us at espertech.com |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |