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,ScriptedDataConnector,StaticDataConnector,TestSources.StaticDataConnector
@ThreadSafe
public abstract class AbstractDataConnector
extends AbstractResolverPlugin<Map<String,IdPAttribute>>
implements DataConnector
Base class for data connector resolver plugins.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Collection<String>Which named attributes do we release?.private StringID of the data connector to use if this one fails.private InstantWhen did this connector last fail?private InstantWhen did this connector last work?private final org.slf4j.LoggerClass logger.private Stringcache for the log prefix - to save multiple recalculations.private DurationHow 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 voidfinal 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 theAbstractDataConnectorwhose 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 StringReturn a string which is to be prepended to all log messages.Get how long to wait until we declare the connector (potentially) alive again.voidsetExportAttributes(Collection<String> what) Sets the list of attribute names to export during resolution.voidSet 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
doDestroy, equals, getActivationCondition, getAttributeDependencies, getDataConnectorDependencies, hashCode, isPropagateResolutionExceptions, resolve, setActivationCondition, setAttributeDependencies, setDataConnectorDependencies, setPropagateResolutionExceptionsMethods inherited from class net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
setIdMethods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentExceptionMethods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, initialize, isDestroyed, isInitializedMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.shibboleth.shared.component.DestructableComponent
destroy, isDestroyedMethods inherited from interface org.springframework.beans.factory.DisposableBean
destroyMethods inherited from interface net.shibboleth.shared.component.IdentifiedComponent
getIdMethods inherited from interface net.shibboleth.shared.component.InitializableComponent
initialize, isInitializedMethods 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. -
exportAttributes
Which named attributes do we release?.
-
-
Constructor Details
-
AbstractDataConnector
public AbstractDataConnector()Constructor.
-
-
Method Details
-
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
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
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:
getLastSuccessin 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:
getLastFailin 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:
getNoRetryDelayin interfaceDataConnector- Returns:
- how long to wait.
-
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:
getExportAttributesin interfaceDataConnector- Returns:
- the list of attribute names to export during resolution
-
doInitialize
- Overrides:
doInitializein classAbstractIdentifiedInitializableComponent- 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 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:
-
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 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:
getLogPrefixin classAbstractResolverPlugin<Map<String,IdPAttribute>> - Returns:
- "Data connector '<definitionID>' :"
-