com.espertech.esper.core.service
Class EPRuntimeImpl

java.lang.Object
  extended by com.espertech.esper.core.service.EPRuntimeImpl
All Implemented Interfaces:
EPRuntime, EPRuntimeEventSender, EPRuntimeSPI, InternalEventRouteDest, TimerCallback

public class EPRuntimeImpl
extends java.lang.Object
implements EPRuntimeSPI, EPRuntimeEventSender, TimerCallback, InternalEventRouteDest

Implements runtime interface. Also accepts timer callbacks for synchronizing time events with regular events sent in.


Constructor Summary
EPRuntimeImpl(EPServicesContext services)
          Constructor.
 
Method Summary
 void clearCaches()
          Clear short-lived memory that may temporarily retain references to stopped or destroyed statements.
 void destroy()
          Destroy for destroying an engine instance: sets references to null and clears thread-locals
 void dispatch()
          Dispatch events.
 EPOnDemandQueryResult executeQuery(EPOnDemandPreparedQueryParameterized parameterizedQuery)
          Execute an on-demand parameterized query.
 EPOnDemandQueryResult executeQuery(EPOnDemandPreparedQueryParameterized parameterizedQuery, ContextPartitionSelector[] contextPartitionSelectors)
          Execute an on-demand parameterized query.
 EPOnDemandQueryResult executeQuery(EPStatementObjectModel model)
          Execute an on-demand query.
 EPOnDemandQueryResult executeQuery(EPStatementObjectModel model, ContextPartitionSelector[] contextPartitionSelectors)
          For use with named windows that have a context declared and that may therefore have multiple context partitions, allows to target context partitions for query execution selectively.
 EPOnDemandQueryResult executeQuery(java.lang.String epl)
          Execute an on-demand query.
 EPOnDemandQueryResult executeQuery(java.lang.String epl, ContextPartitionSelector[] contextPartitionSelectors)
          For use with named windows that have a context declared and that may therefore have multiple context partitions, allows to target context partitions for query execution selectively.
 long getCurrentTime()
          Returns current engine time.
 EPDataFlowRuntime getDataFlowRuntime()
          Returns the data flow runtime.
 java.lang.String getEngineURI()
           
 EventRenderer getEventRenderer()
          Returns the event renderer for events generated by this runtime.
 EventSender getEventSender(java.lang.String eventTypeName)
          Returns a facility to process event objects that are of a known type.
 EventSender getEventSender(java.net.URI[] uri)
          For use with plug-in event representations, returns a facility to process event objects that are of one of a number of types that one or more of the registered plug-in event representation extensions can reflect upon and provide an event for.
 java.lang.Long getNextScheduledTime()
          Returns the time at which the next schedule execution is expected, returns null if no schedule execution is outstanding.
 long getNumEventsEvaluated()
          Number of events evaluated over the lifetime of the event stream processing runtime, or since the last resetStats() call.
 long getRoutedExternal()
          Number of events routed externally.
 long getRoutedInternal()
          Number of events routed internally.
 java.util.Map<java.lang.String,java.lang.Long> getStatementNearestSchedules()
           
protected static java.util.Map<java.lang.String,java.lang.Long> getStatementNearestSchedulesInternal(SchedulingServiceSPI schedulingService, StatementLifecycleSvc statementLifecycleSvc)
           
 java.lang.Class getVariableType(java.lang.String variableName)
          Returns a variable's type.
 java.util.Map<java.lang.String,java.lang.Class> getVariableTypeAll()
          Returns all declared variable names and their types.
 java.util.Map<java.lang.String,java.lang.Object> getVariableValue(java.util.Set<java.lang.String> variableNames)
          Returns current variable values for each of the global variable names passed in, guaranteeing consistency in the face of concurrent updates to the variables.
 java.util.Map<java.lang.String,java.util.List<ContextPartitionVariableState>> getVariableValue(java.util.Set<java.lang.String> variableNames, ContextPartitionSelector contextPartitionSelector)
          Returns the current variable values for a context-partitioned variable, per context partition.
 java.lang.Object getVariableValue(java.lang.String variableName)
          Returns the current variable value for a global variable.
 java.util.Map<java.lang.String,java.lang.Object> getVariableValueAll()
          Returns current variable values for all global variables, guaranteeing consistency in the face of concurrent updates to the variables.
 void initialize()
           
 boolean isExternalClockingEnabled()
          Returns true for external clocking, false for internal clocking.
 EPOnDemandPreparedQuery prepareQuery(EPStatementObjectModel model)
          Prepare an unparameterized on-demand query before execution and for repeated execution.
 EPOnDemandPreparedQuery prepareQuery(java.lang.String epl)
          Prepare an unparameterized on-demand query before execution and for repeated execution.
 EPOnDemandPreparedQueryParameterized prepareQueryWithParameters(java.lang.String epl)
          Prepare a parameterized on-demand query for repeated parameter setting and execution.
 void processEvent(java.lang.Object theEvent)
          Process an unwrapped event.
 void processStatementFilterMultiple(EPStatementAgentInstanceHandle handle, java.lang.Object callbackList, EventBean theEvent, long version)
          Processing multiple filter matches for a statement.
 void processStatementFilterSingle(EPStatementAgentInstanceHandle handle, EPStatementHandleCallback handleCallback, EventBean theEvent, long version)
          Process a single match.
static void processStatementScheduleMultiple(EPStatementAgentInstanceHandle handle, java.lang.Object callbackObject, EPServicesContext services)
          Processing multiple schedule matches for a statement.
static void processStatementScheduleSingle(EPStatementHandleCallback handle, EPServicesContext services)
          Processing single schedule matche for a statement.
 void processThreadWorkQueue()
          Works off the thread's work queue.
 void processWrappedEvent(EventBean eventBean)
          Equivalent to the sendEvent method of EPRuntime, for use to process an known event.
 void resetStats()
          Reset number of events received and emitted
 void route(EventBean theEvent, EPStatementHandle epStatementHandle, boolean addToFront)
          Route the event such that the event is processed as required.
 void route(java.util.Map map, java.lang.String eventTypeName)
          Route the event object back to the event stream processing runtime for internal dispatching, to avoid the possibility of a stack overflow due to nested calls to sendEvent.
 void route(org.w3c.dom.Node document)
          Route the event object back to the event stream processing runtime for internal dispatching, to avoid the possibility of a stack overflow due to nested calls to sendEvent.
 void route(java.lang.Object theEvent)
          Route the event object back to the event stream processing runtime for internal dispatching, to avoid the possibility of a stack overflow due to nested calls to sendEvent.
 void route(java.lang.Object[] objectArray, java.lang.String eventTypeName)
          Route the event object back to the event stream processing runtime for internal dispatching, to avoid the possibility of a stack overflow due to nested calls to sendEvent.
 void routeEventBean(EventBean theEvent)
          For processing a routed event.
 void sendEvent(java.util.Map map, java.lang.String mapEventTypeName)
          Send a map containing event property values to the event stream processing runtime.
 void sendEvent(org.w3c.dom.Node document)
          Send an event represented by a DOM node to the event stream processing runtime.
 void sendEvent(java.lang.Object theEvent)
          Send an event represented by a plain Java object to the event stream processing runtime.
 void sendEvent(java.lang.Object[] propertyValues, java.lang.String objectArrayEventTypeName)
          Send an object array containing event property values to the event stream processing runtime.
 void setInternalEventRouter(InternalEventRouter internalEventRouter)
          Sets the route for events to use
 void setUnmatchedListener(UnmatchedListener listener)
          Sets a listener to receive events that are unmatched by any statement.
 void setVariableValue(java.util.Map<java.lang.String,java.lang.Object> variableValues)
          Sets the value of multiple global variables in one update, applying all or none of the changes to variable values in one atomic transaction.
 void setVariableValue(java.util.Map<java.lang.String,java.lang.Object> variableValues, int agentInstanceId)
          Sets the value of multiple context-partitioned variables in one update, applying all or none of the changes to variable values in one atomic transaction.
 void setVariableValue(java.lang.String variableName, java.lang.Object variableValue)
          Sets the value of a single global variable.
 void timerCallback()
          Invoked by the internal clocking service at regular intervals.
 EventBean wrapEvent(java.util.Map map, java.lang.String eventTypeName)
          Send a map containing event property values to the event stream processing runtime.
 EventBean wrapEvent(org.w3c.dom.Node node)
          Send an event represented by a DOM node to the event stream processing runtime.
 EventBean wrapEvent(java.lang.Object theEvent)
          Send an event represented by a plain Java object to the event stream processing runtime.
 EventBean wrapEvent(java.lang.Object[] objectArray, java.lang.String eventTypeName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EPRuntimeImpl

public EPRuntimeImpl(EPServicesContext services)
Constructor.

Parameters:
services - - references to services
Method Detail

setInternalEventRouter

public void setInternalEventRouter(InternalEventRouter internalEventRouter)
Sets the route for events to use

Specified by:
setInternalEventRouter in interface InternalEventRouteDest
Parameters:
internalEventRouter - router

getRoutedInternal

public long getRoutedInternal()
Description copied from interface: EPRuntimeSPI
Number of events routed internally.

Specified by:
getRoutedInternal in interface EPRuntimeSPI
Returns:
event count routed internally

getRoutedExternal

public long getRoutedExternal()
Description copied from interface: EPRuntimeSPI
Number of events routed externally.

Specified by:
getRoutedExternal in interface EPRuntimeSPI
Returns:
event count routed externally

timerCallback

public void timerCallback()
Description copied from interface: TimerCallback
Invoked by the internal clocking service at regular intervals.

Specified by:
timerCallback in interface TimerCallback

sendEvent

public void sendEvent(java.lang.Object theEvent)
               throws EPException
Description copied from interface: EPRuntime
Send an event represented by a plain Java object to the event stream processing runtime.

Use the route method for sending events into the runtime from within UpdateListener code, to avoid the possibility of a stack overflow due to nested calls to sendEvent (except with the outbound-threading configuration), see EPRuntime.route(Object)).

Specified by:
sendEvent in interface EPRuntime
Parameters:
theEvent - is the event to sent to the runtime
Throws:
EPException - is thrown when the processing of the event lead to an error

sendEvent

public void sendEvent(org.w3c.dom.Node document)
               throws EPException
Description copied from interface: EPRuntime
Send an event represented by a DOM node to the event stream processing runtime.

Use the route method for sending events into the runtime from within UpdateListener code. to avoid the possibility of a stack overflow due to nested calls to sendEvent (except with the outbound-threading configuration), see EPRuntime.route(org.w3c.dom.Node)).

Specified by:
sendEvent in interface EPRuntime
Parameters:
document - is the DOM node as an event
Throws:
EPException - is thrown when the processing of the event lead to an error

wrapEvent

public EventBean wrapEvent(org.w3c.dom.Node node)
Description copied from interface: EPRuntimeSPI
Send an event represented by a DOM node to the event stream processing runtime.

Use the route method for sending events into the runtime from within UpdateListener code. to avoid the possibility of a stack overflow due to nested calls to sendEvent.

Specified by:
wrapEvent in interface EPRuntimeSPI
Parameters:
node - is the DOM node as an event

route

public void route(org.w3c.dom.Node document)
           throws EPException
Description copied from interface: EPRuntime
Route the event object back to the event stream processing runtime for internal dispatching, to avoid the possibility of a stack overflow due to nested calls to sendEvent. The route event is processed just like it was sent to the runtime, that is any active expressions seeking that event receive it. The routed event has priority over other events sent to the runtime. In a single-threaded application the routed event is processed before the next event is sent to the runtime through the EPRuntime.sendEvent method.

Note: when outbound-threading is enabled, the thread delivering to listeners is not the thread processing the original event. Therefore with outbound-threading enabled the sendEvent method should be used by listeners instead.

Specified by:
route in interface EPRuntime
Parameters:
document - is the DOM node as an event
Throws:
EPException - is thrown when the processing of the event lead to an error

sendEvent

public void sendEvent(java.util.Map map,
                      java.lang.String mapEventTypeName)
               throws EPException
Description copied from interface: EPRuntime
Send a map containing event property values to the event stream processing runtime.

Use the route method for sending events into the runtime from within UpdateListener code. to avoid the possibility of a stack overflow due to nested calls to sendEvent (except with the outbound-threading configuration), see EPRuntime.route(java.util.Map, String)).

Specified by:
sendEvent in interface EPRuntime
Parameters:
map - - map that contains event property values. Keys are expected to be of type String while values can be of any type. Keys and values should match those declared via Configuration for the given eventTypeName.
mapEventTypeName - - the name for the Map event type that was previously configured
Throws:
EPException - - when the processing of the event leads to an error

sendEvent

public void sendEvent(java.lang.Object[] propertyValues,
                      java.lang.String objectArrayEventTypeName)
               throws EPException
Description copied from interface: EPRuntime
Send an object array containing event property values to the event stream processing runtime.

Use the route method for sending events into the runtime from within UpdateListener code. to avoid the possibility of a stack overflow due to nested calls to sendEvent (except with the outbound-threading configuration), see EPRuntime.route(Object[], String)).

Specified by:
sendEvent in interface EPRuntime
Parameters:
propertyValues - - array that contains event property values. Your application must ensure that property values match the exact same order that the property names and types have been declared, and that the array length matches the number of properties declared.
objectArrayEventTypeName - - the name for the Object-array event type that was previously configured
Throws:
EPException - - when the processing of the event leads to an error

wrapEvent

public EventBean wrapEvent(java.util.Map map,
                           java.lang.String eventTypeName)
Description copied from interface: EPRuntimeSPI
Send a map containing event property values to the event stream processing runtime.

Use the route method for sending events into the runtime from within UpdateListener code. to avoid the possibility of a stack overflow due to nested calls to sendEvent.

Specified by:
wrapEvent in interface EPRuntimeSPI
Parameters:
map - - map that contains event property values. Keys are expected to be of type String while values can be of any type. Keys and values should match those declared via Configuration for the given eventTypeName.
eventTypeName - - the name for the Map event type that was previously configured

wrapEvent

public EventBean wrapEvent(java.lang.Object[] objectArray,
                           java.lang.String eventTypeName)

route

public void route(java.util.Map map,
                  java.lang.String eventTypeName)
           throws EPException
Description copied from interface: EPRuntime
Route the event object back to the event stream processing runtime for internal dispatching, to avoid the possibility of a stack overflow due to nested calls to sendEvent. The route event is processed just like it was sent to the runtime, that is any active expressions seeking that event receive it. The routed event has priority over other events sent to the runtime. In a single-threaded application the routed event is processed before the next event is sent to the runtime through the EPRuntime.sendEvent method.

Note: when outbound-threading is enabled, the thread delivering to listeners is not the thread processing the original event. Therefore with outbound-threading enabled the sendEvent method should be used by listeners instead.

Specified by:
route in interface EPRuntime
Parameters:
map - - map that contains event property values. Keys are expected to be of type String while values can be of any type. Keys and values should match those declared via Configuration for the given eventTypeName.
eventTypeName - - the name for Map event type that was previously configured
Throws:
EPException - - when the processing of the event leads to an error

route

public void route(java.lang.Object[] objectArray,
                  java.lang.String eventTypeName)
           throws EPException
Description copied from interface: EPRuntime
Route the event object back to the event stream processing runtime for internal dispatching, to avoid the possibility of a stack overflow due to nested calls to sendEvent. The route event is processed just like it was sent to the runtime, that is any active expressions seeking that event receive it. The routed event has priority over other events sent to the runtime. In a single-threaded application the routed event is processed before the next event is sent to the runtime through the EPRuntime.sendEvent method.

Note: when outbound-threading is enabled, the thread delivering to listeners is not the thread processing the original event. Therefore with outbound-threading enabled the sendEvent method should be used by listeners instead.

Specified by:
route in interface EPRuntime
Parameters:
objectArray - - object array that contains event property values. Your application must ensure that property values match the exact same order that the property names and types have been declared, and that the array length matches the number of properties declared.
eventTypeName - - the name for Object-array event type that was previously configured
Throws:
EPException - - when the processing of the event leads to an error

getNumEventsEvaluated

public long getNumEventsEvaluated()
Description copied from interface: EPRuntime
Number of events evaluated over the lifetime of the event stream processing runtime, or since the last resetStats() call.

Specified by:
getNumEventsEvaluated in interface EPRuntime
Returns:
number of events received

resetStats

public void resetStats()
Description copied from interface: EPRuntime
Reset number of events received and emitted

Specified by:
resetStats in interface EPRuntime

routeEventBean

public void routeEventBean(EventBean theEvent)
Description copied from interface: EPRuntimeEventSender
For processing a routed event.

Specified by:
routeEventBean in interface EPRuntimeEventSender
Parameters:
theEvent - routed event

route

public void route(java.lang.Object theEvent)
Description copied from interface: EPRuntime
Route the event object back to the event stream processing runtime for internal dispatching, to avoid the possibility of a stack overflow due to nested calls to sendEvent. The route event is processed just like it was sent to the runtime, that is any active expressions seeking that event receive it. The routed event has priority over other events sent to the runtime. In a single-threaded application the routed event is processed before the next event is sent to the runtime through the EPRuntime.sendEvent method.

Note: when outbound-threading is enabled, the thread delivering to listeners is not the thread processing the original event. Therefore with outbound-threading enabled the sendEvent method should be used by listeners instead.

Specified by:
route in interface EPRuntime
Parameters:
theEvent - to route internally for processing by the event stream processing runtime

route

public void route(EventBean theEvent,
                  EPStatementHandle epStatementHandle,
                  boolean addToFront)
Description copied from interface: InternalEventRouteDest
Route the event such that the event is processed as required.

Specified by:
route in interface InternalEventRouteDest
Parameters:
theEvent - to route
epStatementHandle - provides statement resources

processEvent

public void processEvent(java.lang.Object theEvent)
Process an unwrapped event.

Parameters:
theEvent - to process.

wrapEvent

public EventBean wrapEvent(java.lang.Object theEvent)
Description copied from interface: EPRuntimeSPI
Send an event represented by a plain Java object to the event stream processing runtime.

Use the route method for sending events into the runtime from within UpdateListener code, to avoid the possibility of a stack overflow due to nested calls to sendEvent.

Specified by:
wrapEvent in interface EPRuntimeSPI
Parameters:
theEvent - is the event to sent to the runtime

processWrappedEvent

public void processWrappedEvent(EventBean eventBean)
Description copied from interface: EPRuntimeEventSender
Equivalent to the sendEvent method of EPRuntime, for use to process an known event.

Specified by:
processWrappedEvent in interface EPRuntimeEventSender
Specified by:
processWrappedEvent in interface EPRuntimeSPI
Parameters:
eventBean - is the event object wrapped by an event bean providing the event metadata

processThreadWorkQueue

public void processThreadWorkQueue()
Works off the thread's work queue.

Specified by:
processThreadWorkQueue in interface EPRuntimeSPI
Specified by:
processThreadWorkQueue in interface InternalEventRouteDest

processStatementScheduleMultiple

public static void processStatementScheduleMultiple(EPStatementAgentInstanceHandle handle,
                                                    java.lang.Object callbackObject,
                                                    EPServicesContext services)
Processing multiple schedule matches for a statement.

Parameters:
handle - statement handle
callbackObject - object containing matches
services - engine services

processStatementScheduleSingle

public static void processStatementScheduleSingle(EPStatementHandleCallback handle,
                                                  EPServicesContext services)
Processing single schedule matche for a statement.

Parameters:
handle - statement handle
services - engine services

processStatementFilterMultiple

public void processStatementFilterMultiple(EPStatementAgentInstanceHandle handle,
                                           java.lang.Object callbackList,
                                           EventBean theEvent,
                                           long version)
Processing multiple filter matches for a statement.

Parameters:
handle - statement handle
callbackList - object containing callbacks
theEvent - to process
version - filter version

processStatementFilterSingle

public void processStatementFilterSingle(EPStatementAgentInstanceHandle handle,
                                         EPStatementHandleCallback handleCallback,
                                         EventBean theEvent,
                                         long version)
Process a single match.

Parameters:
handle - statement
handleCallback - callback
theEvent - event to indicate
version - filter version

dispatch

public void dispatch()
Dispatch events.

Specified by:
dispatch in interface EPRuntimeSPI
Specified by:
dispatch in interface InternalEventRouteDest

isExternalClockingEnabled

public boolean isExternalClockingEnabled()
Description copied from interface: EPRuntime
Returns true for external clocking, false for internal clocking.

Specified by:
isExternalClockingEnabled in interface EPRuntime
Returns:
clocking indicator

destroy

public void destroy()
Destroy for destroying an engine instance: sets references to null and clears thread-locals

Specified by:
destroy in interface EPRuntimeSPI

initialize

public void initialize()
Specified by:
initialize in interface EPRuntimeSPI

clearCaches

public void clearCaches()
Description copied from interface: EPRuntimeSPI
Clear short-lived memory that may temporarily retain references to stopped or destroyed statements.

Use this method after stopping and destroying statements for the purpose of clearing thread-local or other short lived storage to statement handles of deleted statements.

NOT safe to use without first acquiring the engine lock.

Specified by:
clearCaches in interface EPRuntimeSPI

setUnmatchedListener

public void setUnmatchedListener(UnmatchedListener listener)
Description copied from interface: EPRuntime
Sets a listener to receive events that are unmatched by any statement.

Events that can be unmatched are all events that are send into a runtime via one of the sendEvent methods, or that have been generated via insert-into clause.

For an event to be unmatched by any statement, the event must not match any statement's event stream filter criteria (a where-clause is NOT a filter criteria for a stream, as below).

Note: In the following statement a MyEvent event does always match this statement's event stream filter criteria, regardless of the value of the 'quantity' property.

select * from MyEvent where quantity > 5

In the following statement only a MyEvent event with a 'quantity' property value of 5 or less does not match this statement's event stream filter criteria:
select * from MyEvent(quantity > 5)

For patterns, if no pattern sub-expression is active for such event, the event is also unmatched.

Specified by:
setUnmatchedListener in interface EPRuntime
Parameters:
listener - is the listener to receive notification of unmatched events, or null to unregister a previously registered listener

setVariableValue

public void setVariableValue(java.lang.String variableName,
                             java.lang.Object variableValue)
                      throws EPException
Description copied from interface: EPRuntime
Sets the value of a single global variable.

Note that the thread setting the variable value queues the changes, i.e. it does not itself re-evaluate such new variable value for any given statement. The timer thread performs this work.

Not for use with context-partitioned variables.

Specified by:
setVariableValue in interface EPRuntime
Parameters:
variableName - is the name of the variable to change the value of
variableValue - is the new value of the variable, with null an allowed value
Throws:
VariableValueException - if the value does not match variable type or cannot be safely coerced to the variable type
VariableNotFoundException - if the variable name has not been declared
EPException

setVariableValue

public void setVariableValue(java.util.Map<java.lang.String,java.lang.Object> variableValues)
                      throws EPException
Description copied from interface: EPRuntime
Sets the value of multiple global variables in one update, applying all or none of the changes to variable values in one atomic transaction.

Note that the thread setting the variable value queues the changes, i.e. it does not itself re-evaluate such new variable value for any given statement. The timer thread performs this work.

Not for use with context-partitioned variables.

Specified by:
setVariableValue in interface EPRuntime
Parameters:
variableValues - is the map of variable name and variable value, with null an allowed value
Throws:
VariableValueException - if any value does not match variable type or cannot be safely coerced to the variable type
VariableNotFoundException - if any of the variable names has not been declared
EPException

setVariableValue

public void setVariableValue(java.util.Map<java.lang.String,java.lang.Object> variableValues,
                             int agentInstanceId)
                      throws VariableValueException,
                             VariableNotFoundException
Description copied from interface: EPRuntime
Sets the value of multiple context-partitioned variables in one update, applying all or none of the changes to variable values in one atomic transaction.

Note that the thread setting the variable value queues the changes, i.e. it does not itself re-evaluate such new variable value for any given statement. The timer thread performs this work.

Only for use with context-partitioned variables.

Specified by:
setVariableValue in interface EPRuntime
Parameters:
variableValues - is the map of variable name and variable value, with null an allowed value
agentInstanceId - the id of the context partition
Throws:
VariableValueException - if any value does not match variable type or cannot be safely coerced to the variable type
VariableNotFoundException - if any of the variable names has not been declared

getVariableValue

public java.lang.Object getVariableValue(java.lang.String variableName)
                                  throws EPException
Description copied from interface: EPRuntime
Returns the current variable value for a global variable. A null value is a valid value for a variable. Not for use with context-partitioned variables.

Specified by:
getVariableValue in interface EPRuntime
Parameters:
variableName - is the name of the variable to return the value for
Returns:
current variable value
Throws:
VariableNotFoundException - if a variable by that name has not been declared
EPException

getVariableValue

public java.util.Map<java.lang.String,java.util.List<ContextPartitionVariableState>> getVariableValue(java.util.Set<java.lang.String> variableNames,
                                                                                                      ContextPartitionSelector contextPartitionSelector)
                                                                                               throws VariableNotFoundException
Description copied from interface: EPRuntime
Returns the current variable values for a context-partitioned variable, per context partition. A null value is a valid value for a variable. Only for use with context-partitioned variables. Variable names provided must all be associated to the same context partition.

Specified by:
getVariableValue in interface EPRuntime
Parameters:
variableNames - are the names of the variables to return the value for
contextPartitionSelector - selector for the context partition to return the value for
Returns:
current variable value
Throws:
VariableNotFoundException - if a variable by that name has not been declared

getVariableValue

public java.util.Map<java.lang.String,java.lang.Object> getVariableValue(java.util.Set<java.lang.String> variableNames)
                                                                  throws EPException
Description copied from interface: EPRuntime
Returns current variable values for each of the global variable names passed in, guaranteeing consistency in the face of concurrent updates to the variables. Not for use with context-partitioned variables.

Specified by:
getVariableValue in interface EPRuntime
Parameters:
variableNames - is a set of variable names for which to return values
Returns:
map of variable name and variable value
Throws:
VariableNotFoundException - if any of the variable names has not been declared
EPException

getVariableValueAll

public java.util.Map<java.lang.String,java.lang.Object> getVariableValueAll()
                                                                     throws EPException
Description copied from interface: EPRuntime
Returns current variable values for all global variables, guaranteeing consistency in the face of concurrent updates to the variables. Not for use with context-partitioned variables.

Specified by:
getVariableValueAll in interface EPRuntime
Returns:
map of variable name and variable value
Throws:
EPException

getVariableTypeAll

public java.util.Map<java.lang.String,java.lang.Class> getVariableTypeAll()
Description copied from interface: EPRuntimeSPI
Returns all declared variable names and their types.

Specified by:
getVariableTypeAll in interface EPRuntimeSPI
Returns:
variable names and types

getVariableType

public java.lang.Class getVariableType(java.lang.String variableName)
Description copied from interface: EPRuntimeSPI
Returns a variable's type.

Specified by:
getVariableType in interface EPRuntimeSPI
Parameters:
variableName - type or null if the variable is not declared
Returns:
type of variable

executeQuery

public EPOnDemandQueryResult executeQuery(java.lang.String epl,
                                          ContextPartitionSelector[] contextPartitionSelectors)
Description copied from interface: EPRuntime
For use with named windows that have a context declared and that may therefore have multiple context partitions, allows to target context partitions for query execution selectively.

Specified by:
executeQuery in interface EPRuntime
Parameters:
epl - is the EPL query to execute
contextPartitionSelectors - selects context partitions to consider
Returns:
result

executeQuery

public EPOnDemandQueryResult executeQuery(java.lang.String epl)
Description copied from interface: EPRuntime
Execute an on-demand query.

On-demand queries are EPL queries that execute non-continuous fire-and-forget queries against named windows.

Specified by:
executeQuery in interface EPRuntime
Parameters:
epl - is the EPL query to execute
Returns:
query result

executeQuery

public EPOnDemandQueryResult executeQuery(EPStatementObjectModel model)
Description copied from interface: EPRuntime
Execute an on-demand query.

On-demand queries are EPL queries that execute non-continuous fire-and-forget queries against named windows.

Specified by:
executeQuery in interface EPRuntime
Parameters:
model - is the EPL query to execute, obtain a model object using EPAdministrator.compileEPL(String) or via the API
Returns:
query result

executeQuery

public EPOnDemandQueryResult executeQuery(EPStatementObjectModel model,
                                          ContextPartitionSelector[] contextPartitionSelectors)
Description copied from interface: EPRuntime
For use with named windows that have a context declared and that may therefore have multiple context partitions, allows to target context partitions for query execution selectively.

Specified by:
executeQuery in interface EPRuntime
Parameters:
model - is the EPL query to execute, obtain a model object using EPAdministrator.compileEPL(String) or via the API
contextPartitionSelectors - selects context partitions to consider
Returns:
result

executeQuery

public EPOnDemandQueryResult executeQuery(EPOnDemandPreparedQueryParameterized parameterizedQuery)
Description copied from interface: EPRuntime
Execute an on-demand parameterized query.

On-demand queries are EPL queries that execute non-continuous fire-and-forget queries against named windows.

Specified by:
executeQuery in interface EPRuntime
Parameters:
parameterizedQuery - contains the query and parameter values
Returns:
query result

executeQuery

public EPOnDemandQueryResult executeQuery(EPOnDemandPreparedQueryParameterized parameterizedQuery,
                                          ContextPartitionSelector[] contextPartitionSelectors)
Description copied from interface: EPRuntime
Execute an on-demand parameterized query.

On-demand queries are EPL queries that execute non-continuous fire-and-forget queries against named windows.

Specified by:
executeQuery in interface EPRuntime
Parameters:
parameterizedQuery - contains the query and parameter values
contextPartitionSelectors - selects context partitions to consider
Returns:
query result

prepareQuery

public EPOnDemandPreparedQuery prepareQuery(java.lang.String epl)
Description copied from interface: EPRuntime
Prepare an unparameterized on-demand query before execution and for repeated execution.

Specified by:
prepareQuery in interface EPRuntime
Parameters:
epl - to prepare
Returns:
proxy to execute upon, that also provides the event type of the returned results

prepareQuery

public EPOnDemandPreparedQuery prepareQuery(EPStatementObjectModel model)
Description copied from interface: EPRuntime
Prepare an unparameterized on-demand query before execution and for repeated execution.

Specified by:
prepareQuery in interface EPRuntime
Parameters:
model - is the EPL query to prepare, obtain a model object using EPAdministrator.compileEPL(String) or via the API
Returns:
proxy to execute upon, that also provides the event type of the returned results

prepareQueryWithParameters

public EPOnDemandPreparedQueryParameterized prepareQueryWithParameters(java.lang.String epl)
Description copied from interface: EPRuntime
Prepare a parameterized on-demand query for repeated parameter setting and execution. Set all values on the returned holder then execute using EPRuntime.executeQuery(EPOnDemandPreparedQueryParameterized).

Specified by:
prepareQueryWithParameters in interface EPRuntime
Parameters:
epl - to prepare
Returns:
parameter holder upon which to set values

getEventSender

public EventSender getEventSender(java.lang.String eventTypeName)
Description copied from interface: EPRuntime
Returns a facility to process event objects that are of a known type.

Given an event type name this method returns a sender that allows to send in event objects of that type. The event objects send in via the event sender are expected to match the event type, thus the event sender does not inspect the event object other then perform basic checking.

For events backed by a Java class (JavaBean events), the sender ensures that the object send in matches in class, or implements or extends the class underlying the event type for the given event type name. Note that event type identity for Java class events is the Java class. When assigning two different event type names to the same Java class the names are an alias for the same event type i.e. there is always a single event type to represent a given Java class.

For events backed by a Object[] (Object-array events), the sender does not perform any checking other then checking that the event object indeed is an array of object.

For events backed by a java.util.Map (Map events), the sender does not perform any checking other then checking that the event object indeed implements Map.

For events backed by a org.w3c.Node (XML DOM events), the sender checks that the root element name indeed does match the root element name for the event type name.

Specified by:
getEventSender in interface EPRuntime
Parameters:
eventTypeName - is the name of the event type
Returns:
sender for fast-access processing of event objects of known type (and content)

getEventSender

public EventSender getEventSender(java.net.URI[] uri)
                           throws EventTypeException
Description copied from interface: EPRuntime
For use with plug-in event representations, returns a facility to process event objects that are of one of a number of types that one or more of the registered plug-in event representation extensions can reflect upon and provide an event for.

Specified by:
getEventSender in interface EPRuntime
Parameters:
uri - is the URIs that specify which plug-in event representations may process an event object.

URIs do not need to match event representation URIs exactly, a child (hierarchical) match is enough for an event representation to participate.

The order of URIs is relevant as each event representation's factory is asked in turn to process the event, until the first factory processes the event.

Returns:
sender for processing of event objects of one of the plug-in event representations
Throws:
EventTypeException - thrown to indicate that the URI list was invalid

getEventRenderer

public EventRenderer getEventRenderer()
Description copied from interface: EPRuntime
Returns the event renderer for events generated by this runtime.

Specified by:
getEventRenderer in interface EPRuntime
Returns:
event renderer

getCurrentTime

public long getCurrentTime()
Description copied from interface: EPRuntime
Returns current engine time.

If time is provided externally via timer events, the function returns current time as externally provided.

Specified by:
getCurrentTime in interface EPRuntime
Returns:
current engine time

getNextScheduledTime

public java.lang.Long getNextScheduledTime()
Description copied from interface: EPRuntime
Returns the time at which the next schedule execution is expected, returns null if no schedule execution is outstanding.

Specified by:
getNextScheduledTime in interface EPRuntime
Returns:
time of next schedule if any

getStatementNearestSchedules

public java.util.Map<java.lang.String,java.lang.Long> getStatementNearestSchedules()
Specified by:
getStatementNearestSchedules in interface EPRuntimeSPI

getStatementNearestSchedulesInternal

protected static java.util.Map<java.lang.String,java.lang.Long> getStatementNearestSchedulesInternal(SchedulingServiceSPI schedulingService,
                                                                                                     StatementLifecycleSvc statementLifecycleSvc)

getEngineURI

public java.lang.String getEngineURI()
Specified by:
getEngineURI in interface EPRuntimeSPI
Specified by:
getEngineURI in interface InternalEventRouteDest

getDataFlowRuntime

public EPDataFlowRuntime getDataFlowRuntime()
Description copied from interface: EPRuntime
Returns the data flow runtime.

Specified by:
getDataFlowRuntime in interface EPRuntime
Returns:
data flow runtime

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