|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.netflix.config.sources.JDBCConfigurationSource
public class JDBCConfigurationSource
Simple JDBC source of config properties. Assuming you have a table with a column that stores the keys and a column to store values, this class can be used as your source of polled configuration.
Constructor Summary | |
---|---|
JDBCConfigurationSource(javax.sql.DataSource datasource,
java.lang.String query,
java.lang.String keyColumnName,
java.lang.String valueColumnName)
Constructor |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
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
Method Detail |
---|
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 used
java.sql.SQLException
- if an error occurs
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |