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.cep.Contextualizable, ca.uqac.lif.cep.Duplicable, ca.uqac.lif.cep.DuplicableProcessor

public class JsonLineFeeder extends ca.uqac.lif.cep.tmf.Source
A 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é
  • Nested Class Summary

    Nested classes/interfaces inherited from class ca.uqac.lif.cep.SynchronousProcessor

    ca.uqac.lif.cep.SynchronousProcessor.InputPushable, ca.uqac.lif.cep.SynchronousProcessor.OutputPullable

    Nested classes/interfaces inherited from class ca.uqac.lif.cep.Processor

    ca.uqac.lif.cep.Processor.InternalProcessorState
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final InputStream
    The input stream to read JSON content from.
    protected final Scanner
    The scanner pulling lines from the input stream.
    protected static final ca.uqac.lif.json.JsonParser
    The 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_hasBeenNotifiedOfEndOfTrace, m_inputArity, m_inputPullables, m_inputQueues, m_notifiedEndOfTraceDownstream, m_outputArity, m_outputPushables, m_outputQueues, MAX_PULL_RETRIES, s_versionString
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new instance of the source, by providing an input stream to read text from.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected boolean
    compute(Object[] inputs, Queue<Object[]> outputs)
     
    duplicate(boolean with_state)
     
    void
     

    Methods inherited from class ca.uqac.lif.cep.tmf.Source

    push

    Methods inherited from class ca.uqac.lif.cep.SynchronousProcessor

    getPullableOutput, getPushableInput

    Methods inherited from class ca.uqac.lif.cep.Processor

    allNotifiedEndOfTrace, allNull, copyInputQueue, copyOutputQueue, duplicate, duplicateInto, equals, getAt, getContext, getContext, getEmptyQueue, getId, getInputArity, getInputQueue, getInputType, getInputTypesFor, getOutputArity, getOutputQueue, getOutputType, getPullableInput, getPullableOutput, getPushableInput, getPushableOutput, hashCode, leftShift, newContext, onEndOfTrace, or, or, or, printState, readState, reset, rightShift, setContext, setContext, setPullableInput, setPushableOutput, start, startAll, stopAll

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • 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 InputStream m_is
      The input stream to read JSON content from.
    • m_scanner

      protected final Scanner m_scanner
      The scanner pulling lines from the input stream.
  • Constructor Details

    • JsonLineFeeder

      public JsonLineFeeder(InputStream is)
      Creates a new instance of the source, by providing an input stream to read text from.
      Parameters:
      is - The input stream
  • Method Details

    • compute

      protected boolean compute(Object[] inputs, Queue<Object[]> outputs)
      Specified by:
      compute in class ca.uqac.lif.cep.SynchronousProcessor
    • duplicate

      public JsonLineFeeder duplicate(boolean with_state)
      Specified by:
      duplicate in interface ca.uqac.lif.cep.Duplicable
      Specified by:
      duplicate in class ca.uqac.lif.cep.Processor
    • stop

      public void stop()
      Overrides:
      stop in class ca.uqac.lif.cep.Processor