netbeans

Post navigation

All samples read their rules from a drl textfile, in a real production rather unlikely to happen. You would rather read the rules from a DB and add it to the Knowledgebase. The add method syntax is public void add(Resource rsrc, ResourceType rt) and does not support a String as a parameter. So here the workaround to convert a String (that you would read from DB) to a resource.

Drools is closer to Eclipse because there is a plugin that supports Drools projects with flows, rules, etc. I still prefer Netbeans because it is our corporate IDE of choice and we can live without the visualization or the syntax highlighting of drl files.
The Drools distribution file (download from here) comes with a bunch of samples that helps you get going with your own projects, usually easier to get hands-on code than to read AI style documentation. Samples and tutorials are for the rest of us.

Netbeans is smart enough to open the examples folder as maven project.

Open Maven Project

When you open the project the first time it will open as “unloadable” because of the missing dependencies. Just right-click on the project “resolve problems” and “prime” the project which will download all the required libraries.

Rule engines are a rather complex topic with potentially a steep learning curve. I am looking at a few options, Drools being one of them. As usual one can read all the theoretical papers, but rather I have a something to look at and play with fast. Ultimately I need to integrate the rule engine into my application, so I dont want to play with eclipse editors for rules but seeing a rule engine ticking inside my Netbeans project. I found one tutorial from Vishal Akhouri which I updated to the latest version of Drools and some minor fixes. Most of the sample source code is from Vishal.

In part 1 of this tutorial we created an EJB using Netbeans and Visual Paradigm, in part 2 a little ZK application to read data using the EJB. In part 3 we will move away from the Derby DB to PostgreSQL and Oracle DB and challenge ourselves with identifier more than 30 characters, which is an issue for Oracle (yes, it is 2011). We will add columns with more than 30 characters and play with a few different column types (the ones showing up in a normal DB layout).

Add new fields to the ERDthis_is_a_very_long_remark_fieldfloatcolnumbercol

In part 1 of this tutorial we walk through the modeling and code creation of an EJB using Netbeans and Visual Paradigm. In part 2 we will create a simple sample ZK web application that reads data using the EJB.

Part 1 of this tutorial we concluded with an web application that displays all our instances and their status. In this part we will add some more features to control our instances.

Prerequisites:

The project and environment from part 1

Tutorial (complete sourcecode at the end):

Display the region endpoints and allow to select different one
We hardcoded our endpoint in the first version, if you run instances across the globe in the various AWS datacentres (US, Ireland, Singapore, Tokyo) we need to switch the endpoint easily.
Lets add one more listbox, that we hide in a ZK popup (we could use a combo listbox, but for the sake of playing with all the available ZK components I use the popup). Same concept add a listbox in the zul and a EC2 region list and a list model with customer renderer in our controller. Continue reading →