Package org.apache.sling.feature
Class Configuration
- java.lang.Object
-
- org.apache.sling.feature.Configuration
-
- All Implemented Interfaces:
Comparable<Configuration>
public class Configuration extends Object implements Comparable<Configuration>
A configuration has either- a pid
- or a factory pid and a name
-
-
Field Summary
Fields Modifier and Type Field Description static StringCONFIGURATOR_PREFIXPrefix for instructions for the configurator.static StringPROP_ARTIFACT_IDThis optional configuration property stores the artifact id (mvn id) of the bundle this configuration belongs to.static StringPROP_PREFIXPrefix for special properties which are not configuration properties.
-
Constructor Summary
Constructors Constructor Description Configuration(String pid)Create a new configuration
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Configuration o)Configurationcopy(String aPid)Create a copy of the configuration with a provided PID.Dictionary<String,Object>getConfigurationProperties()Get the configuration properties of the configuration.StringgetFactoryPid()Return the factory pid of a pid if it's a factory configurationstatic StringgetFactoryPid(String pid)Return the factory pid of a pid if it's a factory configurationStringgetName()Return the name for a factory configuration if it is a factory configuration.static StringgetName(String pid)Return the name for a factory configuration if it is a factory configuration.StringgetPid()Get the pid.Dictionary<String,Object>getProperties()Get all properties of the configuration.booleanisFactoryConfiguration()Check whether the pid is a factory pidstatic booleanisFactoryConfiguration(String pid)Check whether the pid is a factory pidStringtoString()
-
-
-
Field Detail
-
CONFIGURATOR_PREFIX
public static final String CONFIGURATOR_PREFIX
Prefix for instructions for the configurator.- See Also:
- Constant Field Values
-
PROP_PREFIX
public static final String PROP_PREFIX
Prefix for special properties which are not configuration properties.- See Also:
- Constant Field Values
-
PROP_ARTIFACT_ID
public static final String PROP_ARTIFACT_ID
This optional configuration property stores the artifact id (mvn id) of the bundle this configuration belongs to.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Configuration
public Configuration(String pid)
Create a new configuration- Parameters:
pid- The pid- Throws:
IllegalArgumentException- If pid isnull
-
-
Method Detail
-
compareTo
public int compareTo(Configuration o)
- Specified by:
compareToin interfaceComparable<Configuration>
-
getPid
public String getPid()
Get the pid.- Returns:
- The pid
-
isFactoryConfiguration
public boolean isFactoryConfiguration()
Check whether the pid is a factory pid- Returns:
trueif it's a factory pid- Since:
- 1.3
-
getFactoryPid
public String 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:
isFactoryConfiguration()
-
getName
public String 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()
-
isFactoryConfiguration
public static boolean isFactoryConfiguration(String pid)
Check whether the pid is a factory pid- Parameters:
pid- The pid- Returns:
trueif it's a factory pid
-
getFactoryPid
public static String getFactoryPid(String pid)
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:
isFactoryConfiguration(String)
-
getName
public static String getName(String pid)
Return the name for a factory configuration if it is a factory configuration.- Parameters:
pid- The pid- Returns:
- The name or
null. - See Also:
isFactoryConfiguration(String)
-
getProperties
public Dictionary<String,Object> 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
-
getConfigurationProperties
public Dictionary<String,Object> 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
public Configuration copy(String aPid)
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
-
-