Package edu.sc.seis.sod.source.event
Class SimpleEventSource
java.lang.Object
edu.sc.seis.sod.source.AbstractSource
edu.sc.seis.sod.source.event.SimpleEventSource
- All Implemented Interfaces:
EventSource
,Source
- Direct Known Subclasses:
CSVEventSource
public abstract class SimpleEventSource extends AbstractSource implements EventSource
-
Field Summary
Fields Modifier and Type Field Description boolean
hasNextBeenCalled
Fields inherited from class edu.sc.seis.sod.source.AbstractSource
name, NAME_ELEMENT, RETRIES_ELEMENT
-
Constructor Summary
Constructors Constructor Description SimpleEventSource(java.lang.String name)
SimpleEventSource(java.lang.String name, int retries)
SimpleEventSource(org.w3c.dom.Element config, java.lang.String defaultName)
SimpleEventSource(org.w3c.dom.Element config, java.lang.String defaultName, int defaultRetries)
-
Method Summary
Modifier and Type Method Description java.time.Instant
extractBeginTime(edu.sc.seis.sod.model.event.CacheEvent ev)
abstract edu.sc.seis.sod.model.event.CacheEvent[]
getEvents()
edu.sc.seis.sod.model.common.TimeRange
getEventTimeRange()
java.time.Duration
getWaitBeforeNext()
If the source needs to wait for more events to arrive, it should return the amount of time it wants to wait with this method.boolean
hasNext()
edu.sc.seis.sod.model.event.CacheEvent[]
next()
Methods inherited from class edu.sc.seis.sod.source.AbstractSource
appendToName, getName, getRetries, getRetryStrategy, setRetryStrategy
-
Field Details
-
hasNextBeenCalled
public boolean hasNextBeenCalled
-
-
Constructor Details
-
SimpleEventSource
public SimpleEventSource(org.w3c.dom.Element config, java.lang.String defaultName, int defaultRetries) -
SimpleEventSource
public SimpleEventSource(org.w3c.dom.Element config, java.lang.String defaultName) -
SimpleEventSource
public SimpleEventSource(java.lang.String name, int retries) -
SimpleEventSource
public SimpleEventSource(java.lang.String name)
-
-
Method Details
-
getEvents
public abstract edu.sc.seis.sod.model.event.CacheEvent[] getEvents() -
hasNext
public boolean hasNext()- Specified by:
hasNext
in interfaceEventSource
- Returns:
- - false when this event source will return no new events from calls to next
-
next
public edu.sc.seis.sod.model.event.CacheEvent[] next()- Specified by:
next
in interfaceEventSource
- Returns:
- - the next set of events. Events can be returned from this method multiple times
-
getWaitBeforeNext
public java.time.Duration getWaitBeforeNext()Description copied from interface:EventSource
If the source needs to wait for more events to arrive, it should return the amount of time it wants to wait with this method.- Specified by:
getWaitBeforeNext
in interfaceEventSource
-
getEventTimeRange
public edu.sc.seis.sod.model.common.TimeRange getEventTimeRange()- Specified by:
getEventTimeRange
in interfaceEventSource
- Returns:
- - a MicroSecondTimeRange starting at least as early as the earliest event and ending at least as late as the latest event. No event should be returned by this source with an origin before the begin time or after the end time of this range.
-
extractBeginTime
public java.time.Instant extractBeginTime(edu.sc.seis.sod.model.event.CacheEvent ev)
-