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:
AbstractPersistentIdDataConnector
,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
FieldsModifier and TypeFieldDescriptionprivate boolean
Deprecated, for removal: This API element is subject to removal in a future version.private Collection<String>
Which named attributes do we release?.private String
ID of the data connector to use if this one fails.private Instant
When did this connector last fail?private Instant
When did this connector last work?private final org.slf4j.Logger
Class logger.private String
cache for the log prefix - to save multiple recalculations.private Duration
How long to wait until we declare the connector live again. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract Map<String,
IdPAttribute> doDataConnectorResolve
(AttributeResolutionContext resolutionContext, AttributeResolverWorkContext workContext) Retrieves a collection of attributes from some data source.protected void
final Map<String,
IdPAttribute> doResolve
(AttributeResolutionContext resolutionContext, AttributeResolverWorkContext workContext) Perform the actual resolution.Gets the list of attribute names to export during resolution.Gets the ID of theAbstractDataConnector
whose values will be used in the event that this data connector experiences an error.Get the time when this connector last failed.Get the time when this connector last succeeded.protected String
Return a string which is to be prepended to all log messages.Get how long to wait until we declare the connector (potentially) alive again.boolean
Deprecated, for removal: This API element is subject to removal in a future version.void
setExportAllAttributes
(boolean what) Deprecated, for removal: This API element is subject to removal in a future version.void
setExportAttributes
(Collection<String> what) Sets the list of attribute names to export during resolution.void
Set the ID of theAbstractDataConnector
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
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 Details
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
failoverDataConnectorId
ID of the data connector to use if this one fails. -
logPrefix
cache for the log prefix - to save multiple recalculations. -
lastSuccess
When did this connector last work? -
lastFail
When did this connector last fail? -
noRetryDelay
How long to wait until we declare the connector live again. -
exportAllAttributes
Deprecated, for removal: This API element is subject to removal in a future version.Do we release all attributes?. -
exportAttributes
Which named attributes do we release?.
-
-
Constructor Details
-
AbstractDataConnector
public AbstractDataConnector()Constructor.
-
-
Method Details
-
getFailoverDataConnectorId
Gets the ID of theAbstractDataConnector
whose values will be used in the event that this data connector experiences an error.- Specified by:
getFailoverDataConnectorId
in interfaceDataConnector
- Returns:
- ID of the
AbstractDataConnector
whose values will be used in the event that this data connector experiences an error
-
setFailoverDataConnectorId
Set the ID of theAbstractDataConnector
whose values will be used in the event that this data connector experiences an error.- Parameters:
id
- ID of theAbstractDataConnector
whose values will be used in the event that this data connector experiences an error
-
setLastSuccess
Set the time when this connector last worked.- Parameters:
time
- what to set- Since:
- 4.1.0
-
getLastSuccess
Get the time when this connector last succeeded. TODO: Remove default in V5.- Specified by:
getLastSuccess
in interfaceDataConnector
- Returns:
- when it last succeeded
-
setLastFail
Set the time when this connector last failed.- Parameters:
time
- what to set
-
getLastFail
Get the time when this connector last failed. This will be set for any exception regardless of the setting ofResolverPlugin.isPropagateResolutionExceptions()
- Specified by:
getLastFail
in interfaceDataConnector
- Returns:
- when it last failed
-
setNoRetryDelay
Set how long to wait until we declare the connector (potentially) alive again.- Parameters:
delay
- what to set
-
getNoRetryDelay
Get how long to wait until we declare the connector (potentially) alive again.- Specified by:
getNoRetryDelay
in interfaceDataConnector
- Returns:
- how long to wait.
-
setExportAllAttributes
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, 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:
isExportAllAttributes
in interfaceDataConnector
- Returns:
- whether we export all attributes
-
setExportAttributes
Sets the list of attribute names to export during resolution.- Parameters:
what
- the list
-
getExportAttributes
Gets the list of attribute names to export during resolution.- Specified by:
getExportAttributes
in interfaceDataConnector
- Returns:
- the list of attribute names to export during resolution
-
doInitialize
- Overrides:
doInitialize
in 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:
doResolve
in 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:
-
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
Return a string which is to be prepended to all log messages.- Specified by:
getLogPrefix
in classAbstractResolverPlugin<Map<String,
IdPAttribute>> - Returns:
- "Data connector '<definitionID>' :"
-