Class RunMode
- java.lang.Object
-
- org.apache.sling.provisioning.model.Traceable
-
- org.apache.sling.provisioning.model.RunMode
-
- All Implemented Interfaces:
java.lang.Comparable<RunMode>
public class RunMode extends Traceable implements java.lang.Comparable<RunMode>
A run mode is a collection of - artifacts (through start levels) - configurations - settings Only if all run modes are active, this run mode is active. In addition to custom, user defined run modes, special run modes exists. A special run mode name starts with a colon.
-
-
Constructor Summary
Constructors Constructor Description RunMode(java.lang.String[] names)
Create a new run mode
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(RunMode o2)
ArtifactGroup
getArtifactGroup(int startLevel)
Find the artifact group.java.util.List<ArtifactGroup>
getArtifactGroups()
Get all artifact groupsConfiguration
getConfiguration(java.lang.String pid)
Search a configuration with a pidConfiguration
getConfiguration(java.lang.String pid, java.lang.String factoryPid)
Search a configuration with pid and factory pidItemList<Configuration>
getConfigurations()
Get all configurationsjava.lang.String[]
getNames()
Return the run mode names.ArtifactGroup
getOrCreateArtifactGroup(int startLevel)
Get or create an artifact groupConfiguration
getOrCreateConfiguration(java.lang.String pid, java.lang.String factoryPid)
Get or create the configurationKeyValueMap<java.lang.String>
getSettings()
Get the settingsstatic java.lang.String[]
getSortedRunModesArray(java.lang.String[] names)
Get an alphabetical sorted array of the run mode names.boolean
isActive(java.util.Set<java.lang.String> activeRunModes)
Check if this run mode is active wrt the given set of active run modes.boolean
isRunMode(java.lang.String mode)
Check if this run mode is tied to a single specific run mode name.boolean
isSpecial()
Check whether this run mode is a special onejava.lang.String
toString()
-
Methods inherited from class org.apache.sling.provisioning.model.Traceable
getLocation, setLocation
-
-
-
-
Method Detail
-
getSortedRunModesArray
public static java.lang.String[] getSortedRunModesArray(java.lang.String[] names)
Get an alphabetical sorted array of the run mode names.- Parameters:
names
- The run mode names- Returns:
- The sorted run mode names
-
getNames
public java.lang.String[] getNames()
Return the run mode names.- Returns:
- The array of run mode names or
null
.
-
isActive
public boolean isActive(java.util.Set<java.lang.String> activeRunModes)
Check if this run mode is active wrt the given set of active run modes.- Parameters:
activeRunModes
- The set of active run modes.- Returns:
true
if the run mode is active.
-
isSpecial
public boolean isSpecial()
Check whether this run mode is a special one- Returns:
true
if it is special
-
isRunMode
public boolean isRunMode(java.lang.String mode)
Check if this run mode is tied to a single specific run mode name.- Parameters:
mode
- The name of the run mode- Returns:
true
if this run mode is tied to exactly the single one.
-
getArtifactGroup
public ArtifactGroup getArtifactGroup(int startLevel)
Find the artifact group.- Parameters:
startLevel
- the start level- Returns:
- The artifact group for that level or
null
.
-
getOrCreateArtifactGroup
public ArtifactGroup getOrCreateArtifactGroup(int startLevel)
Get or create an artifact group- Parameters:
startLevel
- The start level- Returns:
- The artifact group.
-
getConfiguration
public Configuration getConfiguration(java.lang.String pid)
Search a configuration with a pid- Parameters:
pid
- The configuration pid- Returns:
- The configuration or
null
-
getConfiguration
public Configuration getConfiguration(java.lang.String pid, java.lang.String factoryPid)
Search a configuration with pid and factory pid- Parameters:
pid
- The pidfactoryPid
- The optional factory pid- Returns:
- The configuration or
null
.
-
getOrCreateConfiguration
public Configuration getOrCreateConfiguration(java.lang.String pid, java.lang.String factoryPid)
Get or create the configuration- Parameters:
pid
- The pidfactoryPid
- The optional factory pid- Returns:
- The configuration
-
getArtifactGroups
public java.util.List<ArtifactGroup> getArtifactGroups()
Get all artifact groups- Returns:
- List of artifact groups
-
getConfigurations
public ItemList<Configuration> getConfigurations()
Get all configurations- Returns:
- List of configurations
-
getSettings
public KeyValueMap<java.lang.String> getSettings()
Get the settings- Returns:
- Map with the settings.
-
compareTo
public int compareTo(RunMode o2)
- Specified by:
compareTo
in interfacejava.lang.Comparable<RunMode>
- See Also:
Comparable.compareTo(java.lang.Object)
-
-