Package org.jppf.job
Class ScriptedJobSelector
java.lang.Object
org.jppf.scripting.BaseScriptEvaluator
org.jppf.job.ScriptedJobSelector
- All Implemented Interfaces:
Serializable,JobSelector
A job selector that uses a script to accept jobs. The script is evaluated using the
javax.script.* API (JSR-223).
When the script is executed, it provides access to a variable named "jppfJob" which is an instance of JPPFDistributedJob.
- Since:
- 5.1
- Author:
- Laurent Cohen
- See Also:
-
Field Summary
Fields inherited from interface org.jppf.job.JobSelector
ALL_JOBS -
Constructor Summary
ConstructorsConstructorDescriptionScriptedJobSelector(String language, File scriptFile) Initialize this selector with the specfied language and script file.ScriptedJobSelector(String language, Reader scriptReader) Initialize this selector with the specfied language and script reader.ScriptedJobSelector(String language, String script) Initialize this selector with the specfied language and script. -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermine whether the specified job is accepted by this selector.Methods inherited from class org.jppf.scripting.BaseScriptEvaluator
evaluate, getLanguage, getScript, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.jppf.job.JobSelector
and, negate, or, xor
-
Constructor Details
-
ScriptedJobSelector
Initialize this selector with the specfied language and script.- Parameters:
language- the language of the script to evaluate.script- the script to evaluate.
-
ScriptedJobSelector
Initialize this selector with the specfied language and script reader.- Parameters:
language- the language of the script to evaluate.scriptReader- a reader from which to read the script to evaluate.- Throws:
IOException- if the script could not be read.
-
ScriptedJobSelector
Initialize this selector with the specfied language and script file.- Parameters:
language- the language of the script to evaluate.scriptFile- a file from which to read the script to evaluate.- Throws:
IOException- if the script could not be read.
-
-
Method Details
-
accepts
Description copied from interface:JobSelectorDetermine whether the specified job is accepted by this selector.- Specified by:
acceptsin interfaceJobSelector- Parameters:
job- the job to check.- Returns:
trueif the job is acepted,falseotherwise.
-