com.espertech.esper.core.service
Class EPRuntimeIsolatedImpl

java.lang.Object
  extended by com.espertech.esper.core.service.EPRuntimeIsolatedImpl
All Implemented Interfaces:
EPRuntimeIsolated, EPRuntimeEventSender, EPRuntimeIsolatedSPI, InternalEventRouteDest

public class EPRuntimeIsolatedImpl
extends java.lang.Object
implements EPRuntimeIsolatedSPI, InternalEventRouteDest, EPRuntimeEventSender

Implementation for isolated runtime.


Constructor Summary
EPRuntimeIsolatedImpl(EPIsolationUnitServices svc, EPServicesContext unisolatedSvc)
          Ctor.
 
Method Summary
 void destroy()
          Destroy for destroying an engine instance: sets references to null and clears thread-locals
 void dispatch()
          Dispatch events.
 long getCurrentTime()
          Returns current engine time.
 java.lang.String getEngineURI()
           
 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.
 java.util.Map<java.lang.String,java.lang.Long> getStatementNearestSchedules()
           
 void processEvent(java.lang.Object theEvent)
          Process an unwrapped event.
 void processStatementFilterMultiple(EPStatementAgentInstanceHandle handle, java.util.ArrayDeque<FilterHandleCallback> callbackList, EventBean theEvent)
          Processing multiple filter matches for a statement.
 void processStatementFilterSingle(EPStatementAgentInstanceHandle handle, EPStatementHandleCallback handleCallback, EventBean theEvent)
          Process a single match.
 void processThreadWorkQueue()
          Works off the thread's work queue.
 void processWrappedEvent(EventBean eventBean)
          Process a wrapped event.
 void route(EventBean theEvent, EPStatementHandle epStatementHandle, boolean addToFront)
          Route the event such that the event is processed as required.
 void route(org.w3c.dom.Node document)
          Route a XML docment event
 void routeEventBean(EventBean theEvent)
          For processing a routed event.
 void sendEvent(java.util.Map map, java.lang.String eventTypeName)
          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[] objectarray, java.lang.String objectArrayEventTypeName)
          Send an object array containing event property values to the event stream processing runtime.
 void setInternalEventRouter(InternalEventRouter internalEventRouter)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EPRuntimeIsolatedImpl

public EPRuntimeIsolatedImpl(EPIsolationUnitServices svc,
                             EPServicesContext unisolatedSvc)
Ctor.

Parameters:
svc - isolated services
unisolatedSvc - engine services
Method Detail

sendEvent

public void sendEvent(java.lang.Object theEvent)
               throws EPException
Description copied from interface: EPRuntimeIsolated
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:
sendEvent in interface EPRuntimeIsolated
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: EPRuntimeIsolated
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:
sendEvent in interface EPRuntimeIsolated
Parameters:
document - is the DOM node as an event
Throws:
EPException - is thrown when the processing of the event lead to an error

route

public void route(org.w3c.dom.Node document)
           throws EPException
Route a XML docment event

Parameters:
document - to route
Throws:
EPException - if routing failed

sendEvent

public void sendEvent(java.util.Map map,
                      java.lang.String eventTypeName)
               throws EPException
Description copied from interface: EPRuntimeIsolated
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:
sendEvent in interface EPRuntimeIsolated
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
Throws:
EPException - - when the processing of the event leads to an error

sendEvent

public void sendEvent(java.lang.Object[] objectarray,
                      java.lang.String objectArrayEventTypeName)
Description copied from interface: EPRuntimeIsolated
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.

Specified by:
sendEvent in interface EPRuntimeIsolated
Parameters:
objectarray - - 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

processEvent

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

Parameters:
theEvent - to process.

processWrappedEvent

public void processWrappedEvent(EventBean eventBean)
Process a wrapped event.

Specified by:
processWrappedEvent in interface EPRuntimeEventSender
Parameters:
eventBean - to process

processThreadWorkQueue

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

Specified by:
processThreadWorkQueue in interface InternalEventRouteDest

processStatementFilterMultiple

public void processStatementFilterMultiple(EPStatementAgentInstanceHandle handle,
                                           java.util.ArrayDeque<FilterHandleCallback> callbackList,
                                           EventBean theEvent)
Processing multiple filter matches for a statement.

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

processStatementFilterSingle

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

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

dispatch

public void dispatch()
Dispatch events.

Specified by:
dispatch in interface InternalEventRouteDest

destroy

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


getCurrentTime

public long getCurrentTime()
Description copied from interface: EPRuntimeIsolated
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 EPRuntimeIsolated
Returns:
current engine time

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

setInternalEventRouter

public void setInternalEventRouter(InternalEventRouter internalEventRouter)
Specified by:
setInternalEventRouter in interface InternalEventRouteDest

getNextScheduledTime

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

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

getStatementNearestSchedules

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

getEngineURI

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

getEventSender

public EventSender getEventSender(java.lang.String eventTypeName)
Description copied from interface: EPRuntimeIsolated
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.

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 EPRuntimeIsolated
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: EPRuntimeIsolated
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 EPRuntimeIsolated
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

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

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