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-CRLorOCSP
- 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 classThis 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
ConstructorsModifierConstructorDescriptionprotectedEmpty constructor.protectedFileRevocationSource(RevocationSource<R> proxiedSource) Constructor that initializes the file revocation source with a proxied revocation source provided. -
Method Summary
Modifier and TypeMethodDescriptionvoidClears all cached files from the cache directoryprotected voiddeleteCacheFile(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 givencertificateTokenwith the correspondingkeyGets the cache directoryprotected abstract StringGets the file extension used for cached revocation files.protected voidinsertRevocation(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 voidremoveRevocation(String revocationKey) Removes the RevocationToken from cache with the given keyprotected voidsaveRevocationToken(FileRevocationSource<R>.FileCacheEntry revocationCache, RevocationToken<R> token) Writes therevocationTokenwithin the file systemvoidsetFileCacheDirectory(File fileCacheDirectory) This method allows to set the file cache directory.protected voidupdateRevocation(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#setProxySourcemethod. -
FileRevocationSource
Constructor that initializes the file revocation source with a proxied revocation source provided.- Parameters:
proxiedSource-RevocationSourceto 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-Filepointing the cache folder to be used.
-
getFileCacheDirectory
Gets the cache directory- Returns:
Filethe cache directory
-
findRevocations
protected List<RevocationToken<R>> findRevocations(String key, CertificateToken certificateToken, CertificateToken issuerCertToken) Description copied from class:RepositoryRevocationSourceFinds a list of RevocationTokens in the cache for the givencertificateTokenwith the correspondingkey- Specified by:
findRevocationsin classRepositoryRevocationSource<R extends Revocation>- Parameters:
key- the keyStringcertificateToken-CertificateTokenissuerCertToken-CertificateToken- Returns:
- a list of
RevocationTokenobjects
-
insertRevocation
Description copied from class:RepositoryRevocationSourceInserts a new RevocationToken into the cache- Specified by:
insertRevocationin classRepositoryRevocationSource<R extends Revocation>- Parameters:
revocationKey-Stringtoken-RevocationToken
-
saveRevocationToken
protected void saveRevocationToken(FileRevocationSource<R>.FileCacheEntry revocationCache, RevocationToken<R> token) Writes therevocationTokenwithin the file system- Parameters:
revocationCache-FileRevocationSource<R extends Revocation>.FileCacheEntrytoken-RevocationTokento store
-
updateRevocation
Description copied from class:RepositoryRevocationSourceUpdates the RevocationToken into cache- Specified by:
updateRevocationin classRepositoryRevocationSource<R extends Revocation>- Parameters:
revocationKey-Stringtoken-RevocationToken
-
removeRevocation
Description copied from class:RepositoryRevocationSourceRemoves the RevocationToken from cache with the given key- Specified by:
removeRevocationin 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>.FileCacheEntrythe cached revocation data entrycertificateToken-CertificateTokenthe certificate tokenissuerCertToken-CertificateTokenthe 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
-