Class FileRevocationSource<R extends Revocation>
java.lang.Object
eu.europa.esig.dss.spi.x509.revocation.RepositoryRevocationSource<R>
eu.europa.esig.dss.spi.x509.revocation.FileRevocationSource<R>
- Type Parameters:
R
-CRL
orOCSP
- All Implemented Interfaces:
MultipleRevocationSource<R>
,RevocationSource<R>
,Serializable
- Direct Known Subclasses:
FileCacheCRLSource
,FileCacheOCSPSource
public abstract class FileRevocationSource<R extends Revocation>
extends RepositoryRevocationSource<R>
Abstract class that extends
RepositoryRevocationSource
to provide
file-based caching functionality for revocation data.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected class
This class represents a cache entry related to a single revocation token -
Field Summary
Fields inherited from class eu.europa.esig.dss.spi.x509.revocation.RepositoryRevocationSource
proxiedSource
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Empty constructor.protected
FileRevocationSource
(RevocationSource<R> proxiedSource) Constructor that initializes the file revocation source with a proxied revocation source provided. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clears all cached files from the cache directoryprotected void
deleteCacheFile
(File cacheFile) Deletes a cache fileprotected List
<RevocationToken<R>> findRevocations
(String key, CertificateToken certificateToken, CertificateToken issuerCertToken) Finds a list of RevocationTokens in the cache for the givencertificateToken
with the correspondingkey
Gets the cache directoryprotected abstract String
Gets the file extension used for cached revocation files.protected void
insertRevocation
(String revocationKey, RevocationToken<R> token) Inserts a new RevocationToken into the cacheprotected abstract RevocationToken
<R> reconstructTokenFromEncodedData
(FileRevocationSource<R>.FileCacheEntry revocationCache, CertificateToken certificateToken, CertificateToken issuerCertToken) Creates a revocation token from cached encoded dataprotected void
removeRevocation
(String revocationKey) Removes the RevocationToken from cache with the given keyprotected void
saveRevocationToken
(FileRevocationSource<R>.FileCacheEntry revocationCache, RevocationToken<R> token) Writes therevocationToken
within the file systemvoid
setFileCacheDirectory
(File fileCacheDirectory) This method allows to set the file cache directory.protected void
updateRevocation
(String revocationKey, RevocationToken<R> token) Updates the RevocationToken into cacheMethods inherited from class eu.europa.esig.dss.spi.x509.revocation.RepositoryRevocationSource
getRevocationAccessUrls, getRevocationSourceUrl, getRevocationToken, getRevocationToken, getRevocationTokenKey, getRevocationTokens, getRevocationTokens, initRevocationTokenKeys, isNotExpired, setDefaultNextUpdateDelay, setMaxNextUpdateDelay, setProxySource, setRemoveExpired
-
Constructor Details
-
FileRevocationSource
protected FileRevocationSource()Empty constructor. The proxied revocation source can be provided using the#setProxySource
method. -
FileRevocationSource
Constructor that initializes the file revocation source with a proxied revocation source provided.- Parameters:
proxiedSource
-RevocationSource
to be used to load revocation data when the corresponding revocation document is not available in the file system.
-
-
Method Details
-
setFileCacheDirectory
This method allows to set the file cache directory. If the cache folder does not exist then it's created. Default : Temporary directory with a "/dss-cache-revocation" subdirectory- Parameters:
fileCacheDirectory
-File
pointing the cache folder to be used.
-
getFileCacheDirectory
Gets the cache directory- Returns:
File
the cache directory
-
findRevocations
protected List<RevocationToken<R>> findRevocations(String key, CertificateToken certificateToken, CertificateToken issuerCertToken) Description copied from class:RepositoryRevocationSource
Finds a list of RevocationTokens in the cache for the givencertificateToken
with the correspondingkey
- Specified by:
findRevocations
in classRepositoryRevocationSource<R extends Revocation>
- Parameters:
key
- the keyString
certificateToken
-CertificateToken
issuerCertToken
-CertificateToken
- Returns:
- a list of
RevocationToken
objects
-
insertRevocation
Description copied from class:RepositoryRevocationSource
Inserts a new RevocationToken into the cache- Specified by:
insertRevocation
in classRepositoryRevocationSource<R extends Revocation>
- Parameters:
revocationKey
-String
token
-RevocationToken
-
saveRevocationToken
protected void saveRevocationToken(FileRevocationSource<R>.FileCacheEntry revocationCache, RevocationToken<R> token) Writes therevocationToken
within the file system- Parameters:
revocationCache
-FileRevocationSource<R extends Revocation>.FileCacheEntry
token
-RevocationToken
to store
-
updateRevocation
Description copied from class:RepositoryRevocationSource
Updates the RevocationToken into cache- Specified by:
updateRevocation
in classRepositoryRevocationSource<R extends Revocation>
- Parameters:
revocationKey
-String
token
-RevocationToken
-
removeRevocation
Description copied from class:RepositoryRevocationSource
Removes the RevocationToken from cache with the given key- Specified by:
removeRevocation
in classRepositoryRevocationSource<R extends Revocation>
- Parameters:
revocationKey
-String
-
reconstructTokenFromEncodedData
protected abstract RevocationToken<R> reconstructTokenFromEncodedData(FileRevocationSource<R>.FileCacheEntry revocationCache, CertificateToken certificateToken, CertificateToken issuerCertToken) Creates a revocation token from cached encoded data- Parameters:
revocationCache
-FileRevocationSource<R extends Revocation>.FileCacheEntry
the cached revocation data entrycertificateToken
-CertificateToken
the certificate tokenissuerCertToken
-CertificateToken
the issuer certificate token- Returns:
- the revocation token or null if creation fails
-
getRevocationFileExtension
Gets the file extension used for cached revocation files.- Returns:
- the file extension (e.g., ".crl" or ".ocsp")
-
deleteCacheFile
Deletes a cache file- Parameters:
cacheFile
- the file to delete
-
clearCache
public void clearCache()Clears all cached files from the cache directory
-