Class DefaultFileLoadingStrategy
- java.lang.Object
-
- net.shibboleth.oidc.metadata.cache.impl.DefaultFileLoadingStrategy
-
- All Implemented Interfaces:
LoadingStrategy
@ThreadSafe public class DefaultFileLoadingStrategy extends Object implements LoadingStrategy
Default strategy for loading information from a file.
-
-
Field Summary
Fields Modifier and Type Field Description private org.slf4j.LoggerlogClass logger.private FilemetadataFileThe metadata file.private StringmetadataFileFriendlyNameThe metadata file name to use in logs.
-
Constructor Summary
Constructors Constructor Description DefaultFileLoadingStrategy(Resource metadata)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private InstantgetMetadataUpdateTime()Get the time for the last update/modification of the metadata file.StringgetSourceIdentifier()Get a friendly name source identifier to use in log statements.byte[]load(CacheLoadingContext context)Load cache data from a source.
-
-
-
Constructor Detail
-
DefaultFileLoadingStrategy
public DefaultFileLoadingStrategy(@Nullable Resource metadata) throws IOExceptionConstructor.- Parameters:
metadata- the metadata file resource. Can be null.- Throws:
IOException- if the file is not null put does not exist.
-
-
Method Detail
-
getMetadataUpdateTime
private Instant getMetadataUpdateTime()
Get the time for the last update/modification of the metadata file.- Returns:
- The last update time.
-
load
@Nullable public byte[] load(@Nonnull CacheLoadingContext context) throws CacheLoadingExceptionDescription copied from interface:LoadingStrategyLoad cache data from a source. If the source data has not changed from the last time it was loaded (as specified in theCacheLoadingContext) anullshould be returned. If source data can not be loaded for a known and accepted reason, anullshould be returned. For any other error in loading cache data, theCacheLoadingExceptionshould be thrown.- Specified by:
loadin interfaceLoadingStrategy- 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()
Description copied from interface:LoadingStrategyGet a friendly name source identifier to use in log statements.- Specified by:
getSourceIdentifierin interfaceLoadingStrategy- Returns:
- the source identifier friendly name.
-
-