Package com.espertech.esperio.csv
Class CSVInputAdapter
java.lang.Object
com.espertech.esperio.csv.AbstractCoordinatedAdapter
com.espertech.esperio.csv.CSVInputAdapter
- All Implemented Interfaces:
com.espertech.esper.runtime.client.util.Adapter
,com.espertech.esper.runtime.client.util.InputAdapter
,CoordinatedAdapter
public class CSVInputAdapter
extends AbstractCoordinatedAdapter
implements com.espertech.esper.runtime.client.util.InputAdapter
An event Adapter that uses a CSV file for a source.
-
Field Summary
Fields inherited from class com.espertech.esperio.csv.AbstractCoordinatedAdapter
eventsToSend, scheduleSlot, stateManager
Fields inherited from interface com.espertech.esper.runtime.client.util.InputAdapter
ESPERIO_JSON_EVENT_TYPE, ESPERIO_MAP_EVENT_TYPE
-
Constructor Summary
ConstructorDescriptionCSVInputAdapter
(com.espertech.esper.runtime.client.EPRuntime runtime, AdapterInputSource adapterInputSource, String eventTypeName) Ctor.CSVInputAdapter
(com.espertech.esper.runtime.client.EPRuntime runtime, CSVInputAdapterSpec spec) Ctor.CSVInputAdapter
(AdapterInputSource adapterInputSource, String eventTypeName) Ctor for adapters that will be passed to an AdapterCoordinator.CSVInputAdapter
(CSVInputAdapterSpec adapterSpec) Ctor for adapters that will be passed to an AdapterCoordinator. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
close()
Close the CSVReader.int
Returns row count.read()
Get the next event in line to be sent into the runtime , or null if there is no available event.protected void
Remove the first member of eventsToSend.protected void
reset()
Reset all the changeable state of this ReadableAdapter, as if it were just created.void
setCoercer
(AbstractTypeCoercer coercer) Sets the coercing provider.void
setRuntime
(com.espertech.esper.runtime.client.EPRuntime runtime) Set the runtimeMethods inherited from class com.espertech.esperio.csv.AbstractCoordinatedAdapter
destroy, disallowStateTransitions, getProcessEvent, getState, pause, resume, setScheduleSlot, setSender, setUsingExternalTimer, setUsingRuntimeThread, start, 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.esper.runtime.client.util.Adapter
destroy, getState, pause, resume, start, stop
-
Constructor Details
-
CSVInputAdapter
public CSVInputAdapter(com.espertech.esper.runtime.client.EPRuntime runtime, CSVInputAdapterSpec spec) Ctor.- Parameters:
runtime
- - provides the runtimeruntime and servicesspec
- - the parameters for this adapter
-
CSVInputAdapter
public CSVInputAdapter(com.espertech.esper.runtime.client.EPRuntime runtime, AdapterInputSource adapterInputSource, String eventTypeName) Ctor.- Parameters:
runtime
- - provides the runtimeruntime and servicesadapterInputSource
- - the source of the CSV fileeventTypeName
- - the type name of the Map event to create from the CSV data
-
CSVInputAdapter
Ctor for adapters that will be passed to an AdapterCoordinator.- Parameters:
adapterSpec
- contains parameters that specify the behavior of the input adapter
-
CSVInputAdapter
Ctor for adapters that will be passed to an AdapterCoordinator.- Parameters:
adapterInputSource
- - the parameters for this adaptereventTypeName
- - the event type name that the input adapter generates events for
-
-
Method Details
-
read
Description copied from interface:CoordinatedAdapter
Get the next event in line to be sent into the runtime , or null if there is no available event.- Specified by:
read
in interfaceCoordinatedAdapter
- Returns:
- an instance of SendableEvent that wraps the next event to send, or null if none
- Throws:
com.espertech.esper.common.client.EPException
- in case of errors creating the event
-
setRuntime
public void setRuntime(com.espertech.esper.runtime.client.EPRuntime runtime) Description copied from interface:CoordinatedAdapter
Set the runtime- Specified by:
setRuntime
in interfaceCoordinatedAdapter
- Overrides:
setRuntime
in classAbstractCoordinatedAdapter
- Parameters:
runtime
- - the value to set
-
setCoercer
Sets the coercing provider.- Parameters:
coercer
- to use for coercing
-
close
protected void close()Close the CSVReader.- Specified by:
close
in classAbstractCoordinatedAdapter
-
replaceFirstEventToSend
protected void replaceFirstEventToSend()Remove the first member of eventsToSend. If there is another record in the CSV file, insert the event created from it into eventsToSend.- Specified by:
replaceFirstEventToSend
in classAbstractCoordinatedAdapter
-
reset
protected void reset()Reset all the changeable state of this ReadableAdapter, as if it were just created.- Specified by:
reset
in classAbstractCoordinatedAdapter
-
getRowCount
public int getRowCount()Returns row count.- Returns:
- row count
-