public interface

ApplicationPropertiesService

implements ApplicationModeSupplier
com.atlassian.bitbucket.server.ApplicationPropertiesService

Class Overview

A service for retrieving and updating application properties.

Summary

Public Methods
void deleteMailHostConfiguration()
Remove the mail host configuration.
@Nullable URI getBaseUrl()
Retrieves the configured base URL for the instance.
@Nonnull String getBuildNumber()
@Nonnull Date getBuildTimestamp()
@Nonnull String getBuildVersion()
@Nonnull String getCommitHash()
@Nullable String getDisplayName()
Gets the display name of the current instance.
@Nonnull String getJdbcDriver()
@Nonnull String getJdbcDriverVersion()
@Nonnull String getJdbcUrl()
@Nonnull Locale getLocale()
@Nonnull URI getLoginUri(URI redirectUri)
Gets the login page URI for the current instance.
@Nullable MailHostConfiguration getMailHostConfiguration()
Retrieves the mail host configuration
int getMaxCaptchaAttempts()
@Nonnull ApplicationMode getMode()
long getPluginProperty(String propertyName, long defaultValue)
@Nullable String getPluginProperty(String propertyName)
Return a value of a property as defined in the applications configuration files.
@Nullable String getPluginProperty(String propertyName, String defaultValue)
boolean getPluginProperty(String propertyName, boolean defaultValue)
double getPluginProperty(String propertyName, double defaultValue)
int getPluginProperty(String propertyName, int defaultValue)
@Nullable String getServerEmailAddress()
Gets the email address used in the 'sender' field for any email notification.
@Nullable String getServerId()
Retrieves the server ID used for licensing.
boolean isAllowPublicSignUp()
boolean isDebugLoggingEnabled()
boolean isDisasterRecovery()
boolean isHttpScmHostingEnabled()
boolean isJmxEnabled()
boolean isProfilingEnabled()
boolean isSetup()
boolean isShowCaptchaOnSignUp()
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.
[Expand]
Inherited Methods
From interface com.atlassian.bitbucket.server.ApplicationModeSupplier

Public Methods

public void deleteMailHostConfiguration ()

Remove the mail host configuration.

@Nullable public URI getBaseUrl ()

Retrieves the configured base URL for the instance. If the returned value is not null 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

@Nonnull public String getBuildNumber ()

Returns
  • the build number of the current instance

@Nonnull public Date getBuildTimestamp ()

Returns
  • the build timestamp of the current instance

@Nonnull public String getBuildVersion ()

Returns
  • the build version of the current instance

@Nonnull public String getCommitHash ()

Returns
  • the commit hash of the version of the current instance

@Nullable public String getDisplayName ()

Gets the display name of the current instance.

Returns
  • name of the current instance or null if the display name is not configured

@Nonnull public String getJdbcDriver ()

Returns
  • the name of the JDBC driver class currently used to connect to the database

@Nonnull public String 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.

@Nonnull public String getJdbcUrl ()

Returns
  • the JDBC URL for the database currently in use

@Nonnull public Locale getLocale ()

Returns
  • the default Locale locale of the application.

@Nonnull public URI getLoginUri (URI redirectUri)

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

@Nullable public MailHostConfiguration getMailHostConfiguration ()

Retrieves the mail host configuration

Returns
  • the mail host configuration, null if undefined.

public int getMaxCaptchaAttempts ()

Returns
  • the number of failed login attempts before the user is required to enter a CAPTCHA verification.

@Nonnull public ApplicationMode getMode ()

Returns
  • the mode of this instance

public long getPluginProperty (String propertyName, long defaultValue)

Parameters
propertyName name of the property
defaultValue the default value to return if it is not present
Returns
  • property value or defaultValue if not defined.
Throws
NumberFormatException

@Nullable public String getPluginProperty (String propertyName)

Return a value of a property as defined in the applications configuration files. Code usually should use the Spring @Value annotation to get these injected, but in cases where that is not possible or the property name must be dynamically determined, this method and its adjuncts can be used instead.

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."

@Nullable public String getPluginProperty (String propertyName, String defaultValue)

Parameters
propertyName name of the property
defaultValue the default value to return if it is not present
Returns
  • property value or defaultValue if not defined.

public boolean getPluginProperty (String propertyName, boolean defaultValue)

Parameters
propertyName name of the property
defaultValue the default value to return if it is not present
Returns
  • property value or defaultValue if not defined.

public double getPluginProperty (String propertyName, double defaultValue)

Parameters
propertyName name of the property
defaultValue the default value to return if it is not present
Returns
  • property value or defaultValue if not defined.
Throws
NumberFormatException

public int getPluginProperty (String propertyName, int defaultValue)

Parameters
propertyName name of the property
defaultValue the default value to return if it is not present
Returns
  • property value or defaultValue if not defined.
Throws
NumberFormatException

@Nullable public String getServerEmailAddress ()

Gets the email address used in the 'sender' field for any email notification.

Returns
  • sender address for email notifications

@Nullable public String getServerId ()

Retrieves the server ID used for licensing.

Returns
  • the server ID

public boolean isAllowPublicSignUp ()

Returns
  • whether public signup is allowed for external users.

public boolean isDebugLoggingEnabled ()

Returns
  • whether debug logging is enabled.

public boolean isDisasterRecovery ()

Returns
  • whether disaster recovery tasks should be run on startup.

public boolean isHttpScmHostingEnabled ()

Returns
  • whether the SCM requests are allowed over HTTP(S).

public boolean isJmxEnabled ()

Returns
  • whether JMX is enabled

public boolean isProfilingEnabled ()

Returns
  • whether profiling is enabled.

public boolean isSetup ()

Returns
  • whether or not the application has completed setup

public boolean isShowCaptchaOnSignUp ()

Returns
  • whether CAPTCHA is required for signing up.

public void setAllowPublicSignUp (boolean publicSignUp)

Sets whether public signup is allowed for external users.

Parameters
publicSignUp whether to allow public signup

public void setBaseURL (URI baseUrl)

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 as http://server/stash

Parameters
baseUrl publicly accessible URL for the current instance

public void setDisplayName (String name)

Sets the display name of the current instance.

Parameters
name display name for the current instance

public void setHttpScmHostingEnabled (boolean enabled)

Sets whether the SCM requests are allowed over HTTP(S).

Parameters
enabled whether to enable HTTP(S) access

public void setMailHostConfiguration (MailHostConfiguration mailHostConfiguration)

Sets the mail host configuration, replacing any existing configuration.

Parameters
mailHostConfiguration the configuration to store

public 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

public void setServerEmailAddress (String emailAddress)

Sets the email address used in the 'sender' field for any email notification.

Parameters
emailAddress sender address for email notifications

public void setShowCaptchaOnSignUp (boolean captchaOnSignUp)

Sets whether a CAPTCHA verification is required for signing up.

Parameters
captchaOnSignUp whether to enable CAPTCHA on signup