| java.lang.Object com.flexive.core.configuration.GenericConfigurationImpl
All known Subclasses: com.flexive.ejb.beans.configuration.GlobalConfigurationEngineBean, com.flexive.ejb.beans.configuration.DivisionConfigurationEngineBean, com.flexive.ejb.beans.configuration.UserConfigurationEngineBean,
GenericConfigurationImpl | abstract public class GenericConfigurationImpl implements GenericConfigurationEngine(Code) | | Abstract base class for configuration methods. Implements templated getter/setter
methods for configuration classes that may add custom behavior like caching.
An implementor must create SQL statements for reading, updating and deleting
parameters, and a method for obtaining a database connection for the
configuration table.
The setParameter/getParameter methods may be overridden
to implement custom behavior, e.g. caching of parameter values. Some
set- and get-methods are declared final because they are wrappers
for the (non-final) main set/get method.
author: Daniel Lichtenberger (daniel.lichtenberger@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at) |
Inner Class :protected static class UnsetParameter implements Serializable | |
Inner Class :protected static class NullParameter implements Serializable | |
Method Summary | |
protected void | deleteCache(String path, String key) | protected void | deleteCache(String path) | final public T | get(Parameter<T> parameter) | final public T | get(Parameter<T> parameter, String key) | final public T | get(Parameter<T> parameter, String key, boolean ignoreDefault) | final public Map<String, T> | getAll(Parameter<T> parameter) | protected Serializable | getCache(String path, String key) | protected String | getCachePath(String path) Return the cache path for the given configuration parameter path.
If this method returns null (like the default implementation), caching
is disabled. | abstract protected Connection | getConnection() Return a (new or existing) Connection to the configuration table. | abstract protected PreparedStatement | getDeleteStatement(Connection conn, String path, String key) Return a delete statement to delete the given parameter.
Parameters: conn - the current connection Parameters: path - path of the row to be deleted Parameters: key - key of the row to be deleted. | abstract protected PreparedStatement | getInsertStatement(Connection conn, String path, String key, String value) Return an insert statement that inserts a new row for the given
path, key and value. | final public Collection<String> | getKeys(Parameter<T> parameter) | protected Object | getParameter(Parameter<T> parameter, String path, String key) Get a configuration parameter identified by a path and a key. | abstract protected PreparedStatement | getSelectStatement(Connection conn, String path, String key) Return a select statement that selects the given path and key
and returns the stored value. | abstract protected PreparedStatement | getSelectStatement(Connection conn, String path) Return a select statement that selects all keys and values for the given path. | abstract protected PreparedStatement | getUpdateStatement(Connection conn, String path, String key, String value) Return an update statement that updates the value for the given
path/key combination. | protected T | loadParameterFromDb(Parameter<T> parameter) Loads the given parameter from the database. | protected Serializable | loadParameterFromDb(String path, String key) Loads the given parameter from the database. | protected void | logCacheHit(String path, String key) Wrapper for simple cache stats. | protected void | logCacheMiss(String path, String key) Wrapper for simple cache stats. | public void | put(Parameter<T> parameter, String key, T value) | final public void | put(Parameter<T> parameter, T value) | protected void | putCache(String path, String key, Serializable value) Store the given value in the cache. | public void | remove(Parameter<T> parameter, String key) | final public void | remove(Parameter<T> parameter) | final public void | removeAll(Parameter<T> parameter) |
deleteCache | protected void deleteCache(String path, String key)(Code) | | Delete the given parameter from the cache
Parameters: path - path of the parameter to be removed Parameters: key - key of the parameter to be removed |
deleteCache | protected void deleteCache(String path)(Code) | | Delete the given path from the cache
Parameters: path - the path to be removed |
getCache | protected Serializable getCache(String path, String key) throws FxCacheException(Code) | | Returns the cached value of the given parameter
Parameters: path - the parameter path Parameters: key - the parameter key the cached value of the given parameter throws: FxCacheException - if a cache exception occured |
getCachePath | protected String getCachePath(String path)(Code) | | Return the cache path for the given configuration parameter path.
If this method returns null (like the default implementation), caching
is disabled. Be aware that you have to add the context to your cache path,
e.g. the user ID for user settings.
Parameters: path - the parameter path to be mapped the mapped parameter path, or null to disable caching |
getConnection | abstract protected Connection getConnection() throws SQLException(Code) | | Return a (new or existing) Connection to the configuration table.
throws: SQLException - if the connection could not be retrieved a Connection to the configuration table. |
getDeleteStatement | abstract protected PreparedStatement getDeleteStatement(Connection conn, String path, String key) throws SQLException, FxNoAccessException(Code) | | Return a delete statement to delete the given parameter.
Parameters: conn - the current connection Parameters: path - path of the row to be deleted Parameters: key - key of the row to be deleted. If null, all keys under the given path should be deleted. a PreparedStatement for deleting the given path/key throws: SQLException - if a database error occurs throws: FxNoAccessException - if the caller is not permitted to delete the given parameter |
getInsertStatement | abstract protected PreparedStatement getInsertStatement(Connection conn, String path, String key, String value) throws SQLException, FxNoAccessException(Code) | | Return an insert statement that inserts a new row for the given
path, key and value.
Parameters: conn - the current connection Parameters: path - path of the new row Parameters: key - key of the new row Parameters: value - value of the new row throws: SQLException - if a database error occurs throws: FxNoAccessException - if the caller is not permitted to create the given parameter a PreparedStatement for inserting the given path/key/value |
getSelectStatement | abstract protected PreparedStatement getSelectStatement(Connection conn, String path, String key) throws SQLException(Code) | | Return a select statement that selects the given path and key
and returns the stored value.
Required SELECT arguments:
- value
Parameters: conn - the current connection Parameters: path - the requested path Parameters: key - the requested key throws: SQLException - if a database error occurs a PreparedStatement selecting the value for the given path/key combination |
getSelectStatement | abstract protected PreparedStatement getSelectStatement(Connection conn, String path) throws SQLException(Code) | | Return a select statement that selects all keys and values for the given path.
Required SELECT arguments:
- key
- value
Parameters: conn - the current connection Parameters: path - the requested path throws: SQLException - if a database error occurs a PreparedStatement selecting all keys and values for the given path |
getUpdateStatement | abstract protected PreparedStatement getUpdateStatement(Connection conn, String path, String key, String value) throws SQLException, FxNoAccessException(Code) | | Return an update statement that updates the value for the given
path/key combination.
Parameters: conn - the current connection Parameters: path - path of the parameter Parameters: key - key to be updated Parameters: value - the new value to be stored throws: SQLException - if a database error occurs throws: FxNoAccessException - if the caller is not permitted to update the given parameter a PreparedStatement updating the given row |
loadParameterFromDb | protected T loadParameterFromDb(Parameter<T> parameter) throws FxNotFoundException, FxLoadException(Code) | | Loads the given parameter from the database. Helper method for implementors.
Parameters: parameter - the parameter to be loaded< Parameters: T - > value type of the parameter the parameter value throws: FxNotFoundException - if the parameter does not exist throws: FxLoadException - if the parameter could not be loaded |
logCacheHit | protected void logCacheHit(String path, String key)(Code) | | Wrapper for simple cache stats. May be used as hook
for adding cache logging or as an aspectj pointcut.
Parameters: path - the parameter path that caused the cache hit Parameters: key - the parameter key that caused the cache hit |
logCacheMiss | protected void logCacheMiss(String path, String key)(Code) | | Wrapper for simple cache stats. May be used as hook
for adding cache logging or as an aspectj pointcut.
Parameters: path - the parameter path that caused the cache hit Parameters: key - the parameter key that caused the cache hit |
putCache | protected void putCache(String path, String key, Serializable value)(Code) | | Store the given value in the cache.
Parameters: path - the parameter path Parameters: key - the parameter key Parameters: value - the serializable value to be stored |
|
|