Module jpms_dss_spi

Class FileRevocationSource<R extends eu.europa.esig.dss.model.x509.revocation.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 or OCSP
All Implemented Interfaces:
MultipleRevocationSource<R>, RevocationSource<R>, Serializable

public abstract class FileRevocationSource<R extends eu.europa.esig.dss.model.x509.revocation.Revocation> extends RepositoryRevocationSource<R>
Abstract class that extends RepositoryRevocationSource to provide file-based caching functionality for revocation data.
See Also:
  • Constructor Details

    • FileRevocationSource

      protected FileRevocationSource()
      Empty constructor. The proxied revocation source can be provided using the #setProxySource method.
    • FileRevocationSource

      protected FileRevocationSource(RevocationSource<R> proxiedSource)
      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

      public void setFileCacheDirectory(File fileCacheDirectory)
      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

      public File getFileCacheDirectory()
      Gets the cache directory
      Returns:
      File the cache directory
    • findRevocations

      protected List<RevocationToken<R>> findRevocations(String key, eu.europa.esig.dss.model.x509.CertificateToken certificateToken, eu.europa.esig.dss.model.x509.CertificateToken issuerCertToken)
      Description copied from class: RepositoryRevocationSource
      Finds a list of RevocationTokens in the cache for the given certificateToken with the corresponding key
      Specified by:
      findRevocations in class RepositoryRevocationSource<R extends eu.europa.esig.dss.model.x509.revocation.Revocation>
      Parameters:
      key - the key String
      certificateToken - CertificateToken
      issuerCertToken - CertificateToken
      Returns:
      a list of RevocationToken objects
    • insertRevocation

      protected void insertRevocation(String revocationKey, RevocationToken<R> token)
      Description copied from class: RepositoryRevocationSource
      Inserts a new RevocationToken into the cache
      Specified by:
      insertRevocation in class RepositoryRevocationSource<R extends eu.europa.esig.dss.model.x509.revocation.Revocation>
      Parameters:
      revocationKey - String
      token - RevocationToken
    • saveRevocationToken

      protected void saveRevocationToken(FileRevocationSource<R>.FileCacheEntry revocationCache, RevocationToken<R> token)
      Writes the revocationToken within the file system
      Parameters:
      revocationCache - FileRevocationSource<R extends eu.europa.esig.dss.model.x509.revocation.Revocation>.FileCacheEntry
      token - RevocationToken to store
    • updateRevocation

      protected void updateRevocation(String revocationKey, RevocationToken<R> token)
      Description copied from class: RepositoryRevocationSource
      Updates the RevocationToken into cache
      Specified by:
      updateRevocation in class RepositoryRevocationSource<R extends eu.europa.esig.dss.model.x509.revocation.Revocation>
      Parameters:
      revocationKey - String
      token - RevocationToken
    • removeRevocation

      protected void removeRevocation(String revocationKey)
      Description copied from class: RepositoryRevocationSource
      Removes the RevocationToken from cache with the given key
      Specified by:
      removeRevocation in class RepositoryRevocationSource<R extends eu.europa.esig.dss.model.x509.revocation.Revocation>
      Parameters:
      revocationKey - String
    • reconstructTokenFromEncodedData

      protected abstract RevocationToken<R> reconstructTokenFromEncodedData(FileRevocationSource<R>.FileCacheEntry revocationCache, eu.europa.esig.dss.model.x509.CertificateToken certificateToken, eu.europa.esig.dss.model.x509.CertificateToken issuerCertToken)
      Creates a revocation token from cached encoded data
      Parameters:
      revocationCache - FileRevocationSource<R extends eu.europa.esig.dss.model.x509.revocation.Revocation>.FileCacheEntry the cached revocation data entry
      certificateToken - CertificateToken the certificate token
      issuerCertToken - CertificateToken the issuer certificate token
      Returns:
      the revocation token or null if creation fails
    • getRevocationFileExtension

      protected abstract String getRevocationFileExtension()
      Gets the file extension used for cached revocation files.
      Returns:
      the file extension (e.g., ".crl" or ".ocsp")
    • deleteCacheFile

      protected void deleteCacheFile(File cacheFile)
      Deletes a cache file
      Parameters:
      cacheFile - the file to delete
    • clearCache

      public void clearCache()
      Clears all cached files from the cache directory