Esteban's Blog

/dev/rnd

Emergency Service Installation Guide

This week Mauricio Salatino presented a Drools/jBPM Demo application in Boston JUDCon.

Salaboy and I have developed this application at Plugtree to prove and show a lot of conceptual and architectural concepts behind JBoss Drools and jBPM projects.
The application is about an emergency service call center. It uses jBPM for define and run the company’s processes and Drools Expert to execute part of the involved Business Logic. The Demo application also uses Drools Fusion to correlate events coming form real-time sensors (a Wiimote or the keyboard) .

Prerequisites

Emergency Service (ES) is a multi-module maven project hosted in github. So, the first 2 prerequisites are git and maven.
You can get git binaries from the project home page: http://git-scm.com/download
In the case of Ubuntu, you already have git in the repositories.
In the case of maven, you will need to have at least version 2 installed. In the case of Ubuntu, you can directly get it from the package repository. You can also download its binaries from here: http://maven.apache.org/download.html

Getting the Sources

Getting Emergency Service sources is pretty straight forward. The only thing you need to do is to clone the project from its github location:

$git clone git://github.com/Salaboy/emergency-service-drools-app.git emergency-service

After cloning the repository, you will end up with this directory structure:

Demo Directory Structure

I don’t want to enter in details about the project structure in this post, however this is a brief explanation of each of the modules:

  • emergency-service-core: this module contains the “server” application. This server is in charge of start jBPM’s Human Task Server, create a Drools Grid Node, add some entities to the distributed cache and initialize some of the services classes used by the application.
  • emergency-service-model: this module contains all the model classes involved in the application. It also contains the classes used to reach the distributed cache and to send messages across different modules.
  • emergency-service-tasklists-ui-swing: the task list swing application of the demo.
  • emergency-service-world-ui-slick: the application containing the map of the demo.

Compiling the sources

Compiling the sources is a maven task. Make sure you have maven in your classpath and run:

$mvn clean install -DskipTests=true

*We are skipping test because they are kind of unstable yet 🙂

If everything works as expected, you will end up with the following message in your console:

A Successful Compilation

LWJGL Library Configuration

For the City Map application we are using Slick. Slick is a 2D java library that wraps LWJGL. If you want to use slick, you need to have LWJGL in your system.
These are the steps you need to do to get LWJGL running:

  1. First step to get slick running is to get LWJGL 2.1.0. You can get it from here: http://sourceforge.net/projects/java-game-lib/files/Official%20Releases/LWJGL%202.1.0/lwjgl-2.1.0.zip/download
  2. Download the zip file and expand it somewhere.
  3. Edit  emergency-service-world-ui-slick/pom.xml file and search for -Djava.library.path configuration. Replace the current value to fit your configuration. Note that LWJGL has different directories for different operating systems, make sure you use the correct one.

Executing the Demo

When executing the demo, the order of execution of its modules is essential.
The first project you need to run is emergency-service-core:

$cd emergency-service-core
$mvn exec:exec

When emergency-service-core is running, you can start emergency-service-tasklists-ui-swing or emergency-service-world-ui-slick in any order. For example:

$cd emergency-service-world-ui-slick
$mvn exec:exec

The result should be:

World UI

World UI

and

$cd emergency-service-tasklists-ui-swing
$mvn exec:exec

The result should be:

Task List Application

Task List Application

Playing with the Demo

To start playing with the Demo, you need to start an emergency. To do this, you have to press the space bar key in the map. When you press that key, a new emergency will be displayed in the map.
In the first task list of emergency-service-tasklists-ui-swing you will see a task to be completed (you need to press the “Refresh” button.
At this point you can continue with the flow of execution: complete the first task, go to the second task list, complete it, etc.
Because the demo is not completed yet, it only supports HEART ATTACK emergencies for 1 person between 20 and 60 years old. We are working to support the all the possibilities soon.
To simulate patient heart beat, you can use a Wiimote (need to be configured in task list application) or ‘q’ and ‘w’ keys.

Conclusion

I tried to explain how to download, compile, configure and run the emergency service demo application.
Remember that this Demo is under heavy development, so expect changes and bugs!! 🙂
Feel free to play with it. to report any problem and to give us some feedback too!

Leave a comment

Information

This entry was posted on May 4, 2011 by in drools, java, jbpm5, plugtree and tagged , , , .