Policy Elements Reference
From JPPF 6.2 Documentation
|
Main Page > JPPF Tasks and Execution Policy > Policy Elements Reference |
1 Execution Policy Elements
1.1 NOT
Negates a test
Class name: org.jppf.node.policy.ExecutionPolicy.Not
Usage: policy = otherPolicy.not();
XML 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>
1.2 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);
XML 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>
1.3 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);
XML 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>
1.4 XOR
Combines multiple tests through a logical XOR operator
| valign="top" |
Class name: org.jppf.node.policy.ExecutionPolicy.Xor
Usage:
- policy = policy1.xor(policy2).xor(policy3);
- policy = policy1.xor(policy2, policy3);
| valign="top" |
XML 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>
1.5 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);
XML 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>
1.6 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);
XML 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>
1.7 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);
XML 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>
1.8 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);
XML 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>
1.9 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);
XML 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>
1.10 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);
XML 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>
1.11 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);
XML 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>
1.12 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);
XML 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>
1.13 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);
XML 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>
1.14 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");
XML 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>
1.15 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);
XML 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>
1.16 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");
XML 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>
1.17 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");
XML 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>