com.espertech.esperio
Class AbstractCoordinatedAdapter

java.lang.Object
  extended by com.espertech.esperio.AbstractCoordinatedAdapter
All Implemented Interfaces:
com.espertech.esper.adapter.Adapter, com.espertech.esper.adapter.InputAdapter, CoordinatedAdapter
Direct Known Subclasses:
AdapterCoordinatorImpl, CSVInputAdapter

public abstract class AbstractCoordinatedAdapter
extends java.lang.Object
implements CoordinatedAdapter

A skeleton implementation for coordinated adapter reading, for adapters that can do timestamp-coordinated input.


Field Summary
protected  java.util.SortedSet<SendableEvent> eventsToSend
          Sorted events to be sent.
protected  com.espertech.esper.schedule.ScheduleSlot scheduleSlot
          Slot for scheduling.
protected  com.espertech.esper.adapter.AdapterStateManager stateManager
          Statement management.
 
Fields inherited from interface com.espertech.esper.adapter.InputAdapter
ESPERIO_MAP_EVENT_TYPE
 
Constructor Summary
AbstractCoordinatedAdapter(com.espertech.esper.client.EPServiceProvider epService, boolean usingEngineThread, boolean usingExternalTimer, boolean usingTimeSpanEvents)
          Ctor.
 
Method Summary
protected abstract  void close()
          Perform any actions specific to this Adapter that should be completed before the Adapter is stopped.
 void destroy()
           
 void disallowStateTransitions()
          Disallow subsequent state changes and throw an IllegalStateTransitionException if they are attempted.
 com.espertech.esper.client.EPRuntime getRuntime()
          Returns the runtime.
 com.espertech.esper.adapter.AdapterState getState()
           
 void pause()
           
protected abstract  void replaceFirstEventToSend()
          Remove the first member of eventsToSend and insert another event chosen in some fashion specific to this Adapter.
protected abstract  void reset()
          Reset all the changeable state of this Adapter, as if it were just created.
 void resume()
           
 void setEPService(com.espertech.esper.client.EPServiceProvider epService)
          Set the epService
 void setScheduleSlot(com.espertech.esper.schedule.ScheduleSlot scheduleSlot)
          Set the scheduleSlot for this Adapter.
 void setSender(AbstractSender sender)
          Sets a new sender to use.
 void setUsingEngineThread(boolean usingEngineThread)
          Set the usingEngineThread value
 void setUsingExternalTimer(boolean usingExternalTimer)
          Set to true to use esper's external timer mechanism instead of internal timing
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.espertech.esperio.CoordinatedAdapter
read
 

Field Detail

stateManager

protected final com.espertech.esper.adapter.AdapterStateManager stateManager
Statement management.


eventsToSend

protected final java.util.SortedSet<SendableEvent> eventsToSend
Sorted events to be sent.


scheduleSlot

protected com.espertech.esper.schedule.ScheduleSlot scheduleSlot
Slot for scheduling.

Constructor Detail

AbstractCoordinatedAdapter

public AbstractCoordinatedAdapter(com.espertech.esper.client.EPServiceProvider epService,
                                  boolean usingEngineThread,
                                  boolean usingExternalTimer,
                                  boolean usingTimeSpanEvents)
Ctor.

Parameters:
epService - - the EPServiceProvider for the engine runtime and services
usingEngineThread - - true if the Adapter should set time by the scheduling service in the engine, false if it should set time externally through the calling thread
usingExternalTimer - - true to use esper's external timer mechanism instead of internal timing
Method Detail

getState

public com.espertech.esper.adapter.AdapterState getState()
Specified by:
getState in interface com.espertech.esper.adapter.Adapter

start

public void start()
           throws com.espertech.esper.client.EPException
Specified by:
start in interface com.espertech.esper.adapter.Adapter
Throws:
com.espertech.esper.client.EPException

pause

public void pause()
           throws com.espertech.esper.client.EPException
Specified by:
pause in interface com.espertech.esper.adapter.Adapter
Throws:
com.espertech.esper.client.EPException

resume

public void resume()
            throws com.espertech.esper.client.EPException
Specified by:
resume in interface com.espertech.esper.adapter.Adapter
Throws:
com.espertech.esper.client.EPException

destroy

public void destroy()
             throws com.espertech.esper.client.EPException
Specified by:
destroy in interface com.espertech.esper.adapter.Adapter
Throws:
com.espertech.esper.client.EPException

stop

public void stop()
          throws com.espertech.esper.client.EPException
Specified by:
stop in interface com.espertech.esper.adapter.Adapter
Throws:
com.espertech.esper.client.EPException

disallowStateTransitions

public void disallowStateTransitions()
Description copied from interface: CoordinatedAdapter
Disallow subsequent state changes and throw an IllegalStateTransitionException if they are attempted.

Specified by:
disallowStateTransitions in interface CoordinatedAdapter

setUsingEngineThread

public void setUsingEngineThread(boolean usingEngineThread)
Description copied from interface: CoordinatedAdapter
Set the usingEngineThread value

Specified by:
setUsingEngineThread in interface CoordinatedAdapter
Parameters:
usingEngineThread - - the value to set

setUsingExternalTimer

public void setUsingExternalTimer(boolean usingExternalTimer)
Set to true to use esper's external timer mechanism instead of internal timing

Specified by:
setUsingExternalTimer in interface CoordinatedAdapter
Parameters:
usingExternalTimer - true for external timer

setScheduleSlot

public void setScheduleSlot(com.espertech.esper.schedule.ScheduleSlot scheduleSlot)
Description copied from interface: CoordinatedAdapter
Set the scheduleSlot for this Adapter.

Specified by:
setScheduleSlot in interface CoordinatedAdapter
Parameters:
scheduleSlot - - the scheduleSlot to set

setEPService

public void setEPService(com.espertech.esper.client.EPServiceProvider epService)
Description copied from interface: CoordinatedAdapter
Set the epService

Specified by:
setEPService in interface CoordinatedAdapter
Parameters:
epService - - the value to set

close

protected abstract void close()
Perform any actions specific to this Adapter that should be completed before the Adapter is stopped.


replaceFirstEventToSend

protected abstract void replaceFirstEventToSend()
Remove the first member of eventsToSend and insert another event chosen in some fashion specific to this Adapter.


reset

protected abstract void reset()
Reset all the changeable state of this Adapter, as if it were just created.


getRuntime

public com.espertech.esper.client.EPRuntime getRuntime()
Returns the runtime.

Returns:
runtime

setSender

public void setSender(AbstractSender sender)
Sets a new sender to use.

Parameters:
sender - for sending

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