public abstract class AbstractJDBCPropertyIO extends AbstractPropertyIO
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_MAX_VALUE_FIELD_LENGTH |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractJDBCPropertyIO(String tableName,
String nameField,
String valueField,
boolean readonly,
boolean cached)
Constructs a AbstractJDBCPropertyIO
|
| Modifier and Type | Method and Description |
|---|---|
String |
backup()
Returns a string containing all the properties [name=value] in the PropertyIO seperated by a line feed [
|
String |
backupWithUpdate()
A method that generate SQL which updates all known properties with its values.
|
protected void |
close(ResultSet resultSet,
Statement statement,
PreparedStatement preparedStatement,
Connection connection)
Will class the
close method on all the parameters if the are not null. |
abstract Connection |
getConnection()
Gets the connection to the database.
|
int |
getMaxValueFieldLength()
Gets the max number of characters a value may contain.
|
String |
getNameField()
The name of column in table which holds the property
name. |
Properties |
getProperties()
Gets all the name,value pair in a Properties class instance.
|
String |
getTableName()
The table to access.
|
String |
getValue(String propertyName)
Gets the string value of the name.
|
String |
getValueField()
The name of column in table which holds the property
value as string. |
void |
reload()
Reloads the name,value pairs for the PropertyIO, or forces the values to reload when read next time.
|
void |
setMaxValueFieldLength(int maxValueFieldLength)
Sets the max number of characters a value (as a string) may contain, otherwise a PropertyException thrown upon setting the value.
|
void |
setValue(String propertyName,
String value)
Sets the name,value as String in the IO.
|
void |
validate()
Validates the PropertyIO.
|
getCacheTime, getLastLoaded, getLastSaved, getLogger, getTypedProperties, getTypedValue, isCached, isReadonly, logPerformanceGetProperties, logPerformanceSetValue, setCacheTime, storeTypedValue, updateLastLoaded, updateLastSaved, validateWritableclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetName, getSourcepublic static final int DEFAULT_MAX_VALUE_FIELD_LENGTH
protected AbstractJDBCPropertyIO(String tableName, String nameField, String valueField, boolean readonly, boolean cached)
tableName - the name of the table to read and write from.nameField - the name of the table field which hold the properties unique name. Must be of String field type.valueField - the name of the table field which hold the properties value. Must be of String field type.readonly - is the AbstractJDBCPropertyIO be read only.cached - shall the values be cached in the PropertyIO's.public abstract Connection getConnection() throws SQLException
SQLException - if not possible to get a connection.Connectionpublic String getTableName()
public String getNameField()
name.getTableName()public String getValueField()
value as string.getTableName()public int getMaxValueFieldLength()
public void setMaxValueFieldLength(int maxValueFieldLength)
maxValueFieldLength - the max length of a value as a string, if value is less than 1, no check is performed.public String getValue(String propertyName)
PropertyIO${name} in the value, will be passed by the StringUtils.replaceInlinedProperties(String) method, to replace ${name} where name can either be
a System.getProperty(String) or System.getenv(String).getValue in interface PropertyIOgetValue in class AbstractPropertyIOpropertyName - the name of the property.null is returned.StringUtils.replaceInlinedProperties(String),
PropertyFrameworkGlobalspublic void setValue(String propertyName, String value) throws PropertyIOException
PropertyIOpropertyName - the name of the propertyvalue - the string value of the property.PropertyIOException - if the IO is readonly or failed to write the value.public void validate()
throws PropertyIOException
PropertyIOPropertyIOExceptionpublic void reload()
PropertyIOreload in interface PropertyIOreload in class AbstractPropertyIOpublic Properties getProperties()
PropertyIOPropertiesprotected final void close(ResultSet resultSet, Statement statement, PreparedStatement preparedStatement, Connection connection)
close method on all the parameters if the are not null. Exceptions on close is logged as a warning.resultSet - a resultSet.statement - a statement.preparedStatement - a preparementStatement.connection - a connection.public String backup()
PropertyIO\n].
backup in interface PropertyIObackup in class AbstractPropertyIOpublic String backupWithUpdate()