org.apache.sling.provisioning.model

## Class RunMode

- java.lang.Object
- - org.apache.sling.provisioning.model.Traceable
  - - org.apache.sling.provisioning.model.RunMode

All Implemented Interfaces:
  Comparable<RunMode>

    public class RunMode
    extends Traceable
    implements 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 and Description
`RunMode(String[] names)` Create a new run mode

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`int` `compareTo(RunMode o2)`
`ArtifactGroup` `getArtifactGroup(int startLevel)` Find the artifact group.
`List<ArtifactGroup>` `getArtifactGroups()` Get all artifact groups
`Configuration` `getConfiguration(String pid)` Search a configuration with a pid
`Configuration` `getConfiguration(String pid, String factoryPid)` Search a configuration with pid and factory pid
`ItemList<Configuration>` `getConfigurations()` Get all configurations
`String[]` `getNames()` Return the run mode names.
`ArtifactGroup` `getOrCreateArtifactGroup(int startLevel)` Get or create an artifact group
`Configuration` `getOrCreateConfiguration(String pid, String factoryPid)` Get or create the configuration
`KeyValueMap<String>` `getSettings()` Get the settings
`static String[]` `getSortedRunModesArray(String[] names)` Get an alphabetical sorted array of the run mode names.
`boolean` `isActive(Set<String> activeRunModes)` Check if this run mode is active wrt the given set of active run modes.
`boolean` `isRunMode(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 one
`String` `toString()`

### Methods inherited from class org.apache.sling.provisioning.model.Traceable

`getLocation, setLocation`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### RunMode

    public RunMode(String[] names)

Create a new run mode

Parameters:
  `names` - The run mode names

### Method Detail

#### getSortedRunModesArray

    public static String[] getSortedRunModesArray(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 String[] getNames()

Return the run mode names.

Returns:
  The array of run mode names or `null`.

#### isActive

    public boolean isActive(Set<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(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(String pid)

Search a configuration with a pid

Parameters:
  `pid` - The configuration pid
Returns:
  The configuration or `null`

#### getConfiguration

    public Configuration getConfiguration(String pid,
                                          String factoryPid)

Search a configuration with pid and factory pid

Parameters:
  `pid` - The pid
  `factoryPid` - The optional factory pid
Returns:
  The configuration or `null`.

#### getOrCreateConfiguration

    public Configuration getOrCreateConfiguration(String pid,
                                                  String factoryPid)

Get or create the configuration

Parameters:
  `pid` - The pid
  `factoryPid` - The optional factory pid
Returns:
  The configuration

#### getArtifactGroups

    public 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<String> getSettings()

Get the settings

Returns:
  Map with the settings.

#### compareTo

    public int compareTo(RunMode o2)

Specified by:
  `compareTo` in interface `Comparable<RunMode>`
See Also:
  `Comparable.compareTo(java.lang.Object)`

#### toString

    public String toString()

Overrides:
  `toString` in class `Traceable`