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

# Class ScriptedDataConnector

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
net.shibboleth.idp.attribute.resolver.AbstractResolverPlugin<Map<String,IdPAttribute>>
net.shibboleth.idp.attribute.resolver.AbstractDataConnector
net.shibboleth.idp.attribute.resolver.dc.impl.AbstractSearchDataConnector<ScriptedSearch,ScriptedMappingStrategy>
net.shibboleth.idp.attribute.resolver.dc.scripted.impl.ScriptedDataConnector

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

public class ScriptedDataConnector extends AbstractSearchDataConnector<ScriptedSearch,ScriptedMappingStrategy>
A Data Connector which populates a series of attributes from a provided `ProfileRequestContext`.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`private class`
`ScriptedDataConnector.DataConnectorScriptEvaluator`
Evaluator bound to the DataConnector semantic.
`private final class`
`ScriptedDataConnector.NullValidator`
Because we are a SearchDataConnector we need to have a validator, so this plugs the gap.

## Field Summary

Fields
Modifier and Type
Field
Description
`private Collection<ResolverScriptContextExtender>`
`contextExtenders`
Extenders for script context.
`private Object`
`customObject`
The custom object we inject into all scripts.
`private final org.slf4j.Logger`
`log`
Class logger.
`static final String`
`RESULTS_STRING`
The id of the object where the results go.
`private EvaluableScript`
`script`
Script to be evaluated.
`private ScriptedDataConnector.DataConnectorScriptEvaluator`
`scriptEvaluator`
Evaluator.

## Constructor Summary

Constructors
Constructor
Description
`ScriptedDataConnector()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`protected void`
`doInitialize()`
`Object`
`getCustomObject()`
Return the custom (externally provided) object.
`EvaluableScript`
`getScript()`
Gets the script to be evaluated.
`protected Map<String,IdPAttribute>`
`retrieveAttributes(ScriptedSearch executable)`
Attempts to retrieve attributes from the data source.
`protected Map<String,IdPAttribute>`
`retrieveAttributes(ScriptedSearch executable, AttributeResolverWorkContext workContext)`
A version of `AbstractSearchDataConnector.retrieveAttributes(ExecutableSearch)` that also gets passed the work context.
`void`
`setCustomObject(Object object)`
Set the custom (externally provided) object.
`void`
`setScript(EvaluableScript definitionScript)`
Sets the script to be evaluated.
`void`
`setScriptContextExtenders(Collection<ResolverScriptContextExtender> extenders)`
Set any script context extenders to apply.

### Methods inherited from class net.shibboleth.idp.attribute.resolver.dc.impl.AbstractSearchDataConnector

`doDataConnectorResolve, getExecutableSearchBuilder, getMappingStrategy, getResultsCache, getValidator, isFailFastInitialize, setExecutableSearchBuilder, setFailFastInitialize, setMappingStrategy, setResultsCache, setValidator`

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

`doResolve, getExportAttributes, getFailoverDataConnectorId, getLastFail, getLastSuccess, getLogPrefix, getNoRetryDelay, setExportAttributes, setFailoverDataConnectorId, setLastFail, setLastSuccess, setNoRetryDelay`

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

### RESULTS_STRING

@Nonnull public static final String RESULTS_STRING
The id of the object where the results go.

See Also:
  - Constant Field Values

### log

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

### script

@NonnullAfterInit private EvaluableScript script
Script to be evaluated.

### scriptEvaluator

@NonnullAfterInit private ScriptedDataConnector.DataConnectorScriptEvaluator scriptEvaluator
Evaluator.

### contextExtenders

@Nonnull private Collection<ResolverScriptContextExtender> contextExtenders
Extenders for script context.

### customObject

@Nullable private Object customObject
The custom object we inject into all scripts.

## Constructor Details

### ScriptedDataConnector

public ScriptedDataConnector()
Constructor.

## Method Details

### getCustomObject

@Nullable public Object getCustomObject()
Return the custom (externally provided) object.

Returns:
  the custom object

### setCustomObject

public void setCustomObject(Object object)
Set the custom (externally provided) object.

Parameters:
  `object` - the custom object

### getScript

@NonnullAfterInit public EvaluableScript getScript()
Gets the script to be evaluated.

Returns:
  the script to be evaluated

### setScript

public void setScript(@Nonnull EvaluableScript definitionScript)
Sets the script to be evaluated.

Parameters:
  `definitionScript` - the script to be evaluated

### setScriptContextExtenders

public void setScriptContextExtenders(@Nullable Collection<ResolverScriptContextExtender> extenders)
Set any script context extenders to apply.

Parameters:
  `extenders` - script extenders
Since:
  5.0.0

### doInitialize

protected void doInitialize() throws ComponentInitializationException

Overrides:
  `doInitialize` in class `AbstractSearchDataConnector<ScriptedSearch,ScriptedMappingStrategy>`
Throws:
  `ComponentInitializationException`

### retrieveAttributes

protected Map<String,IdPAttribute> retrieveAttributes(@Nonnull ScriptedSearch executable) throws ResolutionException
Attempts to retrieve attributes from the data source.

Specified by:
  `retrieveAttributes` in class `AbstractSearchDataConnector<ScriptedSearch,ScriptedMappingStrategy>`
Parameters:
  `executable` - used to retrieve data from the data source
Returns:
  attributes
Throws:
  `ResolutionException` - thrown if there is a problem retrieving data from the data source

### retrieveAttributes

protected Map<String,IdPAttribute> retrieveAttributes(@Nonnull ScriptedSearch executable, @Nonnull AttributeResolverWorkContext workContext) throws ResolutionException
A version of `AbstractSearchDataConnector.retrieveAttributes(ExecutableSearch)` that also gets passed the work context.

Overrides:
  `retrieveAttributes` in class `AbstractSearchDataConnector<ScriptedSearch,ScriptedMappingStrategy>`
Parameters:
  `executable` - used to retrieve data from the data source
  `workContext` - the work context for the operation.
Returns:
  attributes
Throws:
  `ResolutionException` - thrown if there is a problem retrieving data from the data source