org.osesb.scheduledjobs.databasepoller
Class DatabasePollerConfiguration

java.lang.Object
  extended by org.osesb.configuration.XMLConfiguration
      extended by org.osesb.scheduledjobs.PollerConfiguration
          extended by org.osesb.scheduledjobs.databasepoller.DatabasePollerConfiguration

public class DatabasePollerConfiguration
extends PollerConfiguration

Extends PollerConfiguration to configure a database poller scheduled job.

DatabasePollerConfiguration(s) are enclosed by the <job-configuration> element in a ScheduledJobConfiguration file.

ScheduledJob(s) can be configured as Quartz Jobs or as Runnable(s). For Quartz-based ScheduledJob(s), scheduledJobConfiguration is set by execute(). For Runnable ScheduledJob(s), scheduledJobConfiguration is set by the constructor that takes a ScheduledJobConfiguration as the parameter.

Database poller scheduled jobs expect a <job-configuration> ScheduledJobConfiguration element that contains a DatabasePollerConfiguration, which includes a org.osesb.connectors.jdbc.TableSetConfiguration and a org.osesb.msgrouting.configuration.ClientGatewayConfiguration.

The TableSetConfiguration is used for processing database changes. A TableSetConfiguration includes:

The ClientGatewayConfiguration configures a ClientGateway, which is used to send messages to osESB. Typically, the ClientGateway configures a org.osesb.messagepipeline.MessagePipeline with org.osesb.messagepipeline.PipelineStage(s) that:

The TableSetConfiguration, which is part of the DatabasePollerConfiguration must configure at least a SQL select statement named 'pollerSelectStatement'. The TableSetConfiguration can also include a SQL update statement that is used to checkpoint processed rows after the message have been sent to osESB using the configured ClientGateway. By default, the name of the update statement is 'checkpointUpdateStatement'.

See the org.osesb.scheduledjobs.databasepoller.test package for example configurations of database poller scheduled jobs.

Since:
Version .9

Field Summary
protected  TableSetConfiguration tableSetConfiguration
          A TableSetConfiguration within this DatabasePollerConfiguration.
 
Fields inherited from class org.osesb.scheduledjobs.PollerConfiguration
clientGatewayConfiguration
 
Fields inherited from class org.osesb.configuration.XMLConfiguration
configFilePath, configurationProperties, constructedFromConfigFile, contentModelElement, ftpClientConfiguration, jaxrpcClientConfiguration, jdbcConfiguration, jmsClientConfiguration, log, rootConfigurationAttributes, smtpClientConfiguration, systemProperties, thisClassName
 
Constructor Summary
DatabasePollerConfiguration(org.w3c.dom.Element contentModelElement)
          Creates a new instance of DatabasePollerConfiguration given the content model Element.
DatabasePollerConfiguration(java.lang.String configFile)
          Creates a new instance of DatabasePollerConfiguration given a XML configuration file.
DatabasePollerConfiguration(java.lang.String configFile, java.lang.String xpathExpression)
          Creates a new instance of DatabasePollerConfiguration given a XML configuration file and a XPath expression that evaluates to the element that marks the beginning of the configuration.
 
Method Summary
 TableSetConfiguration getTableSetConfiguration()
          Returns the TableSetConfiguration for this DatabasePollerConfiguration.
protected  void loadTableSetConfiguration()
          Loads the TableSetConfiguration enclosed within this configuration.
static void main(java.lang.String[] args)
          main() For testing.
 void setConfigFilePath(java.lang.String configFile)
          Set the configuration file name.
 void setDebugFlag(boolean debugFlag)
          Set the debugFlag.
 java.lang.String toString()
          Returns the String representation of this DatabasePollerConfiguration.
 
Methods inherited from class org.osesb.scheduledjobs.PollerConfiguration
getClientGatewayConfiguration, getMaxNumberOfItemsToProcess, getPercentItemsToProcess, loadClientGatewayConfiguration, setMaxNumberOfItemsToProcess, setPercentItemsToProcess
 
Methods inherited from class org.osesb.configuration.XMLConfiguration
checkXMLConfigurationClass, clear, doEncryptionInstructions, getBooleanConfigurationProperty, getBooleanRootConfigurationAttribute, getConfigFilePath, getConfigurationAttribute, getConfigurationAttributes, getConfigurationElement, getConfigurationElements, getConfigurationProperties, getConfigurationProperty, getConfigurationProperty, getContentModelElement, getDebugFlag, getDocument, getEncryptionInstructions, getFTPClientConfiguration, getIntConfigurationProperty, getIntRootConfigurationAttribute, getJAXRPCClientConfiguration, getJDBCConfiguration, getJMSClientConfiguration, getLongConfigurationProperty, getLongRootConfigurationAttribute, getName, getRootConfigurationAttribute, getRootConfigurationAttributes, getSMTPClientConfiguration, getSystemProperties, getSystemProperty, isConfigurationElementEmpty, loadConfiguration, loadExternalConfiguration, loadFTPClientConfiguration, loadJAXRPCClientConfiguration, loadJDBCConfiguration, loadJMSClientConfiguration, loadPropertiesFromContentModel, loadSMTPClientConfiguration, loadSystemProperties, mergeConfigurationProperties, setConfigurationProperty, setFTPClientConfiguration, setJAXRPCClientConfiguration, setJDBCConfiguration, setJMSClientConfiguration, setName, setRootConfigurationAttribute, setSMTPClientConfiguration, setSystemProperties, setSystemProperty, writeConfigurationFile, writeConfigurationFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

tableSetConfiguration

protected TableSetConfiguration tableSetConfiguration
A TableSetConfiguration within this DatabasePollerConfiguration.

See Also:
loadTableSetConfiguration(), package
Constructor Detail

DatabasePollerConfiguration

public DatabasePollerConfiguration(java.lang.String configFile)
                            throws java.lang.Exception
Creates a new instance of DatabasePollerConfiguration given a XML configuration file. The root element of the XML configuration file is the starting element for the configuration.

Parameters:
configFile - The path to the XML configuration file, which is specified as a resource path or as a file system path that is relative to the path specified by the ConfigurationConstants.CONFIG_PATH_SYSTEMPROPERTY System Property.
Throws:
java.lang.Exception - if there is a problem reading or parsing the configuration file.

DatabasePollerConfiguration

public DatabasePollerConfiguration(java.lang.String configFile,
                                   java.lang.String xpathExpression)
                            throws java.lang.Exception
Creates a new instance of DatabasePollerConfiguration given a XML configuration file and a XPath expression that evaluates to the element that marks the beginning of the configuration.

An empty xpathExpression implies that the root element of the XML configuration file is the starting element for the configuration.

Parameters:
configFile - The path to the XML configuration file, which is specified as a resource path or as a file system path that is relative to the path specified by the ConfigurationConstants.CONFIG_PATH_SYSTEMPROPERTY System Property.
xpathExpression - A XPath expression that evaluates to the element that marks the beginning of the configuration.
Throws:
java.lang.Exception - if there is a problem reading or parsing the configuration file.

DatabasePollerConfiguration

public DatabasePollerConfiguration(org.w3c.dom.Element contentModelElement)
                            throws java.lang.Exception
Creates a new instance of DatabasePollerConfiguration given the content model Element.

Parameters:
contentModelElement - The top level Element for the for the configuration.
Throws:
java.lang.Exception - if there is a fatal error transversing the configuration content model enclosed by contentModelElement.
Method Detail

loadTableSetConfiguration

protected final void loadTableSetConfiguration()
                                        throws java.lang.Exception
Loads the TableSetConfiguration enclosed within this configuration.

Throws:
java.lang.Exception - if there is a fatal error transversing the DOM that contains the configuration content models.

setConfigFilePath

public void setConfigFilePath(java.lang.String configFile)
Set the configuration file name.

Overrides:
setConfigFilePath in class PollerConfiguration
Parameters:
configFile - the configuration file name.

setDebugFlag

public void setDebugFlag(boolean debugFlag)
Set the debugFlag.

Overrides:
setDebugFlag in class PollerConfiguration
Parameters:
debugFlag - The debugFlag.

getTableSetConfiguration

public TableSetConfiguration getTableSetConfiguration()
Returns the TableSetConfiguration for this DatabasePollerConfiguration.

Returns:
the TableSetConfiguration for this DatabasePollerConfiguration.

toString

public java.lang.String toString()
Returns the String representation of this DatabasePollerConfiguration.

Overrides:
toString in class PollerConfiguration
Returns:
the String representation of this DatabasePollerConfiguration.

main

public static void main(java.lang.String[] args)
main() For testing.

Parameters:
args - commandline arguments