Book Image

Instant Drools Starter

By : Jeremy Ary
Book Image

Instant Drools Starter

By: Jeremy Ary

Overview of this book

<p>Drools is a popular business rule management system. The book introduces the concept of rules separation, from what to do to how to do it. This Starter guide supports your development to keep pace with your system’s ever-changing needs, making things simple and easy by taking the rigidity out of complex codes.<br /><br />"Instant Drools Starter" is a practical, hand-on guide that provides you with a number of clear and concise explanations with relatable examples. This book offers step-by-step exercises to help you understand business rule management systems. Learn how they work, how they're best used, and how to perform frequently used tasks and techniques.<br /><br />This Starter guide helps you get familiar with the Drools concept. You will learn to evaluate rules engines and cover all the basics, from rules authoring to troubleshooting. This book highlights the capabilities of the Drools modules.</p> <p><br />After discovering exactly what rules are and what a rule engine brings to the table, we will quickly learn how to install Drools. The guide then explores different tools of the trade and gets you writing your first set of rules instantly. We'll then take those rules, write vital codes piece by piece, and put them into action. In addition, with this guide, learn how to document and troubleshoot everything behind the scenes, as well as developing your rules to the next level. "Instant Drools Starter" will cover everything you need to know to get started, so if you are looking for a complete guide that provides simple solutions to complex problems, look no further.</p>
Table of Contents (7 chapters)

Installation


In just five easy steps, you can integrate Drools into a new or existing project.

Step 1 – what do I need?

For starters, you will need to check that you have all of the required elements, listed as follows (all versions are as of time of writing):

  • Java 1.5 (or higher) SE JDK.

  • Apache Maven 3.0.4.

  • Eclipse 4.2 (Juno) and the Drools plugin.

  • Memory—512 MB (minimum), 1 GB or higher recommended. This will depend largely on the scale of your JVM and rule sessions, but the more the better!

Step 2 – installing Java

Java is the core language on which Drools is built, and is the language in which we'll be writing, so we'll definitely be needing that. The easiest way to get Java going is to download from and follow the installation instructions found at:

www.oracle.com/technetwork/java/javase/downloads/index.html

Step 3 – installing Maven

Maven is a build automation tool from Apache that lets us describe a configuration of the project we're building and leave dependency management (amongst other things) up to it to work out. Again, the easiest way to get Maven up and running is to download and follow the documentation provided with the tool, found at:

maven.apache.org/download.cgi

Step 4 – installing Eclipse

If you happen to have some other IDE of choice, or maybe you're just the old school type, then it's perfectly acceptable to author and execute your Drools-integrated code in your usual fashion. However, if you're an Eclipse fan, or you'd like to take advantage of auto-complete, syntax highlighting, and debugging features, then I recommend you go ahead and install Eclipse and the Drools plugin.

The version of Eclipse that we're after is Eclipse IDE for Java Developers, which you can download and find installation instructions for on their site:

www.eclipse.org/downloads/

Step 5 – installing the Drools Eclipse plugin

In order to add the IDE plugin to Eclipse, the easiest method is to use Eclipse's built-in update manager. First, you'll need to add something the plugin depends on—the Graphical Editing Framework (GEF).

In the Eclipse menu, click on Help, then on Install New Software..., enter the following URL in the Work with: field, and hit Add:

download.eclipse.org/tools/gef/updates/releases/

Give your repository a nifty name in the pop-up window, such as GEF, and continue on with the install as prompted. You'll be asked to verify what you're installing and accept the license.

Now we can add the Drools plugin itself—you can find the URL you'll need by visiting:

www.jboss.org/drools/downloads.html

Then, search for the text Eclipse update site and you'll see the link you need. Copy the address of the link to your clipboard, head back into Eclipse, and follow the same process you did for installing GEF. Note that you'll be asked to confirm the install of unsigned content, and that this is expected.

And that's it!

By this point, you should be ready to integrate Drools into your applications. If you find yourself stuck, one of the good parts about an open source community is that there's nearly always someone who has faced your problem before and likely has a solution to recommend. Check towards the back of the book for a list of resources that can help get you going again!