M - OpenPGPCertificate or OpenPGPKeypublic abstract class OpenPGPKeyMaterialPool<M extends OpenPGPCertificate> extends java.lang.Object implements OpenPGPKeyMaterialProvider<M>
OpenPGPKeyMaterialProvider which caches items in a HashMap.
It allows to provide key or certificates dynamically via a callback that can be set using
setMissingItemCallback(OpenPGPKeyMaterialProvider).
Results from this callback are automatically cached for later access. This behavior can be adjusted via
setCacheResultsFromCallback(boolean).| Modifier and Type | Class and Description |
|---|---|
static class |
OpenPGPKeyMaterialPool.OpenPGPCertificatePool
Implementation of
OpenPGPKeyMaterialPool tailored to providing
OpenPGPCertificates. |
static class |
OpenPGPKeyMaterialPool.OpenPGPKeyPool
Implementation of
OpenPGPKeyMaterialPool tailored to provide OpenPGPKeys. |
OpenPGPKeyMaterialProvider.OpenPGPCertificateProvider, OpenPGPKeyMaterialProvider.OpenPGPKeyProvider| Constructor and Description |
|---|
OpenPGPKeyMaterialPool()
Create an empty pool.
|
OpenPGPKeyMaterialPool(java.util.Collection<M> items)
Create a pool and initialize its contents with the provided collection of items.
|
OpenPGPKeyMaterialPool(M item)
Create a pool from the single provided item.
|
| Modifier and Type | Method and Description |
|---|---|
OpenPGPKeyMaterialPool<M> |
addItem(M item)
Add a certificate to the pool.
|
java.util.Collection<M> |
getAllItems()
Return all items from the pool.
|
M |
provide(KeyIdentifier componentKeyIdentifier)
Provide the requested
OpenPGPCertificate or OpenPGPKey containing the component key identified
by the passed in KeyIdentifier. |
OpenPGPKeyMaterialPool<M> |
setCacheResultsFromCallback(boolean cacheResults)
Decide, whether the implementation should add
certificates returned by
callback to the pool of cached certificates. |
OpenPGPKeyMaterialPool<M> |
setMissingItemCallback(OpenPGPKeyMaterialProvider<M> callback)
Set a callback that gets fired whenever an item is requested, which is not found in the pool.
|
public OpenPGPKeyMaterialPool()
public OpenPGPKeyMaterialPool(M item)
item - itempublic OpenPGPKeyMaterialPool(java.util.Collection<M> items)
items - collection of keys or certificatespublic OpenPGPKeyMaterialPool<M> setMissingItemCallback(OpenPGPKeyMaterialProvider<M> callback)
callback - callbackpublic OpenPGPKeyMaterialPool<M> setCacheResultsFromCallback(boolean cacheResults)
certificates returned by
callback to the pool of cached certificates.cacheResults - if true, cache certificates from callbackpublic M provide(KeyIdentifier componentKeyIdentifier)
OpenPGPKeyMaterialProviderOpenPGPCertificate or OpenPGPKey containing the component key identified
by the passed in KeyIdentifier.provide in interface OpenPGPKeyMaterialProvider<M extends OpenPGPCertificate>componentKeyIdentifier - identifier of a component key (primary key or subkey)public OpenPGPKeyMaterialPool<M> addItem(M item)
item - OpenPGP key or certificate that shall be added into the poolpublic java.util.Collection<M> getAllItems()