Interface SlingSettingsService


@ProviderType public interface SlingSettingsService
The SlingSettingsService provides basic Sling settings. - Sling home : If the Sling launchpad is used - Sling Id : A unique id of the installation Run Mode Support A run mode is simply a string like "author", "test", "development",... The server can have a set of active run modes.
  • Field Details

    • SLING_HOME

      static final String SLING_HOME
      The name of the framework property defining the Sling home directory (value is "sling.home"). This is a Platform file system directory below which all runtime data, such as the Felix bundle archives, logfiles, the repository, etc., is located.

      This property is available calling the BundleContext.getProperty(String) method.

      See Also:
    • SLING_HOME_URL

      static final String SLING_HOME_URL
      The name of the framework property defining the Sling home directory as an URL (value is "sling.home.url").

      The value of this property is assigned the value of new File(${sling.home}).toURI().toString() before resolving the property variables.

      This property is available calling the BundleContext.getProperty(String) method.

      See Also:
    • RUN_MODES_PROPERTY

      static final String RUN_MODES_PROPERTY
      The name of the framework property defining the set of used run modes. The value is a comma separated list of run modes.
      See Also:
    • RUN_MODE_OPTIONS

      static final String RUN_MODE_OPTIONS
      The name of the framework property defining the list of run mode options The value is a comma separated list of options where each option contains of a set of run modes separated by a | character.
      Since:
      1.2.0
      See Also:
    • RUN_MODE_INSTALL_OPTIONS

      static final String RUN_MODE_INSTALL_OPTIONS
      The name of the framework property defining the list of run mode options for installation time. The value is a comma separated list of options where each option contains of a set of run modes separated by a | character.
      Since:
      1.2.0
      See Also:
    • RUN_MODE_SPEC_OR_SEPARATOR

      static final String RUN_MODE_SPEC_OR_SEPARATOR
      See Also:
    • RUN_MODE_SPEC_AND_SEPARATOR

      static final String RUN_MODE_SPEC_AND_SEPARATOR
      See Also:
    • RUN_MODE_SPEC_NOT_PREFIX

      static final String RUN_MODE_SPEC_NOT_PREFIX
      See Also:
  • Method Details

    • getAbsolutePathWithinSlingHome

      String getAbsolutePathWithinSlingHome(String relativePath)
      Utility method to generate an absolute path within Sling Home.
      Returns:
      the absolute including the sling home directory.
      Since:
      1.1.0
    • getSlingId

      String getSlingId()
      The identifier of the running Sling instance.
      Returns:
      The unique Sling identifier.
    • getSlingHomePath

      String getSlingHomePath()
      Returns the value of the SLING_HOME property.
      Returns:
      The sling home.
    • getSlingHome

      URL getSlingHome()
      Returns the value of the SLING_HOME_URL property.
      Returns:
      Sling home as a URL.
    • getRunModes

      Set<String> getRunModes()
      Return the set of activate run modes. This set might be empty.
      Returns:
      A non modifiable set of run modes.
    • getBestRunModeMatchCountFromSpec

      int getBestRunModeMatchCountFromSpec(String spec)
      Checks if a given run mode spec is satisfied by the active run modes. A run mode spec consists out of run modes and operators (AND = ".", OR = "," and NOT = "-") and follows the following grammar in EBNF:
      
       run mode spec ::= conjunctions { "," conjunctions }
       conjunctions ::= conjunction { '.' conjunction }
       conjunction ::= notrunmode | runmode
       notrunmode ::= '-' runmode
       
      The operator order is first "-" (not), second "." (AND), last "," (OR).
      Parameters:
      spec - the run mode spec string to check against
      Returns:
      the number of matching run modes or 0 if no match. If multiple disjunctions match the one with the highest number of matching run modes is returned.
      Since:
      1.4.0 (Sling Settings Bundle 1.3.12)
    • getSlingName

      String getSlingName()
      Return the optional name of the instance.
      Returns:
      The name of the instance or null.
      Since:
      1.3
    • getSlingDescription

      String getSlingDescription()
      Return the optional description of the instance.
      Returns:
      The description of the instance or null.
      Since:
      1.3