Package org.apache.sling.caconfig.management

# Interface ConfigurationManager

@ProviderType public interface ConfigurationManager
Manages reading and writing configurations e.g. for Editor GUIs. It manages only configurations handled by `ConfigurationResolver`, no low-level configuration resources managed by `ConfigurationResourceResolver`.

## Method Summary

Modifier and Type
Method
Description
`void`
`deleteConfiguration(@NotNull org.apache.sling.api.resource.Resource resource, @NotNull String configName)`
Delete configuration or configuration collection data from repository using the inner-most context path as reference.
`@Nullable ConfigurationData`
`getConfiguration(@NotNull org.apache.sling.api.resource.Resource resource, @NotNull String configName)`
Get configuration data for the given context resource and configuration name.
`@NotNull ConfigurationCollectionData`
`getConfigurationCollection(@NotNull org.apache.sling.api.resource.Resource resource, @NotNull String configName)`
Get configuration data collection for the given context resource and configuration name.
`@Nullable org.apache.sling.caconfig.spi.metadata.ConfigurationMetadata`
`getConfigurationMetadata(@NotNull String configName)`
Get configuration metadata from any configuration metadata provider.
`@NotNull SortedSet<String>`
`getConfigurationNames()`
Get all configuration names.
`@Nullable String`
`getPersistenceResourcePath(@NotNull String configResourcePath)`
Deprecated.
Please use `ConfigurationPersistenceStrategyMultiplexer` instead.
`@Nullable ConfigurationData`
`newCollectionItem(@NotNull org.apache.sling.api.resource.Resource resource, @NotNull String configName)`
Creates a new empty configuration data item for a configuration data collection for the given configuration name.
`void`
`persistConfiguration(@NotNull org.apache.sling.api.resource.Resource resource, @NotNull String configName, @NotNull org.apache.sling.caconfig.spi.ConfigurationPersistData data)`
Write configuration data to repository using the inner-most context path as reference.
`void`
`persistConfigurationCollection(@NotNull org.apache.sling.api.resource.Resource resource, @NotNull String configName, @NotNull org.apache.sling.caconfig.spi.ConfigurationCollectionPersistData data)`
Write configuration data collection using the inner-most context path as reference.

## Method Details

### getConfiguration

@Nullable @Nullable ConfigurationData getConfiguration(@NotNull @NotNull org.apache.sling.api.resource.Resource resource, @NotNull @NotNull String configName)
Get configuration data for the given context resource and configuration name.

Parameters:
  `resource` - Context resource
  `configName` - Configuration name
Returns:
  Configuration data. Is null when no configuration resource found and no configuration metadata exists.

### getConfigurationCollection

@NotNull @NotNull ConfigurationCollectionData getConfigurationCollection(@NotNull @NotNull org.apache.sling.api.resource.Resource resource, @NotNull @NotNull String configName)
Get configuration data collection for the given context resource and configuration name.

Parameters:
  `resource` - Context resource
  `configName` - Configuration name
Returns:
  Configuration data collection. Is empty when no configuration resources found.

### persistConfiguration

void persistConfiguration(@NotNull @NotNull org.apache.sling.api.resource.Resource resource, @NotNull @NotNull String configName, @NotNull @NotNull org.apache.sling.caconfig.spi.ConfigurationPersistData data)
Write configuration data to repository using the inner-most context path as reference.

Parameters:
  `resource` - Context resource
  `configName` - Configuration name
  `data` - Configuration data to be stored. All existing properties are erased and replaced with the new ones.

### persistConfigurationCollection

void persistConfigurationCollection(@NotNull @NotNull org.apache.sling.api.resource.Resource resource, @NotNull @NotNull String configName, @NotNull @NotNull org.apache.sling.caconfig.spi.ConfigurationCollectionPersistData data)
Write configuration data collection using the inner-most context path as reference.

Parameters:
  `resource` - Context resource
  `configName` - Configuration name
  `data` - Configuration collection data to be stored. All existing collection entries on this context path level are erased and replaced with the new ones.

### newCollectionItem

@Nullable @Nullable ConfigurationData newCollectionItem(@NotNull @NotNull org.apache.sling.api.resource.Resource resource, @NotNull @NotNull String configName)
Creates a new empty configuration data item for a configuration data collection for the given configuration name.

Parameters:
  `resource` - Context resource
  `configName` - Configuration name
Returns:
  Configuration data. Is null when no configuration metadata exists.

### deleteConfiguration

void deleteConfiguration(@NotNull @NotNull org.apache.sling.api.resource.Resource resource, @NotNull @NotNull String configName)
Delete configuration or configuration collection data from repository using the inner-most context path as reference.

Parameters:
  `resource` - Context resource
  `configName` - Configuration name

### getConfigurationNames

@NotNull @NotNull SortedSet<String> getConfigurationNames()
Get all configuration names. The results of all configuration metadata provider implementations are merged.

Returns:
  Configuration names

### getConfigurationMetadata

@Nullable @Nullable org.apache.sling.caconfig.spi.metadata.ConfigurationMetadata getConfigurationMetadata(@NotNull @NotNull String configName)
Get configuration metadata from any configuration metadata provider.

Parameters:
  `configName` - Configuration name
Returns:
  Configuration metadata or null if none exists for the given name.

### getPersistenceResourcePath

@Deprecated @Nullable @Nullable String getPersistenceResourcePath(@NotNull @NotNull String configResourcePath)
Deprecated.
Please use `ConfigurationPersistenceStrategyMultiplexer` instead.
Rewrite given resource path or configuration name according to current persistence strategies.

Parameters:
  `configResourcePath` - Resource path or config name
Returns:
  Rewritten resource path or config name