Package net.shibboleth.idp.attribute.resolver.dc.scripted.impl

# Class ScriptedSearchBuilder

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.idp.attribute.resolver.dc.scripted.impl.ScriptedSearchBuilder

All Implemented Interfaces:
  `ExecutableSearchBuilder<ScriptedSearch>`, `Component`, `DestructableComponent`, `InitializableComponent`

public class ScriptedSearchBuilder extends AbstractInitializableComponent implements ExecutableSearchBuilder<ScriptedSearch>
`ExecutableSearchBuilder` for the `ScriptedDataConnector`.

## Field Summary

Fields
Modifier and Type
Field
Description
`private Template`
`cacheKeyTemplate`
Cache key template to be evaluated.
`private String`
`cacheKeyTemplateText`
Text of cache key template to be evaluated.
`private org.apache.velocity.app.VelocityEngine`
`engine`
VelocityEngine.
`private final org.slf4j.Logger`
`log`
Class logger.

## Constructor Summary

Constructors
Constructor
Description
`ScriptedSearchBuilder()`

## Method Summary

Modifier and Type
Method
Description
`ScriptedSearch`
`build(AttributeResolutionContext resolutionContext, Map<String,List<IdPAttributeValue>> dependencyAttributes)`
Creates an executable search that can be executed against a data source in order to produce results.
`protected void`
`doInitialize()`
`String`
`getCacheKeyTemplateText()`
Get the cache key template text to be evaluated.
`private String`
`getResultCacheKey(AttributeResolutionContext resolutionContext, Map<String,List<IdPAttributeValue>> dependencyAttributes)`
Allow a user-provided cache key for this resolution.
`org.apache.velocity.app.VelocityEngine`
`getVelocityEngine()`
Get the `VelocityEngine` to be used.
`void`
`setCacheKeyTemplateText(String text)`
Set the cache key template to be evaluated.
`void`
`setVelocityEngine(org.apache.velocity.app.VelocityEngine velocityEngine)`
Set the `VelocityEngine` to be used.

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

`checkComponentActive, checkSetterPreconditions, destroy, doDestroy, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, initialize, isDestroyed, isInitialized`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### log

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

### engine

@NonnullAfterInit private org.apache.velocity.app.VelocityEngine engine
VelocityEngine.

### cacheKeyTemplate

@Nullable private Template cacheKeyTemplate
Cache key template to be evaluated.

### cacheKeyTemplateText

@NonnullAfterInit private String cacheKeyTemplateText
Text of cache key template to be evaluated.

## Constructor Details

### ScriptedSearchBuilder

public ScriptedSearchBuilder()

## Method Details

### doInitialize

protected void doInitialize() throws ComponentInitializationException

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

### getVelocityEngine

@NonnullAfterInit public org.apache.velocity.app.VelocityEngine getVelocityEngine()
Get the `VelocityEngine` to be used.

Returns:
  template engine

### setVelocityEngine

public void setVelocityEngine(@Nonnull org.apache.velocity.app.VelocityEngine velocityEngine)
Set the `VelocityEngine` to be used.

Parameters:
  `velocityEngine` - engine to be used

### getCacheKeyTemplateText

@Nullable public String getCacheKeyTemplateText()
Get the cache key template text to be evaluated.

Returns:
  template text

### setCacheKeyTemplateText

public void setCacheKeyTemplateText(@Nullable String text)
Set the cache key template to be evaluated.

Parameters:
  `text` - template to be evaluated

### build

@Nonnull public ScriptedSearch build(@Nonnull AttributeResolutionContext resolutionContext, @Nonnull Map<String,List<IdPAttributeValue>> dependencyAttributes) throws ResolutionException
Creates an executable search that can be executed against a data source in order to produce results.

Specified by:
  `build` in interface `ExecutableSearchBuilder<ScriptedSearch>`
Parameters:
  `resolutionContext` - current request context
  `dependencyAttributes` - made available to the executable search
Returns:
  executable search
Throws:
  `ResolutionException` - throw if their is a problem creating the executable search

### getResultCacheKey

@Nullable @NotEmpty private String getResultCacheKey(@Nonnull AttributeResolutionContext resolutionContext, @Nonnull Map<String,List<IdPAttributeValue>> dependencyAttributes)
Allow a user-provided cache key for this resolution.

Parameters:
  `resolutionContext` - the `AttributeResolutionContext`
  `dependencyAttributes` - the attributes,
Returns:
  They key or null if the user didn't specify one.