Package net.shibboleth.idp.attribute.resolver

# Class AbstractAttributeDefinition

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
net.shibboleth.idp.attribute.resolver.AbstractResolverPlugin<IdPAttribute>
net.shibboleth.idp.attribute.resolver.AbstractAttributeDefinition

All Implemented Interfaces:
  `AttributeDefinition`, `ResolverPlugin<IdPAttribute>`, `Component`, `DestructableComponent`, `IdentifiableComponent`, `IdentifiedComponent`, `InitializableComponent`, `UnmodifiableComponent`, `DisposableBean`

Direct Known Subclasses:
  `ContextDerivedAttributeDefinition`, `DateTimeAttributeDefinition`, `DecryptedAttributeDefinition`, `MappedAttributeDefinition`, `MockAttributeDefinition`, `MockStaticAttributeDefinition`, `PrescopedAttributeDefinition`, `PrincipalNameAttributeDefinition`, `RegexSplitAttributeDefinition`, `ResolvedAttributeDefinition`, `SAML1NameIdentifierAttributeDefinition`, `SAML2NameIDAttributeDefinition`, `ScopedAttributeDefinition`, `ScriptedAttributeDefinition`, `SimpleAttributeDefinition`, `StaticAttributeDefinition`, `TemplateAttributeDefinition`, `TestSources.StaticAttributeDefinition`

@ThreadSafe public abstract class AbstractAttributeDefinition extends AbstractResolverPlugin<IdPAttribute> implements AttributeDefinition
Base class for attribute definition resolver plugins.

## Field Summary

Fields
Modifier and Type
Field
Description
`private boolean`
`dependencyOnly`
Whether this attribute definition is only a dependency and thus its values should never be released.
`private final org.slf4j.Logger`
`log`
Class logger.
`private String`
`logPrefix`
cache for the log prefix - to save multiple recalculations.
`private boolean`
`preRequested`
Whether this attribute definition is to be pre-resolved.

## Constructor Summary

Constructors
Constructor
Description
`AbstractAttributeDefinition()`

## Method Summary

Modifier and Type
Method
Description
`protected abstract IdPAttribute`
`doAttributeDefinitionResolve(AttributeResolutionContext resolutionContext, AttributeResolverWorkContext workContext)`
Creates and populates the values for the resolved attribute.
`protected void`
`doInitialize()`
`protected IdPAttribute`
`doResolve(AttributeResolutionContext resolutionContext, AttributeResolverWorkContext workContext)`
Perform the actual resolution.
`protected String`
`getLogPrefix()`
return a string which is to be prepended to all log messages.
`boolean`
`isDependencyOnly()`
Gets whether this attribute definition is only a dependency and thus its values should never be released outside the resolver.
`boolean`
`isPreRequested()`
Gets whether this attribute definition has to be resolved prior in a first pass (in order to prime contexts which can be used in the "main pass").
`void`
`setDependencyOnly(boolean isDependencyOnly)`
Sets whether this attribute definition is only a dependency and thus its values should never be released outside the resolver.
`void`
`setPreRequested(boolean value)`
Sets whether this definition (and its dependencies) are to be pre-resolved.

### Methods inherited from class net.shibboleth.idp.attribute.resolver.AbstractResolverPlugin

`doDestroy, equals, getActivationCondition, getAttributeDependencies, getDataConnectorDependencies, hashCode, isPropagateResolutionExceptions, resolve, setActivationCondition, setAttributeDependencies, setDataConnectorDependencies, setPropagateResolutionExceptions`

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

`setId`

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

`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`

### Methods inherited from interface net.shibboleth.idp.attribute.resolver.ResolverPlugin

`getActivationCondition, getAttributeDependencies, getDataConnectorDependencies, isPropagateResolutionExceptions, resolve`

## Field Details

### log

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

### dependencyOnly

private boolean dependencyOnly
Whether this attribute definition is only a dependency and thus its values should never be released.

### preRequested

private boolean preRequested
Whether this attribute definition is to be pre-resolved.

### logPrefix

@Nullable private String logPrefix
cache for the log prefix - to save multiple recalculations.

## Constructor Details

### AbstractAttributeDefinition

public AbstractAttributeDefinition()

## Method Details

### isDependencyOnly

public boolean isDependencyOnly()
Gets whether this attribute definition is only a dependency and thus its values should never be released outside the resolver.

Specified by:
  `isDependencyOnly` in interface `AttributeDefinition`
Returns:
  true if this attribute is only used as a dependency, false otherwise

### setDependencyOnly

public void setDependencyOnly(boolean isDependencyOnly)
Sets whether this attribute definition is only a dependency and thus its values should never be released outside the resolver.

Parameters:
  `isDependencyOnly` - whether this attribute definition is only a dependency

### isPreRequested

public boolean isPreRequested()
Gets whether this attribute definition has to be resolved prior in a first pass (in order to prime contexts which can be used in the "main pass").

Specified by:
  `isPreRequested` in interface `AttributeDefinition`
Returns:
  true if this is a definition to be done "first"

### setPreRequested

public void setPreRequested(boolean value)
Sets whether this definition (and its dependencies) are to be pre-resolved.

Parameters:
  `value` - what to set

### doInitialize

protected void doInitialize() throws ComponentInitializationException

Overrides:
  `doInitialize` in class `AbstractIdentifiedInitializableComponent`
Throws:
  `ComponentInitializationException`

### doResolve

@Nullable protected 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 the actual resolution of the attribute's values to the `doAttributeDefinitionResolve(AttributeResolutionContext, AttributeResolverWorkContext)` method. Afterwards, if null was not returned, this method will attach the registered display names, descriptions, and encoders to the resultant attribute.

Specified by:
  `doResolve` in class `AbstractResolverPlugin<IdPAttribute>`
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:
  - `AbstractResolverPlugin.resolve(AttributeResolutionContext)`

### doAttributeDefinitionResolve

@Nullable protected abstract IdPAttribute doAttributeDefinitionResolve(@Nonnull AttributeResolutionContext resolutionContext, @Nonnull AttributeResolverWorkContext workContext) throws ResolutionException
Creates and populates the values for the resolved attribute. Implementations should not set, or otherwise manage, the resolved attribute's display name, description or encoders. Nor should the resultant attribute be recorded in the given resolution context.

Parameters:
  `resolutionContext` - current attribute resolution context
  `workContext` - current resolver work context
Returns:
  resolved attribute or null if nothing to resolve.
Throws:
  `ResolutionException` - thrown if there is a problem resolving and creating the attribute

### getLogPrefix

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

Specified by:
  `getLogPrefix` in class `AbstractResolverPlugin<IdPAttribute>`
Returns:
  "Attribute Definition '<definitionID>' :"