Class TemplatedSearchBuilder
java.lang.Object
net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
net.shibboleth.idp.attribute.resolver.dc.storage.impl.TemplatedSearchBuilder
- All Implemented Interfaces:
ExecutableSearchBuilder<StorageServiceSearch>,Component,DestructableComponent,InitializableComponent
public class TemplatedSearchBuilder
extends AbstractInitializableComponent
implements ExecutableSearchBuilder<StorageServiceSearch>
An
ExecutableSearchBuilder that generates the StorageService context and key
using Velocity templates.- Since:
- 4.1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate TemplateContext template to be evaluated.private StringText of context template to be evaluated.private ObjectA custom object to inject into the template.private org.apache.velocity.app.VelocityEngineVelocityEngine.private TemplateKey template to be evaluated.private StringText of key template to be evaluated.private final org.slf4j.LoggerClass logger. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild(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 voidgetContextAndKey(AttributeResolutionContext resolutionContext, Map<String, List<IdPAttributeValue>> dependencyAttributes) Get the context template to be evaluated.Get the context template text to be evaluated.Get the key template to be evaluated.Get the key template text to be evaluated.org.apache.velocity.app.VelocityEngineGet theVelocityEngineto be used.voidsetContextTemplateText(String text) Set the context template to be evaluated.voidsetCustomObject(Object object) Set the custom (externally provided) object.voidsetKeyTemplateText(String text) Set the key template to be evaluated.voidsetVelocityEngine(org.apache.velocity.app.VelocityEngine velocityEngine) Set theVelocityEngineto be used.Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, doDestroy, initialize, isDestroyed, isInitialized
-
Field Details
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
contextTemplate
Context template to be evaluated. -
keyTemplate
Key template to be evaluated. -
contextTemplateText
Text of context template to be evaluated. -
keyTemplateText
Text of key template to be evaluated. -
engine
VelocityEngine. -
customObject
A custom object to inject into the template.
-
-
Constructor Details
-
TemplatedSearchBuilder
public TemplatedSearchBuilder()
-
-
Method Details
-
getContextTemplate
Get the context template to be evaluated.- Returns:
- template
-
getKeyTemplate
Get the key template to be evaluated.- Returns:
- template
-
getContextTemplateText
Get the context template text to be evaluated.- Returns:
- template text
-
setContextTemplateText
Set the context template to be evaluated.- Parameters:
text- template to be evaluated
-
getKeyTemplateText
Get the key template text to be evaluated.- Returns:
- template text
-
setKeyTemplateText
Set the key template to be evaluated.- Parameters:
text- template to be evaluated
-
getVelocityEngine
Get theVelocityEngineto be used.- Returns:
- template engine
-
setVelocityEngine
public void setVelocityEngine(@Nonnull org.apache.velocity.app.VelocityEngine velocityEngine) Set theVelocityEngineto be used.- Parameters:
velocityEngine- engine to be used
-
setCustomObject
Set the custom (externally provided) object.- Parameters:
object- the custom object
-
doInitialize
- Overrides:
doInitializein classAbstractInitializableComponent- Throws:
ComponentInitializationException
-
build
public StorageServiceSearch build(@Nonnull AttributeResolutionContext resolutionContext, @Nonnull Map<String, List<IdPAttributeValue>> dependencyAttributes) throws ResolutionExceptionCreates an executable search that can be executed against a data source in order to produce results.- Specified by:
buildin interfaceExecutableSearchBuilder<StorageServiceSearch>- Parameters:
resolutionContext- current request contextdependencyAttributes- made available to the executable search- Returns:
- executable search
- Throws:
ResolutionException- throw if their is a problem creating the executable search
-
getContextAndKey
@Nonnull private Pair<String,String> getContextAndKey(@Nonnull AttributeResolutionContext resolutionContext, @Nonnull Map<String, List<IdPAttributeValue>> dependencyAttributes) throws ResolutionException- Throws:
ResolutionException
-