Isn't that nice.
There are only three requirements.
- You have your own servlet container: Tomcat, Glassfish, whatever.
- You have in your possession a JavaBean in some .jar flie somewhere. Any bean will do.
- You don't require screenshots. Sorry, I'm lazy. Maybe in the future.
That's it.
- Download the Drools BRMS from JBoss.
- Deploy it to your app server. I like Glassfish.
[0932][jchilders@Ivan:~/webapps]$ unzip drools-4.0.3-brms.zip
[0932][jchilders@Ivan:~/webapps]$ sudo asadmin
Use "exit" to exit and "help" for online help.
asadmin> start-domain domain1
asadmin> deploydir ./drools-brms/
Log in to it. (Mine deployed to http://localhost:8080/drools-jbrms/). User ID is "", password is "", without the quotes. - You should see five options on the left: Info, Rules, Packages, Deployment, and Admin. Click on Admin.
- Click on "Create New Category".
- Name your category something clever. We'll call ours "BannerAds". Save it.
- 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.
- Give your package a name and optional description. We'll call ours "MyPackage". Save it.
- There is another tiny, hard-to-find button on this page that allows you to create a new model. Click on it.
- 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.
- You should be at a screen that will let you upload your jar. Do it.
- Click on the "Save Changes" button.
- Holy crap we're almost there! Now click on the "MyPackage" package in the tree, then "Edit Package Configuration" in the main window.
- In the "Header" section in the main window you need to actually tell Drools about your bean. To do so:
import com.mycompany.MyBean
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. - Wow we should actually be able to make a rule now! AWESOME!
- Click on the massive 16px button that will let you "Create New Rule"
- Give it a name and category and type it as "Business rule". Save.
- 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 RTFM, else continue.
- Fact. Click on it. Select your bean.
- 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.
May the force be with you, always.
1 comment:
Hi James - awesome writeup ! Could we pinch this blog post as a real quick start for the manual? or website?
michael
(michael dot neale at gmail dot com)
Post a Comment