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>
AnExecutableSearchBuilderthat generates theStorageServicecontext and key using Velocity templates.- Since:
- 4.1.0
-
-
Field Summary
Fields Modifier and Type Field Description private TemplatecontextTemplateContext template to be evaluated.private StringcontextTemplateTextText of context template to be evaluated.private ObjectcustomObjectA custom object to inject into the template.private org.apache.velocity.app.VelocityEngineengineVelocityEngine.private TemplatekeyTemplateKey template to be evaluated.private StringkeyTemplateTextText of key template to be evaluated.private org.slf4j.LoggerlogClass logger.
-
Constructor Summary
Constructors Constructor Description TemplatedSearchBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StorageServiceSearchbuild(AttributeResolutionContext resolutionContext, Map<String,List<IdPAttributeValue>> dependencyAttributes)protected voiddoInitialize()private Pair<String,String>getContextAndKey(AttributeResolutionContext resolutionContext, Map<String,List<IdPAttributeValue>> dependencyAttributes)TemplategetContextTemplate()Get the context template to be evaluated.StringgetContextTemplateText()Get the context template text to be evaluated.TemplategetKeyTemplate()Get the key template to be evaluated.StringgetKeyTemplateText()Get the key template text to be evaluated.org.apache.velocity.app.VelocityEnginegetVelocityEngine()Get 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 Detail
-
log
@Nonnull private final org.slf4j.Logger log
Class logger.
-
contextTemplate
@NonnullAfterInit private Template contextTemplate
Context template to be evaluated.
-
keyTemplate
@NonnullAfterInit private Template keyTemplate
Key template to be evaluated.
-
contextTemplateText
@NonnullAfterInit private String contextTemplateText
Text of context template to be evaluated.
-
keyTemplateText
@NonnullAfterInit private String keyTemplateText
Text of key template to be evaluated.
-
engine
@NonnullAfterInit private org.apache.velocity.app.VelocityEngine engine
VelocityEngine.
-
customObject
@Nullable private Object customObject
A custom object to inject into the template.
-
-
Method Detail
-
getContextTemplate
@NonnullAfterInit public Template getContextTemplate()
Get the context template to be evaluated.- Returns:
- template
-
getKeyTemplate
@NonnullAfterInit public Template getKeyTemplate()
Get the key template to be evaluated.- Returns:
- template
-
getContextTemplateText
@NonnullAfterInit public String getContextTemplateText()
Get the context template text to be evaluated.- Returns:
- template text
-
setContextTemplateText
public void setContextTemplateText(@Nullable String text)Set the context template to be evaluated.- Parameters:
text- template to be evaluated
-
getKeyTemplateText
@NonnullAfterInit public String getKeyTemplateText()
Get the key template text to be evaluated.- Returns:
- template text
-
setKeyTemplateText
public void setKeyTemplateText(@Nullable String text)Set the key template to be evaluated.- Parameters:
text- template to be evaluated
-
getVelocityEngine
@NonnullAfterInit public org.apache.velocity.app.VelocityEngine 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
public void setCustomObject(@Nullable Object object)Set the custom (externally provided) object.- Parameters:
object- the custom object
-
doInitialize
protected void doInitialize() throws ComponentInitializationException- Overrides:
doInitializein classAbstractInitializableComponent- Throws:
ComponentInitializationException
-
build
public StorageServiceSearch build(@Nonnull AttributeResolutionContext resolutionContext, @Nonnull Map<String,List<IdPAttributeValue>> dependencyAttributes) throws ResolutionException
- Specified by:
buildin interfaceExecutableSearchBuilder<StorageServiceSearch>- Throws:
ResolutionException
-
getContextAndKey
@Nonnull private Pair<String,String> getContextAndKey(@Nonnull AttributeResolutionContext resolutionContext, @Nonnull Map<String,List<IdPAttributeValue>> dependencyAttributes) throws ResolutionException
- Throws:
ResolutionException
-
-