本节介绍了各种可用策略和它们在 Identity Manager 中的职能,以及如何定义您自己的策略。包括以下主题:
您可以在订购者通道和发布者通道上定义若干不同类型的策略。每种策略应用于数据转换中的不同步骤,某些策略仅在发生特定操作时才可以使用。例如,创建策略只能在创建新对象时使用。
在通道上执行策略的顺序是:
Figure 1-1 策略的执行顺序

事件转换策略更改 Metadirectory 引擎中事件的显示,这些事件发生在 Identity Vault 或已连接的应用程序中。事件转换策略中执行的大部分常见任务是自定义过滤,如范围过滤和事件类型过滤。
范围过滤根据事件位置或特性值去除不需要的事件。例如,如果 department(部门)特性不等于特定的值或不是特定组的成员,则去除该事件。
事件类型过滤根据事件类型去除不需要的事件。例如,去除所有删除事件。
示例:
范围过滤: 此示例中的 DirXML 底稿策略允许仅用于用户的事件,这些用户包含在用户子树中、未被禁止且其 Title(职务)特性中不包含文字 Consultant 和 Manager。它还生成状态文档,指示阻止操作的时间。
<policy>
<rule>
<description>Scope Filtering</description>
<conditions>
<or>
<if-class-name op="equal">User</if-class-name>
</or>
<or>
<if-src-dn op="not-in-subtree">Users</if-src-dn>
<if-attr name="Login Disabled" op="equal">True</if-attr>
<if-attr mode="regex" name="Title" op="equal">.*Consultant.*</if-attr>
<if-attr mode="regex" name="Title" op="equal">.*Manager.*</if-attr>
</or>
</conditions>
<actions>
<do-status level="error">
<arg-string>
<token-text>User doesn’t meet required conditions</token-text>
</arg-string>
</do-status>
<do-veto/>
</actions>
</rule>
</policy>
此 DirXML 底稿策略禁止对用户对象(已关联的对象除外)进行修改操作。
<policy>
<rule>
<description>Veto all operation on User except modifies of already associated objects</description>
<conditions>
<or>
<if-class-name op="equal">User</if-class-name>
</or>
<or>
<if-operation op="not-equal">modify</if-operation>
<if-association op="not-associated"/>
</or>
</conditions>
<actions>
<do-veto/>
</actions>
</rule>
</policy>
类型过滤 - 此示例中的 DirXML 底稿策略的第一条规则仅允许同步员工和合同工树枝中的对象。第二条规则阻止所有重命名和移动操作。
<policy>
<rule>
<description>Only synchronize the Employee and Contractor subtrees</description>
<conditions>
<and>
<if-src-dn op="not-in-container">Employees</if-src-dn>
<if-src-dn op="not-in-container">Contractors</if-src-dn>
</and>
</conditions>
<actions>
<do-status level="warning">
<arg-string>
<token-text>Change ignored: Out of scope.</token-text>
</arg-string>
</do-status>
<do-veto/>
</actions>
</rule>
<rule>
<description>Don’t synchronize moves or renames</description>
<conditions>
<or>
<if-operation op="equal">move</if-operation>
<if-operation op="equal">rename</if-operation>
</or>
</conditions>
<actions>
<do-status level="warning">
<arg-string>
<token-text>Change ignored: We don’t like you to do that.</token-text>
</arg-string>
</do-status>
<do-veto/>
</actions>
</rule>
</policy>
此 DirXML 底稿策略阻止所有的 Add 事件。
<policy>
<rule>
<description>Type Filtering</description>
<conditions>
<and>
<if-operation op="equal">add</if-operation>
</and>
</conditions>
<actions>
<do-status level="warning">
<arg-string>
<token-text>Change ignored: Adds are not allowed.</token-text>
</arg-string>
</do-status>
<do-veto/>
</actions>
</rule>
</policy>
匹配策略(如订购者匹配和发布者匹配)在目标数据存储区中寻找对应于源数据存储区中的非关联对象的对象。请注意并非始终需要匹配策略,这一点很重要。
例如,在下列情况下可能不需要匹配策略:
必须认真构思匹配策略,以确保匹配策略不会找到错误的匹配项。
示例:
按 ID 匹配: 此示例中的 DirXML 底稿策略根据因特网电子邮件地址匹配用户。
<policy>
<rule>
<description>Match Users based on email address</description>
<conditions>
<and>
<if-class-name op="equal">User</if-class-name>
</and>
</conditions>
<actions>
<do-find-matching-object>
<arg-dn>
<token-text>ou=people,o=novell</token-text>
</arg-dn>
<arg-match-attr name="Internet EMail Address"/>
</do-find-matching-object>
</actions>
</rule>
</policy>
按名称匹配: 此示例中的 DirXML 底稿策略根据组对象的 Common Name(常用名)特性对它进行匹配。
<?xml version="1.0" encoding="UTF-8"?>
<policy>
<rule>
<description>Match Group by Common Name</description>
<conditions>
<or>
<if-class-name op="equal">Group</if-class-name>
</or>
</conditions>
<actions>
<do-find-matching-object scope="subtree">
<arg-match-attr name="CN"/>
</do-find-matching-object>
</actions>
</rule>
</policy>
创建策略(如订购者创建策略和发布者创建策略)定义在创建新对象必须满足的条件。如果没有创建策略,则意味着可以创建对象。
例如,在 Identity Vault 中创建新用户,但只为新用户对象分配了名称和 ID。在 eDirectory 树中可镜像该创建,但不会在与 Identity Vault 连接的应用程序中立即反映这一添加,因为您的创建策略指定只允许具有一个更完整定义的用户对象。
订购者和发布者的创建策略可以相同,也可以不同。
要在 eDirectory 中创建对象时,可指定在创建过程中使用的模板对象。
创建策略常用于以下情况:
示例:
必需的特性: 此示例中的 DirXML 底稿策略的第一条规则要求在创建用户之前用户对象需要包含 CN、Given Name(名)、Surname(姓氏)和 Internet EMail Address(因特网电子邮件地址)特性。第二条规则要求所有组织单元对象都有 OU 特性。最后一条规则禁止所有名为 Fred 的用户对象。
<policy>
<rule>
<description>Veto if required attributes CN, Given Name, Surname and Internet EMail Address not available</description>
<conditions>
<or>
<if-class-name op="equal">User</if-class-name>
</or>
</conditions>
<actions>
<do-veto-if-op-attr-not-available name="CN"/>
<do-veto-if-op-attr-not-available name="Given Name"/>
<do-veto-if-op-attr-not-available name="Surname"/>
<do-veto-if-op-attr-not-available name="Internet EMail Address"/>
</actions>
</rule>
<rule>
<description>Organizational Unit Required Attributes</description>
<conditions>
<or>
<if-class-name op="equal">Organizational Unit</if-class-name>
</or>
</conditions>
<actions>
<do-veto-if-op-attr-not-available name="OU"/>
</actions>
</rule>
</policy>
默认特性值: 此示例中的 DirXML 底稿策略添加用户 Description(说明)特性的默认值。
<policy>
<rule>
<description>Default Description of New Employee</description>
<conditions>
<or>
<if-class-name op="equal">User</if-class-name>
</or>
</conditions>
<actions>
<do-set-default-attr-value name="Description">
<arg-value type="string">
<token-text>New Employee</token-text>
</arg-value>
</do-set-default-attr-value>
</actions>
</rule>
</policy>
默认口令: 此示例中的 DirXML 底稿策略将口令值创建为:名的前两个字母和姓的前六个字母,均为小写。
<policy>
<rule>
<description>Default Password of [2]FN+[6]LN</description>
<conditions>
<and>
<if-class-name op="equal">User</if-class-name>
<if-password op="not-available"/>
</and>
</conditions>
<actions>
<do-set-dest-password>
<arg-string>
<token-lower-case>
<token-substring length="2">
<token-op-attr name="Given Name"/>
</token-substring>
<token-substring length="6">
<token-op-attr name="Surname"/>
</token-substring>
</token-lower-case>
</arg-string>
</do-set-dest-password>
</actions>
</rule>
</policy>
指定模板: 此示例中的 DirXML 底稿策略在用户的 Title(职务)特性指示该用户为经理(包含“Manager”)时指定模板对象。
<policy>
<rule>
<description>Assign Manager Template if Title contains Manager</description>
<conditions>
<and>
<if-class-name op="equal">User</if-class-name>
<if-op-attr name="Title" op="available"/>
<if-op-attr mode="regex" name="Title" op="equal">.*Manager.*</if-op-attr>
</and>
</conditions>
<actions>
<do-set-op-template-dn>
<arg-dn>
<token-text>Users\Manager Template</token-text>
</arg-dn>
</do-set-op-template-dn>
</actions>
</rule>
</policy>
布局策略确定新对象在 Identity Vault 和已连接的应用程序中的放置位置及名称。
如果希望在 Identity Vault 中创建对象,则发布者通道需要布局策略。即使希望在已连接的应用程序中创建对象,订购者通道也可能不需要布局策略,这取决于目标数据存储区的本质。例如,与关系数据库同步时无需任何布局策略,因为关系数据库中的行没有位置或名称。
示例:
按特性值布局: 此示例中的 DirXML 底稿策略根据 Department(部门)特性的值在特定树枝中创建用户。
<policy>
<rule>
<description>Department Engineering</description>
<conditions>
<and>
<if-class-name op="equal">User</if-class-name>
<if-op-attr mode="regex" name="Department" op="equal">.*Engineering.*</if-op-attr>
</and>
</conditions>
<actions>
<do-set-op-dest-dn>
<arg-dn>
<token-text>Eng</token-text>
<token-text>\</token-text>
<token-op-attr name="CN"/>
</arg-dn>
</do-set-op-dest-dn>
</actions>
</rule>
<rule>
<description>Department HR</description>
<conditions>
<and>
<if-class-name op="equal">User</if-class-name>
<if-op-attr mode="regex" name="Department" op="equal">.*HR.*</if-op-attr>
</and>
</conditions>
<actions>
<do-set-op-dest-dn>
<arg-dn>
<token-text>HR</token-text>
<token-text>\</token-text>
<token-op-attr name="CN"/>
</arg-dn>
</do-set-op-dest-dn>
</actions>
</rule>
</policy>
此 DirXML 底稿策略按 src-dn 确定用户或组织单元在输入文档中的布局。
<policy>
<rule>
<description>PublisherPlacementRule</description>
<conditions>
<or>
<if-class-name op="equal">User</if-class-name>
<if-class-name op="equal">Organizational Unit</if-class-name>
</or>
<or>
<if-src-dn op="in-subtree">o=people, o=novell</if-src-dn>
</or>
</conditions>
<actions>
<do-set-op-dest-dn>
<arg-dn>
<token-text>People</token-text>
<token-text>\</token-text>
<token-unmatched-src-dn convert="true"/>
</arg-dn>
</do-set-op-dest-dn>
</actions>
</rule>
</policy>
按名称布局: 此示例中的 DirXML 底稿策略根据用户的姓的第一个字母在特定树枝中创建用户。如果用户姓氏的首字母为 A 到 I,则将用户放置在树枝 Users1 中;若为 J 到 R,则放置在 Users2 中;为 S 到 Z 的字母,则放置在 Users3 中。
<policy>
<rule>
<description>Surname - A to I in Users1</description>
<conditions>
<and>
<if-class-name op="equal">User</if-class-name>
<if-op-attr mode="regex" name="Surname" op="equal">[A-I].*</if-op-attr>
</and>
</conditions>
<actions>
<do-set-op-dest-dn>
<arg-dn>
<token-text>Users1</token-text>
<token-text>\</token-text>
<token-op-attr name="CN"/>
</arg-dn>
</do-set-op-dest-dn>
</actions>
</rule>
<rule>
<description>Surname - J to R in Users2</description>
<conditions>
<and>
<if-class-name op="equal">User</if-class-name>
<if-op-attr mode="regex" name="Surname" op="equal">[J-R].*</if-op-attr>
</and>
</conditions>
<actions>
<do-set-op-dest-dn>
<arg-dn>
<token-text>Users2</token-text>
<token-text>\</token-text>
<token-op-attr name="CN"/>
</arg-dn>
</do-set-op-dest-dn>
</actions>
</rule>
<rule>
<description>Surname - S to Z in Users3</description>
<conditions>
<and>
<if-class-name op="equal">User</if-class-name>
<if-op-attr mode="regex" name="Surname" op="equal">[S-Z].*</if-op-attr>
</and>
</conditions>
<actions>
<do-set-op-dest-dn>
<arg-dn>
<token-text>Users3</token-text>
<token-text>\</token-text>
<token-op-attr name="CN"/>
</arg-dn>
</do-set-op-dest-dn>
</actions>
</rule>
</policy>
命令转换策略通过替换或添加命令,更改 Identity Manager 发送到目标数据存储区的命令。截取“删除”命令并用“修改”、“移动”或“禁用”命令代替便是一个在命令转换策略中替换命令的示例。而根据“添加”命令的特性值创建“修改”命令便是一个在命令转换策略中添加命令的常见示例。
在最常用的情况下,命令转换策略用于更改 Identity Manager 执行的命令,这些命令是对提交至 Metadirectory 引擎的事件的默认处理方式。
通常的做法还有在此处添加与其它任何策略的说明均不完全适合的策略。
示例:
将“删除”转换为“修改”: 此 DirXML 底稿策略将 Login Disabled(禁止登录)特性的“删除”操作转换为“修改”操作。
<policy>
<rule>
<description>Convert User Delete to Modify</description>
<conditions>
<and>
<if-operation op="equal">delete</if-operation>
<if-class-name op="equal">User</if-class-name>
</and>
</conditions>
<actions>
<do-set-dest-attr-value name="Login Disabled">
<arg-value type="state">
<token-text>true</token-text>
</arg-value>
</do-set-dest-attr-value>
<do-veto/>
</actions>
</rule>
</policy>
创建附加操作: 此 DirXML 底稿策略确定用户的目标树枝是否已存在。如果该树枝不存在,则策略将创建“添加”操作以创建树枝对象。
<policy>
<rule>
<description>Check if destination container already exists</description>
<conditions>
<and>
<if-operation op="equal">add</if-operation>
</and>
</conditions>
<actions>
<do-set-local-variable name="target-container">
<arg-string>
<token-dest-dn length="-2"/>
</arg-string>
</do-set-local-variable>
<do-set-local-variable name="does-target-exist">
<arg-string>
<token-dest-attr class-name="OrganizationalUnit" name="objectclass">
<arg-dn>
<token-local-variable name="target-container"/>
</arg-dn>
</token-dest-attr>
</arg-string>
</do-set-local-variable>
</actions>
</rule>
<rule>
<description>Create the target container if necessary</description>
<conditions>
<and>
<if-local-variable name="does-target-exist" op="available"/>
<if-local-variable name="does-target-exist" op="equal"/>
</and>
</conditions>
<actions>
<do-add-dest-object class-name="organizationalUnit" direct="true">
<arg-dn>
<token-local-variable name="target-container"/>
</arg-dn>
</do-add-dest-object>
<do-add-dest-attr-value direct="true" name="ou">
<arg-dn>
<token-local-variable name="target-container"/>
</arg-dn>
<arg-value type="string">
<token-parse-dn dest-dn-format="dot" length="1" src-dn-format="dest-dn" start="-1">
<token-local-variable name="target-container"/>
</token-parse-dn>
</arg-value>
</do-add-dest-attr-value>
</actions>
</rule>
</policy>
设置口令失效时间: 此 DirXML 底稿策略修改 eDirectory 用户的 Password Expiration Time(口令失效时间)特性。
<?xml version="1.0" encoding="UTF-8"?>
<policy xmlns:jsystem="http://www.novell.com/nxsl/java/java.lang.System">
<rule>
<description>Set password expiration time for a given interval from current day</description>
<conditions>
<and>
<if-operation op="equal">modify-password</if-operation>
</and>
</conditions>
<actions>
<do-set-local-variable name="interval">
<arg-string>
<token-text>30</token-text>
</arg-string>
</do-set-local-variable>
<do-set-dest-attr-value class-name="User" name="Password Expiration Time" when="after">
<arg-association>
<token-association/>
</arg-association>
<arg-value type="string">
<token-xpath expression="round(jsystem:currentTimeMillis() div 1000 + (86400*$interval))"/>
</arg-value>
</do-set-dest-attr-value>
</actions>
</rule>
</policy>
纲要映射策略包含 Identity Vault 与已连接系统之间的纲要映射定义。
可以从 eDirectory 中读取 Identity Vault 纲要。而已连接系统的 Identity Manager 驱动程序提供了已连接应用程序的纲要。这两个纲要均确定后,将在 Identity Vault 和目标应用程序之间创建一个简单映射。
在 Identity Manager 驱动程序配置中定义纲要映射策略后,可以映射相应的数据。
请注意,以下内容非常重要:
有关管理信息,请参见Section 7.0, 管理纲要映射策略。
示例:
基本纲要映射策略: 此示例中的 DirXML 底稿策略说明了基本纲要映射策略的原始 XML 源。但是,通过 Designer for Identity Manager 编辑策略时,使用默认的纲要映射编辑器可以以图形方式显示和编辑策略。
<?xml version="1.0" encoding="UTF-8"?><attr-name-map>
<class-name>
<app-name>WorkOrder</app-name>
<nds-name>DirXML-nwoWorkOrder</nds-name>
</class-name>
<class-name>
<app-name>PbxSite</app-name>
<nds-name>DirXML-pbxSite</nds-name>
</class-name>
<attr-name class-name="DirXML-pbxSite">
<app-name>PBXName</app-name>
<nds-name>DirXML-pbxName</nds-name>
</attr-name>
<attr-name class-name="DirXML-pbxSite">
<app-name>TelephoneNumber</app-name>
<nds-name>Telephone Number</nds-name>
</attr-name>
<attr-name class-name="DirXML-pbxSite">
<app-name>LoginName</app-name>
<nds-name>DirXML-pbxLoginName</nds-name>
</attr-name>
<attr-name class-name="DirXML-pbxSite">
<app-name>Password</app-name>
<nds-name>DirXML-pbxPassword</nds-name>
</attr-name>
<attr-name class-name="DirXML-pbxSite">
<app-name>Nodes</app-name>
<nds-name>DirXML-pbxNodesNew</nds-name>
</attr-name>
</attr-name-map>
自定义纲要映射策略: 此示例中的 DirXML 底稿策略使用 DirXML 底稿执行自定义纲要映射。
<?xml version="1.0" encoding="UTF-8"?><policy>
<rule>
<!--
The Schema Mapping Policy can only handle one-to-one mappings.
That Mapping Policy maps StudentPersonal addresses.
This rule maps StaffPersonal addresses.
-->
<description>Publisher Staff Address Mappings</description>
<conditions>
<and>
<if-local-variable name="fromNds" op="equal">false</if-local-variable>
<if-xpath op="true">@original-class-name = ’StaffPersonal’</if-xpath>
</and>
</conditions>
<actions>
<do-rename-op-attr dest-name="SA" src-name="Address/Street/Line1"/>
<do-rename-op-attr dest-name="Postal Office Box" src-name="Address/Street/Line2"/>
<do-rename-op-attr dest-name="Physical Delivery Office Name" src-name="Address/City"/>
<do-rename-op-attr dest-name="S" src-name="Address/StatePr"/>
<do-rename-op-attr dest-name="Postal Code" src-name="Address/PostalCode"/>
</actions>
</rule>
<rule>
<description>Subscriber Staff Address Mappings</description>
<!--
The Schema Mapping Policy has already mapped addresses to StudentPersonal.
This rule maps StudentPersonal to StaffPersonal.
-->
<conditions>
<and>
<if-local-variable name="fromNds" op="equal">true</if-local-variable>
<if-op-attr name="DirXML-sifIsStaff" op="equal">true</if-op-attr>
</and>
</conditions>
<actions>
<do-rename-op-attr dest-name="Address/Street/Line1" src-name="StudentAddress/Address/Street/Line1"/>
<do-rename-op-attr dest-name="Address/Street/Line2" src-name="StudentAddress/Address/Street/Line2"/>
<do-rename-op-attr dest-name="Address/City" src-name="StudentAddress/Address/City"/>
<do-rename-op-attr dest-name="Address/StatePr" src-name="StudentAddress/Address/StatePr"/>
<do-rename-op-attr dest-name="Address/PostalCode" src-name="StudentAddress/Address/PostalCode"/>
</actions>
</rule>
</policy>
输出转换策略主要处理数据格式的转换,即从 Metadirectory 引擎提供的数据转换到应用程序 Shim 需要的数据。这些转换的示例包括:
Metadirectory 引擎在任一通道提供给应用程序 Shim 的所有文档都可以通过输出转换策略传递。因为输出转换发生在纲要映射之后,所以所有纲要名称都在应用程序名称空间中。
示例:
特性值转换: 此示例中的 DirXML 底稿策略将电话号码格式由 (nnn) nnn-nnnn 重设为 nnn.nnn.nnnn。相反的转换可以在输入转换策略的示例中找到。
<policy>
<rule>
<description>Reformat all telephone numbers from (nnn) nnn-nnnn to nnn.nnn.nnnn</description>
<conditions/>
<actions>
<do-reformat-op-attr name="telephoneNumber">
<arg-value type="string">
<token-replace-first regex="^\((\d\d\d)\) *(\d\d\d)-(\d\d\d\d)$" replace-with="$1.$2.$3">
<token-local-variable name="current-value"/>
</token-replace-first>
</arg-value>
</do-reformat-op-attr>
</actions>
</rule>
</policy>
状态讯息的自定义处理: 此示例中的 DirXML 底稿策略检测到级别为未成功,且操作数据中包含 password-publish-status 子要素的状态文档,然后使用“从模板发送电子邮件”操作生成一条电子邮件讯息。
<?xml version="1.0" encoding="UTF-8"?>
<policy>
<description>Email notifications for failed password publications</description>
<rule>
<description>Send e-mail for a failed publish password operation</description>
<conditions>
<and>
<if-global-variable mode="nocase" name="notify-user-on-password-dist-failure" op="equal">true</if-global-variable>
<if-operation op="equal">status</if-operation>
<if-xpath op="true">self::status[@level != ’success’]/operation-data/password-publish-status</if-xpath>
</and>
</conditions>
<actions>
<!-- generate email notification -->
<do-send-email-from-template notification-dn="\cn=security\cn=Default Notification Collection" template-dn="\cn=security\cn=Default Notification Collection\cn=Password Sync Fail">
<arg-string name="UserFullName">
<token-src-attr name="Full Name">
<arg-association>
<token-xpath expression="self::status/operation-data/password-publish-status/association"/>
</arg-association>
</token-src-attr>
</arg-string>
<arg-string name="UserGivenName">
<token-src-attr name="Given Name">
<arg-association>
<token-xpath expression="self::status/operation-data/password-publish-status/association"/>
</arg-association>
</token-src-attr>
</arg-string>
<arg-string name="UserLastName">
<token-src-attr name="Surname">
<arg-association>
<token-xpath expression="self::status/operation-data/password-publish-status/association"/>
</arg-association>
</token-src-attr>
</arg-string>
<arg-string name="ConnectedSystemName">
<token-global-variable name="ConnectedSystemName"/>
</arg-string>
<arg-string name="to">
<token-src-attr name="Internet Email Address">
<arg-association>
<token-xpath expression="self::status/operation-data/password-publish-status/association"/>
</arg-association>
</token-src-attr>
</arg-string>
<arg-string name="FailureReason">
<token-text/>
<token-xpath expression="self::status/child::text()"/>
</arg-string>
</do-send-email-from-template>
</actions>
</rule>
</policy>
输入转换策略主要处理数据格式的转换,即从应用程序 Shim 提供的数据转换到 Metadirectory 引擎需要的数据。这些转换的示例包括:
应用程序 Shim 在任一通道提供给 Metadirectory 引擎的所有文档都通过输入转换策略传递。
示例:
特性值格式转换: 此示例中的 DirXML 底稿策略将电话号码的格式由 nnn.nnn.nnnn 重设为 (nnn) nnn-nnnn。相反的转换可以在输出转换策略的示例中找到。
<policy>
<rule>
<description>Reformat all telephone numbers from nnn.nnn.nnnn to (nnn) nnn-nnnn</description>
<conditions/>
<actions>
<do-reformat-op-attr name="telephoneNumber">
<arg-value type="string">
<token-replace-first regex="^(\d\d\d)\.(\d\d\d)\.(\d\d\d\d)$" replace-with="($1) $2-$3">
<token-local-variable name="current-value"/>
</token-replace-first>
</arg-value>
</do-reformat-op-attr>
</actions>
</rule>
</policy>
驱动程序心跳: 此 DirXML 底稿策略创建了一个状态心跳事件。驱动程序的心跳功能用于在每个心跳间隔发送成功讯息 (HEARTBEAT:$driver)。可以由 Novell Audit 监视此讯息。Identity Manager 驱动程序必须支持心跳,而且必须在驱动程序配置页中启用心跳。
<?xml version="1.0" encoding="UTF-8" ?>
<policy>
<rule>
<description>Heartbeat Rule, v1.01, 040126, by Holger Dopp</description>
<conditions>
<and>
<if-operation op="equal">status</if-operation>
<if-xpath op="true">@type="heartbeat"</if-xpath>
</and>
</conditions>
<actions>
<do-set-xml-attr expression="." name="text1">
<arg-string>
<token-global-variable name="dirxml.auto.driverdn" />
</arg-string>
</do-set-xml-attr>
<do-set-xml-attr expression="." name="text2">
<arg-string>
<token-text>HEARTBEAT</token-text>
</arg-string>
</do-set-xml-attr>
</actions>
</rule>
</policy>
所有策略都可以使用以下两种方式之一进行定义:
还可以(且通常是)使用纲要映射表定义纲要映射策略。
策略构建器界面用于定义可能实施的大多数策略。策略构建器界面使用图形环境,使您可以轻松地定义和管理策略。
策略构建器中规则创建的基本功能由一种称为 DirXML 底稿的自定义脚本语言提供。
DirXML 底稿包含多种可以测试的条件、执行的操作和添加到策略中的动态值。这些选项中的每一个都可以使用智能下拉列表显示,它们在每个点只提供有效的选择,还提供与常用值的快速链接。
借助策略构建器,可以不必直接使用 DirXML 底稿。
有关策略构建器的更多信息,请参见Section 2.0, 通过使用带有 Designer 的策略构建器定义策略和Section 3.0, 在 iManager 中使用策略构建器定义策略。有关 DirXML 底稿的更多信息,请参见Section 1.1.2, DirXML 底稿。
HINT:虽然并不是必须要使用策略构建器,但是您可以在 DirXML Driver Developer Kit Documentation(DirXML 驱动程序开发者工具文档)万维网站点获得完整的 DirXML 底稿参照。
要定义更复杂的策略,可以使用 XSLT 样式表将一个 XML 文档直接转换为包含所需更改的另一个 XML 文档。
样式表提供了极大的灵活性,并在以下情况使用:转换不适合在使用策略构建器中的规则创建的预定义条件和可用操作中进行。
要创建 XSLT 样式表,您需要完全了解 XSLT、nds.dtd 和传送到(以及传送自)Metadirectory 引擎的命令和事件。有关 nds.dtd 的详细参照信息,请参见 NDS DTD 参照。
有关 XSLT 样式表的更多信息,请参见Section 5.0, 使用 XSLT 样式表定义策略。
Novell 已经提供了样本策略,您可以下载并在您的环境中使用。这些策略可以从 Novell 支持万维网站点下载。下载并解压缩这些文件。How_To_Install.rtf 文件包含安装说明。
要使用 Designer 导入这些文件,请参见从 XML 文件导入策略。要使用 iManager 导入这些文件,请参见Section 3.2.9, 从 XML 文件导入策略。