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/>
    <debug/>
    <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.

debug Element (Accepts MScript)

MScript Function classes can be designed to print the log records about their execution in order to let the users to trace it. This parameter accepts a number value between 1 and 3 as the 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>