|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.jira.config.properties.JiraPropertiesImpl
public class JiraPropertiesImpl
Handles getting and setting of system properties.
Non-null values are cached. If you need the latest value of the system property, callrefresh()
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.
For reading properties, this class catches SecurityException
s and returns null or default values provided.
However, this class will not catch such exceptions when setting system properties.
Constructor Summary | |
---|---|
JiraPropertiesImpl(PropertiesAccessor propertiesAccessor)
|
Method Summary | ||
---|---|---|
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. |
|
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. |
|
boolean |
isBundledPluginsDisabled()
|
|
boolean |
isCustomPathPluginsEnabled()
|
|
boolean |
isDangerMode()
|
|
boolean |
isDarkFeaturesDisabled()
|
|
boolean |
isDecodeMailParameters()
|
|
boolean |
isDevMode()
|
|
boolean |
isI18nReloadBundles()
|
|
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. |
|
|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JiraPropertiesImpl(PropertiesAccessor propertiesAccessor)
Method Detail |
---|
public String getProperty(String key)
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)
SecurityException
, it will return defaultString instead.
getProperty
in interface JiraProperties
key
- the name of the system property.defaultString
- default value
SecurityException
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)
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)
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)
SecurityException
, it will return defaultInteger instead.
getInteger
in interface JiraProperties
key
- the name of the system property.defaultInteger
- default value
SecurityException
occurs.public Long getLong(String key)
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)
SecurityException
, it will return defaultLong instead.
getLong
in interface JiraProperties
key
- the name of the system property.defaultLong
- default value
SecurityException
occurs.public Properties getProperties()
SecurityException
, it will return an empty set of properties instead.
getProperties
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 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 isDangerMode()
isDangerMode
in interface JiraProperties
public boolean isXsrfDiagnostics()
isXsrfDiagnostics
in interface JiraProperties
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |