com.flexive.shared.interfaces
Interface GenericConfigurationEngine

All Known Subinterfaces:
ApplicationConfigurationEngine, ApplicationConfigurationEngineLocal, ConfigurationEngine, ConfigurationEngineLocal, CustomDomainConfigurationEngine<T>, DivisionConfigurationEngine, DivisionConfigurationEngineLocal, GlobalConfigurationEngine, GlobalConfigurationEngineLocal, MandatorConfigurationEngine, MandatorConfigurationEngineLocal, NodeConfigurationEngine, NodeConfigurationEngineLocal, UserConfigurationEngine, UserConfigurationEngineLocal

public interface GenericConfigurationEngine

Generic configuration interface. Provides a generic interface for configuration methods based on the Parameter interface.

Author:
Daniel Lichtenberger (daniel.lichtenberger@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
See Also:
GenericConfigurationImpl, Parameter

Method Summary
<T extends java.io.Serializable>
T
get(Parameter<T> parameter)
          Retrieves the value of the given parameter.
<T extends java.io.Serializable>
T
get(Parameter<T> parameter, java.lang.String key)
          Retrieves the value for the given parameter using the given key.
<T extends java.io.Serializable>
T
get(Parameter<T> parameter, java.lang.String key, boolean ignoreDefault)
          Retrieves the value for the given parameter using the given key.
 java.util.Map<ParameterData,java.io.Serializable> getAll()
          Return all parameters that are visible to the current user.
<T extends java.io.Serializable>
java.util.Map<java.lang.String,T>
getAll(Parameter<T> parameter)
          Retrieves all key/value pairs stored under the path of the given parameter.
 java.util.Map<ParameterData,java.io.Serializable> getAllWithXStream(java.util.Map<java.lang.String,com.thoughtworks.xstream.XStream> instances)
          Return all parameters that are visible to the current user using the provided XStream instance for conversions.
<T extends java.io.Serializable>
java.util.Collection<java.lang.String>
getKeys(Parameter<T> parameter)
          Retrieves all keys stored under the path of the given parameter.
<T extends java.io.Serializable>
void
put(Parameter<T> parameter, java.lang.String key, T value)
          Set a parameter containing a value of type T using the given key.
<T extends java.io.Serializable>
void
put(Parameter<T> parameter, T value)
          Set a parameter containing a value of type T.
<T extends java.io.Serializable>
void
remove(Parameter<T> parameter)
          Removes a parameter from the database.
<T extends java.io.Serializable>
void
remove(Parameter<T> parameter, java.lang.String key)
          Removes a parameter from the database using the given key.
<T extends java.io.Serializable>
void
removeAll(Parameter<T> parameter)
          Remove all parameters stored under this parameter's path.
<T extends java.io.Serializable>
Pair<java.lang.Boolean,T>
tryGet(Parameter<T> parameter, java.lang.String key, boolean ignoreDefault)
          Try to fetch the given parameter.
 

Method Detail

put

<T extends java.io.Serializable> void put(Parameter<T> parameter,
                                          T value)
         throws FxApplicationException
Set a parameter containing a value of type T.

Type Parameters:
T - value type to be set (e.g. String, Integer, ...)
Parameters:
parameter - parameter data containing path and key
value - value to be set
Throws:
FxApplicationException - TODO
FxUpdateException - if the value could not be set or updated
FxNoAccessException - if the caller is not allowed to update/set this parameter

put

<T extends java.io.Serializable> void put(Parameter<T> parameter,
                                          java.lang.String key,
                                          T value)
         throws FxApplicationException
Set a parameter containing a value of type T using the given key. This method is useful for setting aggregate parameters with varying keys. Use getAll(com.flexive.shared.configuration.Parameter) to retrieve a map with all keys stored under the path of the given parameter.

Type Parameters:
T - value type to be set
Parameters:
parameter - parameter data containing the path
key - key to be used for this value
value - value to be set
Throws:
FxApplicationException - TODO
FxUpdateException - if the value could not be updated
FxNoAccessException - if the caller is not allowed to update/set this parameter

get

<T extends java.io.Serializable> T get(Parameter<T> parameter)
                                   throws FxApplicationException
Retrieves the value of the given parameter.

Type Parameters:
T - value type of the parameter
Parameters:
parameter - parameter data containing the path and key
Returns:
the value stored under the given path and key
Throws:
FxApplicationException - TODO
FxLoadException - if the value could not be loaded
FxNotFoundException - if the parameter is not set

get

<T extends java.io.Serializable> T get(Parameter<T> parameter,
                                       java.lang.String key)
                                   throws FxApplicationException
Retrieves the value for the given parameter using the given key. This method is useful for getting a single value of aggregate parameters. When all values for an aggregate parameter should be retrieved, use getAll(com.flexive.shared.configuration.Parameter) instead.

Type Parameters:
T - value type of the parameter
Parameters:
parameter - parameter data containing the path
key - key to be used
Returns:
the value stored under the given path and key
Throws:
FxApplicationException - TODO
FxLoadException - if the value could not be loaded
FxNotFoundException - if the parameter is not set

get

<T extends java.io.Serializable> T get(Parameter<T> parameter,
                                       java.lang.String key,
                                       boolean ignoreDefault)
                                   throws FxApplicationException
Retrieves the value for the given parameter using the given key. This method is useful for getting a single value of aggregate parameters. When all values for an aggregate parameter should be retrieved, use getAll(com.flexive.shared.configuration.Parameter) instead. The default value may be disabled through the ignoreDefault parameter, making this method more useful for checking if a parameter exists.

Type Parameters:
T - value type of the parameter
Parameters:
parameter - parameter data containing the path
key - key to be used
ignoreDefault - if the parameter's default value should be used default
Returns:
the value stored under the given path and key
Throws:
FxApplicationException - TODO
FxLoadException - if the value could not be loaded
FxNotFoundException - if the parameter is not set

tryGet

<T extends java.io.Serializable> Pair<java.lang.Boolean,T> tryGet(Parameter<T> parameter,
                                                                  java.lang.String key,
                                                                  boolean ignoreDefault)
Try to fetch the given parameter. Returns (true, [value]) when the parameter was found (value can be null), (false, null) otherwise.

This is mainly a performance optimization for ConfigurationEngine to avoid throwing (possibly expensive) application exceptions from EJB calls.

Parameters:
parameter - the parameter
ignoreDefault -
Returns:
true if the configuration contains a value for the given parameter.
Since:
3.1

getAll

java.util.Map<ParameterData,java.io.Serializable> getAll()
                                                         throws FxApplicationException
Return all parameters that are visible to the current user.

Returns:
all parameters that are visible to the current user.
Throws:
FxApplicationException

getAllWithXStream

java.util.Map<ParameterData,java.io.Serializable> getAllWithXStream(java.util.Map<java.lang.String,com.thoughtworks.xstream.XStream> instances)
                                                                    throws FxApplicationException
Return all parameters that are visible to the current user using the provided XStream instance for conversions.

Parameters:
instances - XStream instances per class name to use for conversions (when none is defined, the default XStream instance is used). A wildcard parameter can be used for prefix matches (e.g. "my.config.*")
Returns:
all parameters that are visible to the current user.
Throws:
FxApplicationException
Since:
3.2.0

getAll

<T extends java.io.Serializable> java.util.Map<java.lang.String,T> getAll(Parameter<T> parameter)
                                                                      throws FxApplicationException
Retrieves all key/value pairs stored under the path of the given parameter.

Note: the values stored under the parameter's path must be of the same type, i.e. they must be of type T.

Type Parameters:
T - value type of the parameter
Parameters:
parameter - parameter data containing the path
Returns:
all key/value-pairs under the given path
Throws:
FxApplicationException - TODO
FxLoadException - when an error occured reading the keys

getKeys

<T extends java.io.Serializable> java.util.Collection<java.lang.String> getKeys(Parameter<T> parameter)
                                               throws FxApplicationException
Retrieves all keys stored under the path of the given parameter.

Note: the values stored under the parameter's path must be of the same type, i.e. they must be of type T.

Type Parameters:
T - value type of the parameter
Parameters:
parameter - parameter containing the path
Returns:
all keys stored under the path of the given parameter.
Throws:
FxApplicationException - TODO

remove

<T extends java.io.Serializable> void remove(Parameter<T> parameter)
            throws FxApplicationException
Removes a parameter from the database.

Type Parameters:
T - value type of the parameter
Parameters:
parameter - parameter to be removed
Throws:
FxApplicationException - TODO
FxRemoveException - if the parameter could not be removed
FxNoAccessException - if the caller is not allowed to remove this parameter

remove

<T extends java.io.Serializable> void remove(Parameter<T> parameter,
                                             java.lang.String key)
            throws FxApplicationException
Removes a parameter from the database using the given key.

Type Parameters:
T - value type of the parameter
Parameters:
parameter - parameter containing the path to be removed
key - the key to be removed
Throws:
FxApplicationException - TODO
FxRemoveException - if the parameter could not be removed
FxNoAccessException - if the caller is not allowed to remove this parameter

removeAll

<T extends java.io.Serializable> void removeAll(Parameter<T> parameter)
               throws FxApplicationException
Remove all parameters stored under this parameter's path.

Type Parameters:
T - value type of the parameter
Parameters:
parameter - the parameter to be removed
Throws:
FxApplicationException - TODO
FxRemoveException - if the parameters could not be removed
FxNoAccessException - if the caller is not allowed to remove this parameter