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()
Gets the base URL of the current instance.
@Nonnull File getBinDir()
@Nonnull String getBuildNumber()
@Nonnull Date getBuildTimestamp()
@Nonnull String getBuildVersion()
@Nonnull File getCacheDir()
@Nonnull String getCommitHash()
@Nonnull File getConfigDir()
@Nonnull File getDataDir()
@Nonnull TimeZone getDefaultTimeZone()
@Nullable String getDisplayName()
Gets the display name of the current instance.
@Nonnull File getHomeDir()
Returns the current home directory for this instance.
@Nonnull String getJdbcDriver()
@Nonnull String getJdbcDriverVersion()
@Nonnull String getJdbcUrl()
@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)
@Nonnull File getRepositoriesDir()
@Nonnull File getRepositoryDir(Repository repository)
@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.
@Nonnull File getSharedHomeDir()
Returns the shared home directory.
@Nonnull File getTempDir()
boolean isAllowPublicSignUp()
boolean isDebugLoggingEnabled()
boolean isHttpScmHostingEnabled()
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 ()

Gets the base URL of the current instance.

The URL is guaranteed to be without a trailing slash

Returns
  • base URL of the current instance, without trailing slash or null if the base URL is not configured

@Nonnull public File getBinDir ()

Returns
  • the directory inside stash.home 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.

@Nonnull public File getCacheDir ()

Returns
  • the directory inside stash.home that contains any caches used by the application.

@Nonnull public String getCommitHash ()

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

@Nonnull public File getConfigDir ()

Returns
  • the directory inside stash.home that contains the configuration files.

@Nonnull public File getDataDir ()

Returns
  • the directory inside stash.home that contains data files, such as repositories

@Nonnull public TimeZone getDefaultTimeZone ()

Returns
  • the default time zone for the server.

@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 File getHomeDir ()

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

@Nonnull public File getRepositoriesDir ()

Returns
  • the directory inside stash.shared.home that contains the repositories.

@Nonnull public File getRepositoryDir (Repository repository)

Parameters
repository the repository
Returns
  • the directory containing the hosted 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

@Nonnull public File getSharedHomeDir ()

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

@Nonnull public File getTempDir ()

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 isHttpScmHostingEnabled ()

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

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