Interface ConfigurationResourceResolvingStrategy

  • All Known Subinterfaces:
    ConfigurationResourceResolvingStrategyMultiplexer

    @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 
      Modifier and Type Method Description
      @Nullable Resource getResource​(@NotNull Resource resource, @NotNull java.util.Collection<java.lang.String> bucketNames, @NotNull java.lang.String configName)
      Get a context-aware singleton configuration resource defined by the given configuration name.
      @Nullable java.util.Collection<Resource> getResourceCollection​(@NotNull Resource resource, @NotNull java.util.Collection<java.lang.String> bucketNames, @NotNull java.lang.String configName)
      Get a collection of context-aware configuration resources defined by the given configuration name.
      @Nullable java.util.Collection<java.util.Iterator<Resource>> getResourceCollectionInheritanceChain​(@NotNull Resource resource, @NotNull java.util.Collection<java.lang.String> bucketNames, @NotNull java.lang.String configName)
      Get a collection of context-aware configuration resource inheritance chains defined by the given configuration name.
      @Nullable java.lang.String getResourceCollectionParentPath​(@NotNull Resource resource, @NotNull java.lang.String bucketName, @NotNull java.lang.String configName)
      Get the configuration resource collection parent path for storing configuration data for the given context resource and configuration name.
      @Nullable java.util.Iterator<Resource> getResourceInheritanceChain​(@NotNull Resource resource, @NotNull java.util.Collection<java.lang.String> bucketNames, @NotNull java.lang.String configName)
      Get a context-aware singleton configuration resource inheritance chain defined by the given configuration name.
      @Nullable java.lang.String getResourcePath​(@NotNull Resource resource, @NotNull java.lang.String bucketName, @NotNull java.lang.String configName)
      Get the configuration resource path for storing configuration data for the given context resource and configuration name.
    • Method Detail

      • getResource

        @Nullable
        @Nullable Resource getResource​(@NotNull
                                       @NotNull Resource resource,
                                       @NotNull
                                       @NotNull java.util.Collection<java.lang.String> bucketNames,
                                       @NotNull
                                       @NotNull java.lang.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 java.util.Collection<Resource> getResourceCollection​(@NotNull
                                                                       @NotNull Resource resource,
                                                                       @NotNull
                                                                       @NotNull java.util.Collection<java.lang.String> bucketNames,
                                                                       @NotNull
                                                                       @NotNull java.lang.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 java.util.Iterator<Resource> getResourceInheritanceChain​(@NotNull
                                                                           @NotNull Resource resource,
                                                                           @NotNull
                                                                           @NotNull java.util.Collection<java.lang.String> bucketNames,
                                                                           @NotNull
                                                                           @NotNull java.lang.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 java.util.Collection<java.util.Iterator<Resource>> getResourceCollectionInheritanceChain​(@NotNull
                                                                                                           @NotNull Resource resource,
                                                                                                           @NotNull
                                                                                                           @NotNull java.util.Collection<java.lang.String> bucketNames,
                                                                                                           @NotNull
                                                                                                           @NotNull java.lang.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 java.lang.String getResourcePath​(@NotNull
                                                   @NotNull Resource resource,
                                                   @NotNull
                                                   @NotNull java.lang.String bucketName,
                                                   @NotNull
                                                   @NotNull java.lang.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 java.lang.String getResourceCollectionParentPath​(@NotNull
                                                                   @NotNull Resource resource,
                                                                   @NotNull
                                                                   @NotNull java.lang.String bucketName,
                                                                   @NotNull
                                                                   @NotNull java.lang.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