Class Vault

Direct Known Subclasses:
EnvironmentVault, PropertiesVault

public abstract class Vault extends StorableObject
An external configuration value source. Commonly used for storing secrets, such as passwords and tokens outside the normal storage tree.
Version:
1.0
  • Field Details

    • KEY_DESCRIPTION

      public static final String KEY_DESCRIPTION
      The dictionary key for the vault description.
      See Also:
    • KEY_GLOBAL

      public static final String KEY_GLOBAL
      The dictionary key for the global flag.
      See Also:
    • PATH

      public static final Path PATH
      The vault object storage path.
  • Constructor Details

    • Vault

      public Vault(String id, String type, Dict dict)
      Creates a new vault from a serialized representation.
      Parameters:
      id - the object identifier
      type - the object type name
      dict - the serialized representation
  • Method Details

    • loadAll

      public static void loadAll(Storage storage)
      Loads all vaults found in the storage to the cache.
      Parameters:
      storage - the storage to search
    • find

      public static Vault find(Storage storage, String id)
      Searches for a specific vault in the storage.
      Parameters:
      storage - the storage to search in
      id - the vault identifier
      Returns:
      the vault found, or null if not found
    • canExpand

      public static boolean canExpand(String text)
      Checks if a string contains variable references.
      Parameters:
      text - the text to check
      Returns:
      true if a variable reference is found, or false otherwise
    • expand

      public static String expand(String text)
      Expands variable references in a string with the values found in the loaded vaults.
      Parameters:
      text - the text to process
      Returns:
      the text with all variable references replaced
    • lookup

      public static String lookup(String id, String key)
      Lookup a specified key value in one or more vaults.
      Parameters:
      id - the vault id, or null for global keys
      key - the key identifier
      Returns:
      the vault value corresponding to the key, or null if the key cannot be found
    • description

      public String description()
      Returns the vault description.
      Returns:
      the vault description.
    • global

      public boolean global()
      Returns the vault global keys flag.
      Returns:
      the vault global keys flag
    • lookup

      public abstract String lookup(String key)
      Lookup a specified key value in this vault.
      Parameters:
      key - the key identifier
      Returns:
      the vault value corresponding to the key, or null if the key cannot be found