Policy Elements Reference

From JPPFWiki

Jump to: navigation, search

Contents

Main Page > JPPF Tasks and Execution Policy > Policy Elements Reference

Index

  1. NOT
  2. AND
  3. OR
  4. XOR
  5. Equal
  6. LessThan
  7. AtMost
  8. MoreThan
  9. AtLeast
  10. BetweenII
  11. BetweenIE
  12. BetweenEI
  13. BetweenEE
  14. Contains
  15. OneOf
  16. RegExp
  17. CustomRule

Policy elements table

Type of policy Java XML

NOT
Negates a test

Class name: org.jppf.node.policy.ExecutionPolicy.Not
Usage: policy = otherPolicy.not();

Element: <NOT>
Nested element: any other policy element, min = 1, max = 1
Usage:

<NOT>
  <Equal ignoreCase="true" valueType="string">
    <Property>some.property</Property>
    <Value>some value here</Value>
  </Equal>
</NOT>

AND
Combines multiple tests through a logical AND operator

Class name: org.jppf.node.policy.ExecutionPolicy.And
Usage:

  • policy = policy1.and(policy2).and(policy3);
  • policy = policy1.and(policy2, policy3);

Element: <AND>
Nested element: any other policy element, min = 2, max = unbounded
Usage:

<AND>
  <Equal ignoreCase="true" valueType="string">
    <Property>some.property.1</Property>
    <Value>some value here</Value>
  </Equal>
  <LessThan>
    <Property>some.property.2</Property>
    <Value>100</Value>
  </LessThan>
  <Contains ignoreCase="true" valueType="string">
    <Property>some.property.3</Property>
    <Value>substring</Value>
  </Contains>
</AND>

OR
Combines multiple tests through a logical OR operator

Class name: org.jppf.node.policy.ExecutionPolicy.Or
Usage:

  • policy = policy1.or(policy2).or(policy3);
  • policy = policy1.or(policy2, policy3);

Element: <OR>
Nested element: any other policy element, min = 2, max = unbounded
Usage:

<OR>
  <Equal ignoreCase="true" valueType="string">
    <Property>some.property.1</Property>
    <Value>some value here</Value>
  </Equal>
  <LessThan>
    <Property>some.property.2</Property>
    <Value>100</Value>
  </LessThan>
  <Contains ignoreCase="true" valueType="string">
    <Property>some.property.3</Property>
    <Value>substring</Value>
  </Contains>
</OR>

XOR
Combines multiple tests through a logical XOR operator

Class name: org.jppf.node.policy.ExecutionPolicy.Xor
Usage:

  • policy = policy1.xor(policy2).xor(policy3);
  • policy = policy1.xor(policy2, policy3);

Element: <XOR>
Nested element: any other policy element, min = 2, max = unbounded
Usage:

<XOR>
  <Equal ignoreCase="true" valueType="string">
    <Property>some.property.1</Property>
    <Value>some value here</Value>
  </Equal>
  <LessThan>
    <Property>some.property.2</Property>
    <Value>100</Value>
  </LessThan>
  <Contains ignoreCase="true" valueType="string">
    <Property>some.property.3</Property>
    <Value>substring</Value>
  </Contains>
</XOR>

Equal
Performs a test of type property_value = value
The value can be either numeric, boolean or a string.

Class name: org.jppf.node.policy.Equal
Constructors:

  • Equal(String propertyName, boolean ignoreCase, String value)
  • Equal(String propertyName, double value)
  • Equal(String propertyName, boolean value)

Usage:

  • policy = new Equal("some.property", true, "some_value");
  • policy = new Equal("some.property", 15);
  • policy = new Equal("some.property", true);

Element: <Equal>
Attributes:

  • ignoreCase: one of "true" or "false", optional, defaults to "false"
  • valueType: one of "string", "numeric" or "boolean", optional, defaults to "string"

Nested elements:

  • <Property> : name of a node property, min = 1, max = 1
  • <Value> : value to compare with, min = 1, max = 1

Usage:

<Equal ignoreCase="true" valueType="string">
  <Property>some.property</Property>
  <Value>some value here</Value>
</Equal>

LessThan
Performs a test of type property_value < value
The value can only be numeric.

Class name: org.jppf.node.policy.LessThan
Constructor: LessThan(String propertyName, double value)
Usage: policy = new LessThan("some.property", 15.50);

Element: <LessThan>
Nested elements:

  • <Property> : name of a node property, min = 1, max = 1
  • <Value> : value to compare with, min = 1, max = 1

Usage:

<LessThan>
  <Property>some.property</Property>
  <Value>15.50</Value>
</LessThan>

AtMost
Performs a test of type property_value <= value
The value can only be numeric.

Class name: org.jppf.node.policy.AtMost
Constructor: AtMost(String propertyName, double value)
Usage: policy = new AtMost("some.property", 15.49);

Element: <AtMost>
Nested elements:

  • <Property> : name of a node property, min = 1, max = 1
  • <Value> : value to compare with, min = 1, max = 1

Usage:

<AtMost>
  <Property>some.property</Property>
  <Value>15.49</Value>
</AtMost>

MoreThan
Performs a test of type property_value > value
The value can only be numeric.

Class name: org.jppf.node.policy.MoreThan
Constructor: MoreThan(String propertyName, double value)
Usage: policy = new MoreThan("some.property", 15.50);

Element: <MoreThan>
Nested elements:

  • <Property> : name of a node property, min = 1, max = 1
  • <Value> : value to compare with, min = 1, max = 1

Usage:

<MoreThan>
  <Property>some.property</Property>
  <Value>15.50</Value>
</MoreThan>

AtLeast
Performs a test of type property_value >= value
The value can only be numeric.

Class name: org.jppf.node.policy.AtLeast
Constructor: AtLeast(String propertyName, double value)
Usage: policy = new AtLeast("some.property", 15.51);

Element: <AtLeast>
Nested elements:

  • <Property> : name of a node property, min = 1, max = 1
  • <Value> : value to compare with, min = 1, max = 1

Usage:

<AtLeast>
  <Property>some.property</Property>
  <Value>15.51</Value>
</AtLeast>

BetweenII
Performs a test of type property_value in [a, b]
(range interval with lower and upper bounds included)
The values a and b can only be numeric.

Class name: org.jppf.node.policy.BetweenII
Constructor: BetweenII(String propertyName, double a, double b)
Usage: policy = new BetweenII("some.property", 1.5, 3.0);

Element: <BetweenII>
Nested elements:

  • <Property> : name of a node property, min = 1, max = 1
  • <Value> : the bounds of the interval, min = 2, max = 2

Usage:

<BetweenII>
  <Property>some.property</Property>
  <Value>1.5</Value>
  <Value>3.0</Value>
</BetweenII>

BetweenIE
Performs a test of type property_value in [a, b[
(lower bound included, upper bounds excluded)
The values a and b can only be numeric.

Class name: org.jppf.node.policy.BetweenIE
Constructor: BetweenIE(String propertyName, double a, double b)
Usage: policy = new BetweenIE("some.property", 1.5, 3.0);

Element: <BetweenIE>
Nested elements:

  • <Property> : name of a node property, min = 1, max = 1
  • <Value> : the bounds of the interval, min = 2, max = 2

Usage:

<BetweenIE>
  <Property>some.property</Property>
  <Value>1.5</Value>
  <Value>3.0</Value>
</BetweenIE>

BetweenEI
Performs a test of type property_value in ]a, b]
(lower bound excluded, upper bound included)
The values a and b can only be numeric.

Class name: org.jppf.node.policy.BetweenEI
Constructor: BetweenEI(String propertyName, double a, double b)
Usage: policy = new BetweenEI("some.property", 1.5, 3.0);

Element: <BetweenEI>
Nested elements:

  • <Property> : name of a node property, min = 1, max = 1
  • <Value> : the bounds of the interval, min = 2, max = 2

Usage:

<BetweenEI>
  <Property>some.property</Property>
  <Value>1.5</Value>
  <Value>3.0</Value>
</BetweenEI>

BetweenEE
Performs a test of type property_value in ]a, b[
(lower and upper bounds excluded)
The values a and b can only be numeric.

Class name: org.jppf.node.policy.BetweenEE
Constructor: BetweenEE(String propertyName, double a, double b)
Usage: policy = new BetweenEE("some.property", 1.5, 3.0);

Element: <BetweenEE>
Nested elements:

  • <Property> : name of a node property, min = 1, max = 1
  • <Value> : the bounds of the interval, min = 2, max = 2

Usage:

<BetweenEE>
  <Property>some.property</Property>
  <Value>1.5</Value>
  <Value>3.0</Value>
</BetweenEE>

Contains
Performs a test of type property_value contains substring
The value can be only a string.

Class name: org.jppf.node.policy.Contains
Constructor: Contains(String propertyName, boolean ignoreCase, String value)
Usage: policy = new Contains("some.property", true, "some_substring");

Element: <Contains>
Attribute: ignoreCase: one of "true" or "false", optional, defaults to "false"
Nested elements:

  • <Property> : name of a node property, min = 1, max = 1
  • <Value> : substring to lookup, min = 1, max = 1

Usage:

<Contains ignoreCase="true">
  <Property>some.property</Property>
  <Value>some substring</Value>
</Contains>

OneOf
Performs a test of type property_value in { A1, ... , An }
(discrete set)
The values A1 ... An can be either all strings or all numeric.

Class name: org.jppf.node.policy.OneOf
Constructor:

  • OneOf(String propertyName, boolean ignoreCase, String...values)
  • OneOf(String propertyName, double...values)

Usage:

  • policy = new OneOf("user.language", true, "en", "en_US", "en_GB");
  • policy = new OneOf("some.property", 1.2, 5.1, 10.3);

Element: <OneOf>
Attributes:

  • ignoreCase: one of "true" or "false", optional, defaults to "false"
  • valueType: one of "string" or "numeric", optional, defaults to "string"

Nested elements:

  • <Property> : name of a node property, min = 1, max = 1
  • <Value> : substring to lookup, min = 1, max = unbounded

Usage:

<OneOf ignoreCase="true">
  <Property>user.language</Property>
  <Value>en</Value>
  <Value>en_US</Value>
  <Value>en_GB</Value>
</OneOf>

RegExp
Performs a test of type property_value matches regular_expression
The regular expression must follow the syntax for the
Java regular expression patterns

Class name: org.jppf.node.policy.RegExp
Constructor: RegExp(String propertyName, String pattern)
Usage: policy = new RegExp("some.property", "a*z");

Element: <RegExp>
Nested elements:

  • <Property> : name of a node property, min = 1, max = 1
  • <Value> : regular expression pattern to match against, min = 1, max = 1

Usage:

<RegExp>
  <Property>some.property</Property>
  <Value>a*z</Value>
</RegExp>

CustomRule
Performs a user-defined test that can be specified in an XML policy document.

Class name: subclass of org.jppf.node.policy.CustomPolicy
Constructor:
MySubclassOfCustomPolicy(String...args)
Usage:
policy = new MySubclassOfCustomPolicy("arg 1", "arg 2", "arg 3");

Element: <CustomRule>
Attribute: class: fully qualified name of a policy class, required
Nested element: <Arg> : custom rule parameters, min = 0, max = unbounded
Usage:

<CustomRule class="my.sample.MySubclassOfCustomPolicy">
  <Arg>arg 1</Arg>
  <Arg>arg 2</Arg>
  <Arg>arg 3</Arg>
</CustomRule>
Personal tools