Package net.shibboleth.idp.admin.impl

# Class InstallableComponentPropertyCache

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
net.shibboleth.idp.admin.impl.InstallableComponentPropertyCache

All Implemented Interfaces:
  `Component`, `DestructableComponent`, `IdentifiableComponent`, `IdentifiedComponent`, `InitializableComponent`

public class InstallableComponentPropertyCache extends AbstractIdentifiableInitializableComponent
A caching shim on top of `InstallableComponentSupport.loadInfo(List, HttpClient, HttpClientSecurityParameters)`.

## Field Summary

Fields
Modifier and Type
Field
Description
`private final Map<URL,Pair<Instant,Properties>>`
`cache`
The cache.
`private Duration`
`cacheLife`
How long before a cached entry expires.
`private final org.slf4j.Logger`
`log`
Logger.
`private final ReadWriteLock`
`readWriteLock`
Shared lock.

## Constructor Summary

Constructors
Constructor
Description
`InstallableComponentPropertyCache()`

## Method Summary

Modifier and Type
Method
Description
`protected void`
`doInitialize()`
`Properties`
`loadInfo(List<URL> updateURLs, org.apache.hc.client5.http.classic.HttpClient client, HttpClientSecurityParameters securityParameters)`
Provide a shim on top of `InstallableComponentSupport.loadInfo(List, HttpClient, HttpClientSecurityParameters)`.
`void`
`setCacheLife(Duration howLong)`
Set `cacheLife`.

### Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent

`setId`

### Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent

`ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException`

### Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent

`checkComponentActive, checkSetterPreconditions, destroy, doDestroy, initialize, isDestroyed, isInitialized`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface net.shibboleth.shared.component.IdentifiedComponent

`getId`

## Field Details

### log

@Nonnull private final org.slf4j.Logger log
Logger.

### cache

@Nonnull private final Map<URL,Pair<Instant,Properties>> cache
The cache.

### cacheLife

@NonnullAfterInit private Duration cacheLife
How long before a cached entry expires.

### readWriteLock

@Nonnull private final ReadWriteLock readWriteLock
Shared lock.

## Constructor Details

### InstallableComponentPropertyCache

public InstallableComponentPropertyCache()

## Method Details

### setCacheLife

public void setCacheLife(@Nullable Duration howLong)
Set `cacheLife`.

Parameters:
  `howLong` - what to set

### doInitialize

protected void doInitialize() throws ComponentInitializationException

Overrides:
  `doInitialize` in class `AbstractIdentifiedInitializableComponent`
Throws:
  `ComponentInitializationException`

### loadInfo

@Nullable public Properties loadInfo(@Nonnull List<URL> updateURLs, @Nonnull org.apache.hc.client5.http.classic.HttpClient client, @Nullable HttpClientSecurityParameters securityParameters)
Provide a shim on top of `InstallableComponentSupport.loadInfo(List, HttpClient, HttpClientSecurityParameters)`.

We use the first URL in the list as the cache key.

Parameters:
  `updateURLs` - where to look
  `client` - the http client to use
  `securityParameters` - the HttpClientSecurityParameters, if any
Returns:
  the property files for the component.