The Missing BRMS tutorial

James Childers (of the macjavadev blog) has helpfully come up with a (slightly humorous) Real Quickstart guide (I like to call it the “missing manual”). Its good advice.

We do have plans to have more 5, 10 minute tutorials. Of course to save some work, we are changing some aspects of the user interface to try and get rid of the annoying confusing bits (especially around package management, and navigation). So with the BRMSv2, expect to see more of these “ease into it” style tutorials (I was quite fond of the olde codehaus 1, 2 and 5 minute tutorials, it was what got me into drools in the first place).

In the mean time, sit back, relax, or something, and take a look at the following.

Quickstart: Drools 4.0.3 Web Admin (BRMS)

                    <p>The documentation on <a href="">Drools</a> is a little bit light on the "where the hell do I start" part, so here's a quickstart guide. I'll walk you through getting the equivalent of a "Hello, World" app up in Drools, i.e. the simplest setup possible. This will use the Drools web management interface, and will not require any actual code whatsoever. This assumes that you, much like myself, in fact know next to nothing about Drools, and just want to play with it before getting into Rete algorithms and truth maintenance and all that crap.<br /><br />Isn't that nice.<br /><br />There are only three requirements.<br /></p><ol><li> You have your own servlet container: Tomcat, Glassfish, whatever.</li><br /><li> You have in your possession a JavaBean in some .jar flie somewhere. Any bean will do.</li><br /><li> You don't require screenshots. Sorry, I'm lazy. Maybe in the future.</li></ol><br />That's it.<br /><br /><ol><li> Download the <a href="">Drools BRMS</a> from JBoss.</li><br /><li> Deploy it to your app server. I like Glassfish.<br /><pre>[0932][jchilders@Ivan:~/webapps]$ unzip<br />[0932][jchilders@Ivan:~/webapps]$ sudo asadmin<br />Use "exit" to exit and "help" for online help.<br />asadmin> start-domain domain1<br />asadmin> deploydir ./drools-brms/</pre><br />Log in to it. (Mine deployed to http://localhost:8080/drools-jbrms/). User ID is "", password is "", without the quotes.</li><br /><li> You should see five options on the left: Info, Rules, Packages, Deployment, and Admin. Click on Admin.</li><br /><li> Click on "Create New Category".</li><br /><li> Name your category something clever. We'll call ours "BannerAds". Save it.</li><br /><li> Click on "Packages". There is a button on this page that will allow you to create a new package. It is small and has no label, but does have a tooltip. Click on it.</li><br /><li> Give your package a name and optional description. We'll call ours "MyPackage". Save it.</li><br /><li> There is another tiny, hard-to-find button on this page that allows you to create a new model. Click on it.</li><br /><li> This model will reference the jar file that has your bean it in I mentioned earlier. Name it something witty like "MyBean" and save it.</li><br /><li> You should be at a screen that will let you upload your jar. Do it. </li><br /><li> Click on the "Save Changes" button.</li><br /><li> Holy crap we're almost there! Now click on the "MyPackage" package in the tree, then "Edit Package Configuration" in the main window.</li><br /><li> In the "Header" section in the main window you need to actually tell Drools about your bean. To do so:<br /><pre>import com.mycompany.MyBean</pre><br />No semicolon at the end. If you want to get crazy and are lucky enough to own more than one JavaBean, do more than one import.</li><br /><li> Wow we should actually be able to make a rule now! AWESOME!</li><br /><li> Click on the massive 16px button that will let you "Create New Rule" </li><br /><li> Give it a name and category and type it as "Business rule". Save.</li><br /><li> Ok, now comes the real test. Click on the big green plus sign to the right of "WHEN". You should see a window that says "Add a condition to the rule..." If everything was set up correctly -- and that's a big if -- then you should see two selects: "Fact", and "Condition Type". If all it says is "Add a condition to the rule..." and nothing else, then you screwed up. Also these instructions may be wrong. It is much more likely that you screwed up because I have a blog. If it doesn't work please go to step <a href="">RTFM</a>, else continue.</li><br /><li> Fact. Click on it. Select your bean.</li><br /><li> Figure out the rest on your own. You're now to the point where you can create rules based upon your bean. Doing so using the visual editor is pretty self-explanatory.</li></ol>

Comments are closed.