Saturday, August 24, 2013

Re: GWT and Client-side rules engine

I have something very similar to what you're describing, but it depends on a complete infrastructure of generated code; the dark-matter-data project (in Google Code).

Classes and attributes are modelled and the generated (fully GWT compliant) classes lend themselves to being sanity checked, and or having business rules applied to them.

The rules themselves are modelled and allow for parameterizing instances of the rules.

For instance, let's say you have a class X with a numeric attribute myValue that you want limited to a range of values. You would specify (as part of the schema that defines your classes):

ruleName Limit myValue to 1-15
nrrMinimum       1
nrrMaximum      15
applyToAttribute myValue
applyToClass     X

At runtime, you tell a RuleManager to load the rules from the schema of the classes you're dealing with.

You call on the RuleManager to apply the attribute level validation rules on your object and it determines which set of rules to apply, based on the applyToClass and applyToAttribute in the rule.

Different categories of rules are supported, since rules applied in different contexts require different interfaces to trigger them. Attribute level rules apply to a single object. Rules that involve consistency between objects require handles to the objects involved (or to a collection objects) etc.

The nice thing about this framework is that you can implement any type of rule or business logic you need because the implementation is just Java. 

I've been working on dark-matter for about 4 years and it forms the basis of the network management system my group is working on; my employer was kind enough to allow to me continue working on it (since I had started it before joining the company).

The only problem is that I haven't had the time to put in on the documentation (my employer wants me focussed on my day job ;-)

Anyway, if any of this intrigues you, I could work up an example and you might be able to create your own mechanisms based on the concepts. 

The dark-matter stuff allows us to generate about 80% of our code for both server and client, so the infrastructure on which the rules stuff depends is fairly extensive (just so you know).


On Friday, August 9, 2013 9:38:21 AM UTC-4, wrote:

The architecture and requirement is as follows

1>. The application has an extensive domain model and significant amount of business logic
2>. At runtime, the user populates data in the domain model.
3>. "The rules engine" evaluates the data and takes various actions including
          a>. Change subsequent data entry forms and data entry process flows
          b>. Pops up ui errors.

Since, I don't want to undergo the cost of server roundtrip for each evaluation, I am looking for a good architecture or pre-built client side rules engine.

In the threads, I came across
1>. Jess
2>. MVEL
3>. Tohu
4>. Metawidget

A brief browse, and I have a feeling that MVEL would be the way to go. Tohu is kind of ruled out for the same reason that I steered clear of Drools/jBPM.

Any expert ideas? Anybody else has attempted anything similar - would love to get their view.


You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment