Package org.rapidcontext.core.type
Class Vault
java.lang.Object
org.rapidcontext.core.storage.StorableObject
org.rapidcontext.core.type.Vault
- Direct Known Subclasses:
EnvironmentVault,PropertiesVault
An external configuration value source. Commonly used for storing
secrets, such as passwords and tokens outside the normal storage
tree.
- Version:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe dictionary key for the vault description.static final StringThe dictionary key for the global flag.static final PathThe vault object storage path.Fields inherited from class org.rapidcontext.core.storage.StorableObject
dict, KEY_ACTIVATED_TIME, KEY_CLASSNAME, KEY_ID, KEY_TYPE, PREFIX_COMPUTED, PREFIX_HIDDEN -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanChecks if a string contains variable references.Returns the vault description.static StringExpands variable references in a string with the values found in the loaded vaults.static VaultSearches for a specific vault in the storage.booleanglobal()Returns the vault global keys flag.static voidLoads all vaults found in the storage to the cache.abstract StringLookup a specified key value in this vault.static StringLookup a specified key value in one or more vaults.Methods inherited from class org.rapidcontext.core.storage.StorableObject
activate, activatedTime, destroy, dictKey, id, init, isActive, isModified, passivate, path, serialize, sterilize, toString, type
-
Field Details
-
KEY_DESCRIPTION
The dictionary key for the vault description.- See Also:
-
KEY_GLOBAL
The dictionary key for the global flag.- See Also:
-
PATH
The vault object storage path.
-
-
Constructor Details
-
Vault
Creates a new vault from a serialized representation.- Parameters:
id- the object identifiertype- the object type namedict- the serialized representation
-
-
Method Details
-
loadAll
Loads all vaults found in the storage to the cache.- Parameters:
storage- the storage to search
-
find
Searches for a specific vault in the storage.- Parameters:
storage- the storage to search inid- the vault identifier- Returns:
- the vault found, or null if not found
-
canExpand
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
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
Lookup a specified key value in one or more vaults.- Parameters:
id- the vault id, or null for global keyskey- the key identifier- Returns:
- the vault value corresponding to the key, or null if the key cannot be found
-
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
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
-