Class BatchMetadataCacheBuilderSpec<IdentifierType,MetadataType>
- java.lang.Object
-
- net.shibboleth.oidc.metadata.cache.impl.BaseMetadataCacheBuilderSpec<IdentifierType,MetadataType>
-
- net.shibboleth.oidc.metadata.cache.impl.BatchMetadataCacheBuilderSpec<IdentifierType,MetadataType>
-
- Type Parameters:
IdentifierType- The metadata identifier type.MetadataType- the metadata type.
- All Implemented Interfaces:
MetadataCacheBuilderSpec<IdentifierType,MetadataType>
public class BatchMetadataCacheBuilderSpec<IdentifierType,MetadataType> extends BaseMetadataCacheBuilderSpec<IdentifierType,MetadataType> implements MetadataCacheBuilderSpec<IdentifierType,MetadataType>
A specification for building a batch based read-ahead metadata cache.
-
-
Field Summary
Fields Modifier and Type Field Description private LoadingStrategyloadingStrategyThe function to use to load metadata.private booleanmatchOnIdentifierRequiredIs a match based on an identifier required? If not, all known metadata will be returned.private DurationmaxRefreshDelayRefresh interval used when metadata does not contain any validUntil or cacheDuration information.private DurationminRefreshDelayFloor, in milliseconds, for the refresh interval.private Function<byte[],List<MetadataType>>parsingStrategyHow to parse the loaded metadata from the loadingStrategy into a usable metadatatype.private Function<byte[],Instant>sourceMetadataExpiryStrategyDetermine the expiration time of the source batch loaded metadata.private Predicate<byte[]>sourceMetadataValidPredicateIs the raw metadata bytes from the source valid?
-
Constructor Summary
Constructors Constructor Description BatchMetadataCacheBuilderSpec()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected LoadingStrategygetLoadingStrategy()Get the batch metadata loading strategy.protected DurationgetMaxRefreshDelay()Get the max delay to wait before refreshing metadata.protected DurationgetMinRefreshDelay()Get the min delay to wait before refreshing metadata.protected Function<byte[],List<MetadataType>>getParsingStrategy()Get the raw batch metadata to metadata type parsing strategy.protected Function<byte[],Instant>getSourceMetadataExpiryStrategy()Get the source metadata expiry date strategy.protected Predicate<byte[]>getSourceMetadataValidPredicate()Get the predicate which determines if the source metadata is valid or not.booleanisMatchOnIdentifierRequired()Get if an identifier criteria match is required.voidsetLoadingStrategy(LoadingStrategy strategy)Set the batch metadata loading strategy, applies to theBatchMetadataCachetype.voidsetMatchRequired(boolean required)Set if a match on identifier is required in order to return results.voidsetMaxRefreshDelay(Duration delay)Sets the maximum amount of time between refresh intervals.voidsetMinRefreshDelay(Duration delay)Sets the minimum amount of time between refreshes.voidsetParsingStrategy(Function<byte[],List<MetadataType>> strategy)Set he raw batch metadata to metadata type parsing strategy.voidsetSourceMetadataExpiryStrategy(Function<byte[],Instant> strategy)Set a strategy to find the metadata expiry date from a source metadata document as bytes.voidsetSourceMetadataValidPredicate(Predicate<byte[]> predicate)Set the predicate which determines if the source metadata is valid or not.-
Methods inherited from class net.shibboleth.oidc.metadata.cache.impl.BaseMetadataCacheBuilderSpec
getCacheId, getCriteriaToIdentifierStrategy, getIdentifierExtractionStrategy, getMetadataBeforeRemovalHook, getMetadataFilterStrategy, getMetadataValidPredicate, getRefreshDelayFactor, setCacheId, setCriteriaToIdentifierStrategy, setIdentifierExtractionStrategy, setMetadataBeforeRemovalHook, setMetadataFilterStrategy, setMetadataValidPredicate, setRefreshDelayFactor
-
-
-
-
Field Detail
-
parsingStrategy
@Nullable private Function<byte[],List<MetadataType>> parsingStrategy
How to parse the loaded metadata from the loadingStrategy into a usable metadatatype. Applicable forBatchMetadataCachetypes.
-
loadingStrategy
@Nullable private LoadingStrategy loadingStrategy
The function to use to load metadata. Applicable forBatchMetadataCachetypes.
-
maxRefreshDelay
@Nonnull @Positive private Duration maxRefreshDelay
Refresh interval used when metadata does not contain any validUntil or cacheDuration information. Default value: 4 hours
-
minRefreshDelay
@Nonnull @Positive private Duration minRefreshDelay
Floor, in milliseconds, for the refresh interval. Default value: 5 minutes
-
matchOnIdentifierRequired
@Nonnull private boolean matchOnIdentifierRequired
Is a match based on an identifier required? If not, all known metadata will be returned. Defaults to true - a match on identifier is required.
-
sourceMetadataExpiryStrategy
@Nullable private Function<byte[],Instant> sourceMetadataExpiryStrategy
Determine the expiration time of the source batch loaded metadata.
-
sourceMetadataValidPredicate
@Nonnull private Predicate<byte[]> sourceMetadataValidPredicate
Is the raw metadata bytes from the source valid?
-
-
Method Detail
-
setSourceMetadataValidPredicate
public void setSourceMetadataValidPredicate(@Nonnull Predicate<byte[]> predicate)Set the predicate which determines if the source metadata is valid or not.- Parameters:
predicate- the predicate.
-
getSourceMetadataValidPredicate
@Nonnull protected Predicate<byte[]> getSourceMetadataValidPredicate()
Get the predicate which determines if the source metadata is valid or not.- Returns:
- the predicate.
-
setSourceMetadataExpiryStrategy
public void setSourceMetadataExpiryStrategy(@Nonnull Function<byte[],Instant> strategy)Set a strategy to find the metadata expiry date from a source metadata document as bytes.- Parameters:
strategy- the strategy.
-
getSourceMetadataExpiryStrategy
@Nullable protected Function<byte[],Instant> getSourceMetadataExpiryStrategy()
Get the source metadata expiry date strategy.- Returns:
- the strategy.
-
setMatchRequired
public void setMatchRequired(boolean required)
Set if a match on identifier is required in order to return results. If false and there are no identifiers in the criteria to match on, all cached entries will be returned.- Parameters:
required- does the metadata lookup need to match the given criteria.
-
isMatchOnIdentifierRequired
public boolean isMatchOnIdentifierRequired()
Get if an identifier criteria match is required.- Returns:
- is an identifier criteria match required.
-
getMinRefreshDelay
@Nonnull protected Duration getMinRefreshDelay()
Get the min delay to wait before refreshing metadata.- Returns:
- the min delay.
-
getMaxRefreshDelay
@Nonnull protected Duration getMaxRefreshDelay()
Get the max delay to wait before refreshing metadata.- Returns:
- the max delay.
-
setMinRefreshDelay
public void setMinRefreshDelay(@Positive @Nonnull Duration delay)
Sets the minimum amount of time between refreshes.- Parameters:
delay- minimum amount of time between refreshes
-
setMaxRefreshDelay
public void setMaxRefreshDelay(@Positive @Nonnull Duration delay)
Sets the maximum amount of time between refresh intervals.- Parameters:
delay- maximum amount of time, in milliseconds, between refresh intervals
-
setParsingStrategy
public void setParsingStrategy(@Nonnull Function<byte[],List<MetadataType>> strategy)Set he raw batch metadata to metadata type parsing strategy.- Parameters:
strategy- the parsing strategy.
-
getParsingStrategy
@Nullable protected Function<byte[],List<MetadataType>> getParsingStrategy()
Get the raw batch metadata to metadata type parsing strategy.- Returns:
- the parsing strategy.
-
setLoadingStrategy
public void setLoadingStrategy(@Nonnull LoadingStrategy strategy)Set the batch metadata loading strategy, applies to theBatchMetadataCachetype.- Parameters:
strategy- the strategy to set.
-
getLoadingStrategy
@Nullable protected LoadingStrategy getLoadingStrategy()
Get the batch metadata loading strategy.- Returns:
- the strategy.
-
-