Class AbstractDataConnector
- java.lang.Object
-
- net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
-
- net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent
-
- net.shibboleth.utilities.java.support.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,PairwiseIdDataConnector,ResolvedDataConnector,ScriptedDataConnector,StaticDataConnector,SubjectDataConnector
@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 booleanexportAllAttributesDeprecated, for removal: This API element is subject to removal in a future version.private Collection<String>exportAttributesWhich named attributes do we release?.private StringfailoverDataConnectorIdID of the data connector to use if this one fails.private InstantlastFailWhen did this connector last fail?private InstantlastSuccessWhen did this connector last work?private org.slf4j.LoggerlogClass logger.private StringlogPrefixcache for the log prefix - to save multiple recalculations.private DurationnoRetryDelayHow long to wait until we declare the connector live again.
-
Constructor Summary
Constructors Constructor Description AbstractDataConnector()Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods 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 voiddoInitialize()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.StringgetFailoverDataConnectorId()Gets the ID of theAbstractDataConnectorwhose values will be used in the event that this data connector experiences an error.InstantgetLastFail()Get the time when this connector last failed.InstantgetLastSuccess()Get the time when this connector last succeeded.protected StringgetLogPrefix()Return a string which is to be prepended to all log messages.DurationgetNoRetryDelay()Get how long to wait until we declare the connector (potentially) alive again.booleanisExportAllAttributes()Deprecated, for removal: This API element is subject to removal in a future version.voidsetExportAllAttributes(boolean what)Deprecated, for removal: This API element is subject to removal in a future version.voidsetExportAttributes(Collection<String> what)Sets the list of attribute names to export during resolution.voidsetFailoverDataConnectorId(String id)Set the ID of theAbstractDataConnectorwhose values will be used in the event that this data connector experiences an error.voidsetLastFail(Instant time)Set the time when this connector last failed.voidsetLastSuccess(Instant time)Set the time when this connector last worked.voidsetNoRetryDelay(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
addDisplayInformation, doDestroy, equals, getActivationCondition, getAttributeDependencies, getDataConnectorDependencies, getProfileContextStrategy, hashCode, isPropagateResolutionExceptions, isSuppressDisplayInformation, resolve, setActivationCondition, setAttributeDependencies, setDataConnectorDependencies, setProfileContextStrategy, setPropagateResolutionExceptions, setSuppressDisplayInformation
-
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent
setId
-
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent
getId
-
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
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.utilities.java.support.component.DestructableComponent
destroy, isDestroyed
-
Methods inherited from interface org.springframework.beans.factory.DisposableBean
destroy
-
Methods inherited from interface net.shibboleth.utilities.java.support.component.IdentifiedComponent
getId
-
Methods inherited from interface net.shibboleth.utilities.java.support.component.InitializableComponent
initialize, isInitialized
-
Methods inherited from interface net.shibboleth.idp.attribute.resolver.ResolverPlugin
getActivationCondition, getAttributeDependencies, getDataConnectorDependencies, isPropagateResolutionExceptions, resolve
-
-
-
-
Field Detail
-
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.
-
exportAllAttributes
@Deprecated(since="4.1.0", forRemoval=true) private boolean exportAllAttributes
Deprecated, for removal: This API element is subject to removal in a future version.Do we release all attributes?.
-
exportAttributes
@Nonnull @NonnullElements @Unmodifiable private Collection<String> exportAttributes
Which named attributes do we release?.
-
-
Method Detail
-
getFailoverDataConnectorId
@Nullable public String getFailoverDataConnectorId()
Gets the ID of theAbstractDataConnectorwhose values will be used in the event that this data connector experiences an error.- Specified by:
getFailoverDataConnectorIdin interfaceDataConnector- Returns:
- ID of the
AbstractDataConnectorwhose 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 theAbstractDataConnectorwhose values will be used in the event that this data connector experiences an error.- Parameters:
id- ID of theAbstractDataConnectorwhose 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:
getLastSuccessin interfaceDataConnector- 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 ofResolverPlugin.isPropagateResolutionExceptions()- Specified by:
getLastFailin interfaceDataConnector- 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:
getNoRetryDelayin interfaceDataConnector- Returns:
- how long to wait.
-
setExportAllAttributes
@Deprecated(since="4.1.0", forRemoval=true) public void setExportAllAttributes(boolean what)
Deprecated, for removal: This API element is subject to removal in a future version.Set whether we export all attributes.- Parameters:
what- whether we export all attributes
-
isExportAllAttributes
@Deprecated(since="4.1.0", forRemoval=true) public boolean isExportAllAttributes()
Deprecated, for removal: This API element is subject to removal in a future version.Gets whether we export all attributes during resolution.If this returns false then
DataConnector.getExportAttributes()returns the list of attributes to return.- Specified by:
isExportAllAttributesin interfaceDataConnector- Returns:
- whether we export all attributes
-
setExportAttributes
public void setExportAttributes(@Nonnull @NonnullElements Collection<String> what)
Sets the list of attribute names to export during resolution.- Parameters:
what- the list
-
getExportAttributes
@Nonnull @NonnullElements @Unmodifiable public Collection<String> getExportAttributes()
Gets the list of attribute names to export during resolution.- Specified by:
getExportAttributesin interfaceDataConnector- Returns:
- the list of attribute names to export during resolution
-
doInitialize
protected void doInitialize() throws ComponentInitializationException- Overrides:
doInitializein classAbstractResolverPlugin<Map<String,IdPAttribute>>- Throws:
ComponentInitializationException
-
doResolve
@Nullable 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 todoDataConnectorResolve(AttributeResolutionContext, AttributeResolverWorkContext). It serves as a future extension point for introducing new common behavior.- Specified by:
doResolvein classAbstractResolverPlugin<Map<String,IdPAttribute>>- Parameters:
resolutionContext- current resolution contextworkContext- 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 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 contextworkContext- 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:
getLogPrefixin classAbstractResolverPlugin<Map<String,IdPAttribute>>- Returns:
- "Data connector '<definitionID>' :"
-
-