Class EuropeanLotlService

java.lang.Object
com.itextpdf.signatures.validation.lotl.LotlService
com.itextpdf.signatures.validation.lotl.EuropeanLotlService
All Implemented Interfaces:
AutoCloseable

public class EuropeanLotlService extends LotlService
This class provides services for managing the Europian List of Trusted Lists (LOTL) and related resources. It includes methods for fetching, validating, and caching LOTL data, as well as managing the European Resource Fetcher and Country-Specific LOTL Fetcher. It also allows for setting custom resource retrievers and cache timeouts.
  • Constructor Details

  • Method Details

    • withLotlServiceCache

      public LotlService withLotlServiceCache (LotlServiceCache cache)
      Sets the cache for the LotlService.

      This method allows you to provide a custom implementation of LotlServiceCache to be used for caching LOTL data, pivot files, and country-specific LOTLs.

      Overrides:
      withLotlServiceCache in class LotlService
      Parameters:
      cache - the custom cache to be used for caching LOTL data
      Returns:
      the current instance of LotlService for method chaining
    • loadFromCache

      public void loadFromCache (InputStream stream)
      Loads the cache from the provided input stream.

      The input stream should contain serialized cache data, which can be created using the LotlService.serializeCache(OutputStream) method.

      Overrides:
      loadFromCache in class LotlService
      Parameters:
      stream - the input stream to read the cached data from
    • getValidationResult

      public ValidationReport getValidationResult()
      Get the validation results for the List of Trusted Lists (LOTL).
      Overrides:
      getValidationResult in class LotlService
      Returns:
      a ValidationReport containing the results of the LOTL validation
    • getNationalTrustedCertificates

      public List<IServiceContext> getNationalTrustedCertificates()
      Retrieves national trusted certificates.
      Overrides:
      getNationalTrustedCertificates in class LotlService
      Returns:
      the list of the national trusted certificates
    • withPivotFetcher

      public LotlService withPivotFetcher (PivotFetcher pivotFetcher)
      Sets the pivot fetcher for the LOTL service.
      Overrides:
      withPivotFetcher in class LotlService
      Parameters:
      pivotFetcher - the pivot fetcher to be used for fetching and validating pivot files
      Returns:
      the current instance of LotlService for method chaining
    • withCountrySpecificLotlFetcher

      public LotlService withCountrySpecificLotlFetcher (CountrySpecificLotlFetcher countrySpecificLotlFetcher)
      Sets the country-specific LOTL fetcher for the LOTL service.
      Overrides:
      withCountrySpecificLotlFetcher in class LotlService
      Parameters:
      countrySpecificLotlFetcher - the country-specific LOTL fetcher to be used for fetching and validating country-specific LOTLs
      Returns:
      the current instance of LotlService for method chaining
    • withEuropeanLotlFetcher

      public LotlService withEuropeanLotlFetcher (EuropeanLotlFetcher fetcher)
      Sets the European List of Trusted Lists (LOTL) byte fetcher for the LOTL service.
      Overrides:
      withEuropeanLotlFetcher in class LotlService
      Parameters:
      fetcher - the fetcher to be used for fetching the LOTL XML data
      Returns:
      the current instance of LotlService for method chaining
    • withEuropeanResourceFetcher

      public LotlService withEuropeanResourceFetcher (EuropeanResourceFetcher europeanResourceFetcher)
      Sets the European Resource Fetcher for the LotlService.
      Overrides:
      withEuropeanResourceFetcher in class LotlService
      Parameters:
      europeanResourceFetcher - the European Resource Fetcher to be used for fetching EU journal certificates
      Returns:
      the current instance of LotlService for method chaining
    • serializeCache

      public void serializeCache (OutputStream outputStream)
      Serializes the current state of the cache to the provided output stream.
      Overrides:
      serializeCache in class LotlService
      Parameters:
      outputStream - the output stream to which the cache will be serialized.
    • loadFromNetwork

      protected void loadFromNetwork()
      Loads the cache from the network by fetching the latest LOTL data and related resources.

      This method fetches the main LOTL file, EU journal certificates, pivot files, and country-specific LOTLs, validates them, and stores them in the cache.

      If the main LOTL fetch fails, the method will throw a PdfException and will not proceed to fetch pivot files or country-specific LOTLs. If a country-specific LOTL fetch fails, the LotlFetchingProperties.getOnCountryFetchFailureStrategy() will be used to handle the failure.

      Note: This method is called during cache initialization and should not be called directly in normal operation.

      Overrides:
      loadFromNetwork in class LotlService
    • tryAndRefreshCache

      protected void tryAndRefreshCache()
      This method is intended to refresh the cache, it will try to download the latest LOTL data and update the cache accordingly.

      The rules taken into account are: Country specific LOTL files will be fetched, validated and updated per country. If country fails to fetch, LotlFetchingProperties.getOnCountryFetchFailureStrategy() will be used to perform corresponding action.

      For the main LOTL file, if the fetch fails, the cache will not be updated. Also, we will NOT proceed to update the pivot files. If the main LOTL file is fetched successfully, the pivot files will be fetched, validated and stored in the cache.

      Overrides:
      tryAndRefreshCache in class LotlService