Package org.apache.sling.feature
Class Configuration
java.lang.Object
org.apache.sling.feature.Configuration
- All Implemented Interfaces:
Serializable
,Comparable<Configuration>
A configuration has either
- a pid
- or a factory pid and a name
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Prefix for instructions for the configurator.static final String
This optional configuration property stores the artifact id (mvn id) of the bundle this configuration belongs to.static final String
This optional configuration property stores the artifact ids (array) of the features this configuration has been specified.static final String
Prefix for special properties which are not configuration properties. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Create a copy of the configuration with a provided PID.Get the configuration properties of the configuration.Return the factory pid of a pid if it's a factory configurationstatic String
getFactoryPid
(String pid) Return the factory pid of a pid if it's a factory configurationGet the feature origins - if recordedgetFeatureOrigins
(String propertyName) Get the feature origins for a property - if recordedgetFeatureOrigins
(String propertyName, ArtifactId self) Get the feature origins for a property.getFeatureOrigins
(ArtifactId self) Get the feature origins.getName()
Return the name for a factory configuration if it is a factory configuration.static String
Return the name for a factory configuration if it is a factory configuration.getPid()
Get the pid.Get all properties of the configuration.boolean
Check whether the pid is a factory pidstatic boolean
Check whether the pid is a factory pidvoid
setFeatureOrigins
(String propertyName, List<ArtifactId> featureOrigins) Set the feature origins for a propertyvoid
setFeatureOrigins
(List<ArtifactId> featureOrigins) Set the feature originstoString()
-
Field Details
-
CONFIGURATOR_PREFIX
Prefix for instructions for the configurator.- See Also:
-
PROP_PREFIX
Prefix for special properties which are not configuration properties.- See Also:
-
PROP_ARTIFACT_ID
This optional configuration property stores the artifact id (mvn id) of the bundle this configuration belongs to.- See Also:
-
PROP_FEATURE_ORIGINS
This optional configuration property stores the artifact ids (array) of the features this configuration has been specified.- Since:
- 1.6
- See Also:
-
-
Constructor Details
-
Configuration
Create a new configuration- Parameters:
pid
- The pid- Throws:
IllegalArgumentException
- If pid isnull
-
-
Method Details
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Configuration>
-
getPid
Get the pid.- Returns:
- The pid
-
isFactoryConfiguration
public boolean isFactoryConfiguration()Check whether the pid is a factory pid- Returns:
true
if it's a factory pid- Since:
- 1.3
-
getFactoryPid
Return the factory pid of a pid if it's a factory configuration- Returns:
- The factory pid or
null
. - Since:
- 1.3
- See Also:
-
getName
Return the name for a factory configuration if it is a factory configuration.- Returns:
- The name or
null
. - Since:
- 1.3
- See Also:
-
isFactoryConfiguration
Check whether the pid is a factory pid- Parameters:
pid
- The pid- Returns:
true
if it's a factory pid
-
getFactoryPid
Return the factory pid of a pid if it's a factory configuration- Parameters:
pid
- The pid- Returns:
- The factory pid or
null
. - See Also:
-
getName
Return the name for a factory configuration if it is a factory configuration.- Parameters:
pid
- The pid- Returns:
- The name or
null
. - See Also:
-
getProperties
Get all properties of the configuration. This method returns a mutable dictionary which can be mutated to alter the properties for this configuration.- Returns:
- The properties
-
getFeatureOrigins
Get the feature origins - if recorded- Returns:
- A immutable list of feature artifact ids - list might be empty
- Throws:
IllegalArgumentException
- If the stored values are not valid artifact ids- Since:
- 1.6
-
getFeatureOrigins
Get the feature origins. If no origins are recorded, the provided id is returned.- Parameters:
self
- The id of the current feature- Returns:
- A immutable list of feature artifact ids
- Throws:
IllegalArgumentException
- If the stored values are not valid artifact ids- Since:
- 1.7
-
setFeatureOrigins
Set the feature origins- Parameters:
featureOrigins
- the list of artifact ids or null to remove the info from this object- Since:
- 1.6
-
getFeatureOrigins
Get the feature origins for a property - if recorded- Parameters:
propertyName
- The name of the property- Returns:
- A immutable list of feature artifact ids - list might be empty
- Throws:
IllegalArgumentException
- If the stored values are not valid artifact ids- Since:
- 1.8
-
getFeatureOrigins
Get the feature origins for a property. If no origins are recorded, the provided id is returned.- Parameters:
propertyName
- The name of the propertyself
- The id of the current feature- Returns:
- A immutable list of feature artifact ids
- Throws:
IllegalArgumentException
- If the stored values are not valid artifact ids- Since:
- 1.8
-
setFeatureOrigins
Set the feature origins for a property- Parameters:
propertyName
- The name of the propertyfeatureOrigins
- the list of artifact ids or null to remove the info from this object- Since:
- 1.8
-
getConfigurationProperties
Get the configuration properties of the configuration. This configuration properties are all properties minus properties used to manage the configuration. Managing properties have to start with#CONFIGURATOR_PREFIX
. The returned copy is a mutable dictionary which represents a snapshot of the properties at the time this method is called.- Returns:
- The configuration properties
-
copy
Create a copy of the configuration with a provided PID.- Parameters:
aPid
- The pid of the configuration- Returns:
- A copy of this configuration with the given PID
-
toString
-