Differences between revisions 9 and 10
Deletions are marked like this. Additions are marked like this.
Line 4: Line 4:
== Ponder2 Policies ==
Policies are the Event Condition Action rules of the Ponder2. A policy is written in XML and describes the [[Ponder2UsingEvents|Event Type]] that it will respond to, the event's arguments that it will use, optional conditions that must be satisfied and a set of actions to be performed.

== Obligation Policies ==
Policies are the Event Condition Action rules of the Ponder2 system. An obligation policy is a Managed Object that is instantiated and given the event it should be expecting, zero or mor conditios to be evaluated and one or more actions to be performed if the conditions are satisified.

s the [[Ponder2UsingEvents|Event Type]] that it will respond to, the event's arguments that it will use, optional conditions that must be satisfied and a set of actions to be performed.
Line 8: Line 11:
A policy, called ''/policy/testpolicy'', that uses ''testevent'' can be described as follows:
Line 9: Line 13:
A policy, called ''/policy/testpolicy'', that uses ''testevent'' can be described as follows:
{{{#!xslt
{{{
#!xslt
Line 35: Line 40:
Create a new Policy called /Policy/testpolicy
Line 36: Line 42:
Create a new Policy called /Policy/testpolicy
Line 49: Line 54:
Line 55: Line 61:
Line 65: Line 72:
The optional condition can contain simple boolean statements comparing string and integer values. In this case we are checking whether the colour is ''red'' and the intensity is greater than ''34''. Conditions can contain any combination of ''and'', ''or'', ''not'', ''eq'', ''ne'', ''gt'', ''ge'', ''lt'' or ''le''. ''And'' and ''or'' take any number of XML sub-elements, ''not'' takes one, the others all take two. Note the string substitution of the arguments ''colour'' and ''intensity''. Note also that the arguments for the comparisons have been separated by XML comments to ensure that they are separate XML elements.
Line 66: Line 74:
The optional condition can contain simple boolean statements comparing string and integer values. In this case we are checking whether the colour is ''red'' and the intensity is greater than ''34''. Conditions can contain any combination of ''and'', ''or'', ''not'', ''eq'', ''ne'', ''gt'', ''ge'', ''lt'' or ''le''. ''And'' and ''or'' take any number of XML sub-elements, ''not'' takes one, the others all take two. Note the string substitution of the arguments ''colour'' and ''intensity''. Note also that the arguments for the comparisons have been separated by XML comments to ensure that they are separate XML elements.
Line 76: Line 83:
The action part of the ECA policy is mandatory. It simply consists of [[Ponder2XML|Ponder2 XML]], the only difference being that execution of the XML is delayed until the policy's event and condition parts are satisfied.
Line 77: Line 85:
The action part of the ECA policy is mandatory. It simply consists of [[Ponder2XML|Ponder2 XML]], the only difference being that execution of the XML is delayed until the policy's event and condition parts are satisfied.
Line 87: Line 94:
CategoryPonder2Project CategoryUsingPonder2  CategoryPonder2Project CategoryUsingPonder2

Obligation Policies

Policies are the Event Condition Action rules of the Ponder2 system. An obligation policy is a Managed Object that is instantiated and given the event it should be expecting, zero or mor conditios to be evaluated and one or more actions to be performed if the conditions are satisified.

s the Event Type that it will respond to, the event's arguments that it will use, optional conditions that must be satisfied and a set of actions to be performed.

Anatomy of a Policy

A policy, called /policy/testpolicy, that uses testevent can be described as follows:

XSLT option disabled, please look at HelpOnConfiguration.
<use name="/policy">
  <add name="testpolicy">
    <use name="/template/policy">
      <create type="obligation" event="/event/testevent" active="true">
        <arg name="colour"/>
        <arg name="intensity"/>
        <condition>
          <and>
            <eq>!colour;<!-- -->red</eq>
            <gt>!intensity;<!-- -->34</gt>
          </and>
        </condition>
        <action>
          <!-- Add one to a counter managed object -->
          <use name="/dom1/counter">
            <inc/>
          </use>
        </action>
      </create>
    </use>
  </add>
</use>

Breakdown of Policy XML

Create a new Policy called /Policy/testpolicy

<use name="/policy">
  <add name="testpolicy">
    <use name="/template/policy">
      <create ...>
        ...
      </create>
    </use>
  </add>
</use>

The policy will be an ECA type policy ("obligation") and it will respond to events of type /event/testevent, described here. The policy will become active as soon as it is created.

      <create type="obligation" event="/event/testevent" active="true">
        ...
      </create>

The policy will make use of two named arguments that the event provides:

      <create event="/event/testevent" ...>
        <arg name="colour"/>
        <arg name="intensity"/>
        ...
      </create>

Named arguments are substituted as text before the XML action is evaluated by enclosing the name inside the two characters "!" and ";"

Condition

The optional condition can contain simple boolean statements comparing string and integer values. In this case we are checking whether the colour is red and the intensity is greater than 34. Conditions can contain any combination of and, or, not, eq, ne, gt, ge, lt or le. And and or take any number of XML sub-elements, not takes one, the others all take two. Note the string substitution of the arguments colour and intensity. Note also that the arguments for the comparisons have been separated by XML comments to ensure that they are separate XML elements.

        <condition>
          <and>
            <eq>!colour;<!-- -->red</eq>
            <gt>!intensity;<!-- -->34</gt>
          </and>
        </condition>

Action

The action part of the ECA policy is mandatory. It simply consists of Ponder2 XML, the only difference being that execution of the XML is delayed until the policy's event and condition parts are satisfied.

       <action>
          <!-- Add one to a counter managed object -->
          <use name="/dom1/counter">
            <inc/>
          </use>
        </action>


ObligationPolicies (last edited 2008-01-25 12:39:01 by KevinTwidle)