@Internal public class JiraPropertiesImpl extends Object implements JiraProperties
Non-null values are cached. If you need the latest value of the system property, call refresh()
before
you access that property. If you are changing a system property wish the changed value to be seen by this class
immediately you need to call setProperty(String, Object)
or setProperties(java.util.Properties)
method of this class. Doing this often is a potential performance problem, as Boolean.getBoolean(String a)
is a blocking operation, so you should NOT do this for every SQL statement or Web request etc.
SecurityException
s and returns null or default values provided.
However, this class will not catch such exceptions when setting system properties.Constructor and Description |
---|
JiraPropertiesImpl(PropertiesAccessor propertiesAccessor) |
Modifier and Type | Method and Description |
---|---|
Boolean |
getBoolean(String key)
Returns a cached system property as a Boolean.
|
String |
getCustomDirectoryPlugins() |
Integer |
getInteger(String key)
Returns a cached system property as an Integer.
|
Integer |
getInteger(String key,
Integer defaultInteger)
Returns a cached system property as an Integer, or a default value if property is not set.
|
Long |
getLong(String key)
Returns a cached system property as a Long.
|
Long |
getLong(String key,
Long defaultLong)
Returns a cached system property as a Long, or a default value if property is not set.
|
String |
getPluginsRosterFile() |
Properties |
getProperties()
Returns a snapshot of all the set system properties.
|
String |
getProperty(String key)
Returns a cached system property as a String.
|
String |
getProperty(String key,
String defaultString)
Returns a cached system property as a String, or a default value if property is not set.
|
Map<String,String> |
getSanitisedProperties()
Return a copy of the current properties with sensitive properties sanitised.
|
boolean |
isBundledPluginsDisabled() |
boolean |
isCustomPathPluginsEnabled() |
boolean |
isDarkFeaturesDisabled() |
boolean |
isDecodeMailParameters() |
boolean |
isDevMode() |
boolean |
isI18nReloadBundles() |
boolean |
isPluginsRosterFileEnabled() |
boolean |
isResourceBundleCacheCleaningDisabled() |
boolean |
isSuperBatchingDisabled() |
boolean |
isWebSudoDisabled() |
boolean |
isXsrfDetectionCheckRequired() |
boolean |
isXsrfDiagnostics() |
void |
refresh()
Causes any previously cached values to be invalidated.
|
void |
setProperties(Properties props)
Sets the system properties and invalidates the accessor accordingly.
|
<T> void |
setProperty(String key,
T value)
Sets a system property and invalidates the accessor accordingly, or unsets the property if value is null.
|
boolean |
showPerformanceMonitor() |
void |
unsetProperty(String key)
Unsets a system property and invalidates the accessor accordingly.
|
public JiraPropertiesImpl(PropertiesAccessor propertiesAccessor)
public String getProperty(String key)
This call will not raise SecurityException
, it will return null instead.
getProperty
in interface JiraProperties
key
- the name of the system property.SecurityException
occurs.public String getProperty(String key, String defaultString)
Note that if the property is not set, the accessor will remain unchanged.
This call will not raise SecurityException
, it will return defaultString instead.
getProperty
in interface JiraProperties
key
- the name of the system property.defaultString
- default valueSecurityException
occurs.public <T> void setProperty(String key, T value)
Object.toString()
called on the value.setProperty
in interface JiraProperties
key
- the name of the system property.value
- the valuepublic void unsetProperty(String key)
unsetProperty
in interface JiraProperties
key
- the name of the system property.public Boolean getBoolean(String key)
This call will not raise SecurityException
, it will return false instead.
Because of the way system properties are read by the Boolean class, this method will never return null,
nor it is possible to provide a variant with the default value. See Boolean.getBoolean(String)
.
You can however use getProperty(String)
and convert it to Boolean manually for that desired effect.
getBoolean
in interface JiraProperties
key
- the name of the system property.SecurityException
occurs.public Integer getInteger(String key)
This call will not raise SecurityException
, it will return null instead.
getInteger
in interface JiraProperties
key
- the name of the system property.SecurityException
occurs.public Integer getInteger(String key, Integer defaultInteger)
Note that if the property is not set, the accessor will remain unchanged.
This call will not raise SecurityException
, it will return defaultInteger instead.
getInteger
in interface JiraProperties
key
- the name of the system property.defaultInteger
- default valueSecurityException
occurs.public Long getLong(String key)
This call will not raise SecurityException
, it will return null instead.
getLong
in interface JiraProperties
key
- the name of the system property.SecurityException
occurs.public Long getLong(String key, Long defaultLong)
Note that if the property is not set, the accessor will remain unchanged.
This call will not raise SecurityException
, it will return defaultLong instead.
getLong
in interface JiraProperties
key
- the name of the system property.defaultLong
- default valueSecurityException
occurs.public Properties getProperties()
This call will not raise SecurityException
, it will return an empty set of properties instead.
getProperties
in interface JiraProperties
public Map<String,String> getSanitisedProperties()
JiraProperties
getSanitisedProperties
in interface JiraProperties
public void setProperties(Properties props)
setProperties
in interface JiraProperties
props
- the properties to set.System#setProperties(Properties)}
public void refresh()
JiraProperties
JiraProperties.setProperty(String, Object)
, JiraProperties.setProperties(java.util.Properties)
or
JiraProperties.unsetProperty(String)
.refresh
in interface JiraProperties
public boolean isDevMode()
isDevMode
in interface JiraProperties
public boolean isXsrfDetectionCheckRequired()
isXsrfDetectionCheckRequired
in interface JiraProperties
public boolean isSuperBatchingDisabled()
isSuperBatchingDisabled
in interface JiraProperties
public boolean isDecodeMailParameters()
isDecodeMailParameters
in interface JiraProperties
public boolean isCustomPathPluginsEnabled()
isCustomPathPluginsEnabled
in interface JiraProperties
public String getCustomDirectoryPlugins()
getCustomDirectoryPlugins
in interface JiraProperties
public boolean isPluginsRosterFileEnabled()
isPluginsRosterFileEnabled
in interface JiraProperties
public String getPluginsRosterFile()
getPluginsRosterFile
in interface JiraProperties
public boolean isWebSudoDisabled()
isWebSudoDisabled
in interface JiraProperties
public boolean isI18nReloadBundles()
isI18nReloadBundles
in interface JiraProperties
public boolean showPerformanceMonitor()
showPerformanceMonitor
in interface JiraProperties
public boolean isBundledPluginsDisabled()
isBundledPluginsDisabled
in interface JiraProperties
public boolean isDarkFeaturesDisabled()
isDarkFeaturesDisabled
in interface JiraProperties
public boolean isXsrfDiagnostics()
isXsrfDiagnostics
in interface JiraProperties
public boolean isResourceBundleCacheCleaningDisabled()
isResourceBundleCacheCleaningDisabled
in interface JiraProperties
Copyright © 2002-2016 Atlassian. All Rights Reserved.