public final class GenericJDBCDataModel extends AbstractJDBCDataModel
A generic DataModel
designed for use with other JDBC data sources;
one just specifies all necessary SQL queries to the constructor here. Optionally, the queries can be
specified from a Properties
object, File
, or InputStream
. This class is most
appropriate when other existing implementations of AbstractJDBCDataModel
are not suitable. If you
are using this class to support a major database, consider contributing a specialized implementation of
AbstractJDBCDataModel
to the project for this database.
Modifier and Type | Field and Description |
---|---|
static String |
DATA_SOURCE_KEY |
static String |
GET_ALL_USERS_SQL_KEY |
static String |
GET_ITEMS_SQL_KEY |
static String |
GET_MAX_PREFERENCE_KEY |
static String |
GET_MIN_PREFERENCE_KEY |
static String |
GET_NUM_ITEMS_SQL_KEY |
static String |
GET_NUM_PREFERENCE_FOR_ITEM_KEY |
static String |
GET_NUM_PREFERENCE_FOR_ITEMS_KEY |
static String |
GET_NUM_USERS_SQL_KEY |
static String |
GET_PREFERENCE_SQL_KEY |
static String |
GET_PREFERENCE_TIME_SQL_KEY |
static String |
GET_PREFS_FOR_ITEM_SQL_KEY |
static String |
GET_USER_SQL_KEY |
static String |
GET_USERS_SQL_KEY |
static String |
REMOVE_PREFERENCE_SQL_KEY |
static String |
SET_PREFERENCE_SQL_KEY |
DEFAULT_ITEM_ID_COLUMN, DEFAULT_PREFERENCE_COLUMN, DEFAULT_PREFERENCE_TABLE, DEFAULT_PREFERENCE_TIME_COLUMN, DEFAULT_USER_ID_COLUMN
DEFAULT_DATASOURCE_NAME
Constructor and Description |
---|
GenericJDBCDataModel(File propertiesFile)
|
GenericJDBCDataModel(Properties props)
Specifies all SQL queries in a
Properties object. |
GenericJDBCDataModel(String resourcePath)
|
buildPreference, doGetPreferencesForItem, exportWithIDsOnly, exportWithPrefs, getDataSource, getItemIDColumn, getItemIDs, getItemIDsFromUser, getLongColumn, getMaxPreference, getMinPreference, getNumItems, getNumUsers, getNumUsersWithPreferenceFor, getNumUsersWithPreferenceFor, getPreferenceColumn, getPreferencesForItem, getPreferencesFromUser, getPreferenceTable, getPreferenceTime, getPreferenceValue, getUserIDColumn, getUserIDs, hasPreferenceValues, refresh, removePreference, setLongParameter, setPreference
checkNotNullAndLog, checkNotNullAndLog, getFetchSize, lookupDataSource
public static final String DATA_SOURCE_KEY
public static final String GET_PREFERENCE_SQL_KEY
public static final String GET_PREFERENCE_TIME_SQL_KEY
public static final String GET_USER_SQL_KEY
public static final String GET_ALL_USERS_SQL_KEY
public static final String GET_NUM_USERS_SQL_KEY
public static final String GET_NUM_ITEMS_SQL_KEY
public static final String SET_PREFERENCE_SQL_KEY
public static final String REMOVE_PREFERENCE_SQL_KEY
public static final String GET_USERS_SQL_KEY
public static final String GET_ITEMS_SQL_KEY
public static final String GET_PREFS_FOR_ITEM_SQL_KEY
public static final String GET_NUM_PREFERENCE_FOR_ITEM_KEY
public static final String GET_NUM_PREFERENCE_FOR_ITEMS_KEY
public static final String GET_MAX_PREFERENCE_KEY
public static final String GET_MIN_PREFERENCE_KEY
public GenericJDBCDataModel(Properties props) throws TasteException
Specifies all SQL queries in a Properties
object. See the *_KEY
constants in this
class (e.g. GET_USER_SQL_KEY
) for a list of all keys which must map to a value in this object.
props
- Properties
object containing valuesTasteException
- if anything goes wrong during initializationpublic GenericJDBCDataModel(File propertiesFile) throws TasteException
See GenericJDBCDataModel(Properties)
. This constructor reads values from a file
instead, as if with Properties.load(InputStream)
. So, the file should be in standard Java
properties file format -- containing key=value
pairs, one per line.
propertiesFile
- properties fileTasteException
- if anything goes wrong during initializationpublic GenericJDBCDataModel(String resourcePath) throws TasteException
See GenericJDBCDataModel(Properties)
. This constructor reads values from a resource available in
the classpath, as if with Class.getResourceAsStream(String)
and
Properties.load(InputStream)
. This is useful if your configuration file is, for example, packaged
in a JAR file that is in the classpath.
resourcePath
- path to resource in classpath (e.g. "/com/foo/TasteSQLQueries.properties")TasteException
- if anything goes wrong during initializationCopyright © 2008–2017 The Apache Software Foundation. All rights reserved.