MScript Function Configuration

Top  Previous  Next

MScript is an extensible language. New functions can be developed in Java and configured using mscriptFunction configuration element.

The mscriptFunction element must be used in a global configuration file. See Global Configuration versus Page Configuration.

  <mscriptFunction name="calculateDiscount">
    <class>mypack.MyMScriptFunction</class>
    <unitname/>
    <log logger="" level=""/> (since v5.0, "debug" element deprecated)
    <param name="myparam1">myparam1 value</param>
  </mscriptFunction>

See Custom MScript Function Development

The nested Elements

class Element

Defines the name of the MScript Function class that implements org.moremotion.evaluator.MScriptFunction interface.

unitname Element (Accepts MScript)

This element defines the resource bundle name of the MScript Function class. Resource bundles contain multi-lingual resources. See Resource Management.

log (since v5.0, "debug" element deprecated)

This element defines a logger and a log level. The logger attribute (Accepts MScript) should contain the name of a logger configuration. If this attribute is omitted the standard logger is used to print the log records to the system console. The level attribute (Accepts MScript) specifies the detail level of the logging

param Element (Accepts MScript)

The parameters defined with param element are evaluated by the MScript Function classes. An MScript Function parameter can be given either with param element

   <mscriptFunction name="calculateDiscount">
    ...
    <param name="rate">0.15</param>
  </mscriptFunction>

or with custom element

  <mscriptFunction name="calculateDiscount">
    ...
    <rate>0.15</rate>
  </mscriptFunction>