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.
@Deprecated @Nonnull File getBinDir()
This method is deprecated. in 5.11 for removal without replacement in 6.0. The bin directory contains nothing intended for use by app developers.
@Nonnull String getBuildNumber()
@Nonnull Date getBuildTimestamp()
@Nonnull String getBuildVersion()
@Deprecated @Nonnull File getCacheDir()
This method is deprecated. in 5.11 for removal in 6.0. Use getCacheDir() instead.
@Nonnull String getCommitHash()
@Deprecated @Nonnull File getConfigDir()
This method is deprecated. in 5.11 for removal in 6.0. Use getConfigDir() instead.
@Deprecated @Nonnull File getDataDir()
This method is deprecated. in 5.11 for removal in 6.0. Use getDataDir() instead.
@Nullable String getDisplayName()
Gets the display name of the current instance.
@Deprecated @Nonnull File getHomeDir()
This method is deprecated. in 5.11 for removal in 6.0. Use getHomeDir() instead.
@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)
@Deprecated @Nonnull File getRepositoriesDir()
This method is deprecated. in 5.10 for removal without replacement in 6.0. Starting in 6.0 apps will no longer be allowed to directly access repository data on disk. They will be required to use API services to interact with repositories instead.
@Deprecated @Nonnull File getRepositoryDir(Repository repository)
This method is deprecated. in 5.10 for removal without replacement in 6.0. Starting in 6.0 apps will no longer be allowed to directly access repository data on disk. They will be required to use API services to interact with repositories instead.
@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.
@Deprecated @Nonnull File getSharedHomeDir()
This method is deprecated. in 5.11 for removal in 6.0. Use getSharedHomeDir() instead.
@Deprecated @Nonnull File getTempDir()
This method is deprecated. in 5.11 for removal in 6.0. Use getTempDir() instead.
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

@Deprecated @Nonnull public File getBinDir ()

This method is deprecated.
in 5.11 for removal without replacement in 6.0. The bin directory contains nothing intended for use by app developers.

Returns
  • the application home subdirectory that contains any scripts / executables used by the application

@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

@Deprecated @Nonnull public File getCacheDir ()

This method is deprecated.
in 5.11 for removal in 6.0. Use getCacheDir() instead.

Returns
  • the application home subdirectory that contains any caches used by the application

@Nonnull public String getCommitHash ()

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

@Deprecated @Nonnull public File getConfigDir ()

This method is deprecated.
in 5.11 for removal in 6.0. Use getConfigDir() instead.

Returns
  • the application home subdirectory that contains the configuration files

@Deprecated @Nonnull public File getDataDir ()

This method is deprecated.
in 5.11 for removal in 6.0. Use getDataDir() instead.

Returns
  • the application home subdirectory that contains data files, such as repositories

@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

@Deprecated @Nonnull public File getHomeDir ()

This method is deprecated.
in 5.11 for removal in 6.0. Use getHomeDir() instead.

Returns the current home directory for this instance. The home directory will contain only node-local data, such as caches, backups, logs and tmp. When running standalone this directory will also generally contain the shared home under /shared, but it is not required to.

Returns
  • the home directory for the instance

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

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

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.

@Deprecated @Nonnull public File getRepositoriesDir ()

This method is deprecated.
in 5.10 for removal without replacement in 6.0. Starting in 6.0 apps will no longer be allowed to directly access repository data on disk. They will be required to use API services to interact with repositories instead.

Returns
  • the application home subdirectory that contains repositories

@Deprecated @Nonnull public File getRepositoryDir (Repository repository)

This method is deprecated.
in 5.10 for removal without replacement in 6.0. Starting in 6.0 apps will no longer be allowed to directly access repository data on disk. They will be required to use API services to interact with repositories instead.

Parameters
repository the repository
Returns
  • the directory containing the specified repository

@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

@Deprecated @Nonnull public File getSharedHomeDir ()

This method is deprecated.
in 5.11 for removal in 6.0. Use getSharedHomeDir() instead.

Returns the shared home directory. This directory contains repository data, config and plugins/installed-plugins. When the application is clustered, this directory is shared among all nodes.

Returns
  • the shared home directory for the instance

@Deprecated @Nonnull public File getTempDir ()

This method is deprecated.
in 5.11 for removal in 6.0. Use getTempDir() instead.

Returns
  • the temp directory for the instance

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