public class CachingMostRecentProvider extends java.lang.Object implements EncryptionMaterialsProvider
ProviderStore and decrypts using whichever version is appropriate. It also caches the results
from the ProviderStore to avoid excessive load on the backing systems.| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
defaultMaterialName |
| Constructor and Description |
|---|
CachingMostRecentProvider(ProviderStore keystore,
java.lang.String materialName,
long ttlInMillis)
Creates a new
CachingMostRecentProvider. |
CachingMostRecentProvider(ProviderStore keystore,
java.lang.String materialName,
long ttlInMillis,
int maxCacheSize)
Creates a new
CachingMostRecentProvider. |
| Modifier and Type | Method and Description |
|---|---|
long |
getCurrentVersion()
The current version of the materials being used for encryption.
|
DecryptionMaterials |
getDecryptionMaterials(EncryptionContext context)
Retrieves encryption materials matching the specified description from some source.
|
EncryptionMaterials |
getEncryptionMaterials(EncryptionContext context)
Returns EncryptionMaterials which the caller can use for encryption.
|
long |
getLastUpdated()
The last time the current version was updated.
|
java.lang.String |
getMaterialName() |
protected java.lang.String |
getMaterialName(EncryptionContext context) |
long |
getTtlInMills() |
void |
refresh()
Completely empties the cache of both the current and old versions.
|
public CachingMostRecentProvider(ProviderStore keystore, java.lang.String materialName, long ttlInMillis)
CachingMostRecentProvider.keystore - The key store that this provider will use to determine which material and which
version of material to usematerialName - The name of the materials associated with this providerttlInMillis - The length of time in milliseconds to cache the most recent providerpublic CachingMostRecentProvider(ProviderStore keystore, java.lang.String materialName, long ttlInMillis, int maxCacheSize)
CachingMostRecentProvider.keystore - The key store that this provider will use to determine which material and which
version of material to usematerialName - The name of the materials associated with this providerttlInMillis - The length of time in milliseconds to cache the most recent providermaxCacheSize - The maximum size of the underlying caches this provider uses. Entries will
be evicted from the cache once this size is exceeded.public EncryptionMaterials getEncryptionMaterials(EncryptionContext context)
EncryptionMaterialsProvidergetEncryptionMaterials in interface EncryptionMaterialsProvidercontext - Information to assist in selecting a the proper return value. The implementation
is free to determine the minimum necessary for successful processing.public DecryptionMaterials getDecryptionMaterials(EncryptionContext context)
EncryptionMaterialsProvidergetDecryptionMaterials in interface EncryptionMaterialsProvidercontext - Information to assist in selecting a the proper return value. The implementation
is free to determine the minimum necessary for successful processing.public void refresh()
refresh in interface EncryptionMaterialsProviderpublic java.lang.String getMaterialName()
public long getTtlInMills()
public long getCurrentVersion()
public long getLastUpdated()
protected java.lang.String getMaterialName(EncryptionContext context)