T - the specific type of contextpublic class ScriptedContextLookupFunction<T extends BaseContext> extends Object implements ContextDataLookupFunction<T,Object>
Function over a BaseContext which calls out to a supplied script.| Modifier and Type | Field and Description |
|---|---|
private Object |
customObject
The custom object we can be injected into the script.
|
static String |
DEFAULT_ENGINE
The default language is Javascript.
|
private boolean |
hideExceptions
Whether to raise runtime exceptions if a script fails.
|
private Class<T> |
inputClass
What class we want the input to test against.
|
private org.slf4j.Logger |
log
Class logger.
|
private String |
logPrefix
Debugging info.
|
private Class |
outputClass
What class we want the output to test against.
|
private EvaluableScript |
script
The script we care about.
|
| Modifier | Constructor and Description |
|---|---|
protected |
ScriptedContextLookupFunction(Class<T> inClass,
EvaluableScript theScript)
Constructor.
|
protected |
ScriptedContextLookupFunction(Class<T> inClass,
EvaluableScript theScript,
String extraInfo)
Constructor.
|
protected |
ScriptedContextLookupFunction(Class<T> inClass,
EvaluableScript theScript,
String extraInfo,
Class outputType)
Constructor.
|
@Nonnull @NotEmpty public static final String DEFAULT_ENGINE
@Nonnull private final org.slf4j.Logger log
@Nonnull private final EvaluableScript script
@Nonnull private final Class<T extends BaseContext> inputClass
@Nullable private Object customObject
private boolean hideExceptions
protected ScriptedContextLookupFunction(@Nonnull Class<T> inClass, @Nonnull EvaluableScript theScript, @Nullable String extraInfo)
inClass - the class we accept as input.theScript - the script we will evaluate.extraInfo - debugging information.protected ScriptedContextLookupFunction(@Nonnull Class<T> inClass, @Nonnull EvaluableScript theScript)
inClass - the class we accept as input.theScript - the script we will evaluate.protected ScriptedContextLookupFunction(@Nonnull Class<T> inClass, @Nonnull EvaluableScript theScript, @Nullable String extraInfo, @Nullable Class outputType)
inClass - the class we accept as input.theScript - the script we will evaluate.extraInfo - debugging information.outputType - the type to test against.@Nullable public Object getCustomObject()
@Nullable public void setCustomObject(Object object)
object - the custom objectpublic void setHideExceptions(boolean flag)
flag - flag to setpublic Object apply(@Nullable T context)
apply in interface Function<T extends BaseContext,Object>static ScriptedContextLookupFunction<ProfileRequestContext> resourceScript(@Nonnull@NotEmpty String engineName, @Nonnull Resource resource) throws ScriptException, IOException
resource - the resource to look atengineName - the languageScriptException - if the compile failsIOException - if the file doesn't exist.static ScriptedContextLookupFunction<ProfileRequestContext> resourceScript(@Nonnull@NotEmpty String engineName, @Nonnull Resource resource, @Nullable Class outputType) throws ScriptException, IOException
resource - the resource to look atengineName - the languageoutputType - the type to test against.ScriptException - if the compile failsIOException - if the file doesn't exist.static ScriptedContextLookupFunction<ProfileRequestContext> resourceScript(Resource resource) throws ScriptException, IOException
ScriptedContextLookupFunction from a Resource.resource - the resource to look atScriptException - if the compile failsIOException - if the file doesn't exist.static ScriptedContextLookupFunction<ProfileRequestContext> resourceScript(Resource resource, @Nullable Class outputType) throws ScriptException, IOException
resource - the resource to look atoutputType - the type to test against.ScriptException - if the compile failsIOException - if the file doesn't exist.static ScriptedContextLookupFunction<ProfileRequestContext> inlineScript(@Nonnull@NotEmpty String engineName, @Nonnull@NotEmpty String scriptSource) throws ScriptException
ScriptedContextLookupFunction for ProfileRequestContexts from inline data.scriptSource - the script, as a stringengineName - the languageScriptException - if the compile failsstatic ScriptedContextLookupFunction<ProfileRequestContext> inlineScript(@Nonnull@NotEmpty String engineName, @Nonnull@NotEmpty String scriptSource, @Nullable Class outputType) throws ScriptException
ScriptedContextLookupFunction for ProfileRequestContexts from inline data.scriptSource - the script, as a stringengineName - the languageoutputType - the type to test against.ScriptException - if the compile failsstatic ScriptedContextLookupFunction<ProfileRequestContext> inlineScript(@Nonnull@NotEmpty String scriptSource) throws ScriptException
ScriptedContextLookupFunction for ProfileRequestContexts from inline data.scriptSource - the script, as a stringScriptException - if the compile failsstatic ScriptedContextLookupFunction<ProfileRequestContext> inlineScript(@Nonnull@NotEmpty String scriptSource, @Nullable Class outputType) throws ScriptException
ScriptedContextLookupFunction for ProfileRequestContexts from inline data.scriptSource - the script, as a stringoutputType - the type to test against.ScriptException - if the compile failsstatic ScriptedContextLookupFunction<MessageContext> resourceMessageContextScript(@Nonnull@NotEmpty String engineName, @Nonnull Resource resource) throws ScriptException, IOException
resource - the resource to look atengineName - the languageScriptException - if the compile failsIOException - if the file doesn't exist.static ScriptedContextLookupFunction<MessageContext> resourceMessageContextScript(@Nonnull@NotEmpty String engineName, @Nonnull Resource resource, @Nullable Class outputType) throws ScriptException, IOException
resource - the resource to look atengineName - the languageoutputType - the type to test against.ScriptException - if the compile failsIOException - if the file doesn't exist.static ScriptedContextLookupFunction resourceMessageContextScript(Resource resource) throws ScriptException, IOException
resource - the resource to look atScriptException - if the compile failsIOException - if the file doesn't exist.static ScriptedContextLookupFunction<MessageContext> resourceMessageContextScript(Resource resource, @Nullable Class outputType) throws ScriptException, IOException
resource - the resource to look atoutputType - the type to test against.ScriptException - if the compile failsIOException - if the file doesn't exist.static ScriptedContextLookupFunction<MessageContext> inlineMessageContextScript(@Nonnull@NotEmpty String engineName, @Nonnull@NotEmpty String scriptSource) throws ScriptException
ScriptedContextLookupFunction for MessageContexts from inline data.scriptSource - the script, as a stringengineName - the languageScriptException - if the compile failsstatic ScriptedContextLookupFunction<MessageContext> inlineMessageContextScript(@Nonnull@NotEmpty String engineName, @Nonnull@NotEmpty String scriptSource, @Nullable Class outputType) throws ScriptException
ScriptedContextLookupFunction for MessageContexts from inline data.scriptSource - the script, as a stringengineName - the languageoutputType - the type to test against.ScriptException - if the compile failsstatic ScriptedContextLookupFunction<MessageContext> inlineMessageContextScript(@Nonnull@NotEmpty String scriptSource) throws ScriptException
ScriptedContextLookupFunction for MessageContexts from inline data.scriptSource - the script, aMessageContexts a stringScriptException - if the compile failsstatic ScriptedContextLookupFunction<MessageContext> inlineMessageContextScript(@Nonnull@NotEmpty String scriptSource, @Nullable Class outputType) throws ScriptException
ScriptedContextLookupFunction for MessageContexts from inline data.scriptSource - the script, as a stringoutputType - the type to test against.ScriptException - if the compile failsCopyright © 1999–2017 Shibboleth Consortium. All rights reserved.