Package ca.uqac.lif.cep.jdbc
Class JdbcSource
java.lang.Object
ca.uqac.lif.cep.Processor
ca.uqac.lif.cep.SynchronousProcessor
ca.uqac.lif.cep.tmf.Source
ca.uqac.lif.cep.jdbc.JdbcSource
- All Implemented Interfaces:
ca.uqac.lif.cep.Contextualizable,ca.uqac.lif.cep.Duplicable,ca.uqac.lif.cep.DuplicableProcessor
public class JdbcSource
extends ca.uqac.lif.cep.tmf.Source
Converts a query to a database into a trace of named tuples.
-
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.OutputPullableNested classes/interfaces inherited from class ca.uqac.lif.cep.Processor
ca.uqac.lif.cep.Processor.InternalProcessorState -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ConnectionThe database connection objectprotected booleanWhether the tuples of the underlying relation should be output one by one on every call tocompute(Object[], Queue), or output all at once on the first call to that method.protected booleanRemembers whether the query has already been run on the databaseprotected final StringThe name of the database table to read from.protected ResultSetThe query's result set, out of which tuples will be extracted one by oneprotected StatementThe statement object corresponding to the SQL query being executedFields inherited from class ca.uqac.lif.cep.SynchronousProcessor
m_inputPushables, m_outputPullables, m_tempQueueFields 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 -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanduplicate(boolean with_state) voidreset()voidsetFeedOneByOne(boolean b) Sets whether the tuples of the underlying relation should be output one by one on every call tocompute(Object[], Queue), or output all at once on the first call to that method.Methods inherited from class ca.uqac.lif.cep.tmf.Source
pushMethods inherited from class ca.uqac.lif.cep.SynchronousProcessor
getPullableOutput, getPushableInputMethods 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, rightShift, setContext, setContext, setPullableInput, setPushableOutput, start, startAll, stop, stopAll
-
Field Details
-
m_query
The name of the database table to read from. Actually, this does not need to be a table name, as any SQL expression that returns a table (e.g. aSELECTstatement) can do. -
m_connection
The database connection object -
m_statement
The statement object corresponding to the SQL query being executed -
m_resultSet
The query's result set, out of which tuples will be extracted one by one -
m_feedOneByOne
protected boolean m_feedOneByOneWhether the tuples of the underlying relation should be output one by one on every call tocompute(Object[], Queue), or output all at once on the first call to that method. -
m_hasRun
protected boolean m_hasRunRemembers whether the query has already been run on the database
-
-
Constructor Details
-
JdbcSource
Builds a JDBC source.- Parameters:
conn- An open connection on the databasetablename- The name of the table to be read from. Actually, this does not need to be a table name, as any SQL expression that returns a table (e.g. aSELECTstatement) can do.
-
-
Method Details
-
setFeedOneByOne
public void setFeedOneByOne(boolean b) Sets whether the tuples of the underlying relation should be output one by one on every call tocompute(Object[], Queue), or output all at once on the first call to that method. While this has no effect on the end result, it might have an impact on the performance (e.g. if the source outputs a very large number of tuples in the output queue, which must be stored in memory).- Parameters:
b- Set totrueto feed the tuples one by one, false otherwise
-
compute
- Specified by:
computein classca.uqac.lif.cep.SynchronousProcessor
-
duplicate
- Specified by:
duplicatein interfaceca.uqac.lif.cep.Duplicable- Specified by:
duplicatein classca.uqac.lif.cep.Processor
-
reset
public void reset()- Overrides:
resetin classca.uqac.lif.cep.Processor
-