31.3. Scripting Metadata

Metadata may be stored in the script to provide additional information to the server on how the script is executed. This metadata is contained in a specially formatted comment on the first lines of the script.
Properties are defined as key=value pairs separated by commas, with the comment styles, such as //, ;;, or #, depending on the scripting language in use. This information may be split over multiple lines if necessary, and single or double quotes may be used to delimit the values.
The following is an example of a valid metadata comment:
// name=test, language=javascript
// mode=local, parameters=[a,b,c]
Metadata Properties

The following metadata properties are available:

  • mode: defines the mode of execution of a script. Can be one of the following values:
    • local: the script will be executed only by the node handling the request. The script itself however can invoke clustered operations.
    • distributed: runs the script using the Distributed Executor Service.
  • language: defines the script engine that will be used to execute the script, e.g. Javascript.
  • extension: an alternative method of specifying the script engine that will be used to execute the script, e.g. js.
  • role: a specific role which is required to execute the script.
  • parameters: an array of valid parameter names for this script. Invocations which specify parameter names not included in this list will cause an exception.

As the execution mode is a characteristic of the script there is no additional configuration required on the client to invoke scripts in different modes.