Class DefaultResourceLoadingStrategy

java.lang.Object
net.shibboleth.oidc.metadata.cache.impl.DefaultResourceLoadingStrategy
All Implemented Interfaces:
LoadingStrategy

@ThreadSafe public class DefaultResourceLoadingStrategy extends Object implements LoadingStrategy
Default strategy for loading information from a resource.
Since:
3.1.0
  • Field Details

    • log

      @Nonnull private final org.slf4j.Logger log
      Class logger.
    • metadataResource

      @Nullable private final Resource metadataResource
      The metadata resource.
    • metadataResourceFriendlyName

      @Nonnull @NotEmpty private final String metadataResourceFriendlyName
      The metadata resource name to use in logs.
  • Constructor Details

    • DefaultResourceLoadingStrategy

      public DefaultResourceLoadingStrategy(@Nullable Resource metadata)
      Constructor.
      Parameters:
      metadata - the metadata resource. Can be null.
  • Method Details

    • getMetadataUpdateTime

      @Nullable private Instant getMetadataUpdateTime() throws IOException
      Get the time for the last update/modification of the metadata resource.
      Returns:
      The last update time.
      Throws:
      IOException - if the time cannot be fetched.
    • load

      @Nullable public byte[] load(@Nonnull CacheLoadingContext context) throws CacheLoadingException
      Load cache data from a source. If the source data has not changed from the last time it was loaded (as specified in the CacheLoadingContext) a null should be returned. If source data can not be loaded for a known and accepted reason, a null should be returned. For any other error in loading cache data, the CacheLoadingException should be thrown.
      Specified by:
      load in interface LoadingStrategy
      Parameters:
      context - the cache loading context
      Returns:
      the cache information as bytes.
      Throws:
      CacheLoadingException - if there is an error loading the cache.
    • getSourceIdentifier

      @Nonnull public String getSourceIdentifier()
      Get a friendly name source identifier to use in log statements.
      Specified by:
      getSourceIdentifier in interface LoadingStrategy
      Returns:
      the source identifier friendly name.