Skip to content

Plugin Parameter Manual

What's Plugin Parameter

Plugin Parameter is the input of Java Plugin, it is defined in xml format. Below is an example from Hello World Plugin:

<server-template>
  <parameter name="url" key="url" type="text" desc="target url" check-regular="" required="true"></parameter>
  <parameter name="positiveMatch" key="positiveMatch" type="text" desc="positive match of content" check-regular="">OKOKOK</parameter>
</server-template>

How to define Plugin Parameter

Create a xml file, let's say parameters.xml, then add a root tag <server-template>, under this tag, you can customize your own parameters.

Each parameter is a <parameter> element, one <parameter> represents one parameter.

Parameter Properties

  • name: required, name of the parameter, which will show on MCT page when adding check.
  • key: required, parameter key, which will be passed to plugin while executing.
  • type: required, parameter type, supported types are text, textarea, number, password, checkbox, select.
  • desc: optional, parameter description.
  • required: optional, mark if the parameter is mandatory, default is false.

In addition, if you want to assign a default value, just add it under <parameter> tag. On above example, OKOKOK is the default value for parameter positiveMatch.

Parameter Dependency

What if a parameter is depended on another? which means, a parameter is only valid when another parameter is present? Don't worry, property show-dependency will do the work, here is the example:

<parameter name='AppToken Key Source' type='select' desc='source of key which used to generate apptoken' required='true'  checkitems='SIS:0;KM:1' key='apptoken_src' check-regular=''>0</parameter>
<parameter name='Tomcat J2ee App Server VIP' type='text' show-dependency="apptoken_src:1" desc='tomcat j2ee app server vip for generate apptoken' required="0" key='apptoken_tc_vip' check-regular=''></parameter>

Pay attention on show-dependency="apptoken_src:1", it means, only when value of parameter apptoken_src is 1, current parameter will be shown. It supports multiple conditions connected with && and || too.