Package net.shibboleth.idp.attribute.resolver

# Class AbstractDataConnector

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
net.shibboleth.idp.attribute.resolver.AbstractResolverPlugin<Map<String,IdPAttribute>>
net.shibboleth.idp.attribute.resolver.AbstractDataConnector

All Implemented Interfaces:
  `DataConnector`, `ResolverPlugin<Map<String,IdPAttribute>>`, `Component`, `DestructableComponent`, `IdentifiableComponent`, `IdentifiedComponent`, `InitializableComponent`, `UnmodifiableComponent`, `DisposableBean`

Direct Known Subclasses:
  `AbstractSearchDataConnector`, `ContextDerivedDataConnector`, `EntityAttributesDataConnector`, `MockDataConnector`, `MockStaticDataConnector`, `PairwiseIdDataConnector`, `ResolvedDataConnector`, `SAMLAttributeDataConnector`, `SimpleAggregationSAMLDataConnector`, `StaticDataConnector`, `TestSources.StaticDataConnector`

@ThreadSafe public abstract class AbstractDataConnector extends AbstractResolverPlugin<Map<String,IdPAttribute>> implements DataConnector
Base class for data connector resolver plugins.

## Field Summary

Fields
Modifier and Type
Field
Description
`private Collection<String>`
`exportAttributes`
Which named attributes do we release?.
`private String`
`failoverDataConnectorId`
ID of the data connector to use if this one fails.
`private Instant`
`lastFail`
When did this connector last fail?
`private Instant`
`lastSuccess`
When did this connector last work?
`private final org.slf4j.Logger`
`log`
Class logger.
`private String`
`logPrefix`
cache for the log prefix - to save multiple recalculations.
`private Duration`
`noRetryDelay`
How long to wait until we declare the connector live again.

## Constructor Summary

Constructors
Constructor
Description
`AbstractDataConnector()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`protected abstract Map<String,IdPAttribute>`
`doDataConnectorResolve(AttributeResolutionContext resolutionContext, AttributeResolverWorkContext workContext)`
Retrieves a collection of attributes from some data source.
`protected void`
`doInitialize()`
`final Map<String,IdPAttribute>`
`doResolve(AttributeResolutionContext resolutionContext, AttributeResolverWorkContext workContext)`
Perform the actual resolution.
`Collection<String>`
`getExportAttributes()`
Gets the list of attribute names to export during resolution.
`String`
`getFailoverDataConnectorId()`
Gets the ID of the `AbstractDataConnector` whose values will be used in the event that this data connector experiences an error.
`Instant`
`getLastFail()`
Get the time when this connector last failed.
`Instant`
`getLastSuccess()`
Get the time when this connector last succeeded.
`protected String`
`getLogPrefix()`
Return a string which is to be prepended to all log messages.
`Duration`
`getNoRetryDelay()`
Get how long to wait until we declare the connector (potentially) alive again.
`void`
`setExportAttributes(Collection<String> what)`
Sets the list of attribute names to export during resolution.
`void`
`setFailoverDataConnectorId(String id)`
Set the ID of the `AbstractDataConnector` whose values will be used in the event that this data connector experiences an error.
`void`
`setLastFail(Instant time)`
Set the time when this connector last failed.
`void`
`setLastSuccess(Instant time)`
Set the time when this connector last worked.
`void`
`setNoRetryDelay(Duration delay)`
Set how long to wait until we declare the connector (potentially) alive again.

### Methods inherited from class net.shibboleth.idp.attribute.resolver.AbstractResolverPlugin

`doDestroy, equals, getActivationCondition, getAttributeDependencies, getDataConnectorDependencies, hashCode, isPropagateResolutionExceptions, resolve, setActivationCondition, setAttributeDependencies, setDataConnectorDependencies, setPropagateResolutionExceptions`

### 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, initialize, isDestroyed, isInitialized`

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

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

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

`destroy, isDestroyed`

### Methods inherited from interface org.springframework.beans.factory.DisposableBean

`destroy`

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

`getId`

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

`initialize, isInitialized`

### Methods inherited from interface net.shibboleth.idp.attribute.resolver.ResolverPlugin

`getActivationCondition, getAttributeDependencies, getDataConnectorDependencies, isPropagateResolutionExceptions, resolve`

## Field Details

### log

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

### failoverDataConnectorId

@Nullable private String failoverDataConnectorId
ID of the data connector to use if this one fails.

### logPrefix

@Nullable private String logPrefix
cache for the log prefix - to save multiple recalculations.

### lastSuccess

@Nullable private Instant lastSuccess
When did this connector last work?

### lastFail

@Nullable private Instant lastFail
When did this connector last fail?

### noRetryDelay

@Nonnull private Duration noRetryDelay
How long to wait until we declare the connector live again.

### exportAttributes

@Nonnull @Unmodifiable private Collection<String> exportAttributes
Which named attributes do we release?.

## Constructor Details

### AbstractDataConnector

public AbstractDataConnector()
Constructor.

## Method Details

### getFailoverDataConnectorId

@Nullable public String getFailoverDataConnectorId()
Gets the ID of the `AbstractDataConnector` whose values will be used in the event that this data connector experiences an error.

Specified by:
  `getFailoverDataConnectorId` in interface `DataConnector`
Returns:
  ID of the `AbstractDataConnector` whose values will be used in the event that this data connector experiences an error

### setFailoverDataConnectorId

public void setFailoverDataConnectorId(@Nullable String id)
Set the ID of the `AbstractDataConnector` whose values will be used in the event that this data connector experiences an error.

Parameters:
  `id` - ID of the `AbstractDataConnector` whose values will be used in the event that this data connector experiences an error

### setLastSuccess

public void setLastSuccess(@Nullable Instant time)
Set the time when this connector last worked.

Parameters:
  `time` - what to set
Since:
  4.1.0

### getLastSuccess

@Nullable public Instant getLastSuccess()
Get the time when this connector last succeeded. TODO: Remove default in V5.

Specified by:
  `getLastSuccess` in interface `DataConnector`
Returns:
  when it last succeeded

### setLastFail

public void setLastFail(@Nullable Instant time)
Set the time when this connector last failed.

Parameters:
  `time` - what to set

### getLastFail

@Nullable public Instant getLastFail()
Get the time when this connector last failed. This will be set for any exception regardless of the setting of `ResolverPlugin.isPropagateResolutionExceptions()`

Specified by:
  `getLastFail` in interface `DataConnector`
Returns:
  when it last failed

### setNoRetryDelay

public void setNoRetryDelay(@Nonnull Duration delay)
Set how long to wait until we declare the connector (potentially) alive again.

Parameters:
  `delay` - what to set

### getNoRetryDelay

@Nonnull public Duration getNoRetryDelay()
Get how long to wait until we declare the connector (potentially) alive again.

Specified by:
  `getNoRetryDelay` in interface `DataConnector`
Returns:
  how long to wait.

### setExportAttributes

public void setExportAttributes(@Nonnull Collection<String> what)
Sets the list of attribute names to export during resolution.

Parameters:
  `what` - the list

### getExportAttributes

@Nonnull @Unmodifiable @NotLive public Collection<String> getExportAttributes()
Gets the list of attribute names to export during resolution.

Specified by:
  `getExportAttributes` in interface `DataConnector`
Returns:
  the list of attribute names to export during resolution

### doInitialize

protected void doInitialize() throws ComponentInitializationException

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

### doResolve

@Nullable @Unmodifiable @NotLive public final Map<String,IdPAttribute> doResolve(@Nonnull AttributeResolutionContext resolutionContext, @Nonnull AttributeResolverWorkContext workContext) throws ResolutionException
Perform the actual resolution. The resolved attribute(s) should not be recorded in the work context. This method delegates to `doDataConnectorResolve(AttributeResolutionContext, AttributeResolverWorkContext)`. It serves as a future extension point for introducing new common behavior.

Specified by:
  `doResolve` in class `AbstractResolverPlugin<Map<String,IdPAttribute>>`
Parameters:
  `resolutionContext` - current resolution context
  `workContext` - child context where intermediate results are tracked
Returns:
  the resolved attributes or null if no attributes were resolved
Throws:
  `ResolutionException` - thrown if there is a problem resolving the attributes
See Also:
  - `AbstractResolverPlugin.resolve(AttributeResolutionContext)`

### doDataConnectorResolve

@Nullable @Unmodifiable @NotLive protected abstract Map<String,IdPAttribute> doDataConnectorResolve(@Nonnull AttributeResolutionContext resolutionContext, @Nonnull AttributeResolverWorkContext workContext) throws ResolutionException
Retrieves a collection of attributes from some data source.

Parameters:
  `resolutionContext` - current resolution context
  `workContext` - current resolver work context
Returns:
  collected attributes indexed by attribute ID
Throws:
  `ResolutionException` - thrown if there is a problem resolving the attributes

### getLogPrefix

@Nonnull @NotEmpty protected String getLogPrefix()
Return a string which is to be prepended to all log messages.

Specified by:
  `getLogPrefix` in class `AbstractResolverPlugin<Map<String,IdPAttribute>>`
Returns:
  "Data connector '<definitionID>' :"