Package com.atlassian.bitbucket.server
Interface ApplicationPropertiesService
- All Superinterfaces:
ApplicationModeSupplier
A service for retrieving and updating application properties.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Remove the mail host configuration.Retrieves the configured base URL for the instance.Gets the display name of the current instance.getLoginUri
(URI redirectUri) Gets the login page URI for the current instance.Retrieves the mail host configurationint
getMode()
getPluginProperty
(String propertyName) Return a value of a property as defined in the applications configuration files.boolean
getPluginProperty
(String propertyName, boolean defaultValue) double
getPluginProperty
(String propertyName, double defaultValue) int
getPluginProperty
(String propertyName, int defaultValue) long
getPluginProperty
(String propertyName, long defaultValue) getPluginProperty
(String propertyName, String defaultValue) Gets whether remember-me authentication is disabled, always performed or only performed when a checkbox is checked on the login form.Gets the email address used in the 'sender' field for any email notification.Retrieves the server ID used for licensing.boolean
boolean
boolean
boolean
boolean
boolean
boolean
isSetup()
boolean
void
setAllowPublicSignUp
(boolean publicSignUp) Sets whether public signup is allowed for external users.void
setBaseURL
(URI baseUrl) Sets the base URL of the current instance.void
setDisplayName
(String name) Sets the display name of the current instance.void
setHttpScmHostingEnabled
(boolean enabled) Sets whether the SCM requests are allowed over HTTP(S).void
setMailHostConfiguration
(MailHostConfiguration mailHostConfiguration) Sets the mail host configuration, replacing any existing configuration.void
setMaxCaptchaAttempts
(int maxCaptchaAttempts) Sets the number of failed login attempts before the user is required to enter a CAPTCHA verification.void
setServerEmailAddress
(String emailAddress) Sets the email address used in the 'sender' field for any email notification.void
setShowCaptchaOnSignUp
(boolean captchaOnSignUp) Sets whether a CAPTCHA verification is required for signing up.
-
Method Details
-
getBaseUrl
Retrieves the configured base URL for the instance. If the returned value is notnull
it is guaranteed to not end with a trailing slash.- Returns:
- the configured base URL, without trailing slash, or
null
if one has not been configured
-
getDisplayName
Gets the display name of the current instance.- Returns:
- name of the current instance or
null
if the display name is not configured
-
setBaseURL
Sets the base URL of the current instance.The URL will be persisted without a trailing slash, if present. Ex: given
http://server/stash/
, the property will be saved ashttp://server/stash
- Parameters:
baseUrl
- publicly accessible URL for the current instance
-
getLoginUri
Gets the login page URI for the current instance.- Parameters:
redirectUri
- the URI the user should be redirected to after a successful login- Returns:
- the login page URI for the current instance
-
getBuildVersion
- Returns:
- the build version of the current instance
-
setDisplayName
Sets the display name of the current instance.- Parameters:
name
- display name for the current instance
-
getBuildTimestamp
- Returns:
- the build timestamp of the current instance
-
getBuildNumber
- Returns:
- the build number of the current instance
-
getCommitHash
- Returns:
- the commit hash of the version of the current instance
-
getDatabaseType
- Returns:
- the type of database currently in use
- Since:
- 7.9
-
getDatabaseVersion
- Returns:
- the version of the database currently in use
- Since:
- 7.9
-
getJdbcDriver
- Returns:
- the name of the JDBC driver class currently used to connect to the database
-
getJdbcDriverVersion
- Returns:
- the version of the JDBC driver currently in use, in a database-specific format
If the version cannot be determined
"Unknown"
is returned.
-
getJdbcUrl
- Returns:
- the JDBC URL for the database currently in use
-
getMaxCaptchaAttempts
int getMaxCaptchaAttempts()- Returns:
- the number of failed login attempts before the user is required to enter a CAPTCHA verification.
-
setMaxCaptchaAttempts
void setMaxCaptchaAttempts(int maxCaptchaAttempts) Sets the number of failed login attempts before the user is required to enter a CAPTCHA verification.- Parameters:
maxCaptchaAttempts
- maximum number of failed CAPTCHA
-
getRememberMeMode
Gets whether remember-me authentication is disabled, always performed or only performed when a checkbox is checked on the login form.- Returns:
- the
remember-me mode
- Since:
- 9.1
-
getServerEmailAddress
Gets the email address used in the 'sender' field for any email notification.- Returns:
- sender address for email notifications
-
setServerEmailAddress
Sets the email address used in the 'sender' field for any email notification.- Parameters:
emailAddress
- sender address for email notifications
-
getServerId
Retrieves the server ID used for licensing.- Returns:
- the server ID
-
isAllowPublicSignUp
boolean isAllowPublicSignUp()- Returns:
- whether public signup is allowed for external users.
-
setAllowPublicSignUp
void setAllowPublicSignUp(boolean publicSignUp) Sets whether public signup is allowed for external users.- Parameters:
publicSignUp
- whether to allow public signup
-
isDisasterRecovery
boolean isDisasterRecovery()- Returns:
- whether disaster recovery tasks should be run on startup.
- Since:
- 4.8
-
isDebugLoggingEnabled
boolean isDebugLoggingEnabled()- Returns:
- whether debug logging is enabled.
-
isProfilingEnabled
boolean isProfilingEnabled()- Returns:
- whether profiling is enabled.
-
isHttpScmHostingEnabled
boolean isHttpScmHostingEnabled()- Returns:
- whether the SCM requests are allowed over HTTP(S).
-
isJmxEnabled
boolean isJmxEnabled()- Returns:
- whether JMX is enabled
- Since:
- 4.8
-
isShowCaptchaOnSignUp
boolean isShowCaptchaOnSignUp()- Returns:
- whether CAPTCHA is required for signing up.
-
setHttpScmHostingEnabled
void setHttpScmHostingEnabled(boolean enabled) Sets whether the SCM requests are allowed over HTTP(S).- Parameters:
enabled
- whether to enable HTTP(S) access
-
setShowCaptchaOnSignUp
void setShowCaptchaOnSignUp(boolean captchaOnSignUp) Sets whether a CAPTCHA verification is required for signing up.- Parameters:
captchaOnSignUp
- whether to enable CAPTCHA on signup
-
isSetup
boolean isSetup()- Returns:
- whether or not the application has completed setup
-
getMode
- Specified by:
getMode
in interfaceApplicationModeSupplier
- Returns:
- the
mode
of this instance
-
getMailHostConfiguration
Retrieves the mail host configuration- Returns:
- the mail host configuration,
null
if undefined.
-
setMailHostConfiguration
Sets the mail host configuration, replacing any existing configuration.- Parameters:
mailHostConfiguration
- the configuration to store
-
deleteMailHostConfiguration
void deleteMailHostConfiguration()Remove the mail host configuration. -
getPluginProperty
Return a value of a property as defined in the applications configuration files.This method should be used only by plugins.
- Parameters:
propertyName
- name of the property, which must start with "plugin."- Returns:
- property value or null if not defined.
- Throws:
IllegalArgumentException
- if the property name is null, or if the property name does not start with "plugin."
-
getPluginProperty
- Parameters:
propertyName
- name of the propertydefaultValue
- the default value to return if it is not present- Returns:
- property value or defaultValue if not defined.
-
getPluginProperty
- Parameters:
propertyName
- name of the propertydefaultValue
- the default value to return if it is not present- Returns:
- property value or defaultValue if not defined.
- Throws:
NumberFormatException
-
getPluginProperty
long getPluginProperty(@Nonnull String propertyName, long defaultValue) throws NumberFormatException - Parameters:
propertyName
- name of the propertydefaultValue
- the default value to return if it is not present- Returns:
- property value or defaultValue if not defined.
- Throws:
NumberFormatException
-
getPluginProperty
- Parameters:
propertyName
- name of the propertydefaultValue
- the default value to return if it is not present- Returns:
- property value or defaultValue if not defined.
-
getPluginProperty
double getPluginProperty(@Nonnull String propertyName, double defaultValue) throws NumberFormatException - Parameters:
propertyName
- name of the propertydefaultValue
- the default value to return if it is not present- Returns:
- property value or defaultValue if not defined.
- Throws:
NumberFormatException
-
getLocale
- Returns:
- the default
locale
of the application. - Since:
- 5.3
-