marinmitev / smarthome

Eclipse SmartHome project
Eclipse Public License 1.0
2 stars 1 forks source link

Rule creation fails if template or module types are not present #58

Closed kaikreuzer closed 9 years ago

kaikreuzer commented 9 years ago

The constructor of RuleImpl throws an IllegalArgumentException, if used templates or module types are not available in the system. This can create a bunch of critical lifecycle problems:

I see two solutions to this problem:

  1. Try to get the dynamic behavior under control, i.e. listen for things coming and going and retry instantiation, as soon as all dependencies are available. I think this might be quite nasty to implement.
  2. Only use the DTO model within the RuleRegistry, which would cut all those dependencies. Move the instantiation problem to the RuleEngine, where the RuleImpl instances are really only required. This would allow the RuleRegistry to offer a consistent view on the rules in the system, regardless if their underlying module types are (still) available in the system or not.

I very much prefer option 2 as I think in option 1 rules can miraculously disappear from the system when module types disappear - they should rather be in an error status in this case.

danchom commented 9 years ago

We agree that rule must be created even the template does not exist. It will be done. ModuleTypes are not used by the RuleEngine and there is no problem with them. The HandlerFactories are tracked by the rule engine and they reflect to the rule status. We are Ok with point 2. See the issue #60.

dnobel commented 9 years ago

Ok, perfect.