Class JdbcPlainUserPreferencesStorage

java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.plugins.core.impl.userpref.JdbcPlainUserPreferencesStorage
All Implemented Interfaces:
UserPreferencesStorage, Configurable, LogEnabled, ThreadSafe

This class is a JDBC implementation of UserPreferencesStorage, which stores preferences in database, one preference by column.
Currently, it only supports storing in string-typed columns (VARCHAR, TEXT, ...), but allows all preference types by casting them from/to strings when retrieving/getting them.
This component does not impose a table structure. This is a configuration example:
 <component role="com.mydomain.test.MyDatabaseUserPreferencesStorage"
class="org.ametys.plugins.core.userpref.JdbcPlainUserPreferencesStorage">
<pool>com.mydomain.test.MyPool</pool>
<table>MyUserPreferences</table>
<loginColumn>user</loginColumn>
<contextColumn>context</contextColumn>
<columnPattern>^(mypref_\w+)$</columnPattern>
<mappings>
<mapping prefId="lastname" column="mypref_lastname"/>
<mapping prefId="firstname" column="mypref_firstname"/>
<mapping prefId="email" column="mypref_email_address"/>
</mappings>
</component>

Column names must be configured lowercase, both when setting login and context columns and when setting mapping columns.

This class differs from JdbcXmlUserPreferencesStorage as it does not implement DefaultUserPreferencesStorage, and because the latter imposes the DB table structure and stores the preferences as an XML binary.