AW Talk is the official development team blog for AribaWeb, the Open Source component-based web application development framework for creating rich, AJAX-enabled applications with the absolute minimum of code (and no hand-coded Javascript).

AribaWeb 101: Playing with rule engine!

Today it’s time for little fun because we are going to play a bit with actual MetaUI engine. So far you might think of this rule engine as the integral part of aribaweb and the only way to work with this was using rules .oss file but it is flexible more than you think. 

If you are kind of person who wants to have things under control and you want know these things also from inside you will definitely check this out. 

Let’s start with something simple! 

Every rule file is loaded and registered once using ValueQueriedObserver. There are several implementations to either load rules out of file or directly from a class using introspection if you have some annotation involved or you let the MetaUI to X-ray your class. For our example we have simple implementation called StringMetaProvider, which takes our  plain string. 

As you can see on the picture below we are creating new context the same thing that happens when you try to render new context using <m:Context inside the awl file.


Every time you try to push new key/value assignment onto the context using set() method the rules matching process is executed and new computed properties map is ready for rendering. 

In example above you can notice once we push all these key/values pairs and we can immediately retrieve the actual value for the label. 

We can go even farther and test how the more specific rules can override less specific rules. 


In this method we added the edit operation, which changes the label. You can think of this as  a switching your UI into editing mode. Here  this new edit operation is pushed onto stack. 
When we ask for the label the rule is already re-calculated and returns correct label. The label should be “Editing Name” 


You might want to checkout the MetaContext class and its method applyValues, renderResponse, invokeAction where everything starts and ends. 


If you are also interested in this StringMetaProvider here you go:






1 comment: