Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.soa.esb.listeners.gateway
Class SqlTableGatewayListener

    java.lang.Object
      org.jboss.soa.esb.listeners.lifecycle.AbstractManagedLifecycle
          org.jboss.soa.esb.listeners.lifecycle.AbstractThreadedManagedLifecycle
              org.jboss.soa.esb.listeners.gateway.SqlTableGatewayListener

All Implemented Interfaces:
  java.io.Serializable, java.lang.Runnable, ManagedLifecycle

    public class SqlTableGatewayListener

extends AbstractThreadedManagedLifecycle

Polls an SQL table for rows that satisfy conditions defined in the xml runtime configuration

When a row that matches conditions is retrieved, it's contents are packed into an ESB Message and

The following fields are mandatory (see checkMyParms()):
SQL table name
list of fields to retrieve
list of key fields to use in the update statement
a field that will be used to mark a row as 'P' (pending), 'W' (in process), 'D' (done) or 'E' (error). When adding a pending row, make sure that the status_col value if an upper-cased 'P', as upper-cased characters are used as a convention.

Since:
  Version 4.0
Author:
  schifest@heuristica.com.ar, tcunning@redhat.com
See Also:
  Serialized Form

Nested Class Summary
`static class` | `SqlTableGatewayListener.PackageRowContents` Default gateway action for SQL table rows It will just drop the result set contents into a Message
`static class` | `SqlTableGatewayListener.ROW_STATE`

Field Summary
`protected java.lang.String[]` | `_columns`
`protected java.lang.Object` | `_composer`
`protected java.lang.Class` | `_composerClass`
`protected java.lang.String` | `_composerName`
`protected ConfigTree` | `_config`
`protected java.util.Map<java.lang.String,java.lang.Object>` | `_currentRow`
`protected java.lang.String` | `_datasource`
`protected JdbcCleanConn` | `_dbConn`
`protected boolean` | `_deleteAfterOK`
`protected java.lang.String` | `_driver`
`protected java.lang.String` | `_inProcessField`
`protected java.lang.String` | `_inProcessVals`
`protected java.lang.String` | `_keyFields`
`protected java.lang.String[]` | `_keys`
`protected static org.apache.log4j.Logger` | `_logger`
`protected java.lang.String` | `_orderBy`
`protected java.lang.String` | `_password`
`protected java.lang.reflect.Method` | `_processMethod`
`protected java.sql.PreparedStatement` | `_PSdeleteRow`
`protected java.sql.PreparedStatement` | `_PSscan`
`protected java.sql.PreparedStatement` | `_PSupdate`
`protected java.lang.String` | `_selectFields`
`protected ServiceInvoker` | `_serviceInvoker`
`protected long` | `_sleepBetweenPolls`
`protected java.lang.String` | `_tableName`
`protected java.lang.String` | `_targetServiceCategory`
`protected java.lang.String` | `_targetServiceName`
`protected java.lang.String` | `_timestamp`
`protected java.util.Map<java.lang.String,java.lang.Object>` | `_upperCurrentRow`
`protected java.lang.String` | `_url`
`protected java.lang.String` | `_user`
`protected java.lang.String` | `_where`
`static java.lang.String` | `DEFAULT_IN_PROCESS_STATES`

Fields inherited from class org.jboss.soa.esb.listeners.lifecycle.AbstractManagedLifecycle
`PARAM_TERMINATION_PERIOD`

Constructor Summary
`SqlTableGatewayListener(ConfigTree config)`

Method Summary
`protected boolean` | `changeStatus(SqlTableGatewayListener.ROW_STATE fromState, SqlTableGatewayListener.ROW_STATE toState)`
`protected boolean` | `changeStatusToDone()`
`protected boolean` | `changeStatusToError()`
`protected boolean` | `changeStatusToWorking()`
`protected boolean` | `deleteCurrentRow()` Try to delete 'current row' from polled table
`protected java.lang.String` | `deleteStatement()` Assemble the SQL statement to delete the current row in the table row uniquely identified by the list of fields in the "keyFields" parameter
`protected void` | `doInitialise()` Handle the initialisation of the managed instance.
`protected void` | `doRun()` Execute on the thread.
`protected void` | `doThreadedDestroy()` Handle the threaded destroy of the managed instance.
`protected JdbcCleanConn` | `getDbConn()` Obtain a new database connection with parameter info
`protected java.lang.String` | `getStatus(SqlTableGatewayListener.ROW_STATE p_oState)`
`protected java.util.List<java.util.Map<java.lang.String,java.lang.Object>>` | `pollForCandidates()`
`protected void` | `prepareStatements()`
`void` | `refreshDatasource()`
`protected void` | `resolveComposerClass()`
`protected java.lang.String` | `scanStatement()` Assemble the SQL statement to scan (poll) the table
`protected java.lang.String` | `updateStatement()` Assemble the SQL statement to update the field in the "inProcessField" parameter in the table row uniquely identified by the list of fields in the "keyFields" parameter

Methods inherited from class org.jboss.soa.esb.listeners.lifecycle.AbstractThreadedManagedLifecycle
`addManagedLifecycleThreadEventListener, doDestroy, doStart, doStop, isRunning, isStopped, isStopping, removeManagedLifecycleThreadEventListener, run, setRunning, waitForRunningStateChange, waitUntilStopped, waitUntilStopped, waitUntilStopping`

Methods inherited from class org.jboss.soa.esb.listeners.lifecycle.AbstractManagedLifecycle
`addManagedLifecycleEventListener, changeState, destroy, getConfig, getState, getTerminationPeriod, initialise, removeManagedLifecycleEventListener, start, stop, waitUntilDestroyed, waitUntilDestroyed, waitUntilNotState, waitUntilState`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### _logger

    protected static final org.apache.log4j.Logger _logger

### _config

    protected ConfigTree _config

### _sleepBetweenPolls

    protected long _sleepBetweenPolls

### _targetServiceCategory

    protected java.lang.String _targetServiceCategory

### _targetServiceName

    protected java.lang.String _targetServiceName

### _composerName

    protected java.lang.String _composerName

### _serviceInvoker

    protected ServiceInvoker _serviceInvoker

### _composerClass

    protected java.lang.Class _composerClass

### _composer

    protected java.lang.Object _composer

### _processMethod

    protected java.lang.reflect.Method _processMethod

### _driver

    protected java.lang.String _driver

### _url

    protected java.lang.String _url

### _user

    protected java.lang.String _user

### _password

    protected java.lang.String _password

### _datasource

    protected java.lang.String _datasource

### _tableName

    protected java.lang.String _tableName

### _selectFields

    protected java.lang.String _selectFields

### _keyFields

    protected java.lang.String _keyFields

### _timestamp

    protected java.lang.String _timestamp

### _where

    protected java.lang.String _where

### _orderBy

    protected java.lang.String _orderBy

### _inProcessField

    protected java.lang.String _inProcessField

### _inProcessVals

    protected java.lang.String _inProcessVals

### _deleteAfterOK

    protected boolean _deleteAfterOK

### _columns

    protected java.lang.String[] _columns

### _keys

    protected java.lang.String[] _keys

### _PSscan

    protected java.sql.PreparedStatement _PSscan

### _PSupdate

    protected java.sql.PreparedStatement _PSupdate

### _PSdeleteRow

    protected java.sql.PreparedStatement _PSdeleteRow

### _dbConn

    protected JdbcCleanConn _dbConn

### _currentRow

    protected java.util.Map<java.lang.String,java.lang.Object> _currentRow

### _upperCurrentRow

    protected java.util.Map<java.lang.String,java.lang.Object> _upperCurrentRow

### DEFAULT_IN_PROCESS_STATES

    public static final java.lang.String DEFAULT_IN_PROCESS_STATES

See Also:
  Constant Field Values

Constructor Detail

### SqlTableGatewayListener

    public SqlTableGatewayListener(ConfigTree config)
                            throws ConfigurationException

Throws:
  `ConfigurationException`

Method Detail

### doInitialise

    protected void doInitialise()
                         throws ManagedLifecycleException

  Handle the initialisation of the managed instance.

  Specified by:
    `doInitialise` in class `AbstractManagedLifecycle`
  Throws:
    `ManagedLifecycleException` - for errors while initialisation.

### doRun

    protected void doRun()

  Execute on the thread.

  Specified by:
    `doRun` in class `AbstractThreadedManagedLifecycle`

### doThreadedDestroy

    protected void doThreadedDestroy()
                              throws ManagedLifecycleException

  Handle the threaded destroy of the managed instance.

  Overrides:
    `doThreadedDestroy` in class `AbstractThreadedManagedLifecycle`
  Throws:
    `ManagedLifecycleException` - for errors while destroying.

### prepareStatements

    protected void prepareStatements()
                              throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`

### resolveComposerClass

    protected void resolveComposerClass()
                                 throws ConfigurationException

  Throws:
    `ConfigurationException`

### pollForCandidates

    protected java.util.List<java.util.Map<java.lang.String,java.lang.Object>> pollForCandidates()

### refreshDatasource

    public void refreshDatasource()

### getDbConn

    protected JdbcCleanConn getDbConn()

  Obtain a new database connection with parameter info

  Returns:
    A new connection
  Throws:
    `ConfigurationException` - - if problems are encountered

### scanStatement

    protected java.lang.String scanStatement()

  Assemble the SQL statement to scan (poll) the table

  Returns:
    - The resulting SQL statement

### updateStatement

    protected java.lang.String updateStatement()

  Assemble the SQL statement to update the field in the "inProcessField" parameter

  in the table row uniquely identified by the list of fields in the "keyFields" parameter

  Returns:
    - The resulting SQL statement

### deleteStatement

    protected java.lang.String deleteStatement()

  Assemble the SQL statement to delete the current row in the table row uniquely identified by the list of fields in the "keyFields" parameter

  Returns:
    - The resulting SQL statement

### deleteCurrentRow

    protected boolean deleteCurrentRow()

  Try to delete 'current row' from polled table

  Returns:
    true if row deletion was successful - false otherwise

### getStatus

    protected java.lang.String getStatus(SqlTableGatewayListener.ROW_STATE p_oState)

### changeStatusToWorking

    protected boolean changeStatusToWorking()

### changeStatusToDone

    protected boolean changeStatusToDone()

### changeStatusToError

    protected boolean changeStatusToError()

### changeStatus

    protected boolean changeStatus(SqlTableGatewayListener.ROW_STATE fromState,
                                   SqlTableGatewayListener.ROW_STATE toState)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD