Class ScriptedContextLookupFunction<T extends org.opensaml.messaging.context.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>,org.opensaml.messaging.context.navigate.ContextDataLookupFunction<T,Object>
public class ScriptedContextLookupFunction<T extends org.opensaml.messaging.context.BaseContext> extends net.shibboleth.utilities.java.support.scripting.AbstractScriptEvaluator implements org.opensaml.messaging.context.navigate.ContextDataLookupFunction<T,Object>
AFunctionover aBaseContextwhich calls out to a supplied script.
-
-
Field Summary
Fields Modifier and Type Field Description private Class<T>inputClassWhat class we want the input to test against.
-
Constructor Summary
Constructors Modifier Constructor Description protectedScriptedContextLookupFunction(Class<T> inClass, net.shibboleth.utilities.java.support.scripting.EvaluableScript theScript)Constructor.protectedScriptedContextLookupFunction(Class<T> inClass, net.shibboleth.utilities.java.support.scripting.EvaluableScript theScript, String extraInfo)Constructor.protectedScriptedContextLookupFunction(Class<T> inClass, net.shibboleth.utilities.java.support.scripting.EvaluableScript theScript, String extraInfo, Class<?> outputType)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectapply(T context)ObjectgetCustomObject()static ScriptedContextLookupFunction<org.opensaml.messaging.context.MessageContext>inlineMessageContextScript(String scriptSource)Factory to createScriptedContextLookupFunctionforMessageContexts from inline data.static ScriptedContextLookupFunction<org.opensaml.messaging.context.MessageContext>inlineMessageContextScript(String scriptSource, Class<?> outputType)Factory to createScriptedContextLookupFunctionforMessageContexts from inline data.static ScriptedContextLookupFunction<org.opensaml.messaging.context.MessageContext>inlineMessageContextScript(String engineName, String scriptSource)Factory to createScriptedContextLookupFunctionforMessageContexts from inline data.static ScriptedContextLookupFunction<org.opensaml.messaging.context.MessageContext>inlineMessageContextScript(String engineName, String scriptSource, Class<?> outputType)Factory to createScriptedContextLookupFunctionforMessageContexts from inline data.static ScriptedContextLookupFunction<org.opensaml.profile.context.ProfileRequestContext>inlineScript(String scriptSource)Factory to createScriptedContextLookupFunctionforProfileRequestContexts from inline data.static ScriptedContextLookupFunction<org.opensaml.profile.context.ProfileRequestContext>inlineScript(String scriptSource, Class<?> outputType)Factory to createScriptedContextLookupFunctionforProfileRequestContexts from inline data.static ScriptedContextLookupFunction<org.opensaml.profile.context.ProfileRequestContext>inlineScript(String engineName, String scriptSource)Factory to createScriptedContextLookupFunctionforProfileRequestContexts from inline data.static ScriptedContextLookupFunction<org.opensaml.profile.context.ProfileRequestContext>inlineScript(String engineName, String scriptSource, Class<?> outputType)Factory to createScriptedContextLookupFunctionforProfileRequestContexts from inline data.protected voidprepareContext(ScriptContext scriptContext, Object... input)static ScriptedContextLookupFunction<org.opensaml.messaging.context.MessageContext>resourceMessageContextScript(String engineName, Resource resource)static ScriptedContextLookupFunction<org.opensaml.messaging.context.MessageContext>resourceMessageContextScript(String engineName, Resource resource, Class<?> outputType)static ScriptedContextLookupFunction<org.opensaml.messaging.context.MessageContext>resourceMessageContextScript(Resource resource)static ScriptedContextLookupFunction<org.opensaml.messaging.context.MessageContext>resourceMessageContextScript(Resource resource, Class<?> outputType)static ScriptedContextLookupFunction<org.opensaml.profile.context.ProfileRequestContext>resourceScript(String engineName, Resource resource)static ScriptedContextLookupFunction<org.opensaml.profile.context.ProfileRequestContext>resourceScript(String engineName, Resource resource, Class<?> outputType)static ScriptedContextLookupFunction<org.opensaml.profile.context.ProfileRequestContext>resourceScript(Resource resource)Factory to createScriptedContextLookupFunctionfrom aResource.static ScriptedContextLookupFunction<org.opensaml.profile.context.ProfileRequestContext>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
-
-
-
-
Constructor Detail
-
ScriptedContextLookupFunction
protected ScriptedContextLookupFunction(@Nonnull Class<T> inClass, @Nonnull net.shibboleth.utilities.java.support.scripting.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 net.shibboleth.utilities.java.support.scripting.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 net.shibboleth.utilities.java.support.scripting.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 Detail
-
getCustomObject
@Nullable public Object getCustomObject()
- Overrides:
getCustomObjectin classnet.shibboleth.utilities.java.support.scripting.AbstractScriptEvaluator
-
prepareContext
protected void prepareContext(@Nonnull ScriptContext scriptContext, @Nullable Object... input)- Specified by:
prepareContextin classnet.shibboleth.utilities.java.support.scripting.AbstractScriptEvaluator
-
resourceScript
@Nonnull public static ScriptedContextLookupFunction<org.opensaml.profile.context.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<org.opensaml.profile.context.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<org.opensaml.profile.context.ProfileRequestContext> resourceScript(Resource resource) throws ScriptException, IOException
Factory to createScriptedContextLookupFunctionfrom 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<org.opensaml.profile.context.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<org.opensaml.profile.context.ProfileRequestContext> inlineScript(@Nonnull @NotEmpty String engineName, @Nonnull @NotEmpty String scriptSource) throws ScriptException
Factory to createScriptedContextLookupFunctionforProfileRequestContexts 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<org.opensaml.profile.context.ProfileRequestContext> inlineScript(@Nonnull @NotEmpty String engineName, @Nonnull @NotEmpty String scriptSource, @Nullable Class<?> outputType) throws ScriptException
Factory to createScriptedContextLookupFunctionforProfileRequestContexts 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<org.opensaml.profile.context.ProfileRequestContext> inlineScript(@Nonnull @NotEmpty String scriptSource) throws ScriptException
Factory to createScriptedContextLookupFunctionforProfileRequestContexts from inline data.- Parameters:
scriptSource- the script, as a string- Returns:
- the function
- Throws:
ScriptException- if the compile fails
-
inlineScript
@Nonnull public static ScriptedContextLookupFunction<org.opensaml.profile.context.ProfileRequestContext> inlineScript(@Nonnull @NotEmpty String scriptSource, @Nullable Class<?> outputType) throws ScriptException
Factory to createScriptedContextLookupFunctionforProfileRequestContexts 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<org.opensaml.messaging.context.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<org.opensaml.messaging.context.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<org.opensaml.messaging.context.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<org.opensaml.messaging.context.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<org.opensaml.messaging.context.MessageContext> inlineMessageContextScript(@Nonnull @NotEmpty String engineName, @Nonnull @NotEmpty String scriptSource) throws ScriptException
Factory to createScriptedContextLookupFunctionforMessageContexts 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<org.opensaml.messaging.context.MessageContext> inlineMessageContextScript(@Nonnull @NotEmpty String engineName, @Nonnull @NotEmpty String scriptSource, @Nullable Class<?> outputType) throws ScriptException
Factory to createScriptedContextLookupFunctionforMessageContexts 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<org.opensaml.messaging.context.MessageContext> inlineMessageContextScript(@Nonnull @NotEmpty String scriptSource) throws ScriptException
Factory to createScriptedContextLookupFunctionforMessageContexts from inline data.- Parameters:
scriptSource- the script, aMessageContexts a string- Returns:
- the function
- Throws:
ScriptException- if the compile fails
-
inlineMessageContextScript
@Nonnull public static ScriptedContextLookupFunction<org.opensaml.messaging.context.MessageContext> inlineMessageContextScript(@Nonnull @NotEmpty String scriptSource, @Nullable Class<?> outputType) throws ScriptException
Factory to createScriptedContextLookupFunctionforMessageContexts from inline data.- Parameters:
scriptSource- the script, as a stringoutputType- the type to test against.- Returns:
- the function
- Throws:
ScriptException- if the compile fails
-
-