Package net.shibboleth.idp.attribute.resolver

# 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 `ResolverPlugin`s.

## Field Summary

Fields
Modifier and Type
Field
Description
`private Predicate<ProfileRequestContext>`
`activationCondition`
Criterion that must be met for this plugin to be active for the given request.
`private Set<ResolverAttributeDefinitionDependency>`
`attributeDependencies`
The `ResolverAttributeDefinitionDependency`s this plug-in depends on.
`private Set<ResolverDataConnectorDependency>`
`dataConnectorDependencies`
The `ResolverDataConnectorDependency`s this plug-in depends on.
`private final org.slf4j.Logger`
`log`
Class logger.
`private boolean`
`propagateResolutionExceptions`
Whether an `ResolutionException` that occurred resolving attributes will be re-thrown.

## Constructor Summary

Constructors
Constructor
Description
`AbstractResolverPlugin()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`protected void`
`doDestroy()`
`protected abstract ResolvedType`
`doResolve(AttributeResolutionContext resolutionContext, AttributeResolverWorkContext workContext)`
Perform the actual resolution.
`boolean`
`equals(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 String`
`getLogPrefix()`
Return a string which is to be prepended to all log messages.
`int`
`hashCode()`
`boolean`
`isPropagateResolutionExceptions()`
Get whether a `ResolutionException` that occurred resolving attributes will be re-thrown.
`final ResolvedType`
`resolve(AttributeResolutionContext resolutionContext)`
Performs the attribute resolution for this plugin.
`void`
`setActivationCondition(Predicate<ProfileRequestContext> pred)`
Sets the predicate which defines whether this plugin is active for a given request.
`void`
`setAttributeDependencies(Set<ResolverAttributeDefinitionDependency> dependencies)`
Sets the list of dependencies for this plugin.
`void`
`setDataConnectorDependencies(Set<ResolverDataConnectorDependency> dependencies)`
Sets the list of dependencies for this plugin.
`void`
`setPropagateResolutionExceptions(boolean propagate)`
Set whether an `AttributeResolutionContext` that occurred resolving attributes will be re-thrown.
`private boolean`
`startTimer(AttributeResolutionContext resolutionContext)`
Conditionally start a timer at the beginning of the resolution process.
`private void`
`stopTimer(AttributeResolutionContext resolutionContext)`
Conditionally stop a timer at the end of the resolution process.

### Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent

`setId`

### Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent

`doInitialize, ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException`

### Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent

`checkComponentActive, checkSetterPreconditions, 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.shared.component.DestructableComponent

`destroy, isDestroyed`

### Methods inherited from interface org.springframework.beans.factory.DisposableBean

`destroy`

### Methods inherited from interface net.shibboleth.shared.component.IdentifiedComponent

`getId`

### Methods inherited from interface net.shibboleth.shared.component.InitializableComponent

`initialize, isInitialized`

## Field Details

### log

@Nonnull private final org.slf4j.Logger log
Class logger.

### propagateResolutionExceptions

private boolean propagateResolutionExceptions
Whether an `ResolutionException` that occurred resolving attributes will be re-thrown.

### activationCondition

@Nullable private Predicate<ProfileRequestContext> activationCondition
Criterion that must be met for this plugin to be active for the given request.

### attributeDependencies

@Nonnull private Set<ResolverAttributeDefinitionDependency> attributeDependencies
The `ResolverAttributeDefinitionDependency`s this plug-in depends on.

### dataConnectorDependencies

@Nonnull private Set<ResolverDataConnectorDependency> dataConnectorDependencies
The `ResolverDataConnectorDependency`s this plug-in depends on.

## Constructor Details

### AbstractResolverPlugin

public AbstractResolverPlugin()
Constructor.

## Method Details

### isPropagateResolutionExceptions

public boolean isPropagateResolutionExceptions()
Get whether a `ResolutionException` that occurred resolving attributes will be re-thrown. Doing so will cause the entire attribute resolution request to fail.

Specified by:
  `isPropagateResolutionExceptions` in interface `ResolverPlugin<ResolvedType>`
Returns:
  true if `ResolutionException`s are propagated, false if not

### setPropagateResolutionExceptions

public void setPropagateResolutionExceptions(boolean propagate)
Set whether an `AttributeResolutionContext` that occurred resolving attributes will be re-thrown. Doing so will cause the entire attribute resolution request to fail.

Parameters:
  `propagate` - true if `ResolutionException`s are propagated, false if not

### getActivationCondition

@Nullable public Predicate<ProfileRequestContext> getActivationCondition()
Get the predicate which defines whether this plugin is active for a given request.

Specified by:
  `getActivationCondition` in interface `ResolverPlugin<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

@Nonnull @Unmodifiable @NotLive public Set<ResolverAttributeDefinitionDependency> getAttributeDependencies()
Gets the unmodifiable list of attributeDependencies for this plugin.

Specified by:
  `getAttributeDependencies` in interface `ResolverPlugin<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:
  `getDataConnectorDependencies` in interface `ResolverPlugin<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 and `isPropagateResolutionExceptions()` is false the exception is logged but not re-thrown, otherwise it is re-thrown.

Specified by:
  `resolve` in interface `ResolverPlugin<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:
  `doDestroy` in class `AbstractInitializableComponent`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`

### equals

public boolean equals(Object obj)

Overrides:
  `equals` in class `Object`

### 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 context
  `workContext` - 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

### getLogPrefix

@Nonnull @NotEmpty protected abstract String getLogPrefix()
Return a string which is to be prepended to all log messages.

Returns:
  a log prefix