Package net.shibboleth.idp.admin.impl

# Class InstallableComponentGaugeSet

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

All Implemented Interfaces:
  `com.codahale.metrics.Metric`, `com.codahale.metrics.MetricFilter`, `com.codahale.metrics.MetricSet`, `Component`, `DestructableComponent`, `IdentifiableComponent`, `IdentifiedComponent`, `InitializableComponent`

public class InstallableComponentGaugeSet extends AbstractIdentifiableInitializableComponent implements com.codahale.metrics.MetricSet, com.codahale.metrics.MetricFilter
Guage set to report the Plugins' and IdP's installation and update statuses.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`(package private) static final record`
`InstallableComponentGaugeSet.InstallableComponentDetails`
Tracks information about an installed component.

## Field Summary

Fields
Modifier and Type
Field
Description
`private InstallableComponentPropertyCache`
`cache`
The cache (to stop us going offsite).
`private static final String`
`DEFAULT_METRIC_NAME`
Default prefix for metrics.
`private final Map<String,com.codahale.metrics.Metric>`
`gauges`
The map of gauges.
`private org.apache.hc.client5.http.classic.HttpClient`
`httpClient`
How to reach out.
`private List<URL>`
`idpUpdateUrls`
Where to look for update information.
`private InstallableComponentVersion`
`idpVersion`
IdP Version to check.
`private final org.slf4j.Logger`
`log`
Logger.
`private HttpClientSecurityParameters`
`securityParams`
any security parameters needed.
`private boolean`
`updateCheckEnabled`
Is update check enabled.

### Fields inherited from interface com.codahale.metrics.MetricFilter

`ALL`

## Constructor Summary

Constructors
Constructor
Description
`InstallableComponentGaugeSet()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`protected void`
`doInitialize()`
`private InstallableComponentGaugeSet.InstallableComponentDetails`
`getIdPDetails()`
Return information about the Installation update state of the IdP.
`(package private) InstallableComponentVersion`
`getIdPVersion()`
Null safe IdP Version.
`Map<String,com.codahale.metrics.Metric>`
`getMetrics()`
`private Map<String,InstallableComponentGaugeSet.InstallableComponentDetails>`
`getPluginDetails()`
Get list of installed plugins and their details.
`private Map<String,InstallableComponentVersion>`
`getPluginList()`
Return the list of installed components and their versions.
`private Properties`
`lookupIdPProperties(@NotNull IdPPlugin plugin, Map<URL,Properties> pluginInfoCache)`
Look in the cache for the URL and return the properties if it's there, otherwise reach out to the URL and load the properties.
`boolean`
`matches(String name, com.codahale.metrics.Metric metric)`
`void`
`setCache(InstallableComponentPropertyCache what)`
Set the the bean which caches information we have phoned home about.
`void`
`setHttpClient(org.apache.hc.client5.http.classic.HttpClient client)`
Set the `HttpClient` to use.
`void`
`setIdpUpdateUrls(List<URL> urls)`
Set where to look for idp update info.
`void`
`setSecurityParams(HttpClientSecurityParameters params)`
Set any `HttpClientSecurityParameters`.
`void`
`setUpdateCheckEnabled(boolean what)`
Set whether to check for IdP and Plugin updates.

### 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

### DEFAULT_METRIC_NAME

@Nonnull @NotEmpty private static final String DEFAULT_METRIC_NAME
Default prefix for metrics.

See Also:
  - Constant Field Values

### log

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

### gauges

@Nonnull private final Map<String,com.codahale.metrics.Metric> gauges
The map of gauges.

### idpUpdateUrls

@Nonnull private List<URL> idpUpdateUrls
Where to look for update information.

### httpClient

@NonnullAfterInit private org.apache.hc.client5.http.classic.HttpClient httpClient
How to reach out.

### securityParams

@Nullable private HttpClientSecurityParameters securityParams
any security parameters needed.

### idpVersion

@NonnullAfterInit private InstallableComponentVersion idpVersion
IdP Version to check.

### cache

@NonnullAfterInit private InstallableComponentPropertyCache cache
The cache (to stop us going offsite).

### updateCheckEnabled

private boolean updateCheckEnabled
Is update check enabled.

## Constructor Details

### InstallableComponentGaugeSet

public InstallableComponentGaugeSet()
Constructor.

## Method Details

### setIdpUpdateUrls

public void setIdpUpdateUrls(@Nonnull List<URL> urls)
Set where to look for idp update info.

Parameters:
  `urls` - what to set.

### setSecurityParams

public void setSecurityParams(@Nullable HttpClientSecurityParameters params)
Set any `HttpClientSecurityParameters`.

Parameters:
  `params` - what to set.

### setHttpClient

public void setHttpClient(@Nonnull org.apache.hc.client5.http.classic.HttpClient client)
Set the `HttpClient` to use.

Parameters:
  `client` - what to set.

### setUpdateCheckEnabled

public void setUpdateCheckEnabled(boolean what)
Set whether to check for IdP and Plugin updates.

Parameters:
  `what` - whether to check or not

### setCache

public void setCache(InstallableComponentPropertyCache what)
Set the the bean which caches information we have phoned home about.

Parameters:
  `what` - what to set

### getIdPVersion

@Nonnull InstallableComponentVersion getIdPVersion()
Null safe IdP Version.

Returns:
  the IdP version

### getPluginList

@Nonnull @NotLive @Unmodifiable private Map<String,InstallableComponentVersion> getPluginList()
Return the list of installed components and their versions.

Returns:
  map where the key is the PluginId and the value is the version

### getPluginDetails

@Nonnull @NotLive @Unmodifiable private Map<String,InstallableComponentGaugeSet.InstallableComponentDetails> getPluginDetails()
Get list of installed plugins and their details.

Returns:
  installed plugins and details

### lookupIdPProperties

@Nullable private Properties lookupIdPProperties(@NotNull @NotNull IdPPlugin plugin, @NullableElements Map<URL,Properties> pluginInfoCache)
Look in the cache for the URL and return the properties if it's there, otherwise reach out to the URL and load the properties.

Parameters:
  `plugin` - the `IdPPlugin` to consider
  `pluginInfoCache` - the cache of already looked up info, also serves as a negative cache
Returns:
  IdP update properties

### getIdPDetails

@Nullable private InstallableComponentGaugeSet.InstallableComponentDetails getIdPDetails()
Return information about the Installation update state of the IdP.

Returns:
  a `InstallableComponentGaugeSet.InstallableComponentDetails`

### doInitialize

protected void doInitialize() throws ComponentInitializationException

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

### getMetrics

public Map<String,com.codahale.metrics.Metric> getMetrics()

Specified by:
  `getMetrics` in interface `com.codahale.metrics.MetricSet`

### matches

public boolean matches(String name, com.codahale.metrics.Metric metric)

Specified by:
  `matches` in interface `com.codahale.metrics.MetricFilter`