Interface ApplicationPropertiesService

All Superinterfaces:
ApplicationModeSupplier

public interface ApplicationPropertiesService extends ApplicationModeSupplier
A service for retrieving and updating application properties.
  • Method Details

    • getBaseUrl

      @Nullable 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
    • getDisplayName

      @Nullable 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
    • setBaseURL

      void setBaseURL(@Nonnull 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
    • getLoginUri

      @Nonnull 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
    • getBuildVersion

      @Nonnull String getBuildVersion()
      Returns:
      the build version of the current instance
    • setDisplayName

      void setDisplayName(@Nonnull String name)
      Sets the display name of the current instance.
      Parameters:
      name - display name for the current instance
    • getBuildTimestamp

      @Nonnull Date getBuildTimestamp()
      Returns:
      the build timestamp of the current instance
    • getBuildNumber

      @Nonnull String getBuildNumber()
      Returns:
      the build number of the current instance
    • getCommitHash

      @Nonnull String getCommitHash()
      Returns:
      the commit hash of the version of the current instance
    • getDatabaseType

      @Nonnull DatabaseType getDatabaseType()
      Returns:
      the type of database currently in use
      Since:
      7.9
    • getDatabaseVersion

      @Nonnull String getDatabaseVersion()
      Returns:
      the version of the database currently in use
      Since:
      7.9
    • getJdbcDriver

      @Nonnull String getJdbcDriver()
      Returns:
      the name of the JDBC driver class currently used to connect to the database
    • getJdbcDriverVersion

      @Nonnull 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.
    • getJdbcUrl

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

      @Nonnull RememberMeMode 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

      @Nullable String getServerEmailAddress()
      Gets the email address used in the 'sender' field for any email notification.
      Returns:
      sender address for email notifications
    • setServerEmailAddress

      void setServerEmailAddress(String emailAddress)
      Sets the email address used in the 'sender' field for any email notification.
      Parameters:
      emailAddress - sender address for email notifications
    • getServerId

      @Nullable String 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

      @Nonnull ApplicationMode getMode()
      Specified by:
      getMode in interface ApplicationModeSupplier
      Returns:
      the mode of this instance
    • getMailHostConfiguration

      @Nullable MailHostConfiguration getMailHostConfiguration()
      Retrieves the mail host configuration
      Returns:
      the mail host configuration, null if undefined.
    • setMailHostConfiguration

      void setMailHostConfiguration(@Nonnull MailHostConfiguration mailHostConfiguration)
      Sets the mail host configuration, replacing any existing configuration.
      Parameters:
      mailHostConfiguration - the configuration to store
    • deleteMailHostConfiguration

      void deleteMailHostConfiguration()
      Remove the mail host configuration.
    • getPluginProperty

      @Nullable String getPluginProperty(@Nonnull String propertyName)
      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

      @Nullable String getPluginProperty(@Nonnull String propertyName, @Nullable 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.
    • getPluginProperty

      int getPluginProperty(@Nonnull String propertyName, int defaultValue) throws NumberFormatException
      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
    • getPluginProperty

      long getPluginProperty(@Nonnull String propertyName, long defaultValue) throws NumberFormatException
      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
    • getPluginProperty

      boolean getPluginProperty(@Nonnull 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.
    • getPluginProperty

      double getPluginProperty(@Nonnull String propertyName, double defaultValue) throws NumberFormatException
      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
    • getLocale

      @Nonnull Locale getLocale()
      Returns:
      the default locale of the application.
      Since:
      5.3