Class AbstractResolverPlugin<ResolvedType>
- 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<ResolvedType>
-
- Type Parameters:
ResolvedType- object type this plug-in resolves to
- All Implemented Interfaces:
ResolverPlugin<ResolvedType>,Component,DestructableComponent,IdentifiableComponent,IdentifiedComponent,InitializableComponent,UnmodifiableComponent,DisposableBean
- Direct Known Subclasses:
AbstractAttributeDefinition,AbstractDataConnector
@ThreadSafe public abstract class AbstractResolverPlugin<ResolvedType> extends AbstractIdentifiableInitializableComponent implements ResolverPlugin<ResolvedType>, DisposableBean
Base class for allResolverPlugins.
-
-
Field Summary
Fields Modifier and Type Field Description private Predicate<ProfileRequestContext>activationConditionCriterion that must be met for this plugin to be active for the given request.private Set<ResolverAttributeDefinitionDependency>attributeDependenciesTheResolverAttributeDefinitionDependencys this plug-in depends on.private Set<ResolverDataConnectorDependency>dataConnectorDependenciesTheResolverDataConnectorDependencys this plug-in depends on.private org.slf4j.LoggerlogClass logger.private Function<AttributeResolutionContext,ProfileRequestContext>profileContextStrategyStrategy to get theProfileRequestContext.private booleanpropagateResolutionExceptionsWhether anAttributeResolutionContextthat occurred resolving attributes will be re-thrown.private booleansuppressDisplayInformationWhether we add DisplayInformation to derived attributes.
-
Constructor Summary
Constructors Constructor Description AbstractResolverPlugin()Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddDisplayInformation(AttributeResolutionContext resolutionContext, IdPAttribute attribute)Deprecated, for removal: This API element is subject to removal in a future version.These values should be calculated at point of use Controllable via theisSuppressDisplayInformation()method.protected voiddoDestroy()protected voiddoInitialize()protected abstract ResolvedTypedoResolve(AttributeResolutionContext resolutionContext, AttributeResolverWorkContext workContext)Perform the actual resolution.booleanequals(Object obj)Predicate<ProfileRequestContext>getActivationCondition()Get the predicate which defines whether this plugin is active for a given request.Set<ResolverAttributeDefinitionDependency>getAttributeDependencies()Gets the unmodifiable list of attributeDependencies for this plugin.Set<ResolverDataConnectorDependency>getDataConnectorDependencies()Gets the unmodifiable list of dependencies for this plugin.protected abstract StringgetLogPrefix()Return a string which is to be prepended to all log messages.Function<AttributeResolutionContext,ProfileRequestContext>getProfileContextStrategy()Gets the mechanism to find out theProfileRequestContext.inthashCode()booleanisPropagateResolutionExceptions()Get whether aResolutionExceptionthat occurred resolving attributes will be re-thrown.booleanisSuppressDisplayInformation()Does this plugin allow addition of Display Information?ResolvedTyperesolve(AttributeResolutionContext resolutionContext)Performs the attribute resolution for this plugin.voidsetActivationCondition(Predicate<ProfileRequestContext> pred)Sets the predicate which defines whether this plugin is active for a given request.voidsetAttributeDependencies(Set<ResolverAttributeDefinitionDependency> dependencies)Sets the list of dependencies for this plugin.voidsetDataConnectorDependencies(Set<ResolverDataConnectorDependency> dependencies)Sets the list of dependencies for this plugin.voidsetProfileContextStrategy(Function<AttributeResolutionContext,ProfileRequestContext> strategy)Sets the mechanism to find out theProfileRequestContext.voidsetPropagateResolutionExceptions(boolean propagate)Set whether anAttributeResolutionContextthat occurred resolving attributes will be re-thrown.voidsetSuppressDisplayInformation(boolean what)Deprecated, for removal: This API element is subject to removal in a future version.Display Information should be consulted at point of useprivate booleanstartTimer(AttributeResolutionContext resolutionContext)Conditionally start a timer at the beginning of the resolution process.private voidstopTimer(AttributeResolutionContext resolutionContext)Conditionally stop a timer at the end of the resolution process.-
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
-
-
-
-
Field Detail
-
log
@Nonnull private final org.slf4j.Logger log
Class logger.
-
propagateResolutionExceptions
private boolean propagateResolutionExceptions
Whether anAttributeResolutionContextthat occurred resolving attributes will be re-thrown.
-
suppressDisplayInformation
private boolean suppressDisplayInformation
Whether we add DisplayInformation to derived attributes.
-
profileContextStrategy
@Nonnull private Function<AttributeResolutionContext,ProfileRequestContext> profileContextStrategy
Strategy to get theProfileRequestContext.
-
activationCondition
@Nullable private Predicate<ProfileRequestContext> activationCondition
Criterion that must be met for this plugin to be active for the given request.
-
attributeDependencies
@Nonnull @NonnullElements private Set<ResolverAttributeDefinitionDependency> attributeDependencies
TheResolverAttributeDefinitionDependencys this plug-in depends on.
-
dataConnectorDependencies
@Nonnull @NonnullElements private Set<ResolverDataConnectorDependency> dataConnectorDependencies
TheResolverDataConnectorDependencys this plug-in depends on.
-
-
Method Detail
-
isSuppressDisplayInformation
public boolean isSuppressDisplayInformation()
Does this plugin allow addition of Display Information?- Returns:
- whether we are suppressing
-
setSuppressDisplayInformation
@Deprecated(forRemoval=true, since="4.2") public void setSuppressDisplayInformation(boolean what)
Deprecated, for removal: This API element is subject to removal in a future version.Display Information should be consulted at point of useSet whether we suppress addition of Display Information.- Parameters:
what- true if we suppress the addition.
-
isPropagateResolutionExceptions
public boolean isPropagateResolutionExceptions()
Get whether aResolutionExceptionthat occurred resolving attributes will be re-thrown. Doing so will cause the entire attribute resolution request to fail.- Specified by:
isPropagateResolutionExceptionsin interfaceResolverPlugin<ResolvedType>- Returns:
- true if
ResolutionExceptions are propagated, false if not
-
setPropagateResolutionExceptions
public void setPropagateResolutionExceptions(boolean propagate)
Set whether anAttributeResolutionContextthat occurred resolving attributes will be re-thrown. Doing so will cause the entire attribute resolution request to fail.- Parameters:
propagate- true ifResolutionExceptions are propagated, false if not
-
getProfileContextStrategy
public Function<AttributeResolutionContext,ProfileRequestContext> getProfileContextStrategy()
Gets the mechanism to find out theProfileRequestContext.- Returns:
- the mechanism
-
setProfileContextStrategy
public void setProfileContextStrategy(Function<AttributeResolutionContext,ProfileRequestContext> strategy)
Sets the mechanism to find out theProfileRequestContext.- Parameters:
strategy- the mechanism
-
getActivationCondition
@Nullable public Predicate<ProfileRequestContext> getActivationCondition()
Get the predicate which defines whether this plugin is active for a given request.- Specified by:
getActivationConditionin interfaceResolverPlugin<ResolvedType>- Returns:
- the predicate.
-
setActivationCondition
public void setActivationCondition(@Nonnull Predicate<ProfileRequestContext> pred)Sets the predicate which defines whether this plugin is active for a given request.- Parameters:
pred- what to set
-
getAttributeDependencies
@NonnullAfterInit @NonnullElements @Unmodifiable public Set<ResolverAttributeDefinitionDependency> getAttributeDependencies()
Gets the unmodifiable list of attributeDependencies for this plugin.- Specified by:
getAttributeDependenciesin interfaceResolverPlugin<ResolvedType>- Returns:
- unmodifiable list of dependencies for this plugin, never null
-
getDataConnectorDependencies
@NonnullAfterInit @NonnullElements @Unmodifiable public Set<ResolverDataConnectorDependency> getDataConnectorDependencies()
Gets the unmodifiable list of dependencies for this plugin.- Specified by:
getDataConnectorDependenciesin interfaceResolverPlugin<ResolvedType>- Returns:
- unmodifiable list of dependencies for this plugin, never null
-
setAttributeDependencies
public void setAttributeDependencies(@Nonnull @NonnullElements Set<ResolverAttributeDefinitionDependency> dependencies)
Sets the list of dependencies for this plugin.- Parameters:
dependencies- unmodifiable list of dependencies for this plugin
-
setDataConnectorDependencies
public void setDataConnectorDependencies(@Nonnull @NonnullElements Set<ResolverDataConnectorDependency> dependencies)
Sets the list of dependencies for this plugin.- Parameters:
dependencies- unmodifiable list of dependencies for this plugin
-
resolve
@Nullable public final ResolvedType resolve(@Nonnull AttributeResolutionContext resolutionContext) throws ResolutionException
Performs the attribute resolution for this plugin.This method first checks to see if this plugin has been initialized and has not be destroyed. Then it checks if the plugins activation criterion has been met. Finally it delegates to
doResolve(AttributeResolutionContext, AttributeResolverWorkContext). If an exception is thrown andisPropagateResolutionExceptions()is false the exception is logged but not re-thrown, otherwise it is re-thrown.- Specified by:
resolvein interfaceResolverPlugin<ResolvedType>- Parameters:
resolutionContext- current attribute resolution context- Returns:
- the attributes made available by the resolution, or null if no attributes were resolved
- Throws:
ResolutionException- thrown if there was a problem resolving the attributes
-
addDisplayInformation
@Deprecated(since="4.2", forRemoval=true) public void addDisplayInformation(@Nonnull AttributeResolutionContext resolutionContext, @Nonnull IdPAttribute attribute)
Deprecated, for removal: This API element is subject to removal in a future version.These values should be calculated at point of use Controllable via theisSuppressDisplayInformation()method.Look at the resolution context for an attribute registry and use it to garnish the attribute.- Parameters:
resolutionContext- where to get the registry fromattribute- what to garnish
-
doDestroy
protected void doDestroy()
- Overrides:
doDestroyin classAbstractInitializableComponent
-
doInitialize
protected void doInitialize() throws ComponentInitializationException- Overrides:
doInitializein classAbstractIdentifiedInitializableComponent- Throws:
ComponentInitializationException
-
doResolve
@Nullable protected abstract ResolvedType 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.- 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:
resolve(AttributeResolutionContext)
-
startTimer
private boolean startTimer(@Nonnull AttributeResolutionContext resolutionContext)Conditionally start a timer at the beginning of the resolution process.- Parameters:
resolutionContext- attribute resolution context- Returns:
- true iff the
stopTimer(AttributeResolutionContext)method needs to be called
-
stopTimer
private void stopTimer(@Nonnull AttributeResolutionContext resolutionContext)Conditionally stop a timer at the end of the resolution process.- Parameters:
resolutionContext- attribute resolution context
-
-