Package org.apache.sling.caconfig.resource.spi

## Interface ConfigurationResourceResolvingStrategy

    @ConsumerType
    public interface ConfigurationResourceResolvingStrategy

Defines how and where the configuration resources are looked up. This SPI allows application to define their own configuration storage and inheritance strategies. If this strategy supports inheritance for collections, it should use the optional `CollectionInheritanceDecider` SPI interface. If such services are available, they should be called in order of there service ranking, starting with the highest ranking. The first decider service providing a non null return value is used for the decision.

### Method Summary

All Methods Instance Methods Abstract Methods
`@Nullable org.apache.sling.api.resource.Resource` `getResource​(@NotNull org.apache.sling.api.resource.Resource resource, @NotNull Collection<String> bucketNames, @NotNull String configName)` Get a context-aware singleton configuration resource defined by the given configuration name.
`@Nullable Collection<org.apache.sling.api.resource.Resource>` `getResourceCollection​(@NotNull org.apache.sling.api.resource.Resource resource, @NotNull Collection<String> bucketNames, @NotNull String configName)` Get a collection of context-aware configuration resources defined by the given configuration name.
`@Nullable Collection<Iterator<org.apache.sling.api.resource.Resource>>` `getResourceCollectionInheritanceChain​(@NotNull org.apache.sling.api.resource.Resource resource, @NotNull Collection<String> bucketNames, @NotNull String configName)` Get a collection of context-aware configuration resource inheritance chains defined by the given configuration name.
`@Nullable String` `getResourceCollectionParentPath​(@NotNull org.apache.sling.api.resource.Resource resource, @NotNull String bucketName, @NotNull String configName)` Get the configuration resource collection parent path for storing configuration data for the given context resource and configuration name.
`@Nullable Iterator<org.apache.sling.api.resource.Resource>` `getResourceInheritanceChain​(@NotNull org.apache.sling.api.resource.Resource resource, @NotNull Collection<String> bucketNames, @NotNull String configName)` Get a context-aware singleton configuration resource inheritance chain defined by the given configuration name.
`@Nullable String` `getResourcePath​(@NotNull org.apache.sling.api.resource.Resource resource, @NotNull String bucketName, @NotNull String configName)` Get the configuration resource path for storing configuration data for the given context resource and configuration name.

### Method Detail

#### getResource

    @Nullable
    @Nullable org.apache.sling.api.resource.Resource getResource​(@NotNull
                                                                 @NotNull org.apache.sling.api.resource.Resource resource,
                                                                 @NotNull
                                                                 @NotNull Collection<String> bucketNames,
                                                                 @NotNull
                                                                 @NotNull String configName)

Get a context-aware singleton configuration resource defined by the given configuration name.

Parameters:
  `resource` - Context resource to fetch configuration for
  `bucketNames` - Configuration "bucket" names. For each inheritance level all bucket names are tried, and the first one that has a result is included.
  `configName` - Configuration name or relative path.
Returns:
  Configuration resource or `null` if this strategy did not found matching resources.

#### getResourceCollection

    @Nullable
    @Nullable Collection<org.apache.sling.api.resource.Resource> getResourceCollection​(@NotNull
                                                                                       @NotNull org.apache.sling.api.resource.Resource resource,
                                                                                       @NotNull
                                                                                       @NotNull Collection<String> bucketNames,
                                                                                       @NotNull
                                                                                       @NotNull String configName)

Get a collection of context-aware configuration resources defined by the given configuration name.

Parameters:
  `resource` - Context resource to fetch configuration for
  `bucketNames` - Configuration "bucket" names. For each inheritance level all bucket names are tried, and the first one that has a result is included.
  `configName` - Configuration name or relative path.
Returns:
  Collection of configuration resources or `null` if this strategy did not found matching resources.

#### getResourceInheritanceChain

    @Nullable
    @Nullable Iterator<org.apache.sling.api.resource.Resource> getResourceInheritanceChain​(@NotNull
                                                                                           @NotNull org.apache.sling.api.resource.Resource resource,
                                                                                           @NotNull
                                                                                           @NotNull Collection<String> bucketNames,
                                                                                           @NotNull
                                                                                           @NotNull String configName)

Get a context-aware singleton configuration resource inheritance chain defined by the given configuration name. The first item of the inheritance chain it the same resource returned by `getResource(Resource, Collection, String)`.

Parameters:
  `resource` - Context resource to fetch configuration for
  `bucketNames` - Configuration "bucket" names. For each inheritance level all bucket names are tried, and the first one that has a result is included.
  `configName` - Configuration name or relative path.
Returns:
  Configuration resource inheritance chain or `null` if this strategy did not found matching resources.

#### getResourceCollectionInheritanceChain

    @Nullable
    @Nullable Collection<Iterator<org.apache.sling.api.resource.Resource>> getResourceCollectionInheritanceChain​(@NotNull
                                                                                                                 @NotNull org.apache.sling.api.resource.Resource resource,
                                                                                                                 @NotNull
                                                                                                                 @NotNull Collection<String> bucketNames,
                                                                                                                 @NotNull
                                                                                                                 @NotNull String configName)

Get a collection of context-aware configuration resource inheritance chains defined by the given configuration name. The first item of each inheritance chain is the same item returned by `getResourceCollection(Resource, Collection, String)`.

Parameters:
  `resource` - Context resource to fetch configuration for
  `bucketNames` - Configuration "bucket" names. For each inheritance level all bucket names are tried, and the first one that has a result is included.
  `configName` - Configuration name or relative path.
Returns:
  Collection of configuration resource inheritance chains or `null` if this strategy did not found matching resources.

#### getResourcePath

    @Nullable
    @Nullable String getResourcePath​(@NotNull
                                     @NotNull org.apache.sling.api.resource.Resource resource,
                                     @NotNull
                                     @NotNull String bucketName,
                                     @NotNull
                                     @NotNull String configName)

Get the configuration resource path for storing configuration data for the given context resource and configuration name. This path is used when no configuration resource exists yet, but new configuration data should be stored. So usually the returned path does not yet exist (and perhaps not even it's parents).

Parameters:
  `resource` - Context resource to fetch configuration for
  `bucketName` - Configuration "bucket" name. Each high-level configuration resolver should store it's configuration data grouped in a child resource of the configuration resource. This is what we call a "bucket", and the resource name is specified with this parameter.
  `configName` - Configuration name or relative path.
Returns:
  Resource path, or null if no matching configuration resource path can be determined

#### getResourceCollectionParentPath

    @Nullable
    @Nullable String getResourceCollectionParentPath​(@NotNull
                                                     @NotNull org.apache.sling.api.resource.Resource resource,
                                                     @NotNull
                                                     @NotNull String bucketName,
                                                     @NotNull
                                                     @NotNull String configName)

Get the configuration resource collection parent path for storing configuration data for the given context resource and configuration name. This path is used when no configuration resource collection exists yet, but new configuration data should be stored. So usually the returned path does not yet exist (and perhaps not even it's parents).

Parameters:
  `resource` - Context resource to fetch configuration for
  `bucketName` - Configuration "bucket" name. Each high-level configuration resolver should store it's configuration data grouped in a child resource of the configuration resource. This is what we call a "bucket", and the resource name is specified with this parameter.
  `configName` - Configuration name or relative path.
Returns:
  Resource path, or null if no matching configuration resource path can be determined