Package org.jppf.job

Class ScriptedJobSelector

All Implemented Interfaces:
Serializable, JobSelector

public class ScriptedJobSelector extends BaseScriptEvaluator implements 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:
  • Constructor Details

    • ScriptedJobSelector

      public ScriptedJobSelector(String language, String script)
      Initialize this selector with the specfied language and script.
      Parameters:
      language - the language of the script to evaluate.
      script - the script to evaluate.
    • ScriptedJobSelector

      public ScriptedJobSelector(String language, Reader scriptReader) throws IOException
      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

      public ScriptedJobSelector(String language, File scriptFile) throws IOException
      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

      public boolean accepts(JPPFDistributedJob job)
      Description copied from interface: JobSelector
      Determine whether the specified job is accepted by this selector.
      Specified by:
      accepts in interface JobSelector
      Parameters:
      job - the job to check.
      Returns:
      true if the job is acepted, false otherwise.