Class AbstractResolverPlugin<ResolvedType>
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.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 all
ResolverPlugins.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Predicate<ProfileRequestContext>Criterion that must be met for this plugin to be active for the given request.private Set<ResolverAttributeDefinitionDependency>TheResolverAttributeDefinitionDependencys this plug-in depends on.private Set<ResolverDataConnectorDependency>TheResolverDataConnectorDependencys this plug-in depends on.private final org.slf4j.LoggerClass logger.private booleanWhether anResolutionExceptionthat occurred resolving attributes will be re-thrown. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected abstract ResolvedTypedoResolve(AttributeResolutionContext resolutionContext, AttributeResolverWorkContext workContext) Perform the actual resolution.booleanGet the predicate which defines whether this plugin is active for a given request.Gets the unmodifiable list of attributeDependencies for this plugin.Gets the unmodifiable list of dependencies for this plugin.protected abstract StringReturn a string which is to be prepended to all log messages.inthashCode()booleanGet whether aResolutionExceptionthat occurred resolving attributes will be re-thrown.final ResolvedTyperesolve(AttributeResolutionContext resolutionContext) Performs the attribute resolution for this plugin.voidSets 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.voidsetPropagateResolutionExceptions(boolean propagate) Set whether anAttributeResolutionContextthat occurred resolving attributes will be re-thrown.private 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.shared.component.AbstractIdentifiableInitializableComponent
setIdMethods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
doInitialize, 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, isInitialized
-
Field Details
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
propagateResolutionExceptions
private boolean propagateResolutionExceptionsWhether anResolutionExceptionthat occurred resolving attributes will be re-thrown. -
activationCondition
Criterion that must be met for this plugin to be active for the given request. -
attributeDependencies
TheResolverAttributeDefinitionDependencys this plug-in depends on. -
dataConnectorDependencies
TheResolverDataConnectorDependencys this plug-in depends on.
-
-
Constructor Details
-
AbstractResolverPlugin
public AbstractResolverPlugin()Constructor.
-
-
Method Details
-
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
-
getActivationCondition
Get the predicate which defines whether this plugin is active for a given request.- Specified by:
getActivationConditionin interfaceResolverPlugin<ResolvedType>- Returns:
- the predicate.
-
setActivationCondition
Sets the predicate which defines whether this plugin is active for a given request.- Parameters:
pred- what to set
-
getAttributeDependencies
@Nonnull @Unmodifiable @NotLive 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
@Nonnull @Unmodifiable @NotLive 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 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 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
-
doDestroy
protected void doDestroy()- Overrides:
doDestroyin classAbstractInitializableComponent
-
hashCode
public int hashCode() -
equals
-
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:
-
startTimer
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
Conditionally stop a timer at the end of the resolution process.- Parameters:
resolutionContext- attribute resolution context
-
getLogPrefix
Return a string which is to be prepended to all log messages.- Returns:
- a log prefix
-