public class JDBCConfigurationSource extends java.lang.Object implements PolledConfigurationSource
Constructor and Description |
---|
JDBCConfigurationSource(javax.sql.DataSource datasource,
java.lang.String query,
java.lang.String keyColumnName,
java.lang.String valueColumnName)
Constructor
|
Modifier and Type | Method and Description |
---|---|
protected java.sql.Connection |
getConnection()
Returns a
Connection object. |
javax.sql.DataSource |
getDatasource()
Returns the used
DataSource object. |
PollResult |
poll(boolean initial,
java.lang.Object checkPoint)
Poll the configuration source to get the latest content.
|
public JDBCConfigurationSource(javax.sql.DataSource datasource, java.lang.String query, java.lang.String keyColumnName, java.lang.String valueColumnName)
datasource
- The DataSource object for the JDBC; e.g.
new OracleDataSource(databaseName, schema);
query
- The query statement to fetch the properties; e.g.
"Select distinct property_key, property_value from SITE_PROPERTIES"
keyColumnName
- The column name which stores the property keys; e.g.
property_key
valueColumnName
- The column name which stores the property values; e.g.
property_value
public PollResult poll(boolean initial, java.lang.Object checkPoint) throws java.lang.Exception
PolledConfigurationSource
poll
in interface PolledConfigurationSource
initial
- true if this operation is the first poll.checkPoint
- Object that is used to determine the starting point if the result returned is incremental.
Null if there is no check point or the caller wishes to get the full content.java.lang.Exception
- If any exception occurs when fetching the configurations.public javax.sql.DataSource getDatasource()
DataSource
object.protected java.sql.Connection getConnection() throws java.sql.SQLException
Connection
object. This method is called when ever
the database is to be accessed. This implementation returns a connection
from the current DataSource
.Connection
object to be usedjava.sql.SQLException
- if an error occurs