Class CacheConfigParser
java.lang.Object
net.shibboleth.idp.attribute.resolver.spring.dc.impl.CacheConfigParser
Utility class for parsing v2 cache configuration.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ElementBase XML element.static final longDocumented maximumCachedElements maximum (500).static final DurationDocumented cache lifetime (4 hours).private final org.slf4j.LoggerClass logger.static final QNameResultCache name.static final QNameResultCacheBean name. -
Constructor Summary
ConstructorsConstructorDescriptionCacheConfigParser(Element config) Creates a new cache config parser with the supplied ResultsCache element. -
Method Summary
Modifier and TypeMethodDescriptionstatic Cache<String,Map<String, IdPAttribute>> buildCacheAccess(String timeToLive, String maximumSize) Factory method to leverage spring property replacement functionality.static Cache<String,Map<String, IdPAttribute>> buildCacheWrite(String timeToLive, String maximumSize) Factory method to leverage spring property replacement functionality.Creates a new cache bean definition from a v2 XML configuration.static StringgetBeanResultCacheID(Element config) Get the bean ID of an externally defined result cache.private static longgetMaxSize(String maximumSize) Helper function to return size provided with a suitable default.private static DurationgetTimeToLive(String timeToLive) Helper function to return the TTL with a suitable default.
-
Field Details
-
RESULT_CACHE
ResultCache name. -
RESULT_CACHE_BEAN
ResultCacheBean name. -
DEFAULT_CACHE_ENTRIES
public static final long DEFAULT_CACHE_ENTRIESDocumented maximumCachedElements maximum (500). Unfortunately it has to be here since we do not own the implemented class- See Also:
-
DEFAULT_TTL_MS
Documented cache lifetime (4 hours). Unfortunately it has to be here since we do not own the implemented class. -
log
@Nonnull private final org.slf4j.Logger logClass logger. -
configElement
Base XML element.
-
-
Constructor Details
-
CacheConfigParser
Creates a new cache config parser with the supplied ResultsCache element.- Parameters:
config- LDAPDirectory element
-
-
Method Details
-
createCache
Creates a new cache bean definition from a v2 XML configuration.- Returns:
- cache bean definition
-
getMaxSize
Helper function to return size provided with a suitable default.- Parameters:
maximumSize- long string- Returns:
- the input as a long, or DEFAULT_CACHE_ENTRIES
-
getTimeToLive
Helper function to return the TTL with a suitable default.- Parameters:
timeToLive- duration string- Returns:
- the input as a long, or DEFAULT_TTL_MS
-
buildCacheAccess
@Nullable public static Cache<String,Map<String, buildCacheAccessIdPAttribute>> (@Nullable String timeToLive, @Nullable String maximumSize) Factory method to leverage spring property replacement functionality. The default settings are a max size ofDEFAULT_CACHE_ENTRIESand an expiration timeDEFAULT_TTL_MS. The Cache is set to reset the timer on Access- Parameters:
timeToLive- duration stringmaximumSize- long string- Returns:
- cache
-
buildCacheWrite
@Nullable public static Cache<String,Map<String, buildCacheWriteIdPAttribute>> (@Nullable String timeToLive, @Nullable String maximumSize) Factory method to leverage spring property replacement functionality. The default settings are a max size ofDEFAULT_CACHE_ENTRIESand an expiration timeDEFAULT_TTL_MS. The Cache is set to set the timer on Populate- Parameters:
timeToLive- duration stringmaximumSize- long string- Returns:
- cache
-
getBeanResultCacheID
Get the bean ID of an externally defined result cache.- Parameters:
config- the config element- Returns:
- data source bean ID
-