public class CacheConfigPropertyManager extends ConfigPropertyManager
CacheConfigPropertyManager configMgr = CacheConfigPropertyManager.getCacheConfigPropertyManager();
String propertyName="oracle.adf.share.props.MyTestPropName1";
String propertyValue = configMgr.getProperty(propertyName); // propertyValue = oracle.adfinternal.share.props.MyTestPropValue1
String booleanPropName= oracle.java.lang.Boolean.PropName.true";" +
Boolean booleanPropVal= configMgr.getBooleanProperty(booleanPropName); // booleanPropVal = Boolean "true"
Here is how property value for a given key is obtained
(1) For any key, that is not registered in adf-settings.xml or if the key does not start with "oracle." or if it is more than 76 characters, null value is returned.
(2) The call is delegated to the registered value-provider class. If value-provider returns a non null value, it is returned as the property value.
(3) If (2) returns null, then the framework returns the value as specified in the adf-settings.xml file.
Note that the property values for all keys as returned by the registered value-provider class are cached during application initialization into ADF Application scope.
So only the cached values are returned by the framework even if the the registered value-provider returns a different value.
Following are additional considertations:
(1) These properties are immutable except for writing tests. See oracle.adf.share.props.CacheConfigPropertyManagerTester for API's for changing property values
(2) The multi-threaded behavior of this class is tied to the oracle.adf.share.ADFContext application scope as the scope of the instance of this class and corresponding properties is same as
oracle.adf.share.ADFContext#getApplicationScope
(3) Using this class requires intitalization of oracle.adf.share.ADFContext. This happens after ADFBindingFilter has already executed in an ADF web request. For non web requests, ADFContext must be explicityly initialized.
(4) The properties are not currently partitioned by tenant
(5) The framework does support notifications for property changes for testing onlyDEF_CONF_PROP_MGR
Constructor and Description |
---|
CacheConfigPropertyManager() |
Modifier and Type | Method and Description |
---|---|
protected void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list.
|
static CacheConfigPropertyManager |
createCacheConfigPropertyManager()
Creates a new instance of this class
|
static CacheConfigPropertyManager |
createCacheConfigPropertyManager(ScopeMaps scmps)
Creates a new instance of this class
|
java.lang.Boolean |
getBooleanProperty(java.lang.String key)
returns the property value for the specified key.
|
static CacheConfigPropertyManager |
getCacheConfigPropertyManager()
Create CacheConfigPropertyManager instance and stores it in adf context application scope.
|
static CacheConfigPropertyManager |
getCacheConfigPropertyManager(ScopeMaps scMaps)
Create CacheConfigPropertyManager instance and stores it in adf context application scope.
|
java.lang.Integer |
getIntegerProperty(java.lang.String key)
returns the property value for the specified key.
|
java.lang.String |
getProperty(java.lang.String name)
returns the property value for the specified key.
|
protected boolean |
logCheckAndUpdate(ADFLogger log,
java.lang.String key,
int max) |
protected void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove a PropertyChangeListener from the listener list.
|
protected boolean |
setProperty(java.lang.String key,
java.lang.Object value)
sets the specified property value.
|
protected void |
setPropertyLocal(java.lang.String key,
java.lang.Object value,
java.lang.String scope) |
protected void |
setProvider(ConfigPropertyProvider prov) |
getConfigPropertyManager, getDefaultConfigPropertyProviderImpl, getPropDump, getPropertyInternal, getPropKeys, getPropMetadata
public static CacheConfigPropertyManager createCacheConfigPropertyManager()
public static CacheConfigPropertyManager createCacheConfigPropertyManager(ScopeMaps scmps)
scmps
- the scope map instancepublic static CacheConfigPropertyManager getCacheConfigPropertyManager()
public static CacheConfigPropertyManager getCacheConfigPropertyManager(ScopeMaps scMaps)
scMaps
- the scope map instancepublic java.lang.String getProperty(java.lang.String name)
CacheConfigPropertyManager
getProperty
in class ConfigPropertyManager
name
- the name of the propertypublic java.lang.Integer getIntegerProperty(java.lang.String key)
CacheConfigPropertyManager
the string value of the property is converted to Integer. For conversion Integer.valueOf(java.lang.String, int)
operation is used.
The converted value is cached so only the first call to this API takes the type conversion hit
An ADFShareException is thrown if the conversion fails.key
- the name of the propertyADFShareException
- if the type conversion failspublic java.lang.Boolean getBooleanProperty(java.lang.String key)
CacheConfigPropertyManager
the string value of the property is converted to Boolean. For conversion Boolean.valueOf(boolean)
operation is used.
The converted value is cached so only the first call to this API takes the type conversion hit
An ADFShareException is thrown if the conversion fails.key
- the name of the propertyADFShareException
- if the type conversion failsprotected void setPropertyLocal(java.lang.String key, java.lang.Object value, java.lang.String scope)
protected boolean setProperty(java.lang.String key, java.lang.Object value)
ConfigPropertyManager
setProperty
in class ConfigPropertyManager
key
- the property keyvalue
- value of the property to be set.protected void setProvider(ConfigPropertyProvider prov)
setProvider
in class ConfigPropertyManager
protected boolean logCheckAndUpdate(ADFLogger log, java.lang.String key, int max)
protected void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
is null, no exception is thrown and no action
is taken.addPropertyChangeListener
in class ConfigPropertyManager
listener
- The PropertyChangeListener to be addedprotected void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
was added more than once to the same event
source, it will be notified one less time after being removed.
If listener
is null, or was never added, no exception is
thrown and no action is taken.removePropertyChangeListener
in class ConfigPropertyManager
listener
- The PropertyChangeListener to be removed