Package net.shibboleth.idp.profile.logic
Class ScriptedPredicate
java.lang.Object
net.shibboleth.utilities.java.support.scripting.AbstractScriptEvaluator
net.shibboleth.utilities.java.support.logic.ScriptedPredicate<ProfileRequestContext>
net.shibboleth.idp.profile.logic.ScriptedPredicate
- All Implemented Interfaces:
Predicate<ProfileRequestContext>,Predicate<ProfileRequestContext>
A
Predicate which calls out to a supplied script.-
Field Summary
FieldsFields inherited from class net.shibboleth.utilities.java.support.scripting.AbstractScriptEvaluator
DEFAULT_ENGINE -
Constructor Summary
ConstructorsConstructorDescriptionScriptedPredicate(EvaluableScript theScript) Constructor.ScriptedPredicate(EvaluableScript theScript, String extraInfo) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic ScriptedPredicateinlineScript(String scriptSource) Factory to createScriptedPredicatefrom inline data.static ScriptedPredicateinlineScript(String engineName, String scriptSource) Factory to createScriptedPredicatefrom inline data.protected voidprepareContext(ScriptContext scriptContext, Object... input) static ScriptedPredicateresourceScript(String engineName, Resource resource) Factory to createScriptedPredicatefrom aResource.static ScriptedPredicateresourceScript(Resource resource) Factory to createScriptedPredicatefrom aResource.Methods inherited from class net.shibboleth.utilities.java.support.logic.ScriptedPredicate
getInputType, resourceScript, resourceScript, setInputType, setReturnOnError, testMethods inherited from class net.shibboleth.utilities.java.support.scripting.AbstractScriptEvaluator
evaluate, finalizeContext, getCustomObject, getHideExceptions, getLogPrefix, getOutputType, getReturnOnError, setCustomObject, setHideExceptions, setLogPrefix, setOutputType, setReturnOnError
-
Field Details
-
log
@Nonnull private final org.slf4j.Logger logClass logger.
-
-
Constructor Details
-
ScriptedPredicate
public ScriptedPredicate(@Nonnull @NotEmpty @ParameterName(name="theScript") EvaluableScript theScript, @Nullable @NotEmpty @ParameterName(name="extraInfo") String extraInfo) Constructor.- Parameters:
theScript- the script we will evaluate.extraInfo- debugging information.
-
ScriptedPredicate
public ScriptedPredicate(@Nonnull @NotEmpty @ParameterName(name="theScript") EvaluableScript theScript) Constructor.- Parameters:
theScript- the script we will evaluate.
-
-
Method Details
-
prepareContext
- Overrides:
prepareContextin classScriptedPredicate<ProfileRequestContext>
-
resourceScript
public static ScriptedPredicate resourceScript(@Nonnull @NotEmpty String engineName, @Nonnull Resource resource) throws ScriptException, IOException Factory to createScriptedPredicatefrom aResource.- Parameters:
resource- the resource to look atengineName- the language- Returns:
- the predicate
- Throws:
ScriptException- if the compile failsIOException- if the file doesn't exist.
-
resourceScript
public static ScriptedPredicate resourceScript(Resource resource) throws ScriptException, IOException Factory to createScriptedPredicatefrom aResource.- Parameters:
resource- the resource to look at- Returns:
- the predicate
- Throws:
ScriptException- if the compile failsIOException- if the file doesn't exist.
-
inlineScript
public static ScriptedPredicate inlineScript(@Nonnull @NotEmpty String engineName, @Nonnull @NotEmpty String scriptSource) throws ScriptException Factory to createScriptedPredicatefrom inline data.- Parameters:
scriptSource- the script, as a stringengineName- the language- Returns:
- the predicate
- Throws:
ScriptException- if the compile fails
-
inlineScript
public static ScriptedPredicate inlineScript(@Nonnull @NotEmpty String scriptSource) throws ScriptException Factory to createScriptedPredicatefrom inline data.- Parameters:
scriptSource- the script, as a string- Returns:
- the predicate
- Throws:
ScriptException- if the compile fails
-