Class DefaultConfigurationResourceResolvingStrategy
java.lang.Object
org.apache.sling.caconfig.resource.impl.def.DefaultConfigurationResourceResolvingStrategy
- All Implemented Interfaces:
ConfigurationResourceResolvingStrategy
public class DefaultConfigurationResourceResolvingStrategy
extends Object
implements ConfigurationResourceResolvingStrategy
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic @interface
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetResource
(@NotNull Resource contentResource, @NotNull Collection<String> bucketNames, @NotNull String configName) Get a context-aware singleton configuration resource defined by the given configuration name.getResourceCollection
(@NotNull Resource contentResource, @NotNull Collection<String> bucketNames, @NotNull String configName) Get a collection of context-aware configuration resources defined by the given configuration name.getResourceCollectionInheritanceChain
(@NotNull Resource contentResource, @NotNull Collection<String> bucketNames, @NotNull String configName) Get a collection of context-aware configuration resource inheritance chains defined by the given configuration name.getResourceCollectionParentPath
(@NotNull Resource contentResource, @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.getResourceInheritanceChain
(@NotNull Resource contentResource, @NotNull Collection<String> bucketNames, @NotNull String configName) Get a context-aware singleton configuration resource inheritance chain defined by the given configuration name.getResourcePath
(@NotNull Resource contentResource, @NotNull String bucketName, @NotNull String configName) Get the configuration resource path for storing configuration data for the given context resource and configuration name.
-
Constructor Details
-
DefaultConfigurationResourceResolvingStrategy
public DefaultConfigurationResourceResolvingStrategy()
-
-
Method Details
-
getResource
public Resource getResource(@NotNull @NotNull Resource contentResource, @NotNull @NotNull Collection<String> bucketNames, @NotNull @NotNull String configName) Description copied from interface:ConfigurationResourceResolvingStrategy
Get a context-aware singleton configuration resource defined by the given configuration name.- Specified by:
getResource
in interfaceConfigurationResourceResolvingStrategy
- Parameters:
contentResource
- Context resource to fetch configuration forbucketNames
- 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.
-
getResourceInheritanceChain
public Iterator<Resource> getResourceInheritanceChain(@NotNull @NotNull Resource contentResource, @NotNull @NotNull Collection<String> bucketNames, @NotNull @NotNull String configName) Description copied from interface:ConfigurationResourceResolvingStrategy
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 byConfigurationResourceResolvingStrategy.getResource(Resource, Collection, String)
.- Specified by:
getResourceInheritanceChain
in interfaceConfigurationResourceResolvingStrategy
- Parameters:
contentResource
- Context resource to fetch configuration forbucketNames
- 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.
-
getResourceCollection
public Collection<Resource> getResourceCollection(@NotNull @NotNull Resource contentResource, @NotNull @NotNull Collection<String> bucketNames, @NotNull @NotNull String configName) Description copied from interface:ConfigurationResourceResolvingStrategy
Get a collection of context-aware configuration resources defined by the given configuration name.- Specified by:
getResourceCollection
in interfaceConfigurationResourceResolvingStrategy
- Parameters:
contentResource
- Context resource to fetch configuration forbucketNames
- 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.
-
getResourceCollectionInheritanceChain
public Collection<Iterator<Resource>> getResourceCollectionInheritanceChain(@NotNull @NotNull Resource contentResource, @NotNull @NotNull Collection<String> bucketNames, @NotNull @NotNull String configName) Description copied from interface:ConfigurationResourceResolvingStrategy
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 byConfigurationResourceResolvingStrategy.getResourceCollection(Resource, Collection, String)
.- Specified by:
getResourceCollectionInheritanceChain
in interfaceConfigurationResourceResolvingStrategy
- Parameters:
contentResource
- Context resource to fetch configuration forbucketNames
- 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
public String getResourcePath(@NotNull @NotNull Resource contentResource, @NotNull @NotNull String bucketName, @NotNull @NotNull String configName) Description copied from interface:ConfigurationResourceResolvingStrategy
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).- Specified by:
getResourcePath
in interfaceConfigurationResourceResolvingStrategy
- Parameters:
contentResource
- Context resource to fetch configuration forbucketName
- 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
public String getResourceCollectionParentPath(@NotNull @NotNull Resource contentResource, @NotNull @NotNull String bucketName, @NotNull @NotNull String configName) Description copied from interface:ConfigurationResourceResolvingStrategy
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).- Specified by:
getResourceCollectionParentPath
in interfaceConfigurationResourceResolvingStrategy
- Parameters:
contentResource
- Context resource to fetch configuration forbucketName
- 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
-