Package org.jppf.management
Class ScriptedNodeSelector
java.lang.Object
org.jppf.scripting.BaseScriptEvaluator
org.jppf.management.ScriptedNodeSelector
- All Implemented Interfaces:
Serializable,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:
-
Field Summary
Fields inherited from interface org.jppf.management.NodeSelector
ALL_NODES -
Constructor Summary
ConstructorsConstructorDescriptionScriptedNodeSelector(String language, File scriptFile) Initialize this selector with the specfied language and script file.ScriptedNodeSelector(String language, Reader scriptReader) Initialize this selector with the specfied language and script reader.ScriptedNodeSelector(String language, String script) Initialize this selector with the specfied language and script. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaccepts(JPPFManagementInfo nodeInfo) Determine whether a node is accepted by this selector.Methods inherited from class org.jppf.scripting.BaseScriptEvaluator
evaluate, getLanguage, getScript, toString
-
Constructor Details
-
ScriptedNodeSelector
Initialize this selector with the specfied language and script.- Parameters:
language- the language of the script to evaluate.script- the script to evaluate.
-
ScriptedNodeSelector
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
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:NodeSelectorDetermine whether a node is accepted by this selector.- Specified by:
acceptsin interfaceNodeSelector- Parameters:
nodeInfo- information on the node.- Returns:
trueif the node is accepted,falseotherwise.
-