Package ca.uqac.lif.cep.json
Class JsonLineFeeder
- java.lang.Object
-
- ca.uqac.lif.cep.Processor
-
- ca.uqac.lif.cep.SynchronousProcessor
-
- ca.uqac.lif.cep.tmf.Source
-
- ca.uqac.lif.cep.json.JsonLineFeeder
-
- All Implemented Interfaces:
ca.uqac.lif.azrael.Printable,ca.uqac.lif.azrael.Readable,ca.uqac.lif.cep.Contextualizable,ca.uqac.lif.cep.Duplicable,ca.uqac.lif.cep.DuplicableProcessor
public class JsonLineFeeder extends ca.uqac.lif.cep.tmf.SourceA source of JSON events taking its data from a JSON file. To facilitate parsing, the source expects one complete JSON snippet per text line.- Since:
- 0.8
- Author:
- Sylvain Hallé
-
-
Field Summary
Fields Modifier and Type Field Description protected java.io.InputStreamm_isThe input stream to read JSON content from.protected java.util.Scannerm_scannerThe scanner pulling lines from the input stream.protected static ca.uqac.lif.json.JsonParsers_parserThe parser used to parse the elements.-
Fields inherited from class ca.uqac.lif.cep.SynchronousProcessor
m_inputPushables, m_outputPullables, m_tempQueue
-
Fields inherited from class ca.uqac.lif.cep.Processor
m_context, m_eventTracker, m_hasBeenNotifiedOfEndOfTrace, m_inputArity, m_inputCount, m_inputPullables, m_inputQueues, m_notifiedEndOfTraceDownstream, m_outputArity, m_outputCount, m_outputPushables, m_outputQueues, MAX_PULL_RETRIES, s_versionString
-
-
Constructor Summary
Constructors Constructor Description JsonLineFeeder(java.io.InputStream is)Creates a new instance of the source, by providing an input stream to read text from.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancompute(java.lang.Object[] inputs, java.util.Queue<java.lang.Object[]> outputs)JsonLineFeederduplicate(boolean with_state)voidstop()-
Methods inherited from class ca.uqac.lif.cep.SynchronousProcessor
getPullableOutput, getPushableInput, setEventTracker
-
Methods inherited from class ca.uqac.lif.cep.Processor
allNotifiedEndOfTrace, allNull, associateTo, associateToInput, associateToOutput, copyInputQueue, copyOutputQueue, duplicate, duplicateInto, equals, getAt, getContext, getContext, getEmptyQueue, getEventTracker, getId, getInputArity, getInputCount, getInputQueue, getInputType, getInputTypesFor, getLeaves, getLeaves, getOutputArity, getOutputCount, getOutputQueue, getOutputType, getPullableInput, getPullableOutput, getPushableInput, getPushableOutput, hashCode, leftShift, newContext, onEndOfTrace, or, or, print, printState, read, readState, reset, rightShift, setContext, setContext, setPullableInput, setPushableOutput, start, startAll, stopAll
-
-
-
-
Field Detail
-
s_parser
protected static final ca.uqac.lif.json.JsonParser s_parser
The parser used to parse the elements. All instances of the processor share the same parser.
-
m_is
protected final java.io.InputStream m_is
The input stream to read JSON content from.
-
m_scanner
protected final java.util.Scanner m_scanner
The scanner pulling lines from the input stream.
-
-
Method Detail
-
compute
protected boolean compute(java.lang.Object[] inputs, java.util.Queue<java.lang.Object[]> outputs)- Specified by:
computein classca.uqac.lif.cep.SynchronousProcessor
-
duplicate
public JsonLineFeeder duplicate(boolean with_state)
- Specified by:
duplicatein interfaceca.uqac.lif.cep.Duplicable- Specified by:
duplicatein classca.uqac.lif.cep.Processor
-
stop
public void stop()
- Overrides:
stopin classca.uqac.lif.cep.Processor
-
-