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 ScriptedPredicate
inlineScript
(String scriptSource) Factory to createScriptedPredicate
from inline data.static ScriptedPredicate
inlineScript
(String engineName, String scriptSource) Factory to createScriptedPredicate
from inline data.protected void
prepareContext
(ScriptContext scriptContext, Object... input) static ScriptedPredicate
resourceScript
(String engineName, Resource resource) Factory to createScriptedPredicate
from aResource
.static ScriptedPredicate
resourceScript
(Resource resource) Factory to createScriptedPredicate
from aResource
.Methods inherited from class net.shibboleth.utilities.java.support.logic.ScriptedPredicate
getInputType, resourceScript, resourceScript, setInputType, setReturnOnError, test
Methods 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:
prepareContext
in classScriptedPredicate<ProfileRequestContext>
-
resourceScript
public static ScriptedPredicate resourceScript(@Nonnull @NotEmpty String engineName, @Nonnull Resource resource) throws ScriptException, IOException Factory to createScriptedPredicate
from 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 createScriptedPredicate
from 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 createScriptedPredicate
from 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 createScriptedPredicate
from inline data.- Parameters:
scriptSource
- the script, as a string- Returns:
- the predicate
- Throws:
ScriptException
- if the compile fails
-