public class StatementLifecycleSvcImpl extends java.lang.Object implements StatementLifecycleSvc
Modifier and Type | Class and Description |
---|---|
static class |
StatementLifecycleSvcImpl.EPStatementDesc
Statement information.
|
Constructor and Description |
---|
StatementLifecycleSvcImpl(EPServiceProvider epServiceProvider,
EPServicesContext services)
Ctor.
|
Modifier and Type | Method and Description |
---|---|
void |
addObserver(StatementLifecycleObserver observer)
Add an observer to be called back when statement-state or listener/subscriber changes are registered.
|
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.
|
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)
Statements indicate that listeners have been added through this method.
|
public StatementLifecycleSvcImpl(EPServiceProvider epServiceProvider, EPServicesContext services)
epServiceProvider
- is the engine instance to hand to statement-aware listenersservices
- is engine servicespublic 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 servicespublic 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 namepublic 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 idpublic 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)
StatementLifecycleSvc
updatedListeners
in interface StatementLifecycleSvc
statement
- is the statement for which listeners were addedlisteners
- is the set of listeners after adding the new listenerpublic static SelectClauseSpecCompiled compileSelectAllowSubselect(SelectClauseSpecRaw spec) throws ExprValidationException
spec
- to compileExprValidationException
- when validation failspublic void dispatchStatementLifecycleEvent(StatementLifecycleEvent theEvent)
StatementLifecycleSvc
dispatchStatementLifecycleEvent
in interface StatementLifecycleSvc
theEvent
- to dispatch