Class ScriptedContextLookupFunction<T extends BaseContext>
java.lang.Object
net.shibboleth.utilities.java.support.scripting.AbstractScriptEvaluator
net.shibboleth.idp.profile.context.navigate.ScriptedContextLookupFunction<T>
- Type Parameters:
T
- the specific type of context
- All Implemented Interfaces:
Function<T,
,Object> ContextDataLookupFunction<T,
Object>
public class ScriptedContextLookupFunction<T extends BaseContext>
extends AbstractScriptEvaluator
implements ContextDataLookupFunction<T,Object>
A
Function
over a BaseContext
which calls out to a supplied script.-
Field Summary
FieldsModifier and TypeFieldDescriptionWhat class we want the input to test against.Fields inherited from class net.shibboleth.utilities.java.support.scripting.AbstractScriptEvaluator
DEFAULT_ENGINE
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
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. -
Method Summary
Modifier and TypeMethodDescriptioninlineMessageContextScript
(String scriptSource) Factory to createScriptedContextLookupFunction
forMessageContext
s from inline data.inlineMessageContextScript
(String scriptSource, Class<?> outputType) Factory to createScriptedContextLookupFunction
forMessageContext
s from inline data.inlineMessageContextScript
(String engineName, String scriptSource) Factory to createScriptedContextLookupFunction
forMessageContext
s from inline data.inlineMessageContextScript
(String engineName, String scriptSource, Class<?> outputType) Factory to createScriptedContextLookupFunction
forMessageContext
s from inline data.inlineScript
(String scriptSource) Factory to createScriptedContextLookupFunction
forProfileRequestContext
s from inline data.inlineScript
(String scriptSource, Class<?> outputType) Factory to createScriptedContextLookupFunction
forProfileRequestContext
s from inline data.inlineScript
(String engineName, String scriptSource) Factory to createScriptedContextLookupFunction
forProfileRequestContext
s from inline data.inlineScript
(String engineName, String scriptSource, Class<?> outputType) Factory to createScriptedContextLookupFunction
forProfileRequestContext
s from inline data.protected void
prepareContext
(ScriptContext scriptContext, Object... input) resourceMessageContextScript
(String engineName, Resource resource) resourceMessageContextScript
(String engineName, Resource resource, Class<?> outputType) resourceMessageContextScript
(Resource resource) resourceMessageContextScript
(Resource resource, Class<?> outputType) resourceScript
(String engineName, Resource resource) resourceScript
(String engineName, Resource resource, Class<?> outputType) resourceScript
(Resource resource) Factory to createScriptedContextLookupFunction
from aResource
.resourceScript
(Resource resource, Class<?> outputType) Methods inherited from class net.shibboleth.utilities.java.support.scripting.AbstractScriptEvaluator
evaluate, finalizeContext, getHideExceptions, getLogPrefix, getOutputType, getReturnOnError, setCustomObject, setHideExceptions, setLogPrefix, setOutputType, setReturnOnError
-
Field Details
-
inputClass
What class we want the input to test against.
-
-
Constructor Details
-
ScriptedContextLookupFunction
protected ScriptedContextLookupFunction(@Nonnull Class<T> inClass, @Nonnull EvaluableScript theScript, @Nullable String extraInfo) Constructor.- Parameters:
inClass
- the class we accept as input.theScript
- the script we will evaluate.extraInfo
- debugging information.
-
ScriptedContextLookupFunction
protected ScriptedContextLookupFunction(@Nonnull Class<T> inClass, @Nonnull EvaluableScript theScript) Constructor.- Parameters:
inClass
- the class we accept as input.theScript
- the script we will evaluate.
-
ScriptedContextLookupFunction
protected ScriptedContextLookupFunction(@Nonnull Class<T> inClass, @Nonnull EvaluableScript theScript, @Nullable String extraInfo, @Nullable Class<?> outputType) Constructor.- Parameters:
inClass
- the class we accept as input.theScript
- the script we will evaluate.extraInfo
- debugging information.outputType
- the type to test against.
-
-
Method Details
-
getCustomObject
- Overrides:
getCustomObject
in classAbstractScriptEvaluator
-
apply
- Specified by:
apply
in interfaceFunction<T extends BaseContext,
Object>
-
prepareContext
- Specified by:
prepareContext
in classAbstractScriptEvaluator
-
resourceScript
@Nonnull public static ScriptedContextLookupFunction<ProfileRequestContext> resourceScript(@Nonnull @NotEmpty String engineName, @Nonnull Resource resource) throws ScriptException, IOException - Parameters:
resource
- the resource to look atengineName
- the language- Returns:
- the function
- Throws:
ScriptException
- if the compile failsIOException
- if the file doesn't exist.
-
resourceScript
@Nonnull public static ScriptedContextLookupFunction<ProfileRequestContext> resourceScript(@Nonnull @NotEmpty String engineName, @Nonnull Resource resource, @Nullable Class<?> outputType) throws ScriptException, IOException - Parameters:
resource
- the resource to look atengineName
- the languageoutputType
- the type to test against.- Returns:
- the function
- Throws:
ScriptException
- if the compile failsIOException
- if the file doesn't exist.
-
resourceScript
@Nonnull public static ScriptedContextLookupFunction<ProfileRequestContext> resourceScript(Resource resource) throws ScriptException, IOException Factory to createScriptedContextLookupFunction
from aResource
.- Parameters:
resource
- the resource to look at- Returns:
- the function
- Throws:
ScriptException
- if the compile failsIOException
- if the file doesn't exist.
-
resourceScript
@Nonnull public static ScriptedContextLookupFunction<ProfileRequestContext> resourceScript(Resource resource, @Nullable Class<?> outputType) throws ScriptException, IOException - Parameters:
resource
- the resource to look atoutputType
- the type to test against.- Returns:
- the function
- Throws:
ScriptException
- if the compile failsIOException
- if the file doesn't exist.
-
inlineScript
@Nonnull public static ScriptedContextLookupFunction<ProfileRequestContext> inlineScript(@Nonnull @NotEmpty String engineName, @Nonnull @NotEmpty String scriptSource) throws ScriptException Factory to createScriptedContextLookupFunction
forProfileRequestContext
s from inline data.- Parameters:
scriptSource
- the script, as a stringengineName
- the language- Returns:
- the function
- Throws:
ScriptException
- if the compile fails
-
inlineScript
@Nonnull public static ScriptedContextLookupFunction<ProfileRequestContext> inlineScript(@Nonnull @NotEmpty String engineName, @Nonnull @NotEmpty String scriptSource, @Nullable Class<?> outputType) throws ScriptException Factory to createScriptedContextLookupFunction
forProfileRequestContext
s from inline data.- Parameters:
scriptSource
- the script, as a stringengineName
- the languageoutputType
- the type to test against.- Returns:
- the function
- Throws:
ScriptException
- if the compile fails
-
inlineScript
@Nonnull public static ScriptedContextLookupFunction<ProfileRequestContext> inlineScript(@Nonnull @NotEmpty String scriptSource) throws ScriptException Factory to createScriptedContextLookupFunction
forProfileRequestContext
s from inline data.- Parameters:
scriptSource
- the script, as a string- Returns:
- the function
- Throws:
ScriptException
- if the compile fails
-
inlineScript
@Nonnull public static ScriptedContextLookupFunction<ProfileRequestContext> inlineScript(@Nonnull @NotEmpty String scriptSource, @Nullable Class<?> outputType) throws ScriptException Factory to createScriptedContextLookupFunction
forProfileRequestContext
s from inline data.- Parameters:
scriptSource
- the script, as a stringoutputType
- the type to test against.- Returns:
- the function
- Throws:
ScriptException
- if the compile fails
-
resourceMessageContextScript
@Nonnull public static ScriptedContextLookupFunction<MessageContext> resourceMessageContextScript(@Nonnull @NotEmpty String engineName, @Nonnull Resource resource) throws ScriptException, IOException - Parameters:
resource
- the resource to look atengineName
- the language- Returns:
- the function
- Throws:
ScriptException
- if the compile failsIOException
- if the file doesn't exist.
-
resourceMessageContextScript
@Nonnull public static ScriptedContextLookupFunction<MessageContext> resourceMessageContextScript(@Nonnull @NotEmpty String engineName, @Nonnull Resource resource, @Nullable Class<?> outputType) throws ScriptException, IOException - Parameters:
resource
- the resource to look atengineName
- the languageoutputType
- the type to test against.- Returns:
- the function
- Throws:
ScriptException
- if the compile failsIOException
- if the file doesn't exist.
-
resourceMessageContextScript
@Nonnull public static ScriptedContextLookupFunction<MessageContext> resourceMessageContextScript(Resource resource) throws ScriptException, IOException - Parameters:
resource
- the resource to look at- Returns:
- the function
- Throws:
ScriptException
- if the compile failsIOException
- if the file doesn't exist.
-
resourceMessageContextScript
@Nonnull public static ScriptedContextLookupFunction<MessageContext> resourceMessageContextScript(Resource resource, @Nullable Class<?> outputType) throws ScriptException, IOException - Parameters:
resource
- the resource to look atoutputType
- the type to test against.- Returns:
- the function
- Throws:
ScriptException
- if the compile failsIOException
- if the file doesn't exist.
-
inlineMessageContextScript
@Nonnull public static ScriptedContextLookupFunction<MessageContext> inlineMessageContextScript(@Nonnull @NotEmpty String engineName, @Nonnull @NotEmpty String scriptSource) throws ScriptException Factory to createScriptedContextLookupFunction
forMessageContext
s from inline data.- Parameters:
scriptSource
- the script, as a stringengineName
- the language- Returns:
- the function
- Throws:
ScriptException
- if the compile fails
-
inlineMessageContextScript
@Nonnull public static ScriptedContextLookupFunction<MessageContext> inlineMessageContextScript(@Nonnull @NotEmpty String engineName, @Nonnull @NotEmpty String scriptSource, @Nullable Class<?> outputType) throws ScriptException Factory to createScriptedContextLookupFunction
forMessageContext
s from inline data.- Parameters:
scriptSource
- the script, as a stringengineName
- the languageoutputType
- the type to test against.- Returns:
- the function
- Throws:
ScriptException
- if the compile fails
-
inlineMessageContextScript
@Nonnull public static ScriptedContextLookupFunction<MessageContext> inlineMessageContextScript(@Nonnull @NotEmpty String scriptSource) throws ScriptException Factory to createScriptedContextLookupFunction
forMessageContext
s from inline data.- Parameters:
scriptSource
- the script, aMessageContexts a string- Returns:
- the function
- Throws:
ScriptException
- if the compile fails
-
inlineMessageContextScript
@Nonnull public static ScriptedContextLookupFunction<MessageContext> inlineMessageContextScript(@Nonnull @NotEmpty String scriptSource, @Nullable Class<?> outputType) throws ScriptException Factory to createScriptedContextLookupFunction
forMessageContext
s from inline data.- Parameters:
scriptSource
- the script, as a stringoutputType
- the type to test against.- Returns:
- the function
- Throws:
ScriptException
- if the compile fails
-