Package org.apache.sling.settings
Interface SlingSettingsService
-
@ProviderType public interface SlingSettingsService
TheSlingSettingsService
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
Fields Modifier and Type Field Description static java.lang.String
RUN_MODE_INSTALL_OPTIONS
The name of the framework property defining the list of run mode options for installation time.static java.lang.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.static java.lang.String
RUN_MODE_SPEC_AND_SEPARATOR
static java.lang.String
RUN_MODE_SPEC_NOT_PREFIX
static java.lang.String
RUN_MODE_SPEC_OR_SEPARATOR
static java.lang.String
RUN_MODES_PROPERTY
The name of the framework property defining the set of used run modes.static java.lang.String
SLING_HOME
The name of the framework property defining the Sling home directory (value is "sling.home").static java.lang.String
SLING_HOME_URL
The name of the framework property defining the Sling home directory as an URL (value is "sling.home.url").
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.String
getAbsolutePathWithinSlingHome(java.lang.String relativePath)
Utility method to generate an absolute path within Sling Home.int
getBestRunModeMatchCountFromSpec(java.lang.String spec)
Checks if a given run mode spec is satisfied by the active run modes.java.util.Set<java.lang.String>
getRunModes()
Return the set of activate run modes.java.lang.String
getSlingDescription()
Return the optional description of the instance.java.net.URL
getSlingHome()
Returns the value of theSLING_HOME_URL
property.java.lang.String
getSlingHomePath()
Returns the value of theSLING_HOME
property.java.lang.String
getSlingId()
The identifier of the running Sling instance.java.lang.String
getSlingName()
Return the optional name of the instance.
-
-
-
Field Detail
-
SLING_HOME
static final java.lang.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
, Constant Field Values
-
SLING_HOME_URL
static final java.lang.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:
SLING_HOME
, Constant Field Values
-
RUN_MODES_PROPERTY
static final java.lang.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:
- Constant Field Values
-
RUN_MODE_OPTIONS
static final java.lang.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:
- Constant Field Values
-
RUN_MODE_INSTALL_OPTIONS
static final java.lang.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:
- Constant Field Values
-
RUN_MODE_SPEC_OR_SEPARATOR
static final java.lang.String RUN_MODE_SPEC_OR_SEPARATOR
- See Also:
- Constant Field Values
-
RUN_MODE_SPEC_AND_SEPARATOR
static final java.lang.String RUN_MODE_SPEC_AND_SEPARATOR
- See Also:
- Constant Field Values
-
RUN_MODE_SPEC_NOT_PREFIX
static final java.lang.String RUN_MODE_SPEC_NOT_PREFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
getAbsolutePathWithinSlingHome
java.lang.String getAbsolutePathWithinSlingHome(java.lang.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
java.lang.String getSlingId()
The identifier of the running Sling instance.- Returns:
- The unique Sling identifier.
-
getSlingHomePath
java.lang.String getSlingHomePath()
Returns the value of theSLING_HOME
property.- Returns:
- The sling home.
-
getSlingHome
java.net.URL getSlingHome()
Returns the value of theSLING_HOME_URL
property.- Returns:
- Sling home as a URL.
-
getRunModes
java.util.Set<java.lang.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(java.lang.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:
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
java.lang.String getSlingName()
Return the optional name of the instance.- Returns:
- The name of the instance or
null
. - Since:
- 1.3
-
getSlingDescription
java.lang.String getSlingDescription()
Return the optional description of the instance.- Returns:
- The description of the instance or
null
. - Since:
- 1.3
-
-