Package de.businesscode.util
Class JNDIProvider
- java.lang.Object
-
- de.businesscode.util.JNDIProvider
-
- All Implemented Interfaces:
ConfigurationProvider
- Direct Known Subclasses:
BareConfiguration
public class JNDIProvider extends java.lang.Object implements ConfigurationProvider
Provider class for JNDI access easing. Per default goes to JNDI environment but LocalConfiguration will get its values from a properties file
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.String,java.lang.Object>
configurationParameters
protected org.apache.logging.log4j.Logger
log
-
Constructor Summary
Constructors Constructor Description JNDIProvider()
initializes JNDI context java:comp/env, implements caching of parameters, usepurgeCache()
to clear cache
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.Object
getConfigurationParameter(java.lang.String id)
retrieve a (mandatory) parameter or throw exception, also seeConfigurationProvider.getConfigurationParameterOrNull(String)
<T> T
getConfigurationParameter(java.lang.String id, T defaultValue)
getter for configuration parameter including downcastjava.lang.Object
getConfigurationParameterOrNull(java.lang.String id)
retrieve parameterstatic JNDIProvider
getInstance()
Deprecated.will be removed after BCD-UI 4.5static JNDIProvider
getLocalInstance(java.lang.String propsFile)
Deprecated.will be removed after BCD-UI 4.5protected void
init()
void
purgeCache()
purges cache ATTENTION this method also deletes parameters previously added viaputConfigurationParameter(String, Object)
java.lang.Object
putConfigurationParameter(java.lang.String id, java.lang.Object value)
stores and object at given id in the properties.
-
-
-
Constructor Detail
-
JNDIProvider
public JNDIProvider()
initializes JNDI context java:comp/env, implements caching of parameters, usepurgeCache()
to clear cache
-
-
Method Detail
-
getInstance
@Deprecated public static JNDIProvider getInstance()
Deprecated.will be removed after BCD-UI 4.5- Returns:
-
getLocalInstance
@Deprecated public static JNDIProvider getLocalInstance(java.lang.String propsFile)
Deprecated.will be removed after BCD-UI 4.5- Parameters:
propsFile
-- Returns:
-
purgeCache
public void purgeCache()
purges cache ATTENTION this method also deletes parameters previously added viaputConfigurationParameter(String, Object)
-
init
protected void init() throws java.lang.RuntimeException
- Throws:
java.lang.RuntimeException
-
getConfigurationParameter
public <T> T getConfigurationParameter(java.lang.String id, T defaultValue)
Description copied from interface:ConfigurationProvider
getter for configuration parameter including downcast- Specified by:
getConfigurationParameter
in interfaceConfigurationProvider
- Returns:
- configuration parameter instance or defaultValue
-
getConfigurationParameterOrNull
public java.lang.Object getConfigurationParameterOrNull(java.lang.String id)
Description copied from interface:ConfigurationProvider
retrieve parameter- Specified by:
getConfigurationParameterOrNull
in interfaceConfigurationProvider
- Returns:
- configuration parameter instance or NULL
-
getConfigurationParameter
public java.lang.Object getConfigurationParameter(java.lang.String id)
Description copied from interface:ConfigurationProvider
retrieve a (mandatory) parameter or throw exception, also seeConfigurationProvider.getConfigurationParameterOrNull(String)
- Specified by:
getConfigurationParameter
in interfaceConfigurationProvider
- Returns:
- configuration parameter instance
-
putConfigurationParameter
public java.lang.Object putConfigurationParameter(java.lang.String id, java.lang.Object value)
stores and object at given id in the properties. Does overwrite the old reference in case one existed. ATTENTION: this is NOT persistent, the configuration parameters are reset during reload of a context / application.- Parameters:
id
-value
-- Returns:
- an object previously set at given id or NULL in case the id has never been used before
-
-