3.2. 基本的な XML ルールの作成
本セクションでは、MTA XML ルールを作成する方法を説明します。これは、すでに MTA がインストールされていることを前提としています。インストール手順は、MTA の『CLI ガイド』を参照してください。
3.2.1. 基本的な XML ルールテンプレートの作成
MTA XML ルールは conditions および actions で構成され、以下のルールパターンを使用します。
when(condition) perform(action) otherwise(action)
when(condition)
perform(action)
otherwise(action)
以下の内容で、XML ルールの基本的な構文であるファイルを作成します。
重要
XML ファイル名には、.windup.xml
または .mta.xml
拡張子が含まれている必要があります。それ以外の場合には、MTA は新しいルールを評価しません。
<?xml version="1.0"?> <ruleset id="unique-ruleset-id" xmlns="http://windup.jboss.org/schema/jboss-ruleset" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://windup.jboss.org/schema/jboss-ruleset http://windup.jboss.org/schema/jboss-ruleset/windup-jboss-ruleset.xsd"> <metadata> <!-- Metadata about the rule including a description, source technology, target technology, and any add-on dependencies --> </metadata> <rules> <rule id="unique-ruleset-id-01000"> <when> <!-- Test a condition... --> </when> <perform> <!-- Perform this action when condition is satisfied --> </perform> <otherwise> <!-- Perform this action when condition is not satisfied --> </otherwise> </rule> <rules> </ruleset>
<?xml version="1.0"?>
<ruleset id="unique-ruleset-id"
xmlns="http://windup.jboss.org/schema/jboss-ruleset"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://windup.jboss.org/schema/jboss-ruleset http://windup.jboss.org/schema/jboss-ruleset/windup-jboss-ruleset.xsd">
<metadata>
<!-- Metadata about the rule including a description,
source technology, target technology, and any
add-on dependencies -->
</metadata>
<rules>
<rule id="unique-ruleset-id-01000">
<when>
<!-- Test a condition... -->
</when>
<perform>
<!-- Perform this action when condition is satisfied -->
</perform>
<otherwise>
<!-- Perform this action when condition is not satisfied -->
</otherwise>
</rule>
<rules>
</ruleset>