Previous Topic

Next Topic

Book Contents

Book Index

Overview

A new Rule can be created in the following ways:

       •         You can load a modifiable rule with the atm.load <path_to_json_file> -r command.
       •         You will have unmodifiable rule with loading a file via File Watcher service. Its json file is in the folder you have created in advance: ../<bosch.iot.sdk_home>/runtime/osgi/automation/rules. Changes you make to the file apply to the rule. Deleting the file removes the rule from the automation module. The /automation folder must be manually created and present before the automation.core bundle is started otherwise the service will not work.

Automation Rule State Transitions

mbs_auto_rule_state_92

FROM/TO

UNRESOLVED

RESOLVED

ACTIVE

DISABLED

REMOVED

UNRESOLVED

  • AutomationAdmin .updateRule(RuleInfo)
  • Internal rule resolve success
  • TriggerHandlerCallback .resolved() & internal rule resolve success

N/A

  • AutomationAdmin .disableRule(String)
  • AutomationAdmin .removeRule(String)

RESOLVED

  • AutomationAdmin .updateRule(RuleInfo)
  • TriggerHandlerCallback .unresolved(String)

N/A

  • TriggerHandlerCallback .triggered(Map<String, Object>)
  • AutomationAdmin .runRule(String)
  • AutomationAdmin .disableRule(String)
  • AutomationAdmin .removeRule(String)

ACTIVE

  • AutomationAdmin .updateRule(RuleInfo)
  • TriggerHandlerCallback .unresolved(String)

Rule run finish

N/A

  • AutomationAdmin .disableRule(String)
  • AutomationAdmin .removeRule(String)

DISABLED

  • AutomationAdmin .enableRule(String

N/A

N/A

  • AutomationAdmin .updateRule(RuleInfo)
  • AutomationAdmin .removeRule(String)

REMOVED

N/A

N/A

N/A

N/A

N/A

Bindings between Rule Instructions

Instructions can consume/produce static or dynamic data by virtue of their inputs and outputs. For the needs of the dynamic data there are bindings defined, which follow certain rules as described below.

mbs_auto_rule_state_92

An input binding is defined by:

It is possible to chain these references in one bigger expression, e.g. [0]/id/name.

The source of the bindings from type Type.CONSTANT must follow the proper rules:

The bindings between inputs and outputs of instructions must follow the proper rules:

An exception to the above rules is made only in case a reference is defined.

The condition or action inputs can be connected to triggers' or preceding conditions' or actions' outputs.

Supported Container Conversion

From/To

Array

List

Collection

Set

Map

Array

+

+

+

Exception

Exception

List

+

+

+

Exception

Exception

Collection

+

+

+

Exception

Exception

Set

+

+

+

+

Exception

Map

Exception

Exception

Exception

Exception

+

Supported Type Conversion

From/

To

boolean

Boolean

char

Character

String

Primitive Numeric

Java Core Numeric

Custom Numeric Bean

Other

null

False

null

Character.valueOf((char)0)

null

null

default primitive:

  • int: Integer.valueOf(0)
  • long: Long.valueOf(0)
  • float - Float.valueOf(0)
  • double - Double.valueOf(0)
  • short - Short.valueOf((short) 0)
  • byte - Byte.valueOf((byte) 0)

null

null

null

boolean/ Boolean

+

+

Exception

Exception

+

Exception

Exception

Exception

Exception

char/ Character

Exception

Exception

+

+

+

  • for characters '0','1','2','3','4','5','6','7','8','9'
    – success
  • for others – Exception
  • for characters '0','1','2','3','4','5','6','7','8','9'
    – success
  • for others – Exception

Exception

Exception

String

"true" ? True : False

"true" ? True : False

  • If matching regex .{1}|[+-]?\\d{1,18}
    – success
  • for others – Exception
  • If matching regex .{1}|[+-]?\\d{1,18}
    – success
  • for others – Exception

+

  • If matching regex [+-]?\\d+
    – success
  • for others – Exception
  • If matching regex [+-]?\\d+
    – success
  • for others – Exception

Exception

Exception

Primitive/ Java Core Numeric

Exception

Exception

+

+

+

+

+

Exception

Exception

Custom Numeric Bean

Exception

Exception

Exception

Exception

+

+

+

Exception

Exception

Other

Exception

Exception

Exception

Exception

+

Exception

Exception

Exception

Exception

Legend

See also