Class JiraPropertiesImpl
- All Implemented Interfaces:
JiraProperties
- Direct Known Subclasses:
MockJiraProperties
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.- Since:
- v6.1
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetBoolean
(String key) Returns a cached system property as a Boolean.getInteger
(String key) Returns a cached system property as an Integer.getInteger
(String key, Integer defaultInteger) Returns a cached system property as an Integer, or a default value if property is not set.Returns a cached system property as a Long.Returns a cached system property as a Long, or a default value if property is not set.Returns a snapshot of all the set system properties.getProperty
(String key) Returns a cached system property as a String.getProperty
(String key, String defaultString) Returns a cached system property as a String, or a default value if property is not set.Return a copy of the current properties with sensitive properties sanitised.boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
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
void
unsetProperty
(String key) Unsets a system property and invalidates the accessor accordingly.
-
Constructor Details
-
JiraPropertiesImpl
-
-
Method Details
-
getProperty
Returns a cached system property as a String.This call will not raise
SecurityException
, it will return null instead.- Specified by:
getProperty
in interfaceJiraProperties
- Parameters:
key
- the name of the system property.- Returns:
- the value of the system property, or null if property is not set or
SecurityException
occurs.
-
getProperty
Returns a cached system property as a String, or a default value if property is not set.Note that if the property is not set, the accessor will remain unchanged.
This call will not raise
SecurityException
, it will return defaultString instead.- Specified by:
getProperty
in interfaceJiraProperties
- Parameters:
key
- the name of the system property.defaultString
- default value- Returns:
- the value of the system property, or defaultString if property is not set or
SecurityException
occurs.
-
setProperty
Sets a system property and invalidates the accessor accordingly, or unsets the property if value is null. The value set is the result ofObject.toString()
called on the value.- Specified by:
setProperty
in interfaceJiraProperties
- Parameters:
key
- the name of the system property.value
- the value
-
unsetProperty
Unsets a system property and invalidates the accessor accordingly.- Specified by:
unsetProperty
in interfaceJiraProperties
- Parameters:
key
- the name of the system property.
-
getBoolean
Returns a cached system property as a Boolean.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 usegetProperty(String)
and convert it to Boolean manually for that desired effect.- Specified by:
getBoolean
in interfaceJiraProperties
- Parameters:
key
- the name of the system property.- Returns:
- the value of the system property, or false if property is not set or
SecurityException
occurs.
-
getInteger
Returns a cached system property as an Integer.This call will not raise
SecurityException
, it will return null instead.- Specified by:
getInteger
in interfaceJiraProperties
- Parameters:
key
- the name of the system property.- Returns:
- the value of the system property, or null if property is not set or
SecurityException
occurs.
-
getInteger
Returns a cached system property as an Integer, or a default value if property is not set.Note that if the property is not set, the accessor will remain unchanged.
This call will not raise
SecurityException
, it will return defaultInteger instead.- Specified by:
getInteger
in interfaceJiraProperties
- Parameters:
key
- the name of the system property.defaultInteger
- default value- Returns:
- the value of the system property, or defaultInteger if property is not set or
SecurityException
occurs.
-
getLong
Returns a cached system property as a Long.This call will not raise
SecurityException
, it will return null instead.- Specified by:
getLong
in interfaceJiraProperties
- Parameters:
key
- the name of the system property.- Returns:
- the value of the system property, or null if property is not set or
SecurityException
occurs.
-
getLong
Returns a cached system property as a Long, or a default value if property is not set.Note that if the property is not set, the accessor will remain unchanged.
This call will not raise
SecurityException
, it will return defaultLong instead.- Specified by:
getLong
in interfaceJiraProperties
- Parameters:
key
- the name of the system property.defaultLong
- default value- Returns:
- the value of the system property, or defaultLong if property is not set or
SecurityException
occurs.
-
getProperties
Returns a snapshot of all the set system properties. This is not a view.This call will not raise
SecurityException
, it will return an empty set of properties instead.- Specified by:
getProperties
in interfaceJiraProperties
- Returns:
- system properties.
-
getSanitisedProperties
Description copied from interface:JiraProperties
Return a copy of the current properties with sensitive properties sanitised. This should only be used when displaying properties to the user as some of the properties will not have their real values.- Specified by:
getSanitisedProperties
in interfaceJiraProperties
- Returns:
- a view of the system properties.
-
setProperties
Sets the system properties and invalidates the accessor accordingly.- Specified by:
setProperties
in interfaceJiraProperties
- Parameters:
props
- the properties to set.- See Also:
-
refresh
public void refresh()Description copied from interface:JiraProperties
Causes any previously cached values to be invalidated. As long as this object is used to set or retrieve system properties it is not necessary to call this method. Call it only if you caused a system property change in another way thanJiraProperties.setProperty(String, Object)
,JiraProperties.setProperties(java.util.Properties)
orJiraProperties.unsetProperty(String)
.- Specified by:
refresh
in interfaceJiraProperties
-
isDevMode
public boolean isDevMode()- Specified by:
isDevMode
in interfaceJiraProperties
- Returns:
- true if jira is running in dev mode (meaning jira.home lock files will be ignored)
-
isXsrfDetectionCheckRequired
public boolean isXsrfDetectionCheckRequired()- Specified by:
isXsrfDetectionCheckRequired
in interfaceJiraProperties
-
isSuperBatchingDisabled
public boolean isSuperBatchingDisabled()- Specified by:
isSuperBatchingDisabled
in interfaceJiraProperties
-
isContextBatchingDisabled
public boolean isContextBatchingDisabled()- Specified by:
isContextBatchingDisabled
in interfaceJiraProperties
-
isDecodeMailParameters
public boolean isDecodeMailParameters()- Specified by:
isDecodeMailParameters
in interfaceJiraProperties
-
isCustomPathPluginsEnabled
public boolean isCustomPathPluginsEnabled()- Specified by:
isCustomPathPluginsEnabled
in interfaceJiraProperties
-
getCustomDirectoryPlugins
- Specified by:
getCustomDirectoryPlugins
in interfaceJiraProperties
-
isPluginsRosterFileEnabled
public boolean isPluginsRosterFileEnabled()- Specified by:
isPluginsRosterFileEnabled
in interfaceJiraProperties
-
getPluginsRosterFile
- Specified by:
getPluginsRosterFile
in interfaceJiraProperties
-
isWebSudoDisabled
public boolean isWebSudoDisabled()- Specified by:
isWebSudoDisabled
in interfaceJiraProperties
-
isI18nReloadBundles
public boolean isI18nReloadBundles()- Specified by:
isI18nReloadBundles
in interfaceJiraProperties
-
showPerformanceMonitor
public boolean showPerformanceMonitor()- Specified by:
showPerformanceMonitor
in interfaceJiraProperties
-
isBundledPluginsDisabled
public boolean isBundledPluginsDisabled()- Specified by:
isBundledPluginsDisabled
in interfaceJiraProperties
-
isDarkFeaturesDisabled
public boolean isDarkFeaturesDisabled()- Specified by:
isDarkFeaturesDisabled
in interfaceJiraProperties
-
isXsrfDiagnostics
public boolean isXsrfDiagnostics()- Specified by:
isXsrfDiagnostics
in interfaceJiraProperties
-
isResourceBundleCacheCleaningDisabled
public boolean isResourceBundleCacheCleaningDisabled()- Specified by:
isResourceBundleCacheCleaningDisabled
in interfaceJiraProperties
-
isSecretServiceDisabled
public boolean isSecretServiceDisabled()- Specified by:
isSecretServiceDisabled
in interfaceJiraProperties
-