JPPF, java, parallel computing, distributed computing, grid computing, parallel, distributed, cluster, grid, cloud, open source, android, .net
JPPF, java, parallel computing, distributed computing, grid computing, parallel, distributed, cluster, grid, cloud, open source, android, .net
JPPF

The open source
grid computing
solution

 Home   About   Features   Download   Documentation   Forums 

Execution Policy Elements

From JPPF 4.2 Documentation

Jump to: navigation, search

Contents

Main Page > Execution policy reference > Execution Policy Elements

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>

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>

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>

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);

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>

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>

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>

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>

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>

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>

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>

BetweenIE

Performs a test of type “property_value in[a, b[“ (lower bound included, upper bound 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>

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>

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>

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>

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", "fr", "it");
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>fr</Value>
  <Value>it</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");

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>

ScriptedPolicy

Executes a script which returns a boolean value.

Class name: org.jppf.node.policy.ScriptedPolicy

Constructors:

ScriptedPolicy(String language, String script)
ScriptedPolicy(String language, Reader scriptReader)
ScriptedPolicy(String language, File scriptFile)

Usage:

policy = new ScriptedPolicy("javascript", "true");
policy = new ScriptedPolicy("javascript", new StringReader(myScript));
policy = new ScriptedPolicy("javascript", new File("myScript.js"));

XML Element: <Script>

Attribute: language

Usage:

<Script language=”javascript”>true</Script>
 
<Script language=”javascript”><![CDATA[
function myFunction() {
  return true;
}
myFunction();
]]></Script>

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>

Preference

Evaluates a set of nested policies ordered by preference.

Class name: org.jppf.node.policy.Preference

Constructors:

Preference(ExecutionPolicy...policies)
Preference(List<ExecutionPolicy> policies)

Usage:

policy = new Preference(AtLeast("jppf.processing.threads", 4),
  new LessThan("jppf.processing.threads", 4).and(new AtLeast("maxMemory", 1_000_000)));

XML Element: <Preference>

Usage:

<Preference>
  <AtLeast>
    <Property>jppf.processing.threads</Property>
    <Value>4</Arg>
  </AtLeast>
  <AND>
    <LessThan>
      <Property>jppf.processing.threads</Property>
      <Value>4</Arg>
    </LessThan>
    <AtLeast>
      <Property>maxMemory</Property>
      <Value>1000000</Arg>
    </AtLeast>
  </AND>
</Preference>

IsInIPv4Subnet

Performs a test of type "ipv4.addresses has an address in at least one of s1, ... or sn subnets"
Each subnet can be expressed in either CIDR or IPv4AddressPattern format.


Class name: org.jppf.node.policy.IsInIPv4Subnet

Constructors:

IsInIPv4Subnet(String...subnets)
IsInIPv4Subnet(Collection<String> subnets)

Usage:

policy = new IsInIPv4Subnet("192.168.1.0/24", "192.168.1.0-255");

XML element: <IsInIPv4Subnet>

Nested element: <Subnet> : IPv4 subnet mask, min = 1, max = unbounded

Usage:

<IsInIPv4Subnet>
  <Subnet>192.168.1.0/24</Subnet>
  <Subnet>192.168.1.0-255</Subnet>
</IsInIPv4Subnet>

IsInIPv6Subnet

Performs a test of type "ipv6.addresses has an address in at least one of s1, ... or sn subnets"
Each subnet can be expressed in either CIDR or IPv6AddressPattern format.


Class name: org.jppf.node.policy.IsInIPv6Subnet

Constructors:

IsInIPv6Subnet(String...subnets)
IsInIPv6Subnet(Collection<String> subnets)

Usage:

policy = new IsInIPv6Subnet("::1/80", "1080::0:0:8:800:200C:417A/97");

XML element: <IsInIPv6Subnet>

Nested element: <Subnet> : IPv6 subnet mask, min = 1, max = unbounded

Usage:

<IsInIPv6Subnet>
  <Subnet>::1/80</Subnet>
  <Subnet>1080::0:0:8:800:200C:417A/97</Subnet>
</IsInIPv6Subnet>


Main Page > Execution policy reference > Execution Policy Elements

JPPF Copyright © 2005-2017 JPPF.org Powered by MediaWiki