Class ScriptedNodeSelector

java.lang.Object
org.jppf.scripting.BaseScriptEvaluator
org.jppf.management.ScriptedNodeSelector
All Implemented Interfaces:
Serializable, NodeSelector

public class ScriptedNodeSelector extends BaseScriptEvaluator implements NodeSelector
A node selector that uses a script to accept nodes. The script is evaluated using the javax.script.* API (JSR-223).

When the script is executed, it provides access to a variable named "nodeInfo" which is an instance of JPPFManagementInfo and represents the node.

Since:
5.2
Author:
Laurent Cohen
See Also:
  • Constructor Details

    • ScriptedNodeSelector

      public ScriptedNodeSelector(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.
    • ScriptedNodeSelector

      public ScriptedNodeSelector(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.
    • ScriptedNodeSelector

      public ScriptedNodeSelector(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(JPPFManagementInfo nodeInfo)
      Description copied from interface: NodeSelector
      Determine whether a node is accepted by this selector.
      Specified by:
      accepts in interface NodeSelector
      Parameters:
      nodeInfo - information on the node.
      Returns:
      true if the node is accepted, false otherwise.