Package org.apache.sling.settings
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe name of the framework property defining the list of run mode options for installation time.static final StringThe 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.static final Stringstatic final Stringstatic final Stringstatic final StringThe name of the framework property defining the set of used run modes.static final StringThe name of the framework property defining the Sling home directory (value is "sling.home").static final StringThe name of the framework property defining the Sling home directory as an URL (value is "sling.home.url"). -
Method Summary
Modifier and TypeMethodDescriptiongetAbsolutePathWithinSlingHome(String relativePath) Utility method to generate an absolute path within Sling Home.intChecks if a given run mode spec is satisfied by the active run modes.Return the set of activate run modes.Return the optional description of the instance.Returns the value of theSLING_HOME_URLproperty.Returns the value of theSLING_HOMEproperty.The identifier of the running Sling instance.Return the optional name of the instance.
-
Field Details
-
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
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
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
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
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
- See Also:
-
RUN_MODE_SPEC_AND_SEPARATOR
- See Also:
-
RUN_MODE_SPEC_NOT_PREFIX
- See Also:
-
-
Method Details
-
getAbsolutePathWithinSlingHome
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 theSLING_HOMEproperty.- Returns:
- The sling home.
-
getSlingHome
URL getSlingHome()Returns the value of theSLING_HOME_URLproperty.- Returns:
- Sling home as a URL.
-
getRunModes
Return the set of activate run modes. This set might be empty.- Returns:
- A non modifiable set of run modes.
-
getBestRunModeMatchCountFromSpec
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:
The operator order is first "-" (not), second "." (AND), last "," (OR).run mode spec ::= conjunctions { "," conjunctions } conjunctions ::= conjunction { '.' conjunction } conjunction ::= notrunmode | runmode notrunmode ::= '-' runmode- 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
-