Class PropertyResolvers

java.lang.Object
org.forgerock.config.resolvers.PropertyResolvers

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

    • 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.
    • environmentVariablePropertyResolver

      public static PropertyResolver environmentVariablePropertyResolver()
      Returns:
      a EnvironmentVariableResolver
    • systemPropertyResolver

      public static PropertyResolver systemPropertyResolver()
      Construct a new SystemPropertyResolver.
      Returns:
      a SystemPropertyResolver
    • jsonResolver

      public static PropertyResolver jsonResolver(String filename)
      Construct a new JsonValueResolver using the given filename.
      Parameters:
      filename - The name of the file to obtain the JSON from.
      Returns:
      a JsonValueResolver
    • jsonResolver

      public static PropertyResolver jsonResolver(Path path)
      Construct a new JsonValueResolver using a file at the given path.
      Parameters:
      path - The path of the file to obtain the JSON from.
      Returns:
      a JsonValueResolver
    • jsonResolver

      public static PropertyResolver jsonResolver(File jsonFile)
      Construct a new JsonValueResolver using a given file.
      Parameters:
      jsonFile - the file to obtain the JSON from.
      Returns:
      a JsonValueResolver
    • jsonResolver

      public static PropertyResolver jsonResolver(JsonValue json)
      Construct a new JsonValueResolver using a given a JsonValue.
      Parameters:
      json - The JsonValue for this resolver
      Returns:
      a JsonValueResolver
    • jsonResolver

      public static PropertyResolver jsonResolver(String name, JsonValue json)
      Construct a new JsonValueResolver using a given a JsonValue.
      Parameters:
      name - The name of the JsonValueResolver
      json - The JsonValue for this resolver
      Returns:
      a JsonValueResolver
    • propertiesResolver

      public static PropertyResolver propertiesResolver(Path filename)
      Creates a PropertiesResolver given a file location.
      Parameters:
      filename - the file to obtain the Properties from.
      Returns:
      a PropertiesResolver
    • propertiesResolver

      public static PropertyResolver propertiesResolver(String filename)
      Creates a PropertiesResolver given a file location.
      Parameters:
      filename - the file to obtain the Properties from.
      Returns:
      a PropertiesResolver
    • propertiesResolver

      public static PropertyResolver propertiesResolver(File propertiesFile)
      Creates a PropertiesResolver given a file object.
      Parameters:
      propertiesFile - the properties file as a File object.
      Returns:
      a PropertiesResolver
    • propertiesResolver

      public static PropertyResolver propertiesResolver(Properties properties)
      Creates a PropertiesResolver given a Properties object.
      Parameters:
      properties - the properties as a Properties object.
      Returns:
      a PropertiesResolver
    • propertiesResolver

      public static PropertyResolver propertiesResolver(String name, Properties properties)
      Creates a PropertiesResolver given a Properties object.
      Parameters:
      name - the name of the PropertiesResolver.
      properties - the properties as a Properties object.
      Returns:
      a PropertiesResolver
    • prefixed

      public static PropertyResolver prefixed(String prefix, PropertyResolver delegate)
      Constructs a prefixed PropertyResolver.
      Parameters:
      prefix - prefix (not null)
      delegate - delegate resolver (not null)
      Returns:
      a resolver that handle prefixed keys
    • 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.