org.openadaptor.adaptor.jdbc.sybase
Class SybaseBatchSource

java.lang.Object
  extended by org.openadaptor.adaptor.SimpleComponent
      extended by org.openadaptor.adaptor.AbstractReader
          extended by org.openadaptor.adaptor.AbstractSimpleSource
              extended by org.openadaptor.adaptor.jdbc.JdbcSource
                  extended by org.openadaptor.adaptor.jdbc.sybase.SybaseSource
                      extended by org.openadaptor.adaptor.jdbc.sybase.SybaseBatchSource
All Implemented Interfaces:
java.lang.Runnable, CallbackProvider, Component, Configurable, IbafTransactionalResource, Source, DOMessageReaderDelegate

public class SybaseBatchSource
extends SybaseSource

Sybase-specific JdbcSource

Author:
Fred Perry, Steve Howe

Nested Class Summary
 
Nested classes/interfaces inherited from class org.openadaptor.adaptor.AbstractSimpleSource
AbstractSimpleSource.SourceListenThread
 
Nested classes/interfaces inherited from class org.openadaptor.adaptor.SimpleComponent
SimpleComponent.StateHolder
 
Field Summary
 java.lang.String DO_TYPE_NAME
          default DataObject type name used for the DataObjects that are created from the batch select
(package private) static org.apache.log4j.Logger log
           
 
Fields inherited from class org.openadaptor.adaptor.jdbc.JdbcSource
_batchSize, _bcgProcNamePrefix, _dbConnection, _deadlockIsFatal, _deadlockRetryDelay, _jdbcDriver, _jdbcTypeMap, _jdbcUrl, _maxDeadlockRetry, _maxNumberOfFailures, _msgServiceId, _msgServiceName, _passingProcParamNames, _password, _sqlQueryTimeout, _sqlQueryTimeoutSet, _transactionIsolationLevel, _userName, _usingSelect, DEFAULT_DOTYPE_MAP, failedEvents, sentEvents
 
Fields inherited from class org.openadaptor.adaptor.AbstractSimpleSource
_last_processed_time, _max_calls_per_poll, _num_polls, _num_processed, _source_type, CALLBACK_SOURCE, LISTEN_SOURCE, POLL_SOURCE
 
Fields inherited from class org.openadaptor.adaptor.AbstractReader
_batch_size, _comment_regexps, _end_data, _file_name, _file_name_att, _header_lines, _re_compiler, _re_matcher, _reader, _rec_num, _rec_num_att, _record_regexps, _start_data, _stream_reader, _string_reader, _useAlternateDOXMLReader
 
Fields inherited from class org.openadaptor.adaptor.SimpleComponent
_controller, _formatter, _name, _propsPrefix, _readerDelegate, _textEncoding, MESSAGE_WRITER_PREFIX, MESSAGEID_ATTR, TEXT_ENCODING_ATTR
 
Constructor Summary
SybaseBatchSource()
           
 
Method Summary
protected  JdbcSourceEventMessage getNextEvent(int msgServiceId)
          Retrieves the next event from the database.
protected  JdbcSourceEventMessage getNextQueuedMsgStatement(int msgServiceId)
          calls special proc that returns batches of result sets, with MsgTypeName and msgId as part as the first two columns.
 void init(java.lang.String name, java.util.Properties props, java.lang.String prefix, Controller controller)
          initialise using properties
protected  void setEventMessageStatus(JdbcSourceEventMessage theEvent, java.lang.String messageStatus, java.lang.String failedMessage)
          Sets the status of a particular event on the BCG_MsgQueue table.
protected  void setEventMessageStatus(JdbcSourceEventMessage theEvent, java.lang.String messageStatus, java.lang.String failedMessage, int numFailed)
          Sets the status of a particular event on the BCG_MsgQueue table.
protected  void setEventMessageStatus(java.lang.String msgId, java.lang.String messageStatus, java.lang.String failedMessage)
          Sets the status of a particular event on the BCG_MsgQueue table.
 void sourceStartUp()
          Called when the source starts.
 void txnCommitWithExceptions(Message m)
          Called by the controller when a txnCommit is requested by the Source of a message In this case not all of the data in the message was successfully processed, you can get an array of Exceptions using Message.getExceptions, this corresponds to the array of data objects.
 
Methods inherited from class org.openadaptor.adaptor.jdbc.sybase.SybaseSource
constructSqlFromEvent, dbInit, dealWithReturnValue, getProcResultSet, isDeadlock, registerReturnValue, retrieveMsgServiceId
 
Methods inherited from class org.openadaptor.adaptor.jdbc.JdbcSource
getBcgProcNamePrefix, getDeadlockIsFatal, getDeadlockRetryDelay, getJdbcConnection, getJdbcDriver, getJdbcUrl, getMaxDeadlockRetry, getMaxNumberOfFailures, getMsgServiceName, getPassword, getSqlQueryTimeout, getTransactionIsolationLevel, getUserName, isPassingProcParamNames, isUsingSelect, jdbcTxnBegin, jdbcTxnCommit, jdbcTxnRollback, setBatchSize, setBcgProcNamePrefix, setDeadlockIsFatal, setDeadlockRetryDelay, setJdbcConnection, setJdbcDriver, setJDBCTypeMap, setJdbcUrl, setMaxDeadlockRetry, setMaxNumberOfFailures, setMsgServiceName, setPassingProcParamNames, setPassword, setSqlQueryTimeout, setTransactionIsolationLevel, setUserName, setUsingSelect, sourceCleanUp, sourcePoll, txnBegin, txnCommit, txnRollback
 
Methods inherited from class org.openadaptor.adaptor.AbstractSimpleSource
getPollPeriod, getSourceType, getStatus, processMessage, processMessage, processMessageWithTxn, run, runCallback, runListen, runPoll, setMaxCallsPerPoll, setPollPeriod, setSourceType, sourceHasTransactionRecovery, sourceListen, sourcePause, sourceProcess, sourceProcess, sourceProcess, sourceResume, sourceStop, sourceTransactionBegin, sourceTransactionProcess
 
Methods inherited from class org.openadaptor.adaptor.AbstractReader
getDOStreamReader, getDOStringReader, getLineNumberReader, getReader, getXMLString, isReaderEOF, isWhitespace, nextDataObjectArray, readDOStreamReader, readDOStringReader, readDOXML, readDOXMLAlternate, readerCleanUp, readerEOF, readerException, readerStartUp, setDOStringReader, setHeaderLines, setReader
 
Methods inherited from class org.openadaptor.adaptor.SimpleComponent
addCallback, canUpdateWhileRunning, cleanUp, customControl, didReceiveMessage, getAsProperties, getCallbackManager, getCurrentState, getCustomControlProperties, getLastUID, getName, getProperty, getProperty, getPropsPrefix, getRequestedState, getSecurityManager, getTextEncoding, getXMLFormatter, notifyEvent, pause, removeCallback, resume, setCallbackManager, setCallbackManager, setCurrentState, setFromProperties, setFromProperties, setFromResource, setName, setPropsPrefix, setRequestedState, terminate, txnRollback, waitForRequestedStateChange
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.openadaptor.adaptor.Component
cleanUp, customControl, getName, getPropsPrefix, getRequestedState, pause, resume, setName, setPropsPrefix, terminate
 
Methods inherited from interface org.openadaptor.adaptor.IbafTransactionalResource
txnRollback
 
Methods inherited from interface org.openadaptor.adaptor.Configurable
canUpdateWhileRunning, getAsProperties, setFromProperties, setFromProperties
 
Methods inherited from interface org.openadaptor.adaptor.CallbackProvider
addCallback, getCallbackManager, notifyEvent, removeCallback, setCallbackManager, setCallbackManager
 

Field Detail

log

static org.apache.log4j.Logger log

DO_TYPE_NAME

public java.lang.String DO_TYPE_NAME
default DataObject type name used for the DataObjects that are created from the batch select

Constructor Detail

SybaseBatchSource

public SybaseBatchSource()
Method Detail

init

public void init(java.lang.String name,
                 java.util.Properties props,
                 java.lang.String prefix,
                 Controller controller)
          throws IbafException
initialise using properties

Specified by:
init in interface Component
Overrides:
init in class SybaseSource
Parameters:
name - The name to be given to the component
props - Properties object
prefix - Prefix string to search for properties
controller - The component's controller object
Throws:
IbafException - if initialization fails
See Also:
Controller, SimpleController

sourceStartUp

public void sourceStartUp()
                   throws IbafException
Called when the source starts. If the user has supplied the 'InitialisationProcedure' configuration parameter this stored procedure will be called.

Overrides:
sourceStartUp in class JdbcSource
Throws:
IbafException

txnCommitWithExceptions

public void txnCommitWithExceptions(Message m)
                             throws IbafException
Description copied from class: SimpleComponent
Called by the controller when a txnCommit is requested by the Source of a message In this case not all of the data in the message was successfully processed, you can get an array of Exceptions using Message.getExceptions, this corresponds to the array of data objects. This default implementation must be overridden to support this behaviour

Specified by:
txnCommitWithExceptions in interface IbafTransactionalResource
Overrides:
txnCommitWithExceptions in class SimpleComponent
Throws:
IbafException - If fails to commit the transaction
See Also:
Controller.txnCommit(Source)

getNextEvent

protected JdbcSourceEventMessage getNextEvent(int msgServiceId)
                                       throws java.sql.SQLException,
                                              DeadlockException
Description copied from class: JdbcSource
Retrieves the next event from the database.

Overrides:
getNextEvent in class JdbcSource
Throws:
java.sql.SQLException - if something goes wrong
DeadlockException

getNextQueuedMsgStatement

protected JdbcSourceEventMessage getNextQueuedMsgStatement(int msgServiceId)
                                                    throws java.sql.SQLException,
                                                           DeadlockException
calls special proc that returns batches of result sets, with MsgTypeName and msgId as part as the first two columns.

Overrides:
getNextQueuedMsgStatement in class SybaseSource
Throws:
java.sql.SQLException - if something goes wrong.
DeadlockException

setEventMessageStatus

protected void setEventMessageStatus(JdbcSourceEventMessage theEvent,
                                     java.lang.String messageStatus,
                                     java.lang.String failedMessage)
                              throws java.sql.SQLException,
                                     DeadlockException
Sets the status of a particular event on the BCG_MsgQueue table.

Overrides:
setEventMessageStatus in class SybaseSource
Throws:
java.sql.SQLException - if something goes wrong.
DeadlockException

setEventMessageStatus

protected void setEventMessageStatus(JdbcSourceEventMessage theEvent,
                                     java.lang.String messageStatus,
                                     java.lang.String failedMessage,
                                     int numFailed)
                              throws java.sql.SQLException,
                                     DeadlockException
Sets the status of a particular event on the BCG_MsgQueue table.

Throws:
java.sql.SQLException - if something goes wrong.
DeadlockException

setEventMessageStatus

protected void setEventMessageStatus(java.lang.String msgId,
                                     java.lang.String messageStatus,
                                     java.lang.String failedMessage)
                              throws java.sql.SQLException,
                                     DeadlockException
Sets the status of a particular event on the BCG_MsgQueue table.

Throws:
java.sql.SQLException - if something goes wrong.
DeadlockException