|
QJCC homepage | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object biz.chitec.quarterback.util.PropertiesStorer
Static helper class to store a Properties object into a database. For this to work, a table has to be defined:
create table propertiestable ( name varchar(40) not null default '', thekey varchar(255) not null default '', thevalue mediumtext not null default '', unique (name,thekey) );Property tables' names have to be defines uniquely, of course. Storing is done in a way that the least possible information is lost in case of an intermediate crash.
Constructor Summary | |
private |
PropertiesStorer()
This is a fully static class |
Method Summary | |
static void |
dropProperties(java.sql.Statement dbstmt,
java.lang.String propertiesname)
Drops a properties object finally from the database. |
static java.lang.String |
getProperty(java.sql.Statement dbstmt,
java.lang.String propertiesname,
java.lang.String key,
java.lang.String defaultvalue)
Get a single property from the database. |
static java.util.Properties |
loadProperties(java.sql.Statement dbstmt,
java.lang.String propertiesname,
java.util.Properties defaults)
Loads a properties object from the database. |
static void |
storeProperties(java.sql.Statement dbstmt,
java.lang.String propertiesname,
java.util.Set allowedkeys,
java.util.Properties props)
Stores a properties object into the database. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
private PropertiesStorer()
Method Detail |
public static void storeProperties(java.sql.Statement dbstmt, java.lang.String propertiesname, java.util.Set allowedkeys, java.util.Properties props) throws java.sql.SQLException
The method locks the entries for this properties object as long as it stores them. For this, it uses the RowLock mechanism.
dbstmt
- Statement to work onpropertiesname
- Name of the properties objectallowedkeys
- Complete set of keys which are changeable, null if irrelevantprops
- The properties to store
java.sql.SQLException
- If something goes wrong in the databasepublic static java.util.Properties loadProperties(java.sql.Statement dbstmt, java.lang.String propertiesname, java.util.Properties defaults) throws java.sql.SQLException
dbstmt
- Statement to work onpropertiesname
- Name of the properties table to loaddefaults
- Default (or "parent") properties for the properties to build, null if none exist
java.sql.SQLException
public static java.lang.String getProperty(java.sql.Statement dbstmt, java.lang.String propertiesname, java.lang.String key, java.lang.String defaultvalue) throws java.sql.SQLException
loadProperties(Statement, String, Properties)
.
dbstmt
- Statement to work on the database withpropertiesname
- Name of the bundlekey
- The needed value's key.defaultvalue
- The default value to return if nothing is stored in the database
java.sql.SQLException
- If something goes wrong with the databasepublic static void dropProperties(java.sql.Statement dbstmt, java.lang.String propertiesname) throws java.sql.SQLException
dbstmt
- Statement to work onpropertiesname
- Name of the properties table to drop
java.sql.SQLException
|
QJCC homepage | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |