Class PropertyResolvers


  • public final class PropertyResolvers
    extends Object
    A utility class that gives access to the default property resolvers for a product.
    • Method Detail

      • defaultingPropertyResolver

        public static PropertyResolver defaultingPropertyResolver()
        Returns an empty resolver that always return the default value.
        Returns:
        an empty resolver that always return the default value.
      • singletonPropertyResolver

        public static PropertyResolver singletonPropertyResolver​(String key,
                                                                 String value)
        Returns a resolver that knows only to resolve the given key.
        Parameters:
        key - the only resolvable key
        value - the key's value
        Returns:
        a resolver that knows only to resolve the given key.
      • bootstrapPropertyResolver

        public static PropertyResolver bootstrapPropertyResolver​(String productKey,
                                                                 PropertyResolver productPathResolver)
        Get the standard bootstrap property resolver, which is defined as a resolver that checks in turn:
        1. The product paths resolver
        2. Environment variables
        3. System properties
        4. Any external sources defined in the <productKey>.envconfig.dirs system property, or (if it does not exist) the <PRODUCTKEY>_ENVCONFIG_DIRS environment variable, which is treated as a comma-separated list of source directories, where the files in a directory are resolved in a non-deterministic order, and are checked for duplicate keys. The sources are used in the order specified (i.e. the first source has the highest precedence).
        Parameters:
        productKey - Product key (AM, IG, lowercased) to get the appropriate .envconfig.dirs value.
        productPathResolver - A resolver that resolves the product installation details, etc. This resolver might also provide a value for the <productKey>.envconfig.dirs, if the product has an additional mechanism for obtaining that value.
        Returns:
        a property resolver that can be passed to the SubstitutionService(PropertyResolver) constructor, or extended by a product as required.
      • pathPropertyResolver

        public static PropertyResolver pathPropertyResolver​(Map<String,​Path> directories)
        Constructs a path resolver to expose paths and associated URLs.
        Parameters:
        directories - The directories to expose, cannot be null.
        Returns:
        a ProductPathResolver
      • productPathPropertyResolver

        public static PropertyResolver productPathPropertyResolver​(String productKey,
                                                                   Path instanceDirectory)
        Constructs a path resolver to expose a product instance directory.
        Parameters:
        productKey - Used as a prefix for computed key names (lowercased)
        instanceDirectory - The instance directory of this product, cannot be null.
        Returns:
        a ProductPathResolver
      • secretsPropertyResolver

        public static PropertyResolver secretsPropertyResolver​(SecretsProvider secretsProvider)
        Constructs a resolver that looks up GenericSecrets from the given SecretsProvider and converts them to UTF-8 strings. Callers should take care to periodically reload configuration values to ensure that the latest version is picked up when secrets are rotated. The Purpose used to look up secrets will have a label corresponding to the config property name.
        Parameters:
        secretsProvider - the secrets provider to resolve secrets from. Must not be null.
        Returns:
        a property resolver for secrets.