
Application Overview:
--------------------
This application watch alarm messages generated asynchronously via
JMS. It involves the different technics used in JOnAS:
- Entity Bean for AlarmRecord, persistent in a DataBase
- Session Bean to allow clients to visualize alarm received
- Message Driven Bean to catch Alarms
- JMS to use a topic where Alarms are sent and received
- a service included in EJBServer (AlarmManager)
- tomcat (for JSP pages and servlets)
- security
Alarm messages are formed of (severity 1-3, from, reason).

Directory structure:
--------------------
etc/web.xml	application description
web/		JSPs, images, html files.
beans/		beans and service, to be loaded in EJBServer.
client/		client java program generating alarms and using JMS.
		this alarm generator is obsolete.

Compiling this test:
-------------------

On $JONAS_ROOT/example/alarm, run the compile script,
 - compile.sh on Unix or
 - compile.bat on Windows.

If the gnu make is installed on your machine you can also build this example
by using the Makefile as it is defined in the $JONAS_ROOT/example/README.

If the Ant 1.4 build tool is installed on your machine you can also build this
example by using the build.xml as it is defined in the $JONAS_ROOT/example/README.


Running this test:
-----------------
Prerequisite:
   - You must have configured a Database.
     The jndi name used in the bean is jdbc_1.
     See $JONAS_ROOT/doc/GettingStarted.html for more information.
     If you use InstantDb, you have nothing else to do. A db1.prp file
     is already supplied in this directory.
   - Using Tomcat3.3.x :Tomcat3.3  has been installed and TOMCAT_HOME is set.
   - Using Tomcat4.0.x :Tomcat4.0.x has been installed and CATALINA_HOME and CATALINA_BASE are set.




1) run EJBServer
   We use a special jonas.properties file to describe the beans and the services
   that must be loaded (the tomcat service is used):
	cd $JONAS_ROOT/examples/alarm
	EJBServer &

2) Generate alarms
   The easiest way is to use the link on the first html page that will run
   a servlet that will generate customized alarms.

   Another method (obsolete) was to use the client AlarmGenerator.
   Options for AlarmGenerator are:
   -l <loops>
   -t <threads>
   -m <message_number>
   -d <device_name>
   Example:
   . $JONAS_ROOT/bin/unix/config_env
   CLASSPATH=$JONAS_ROOT/examples/classes:$CLASSPATH
   java org.objectweb.alarm.AlarmGenerator -l 2 -t 1

3) Look at http://$HOSTNAME:<your_port_number>/alarm/index.html
   to start using the web application.

Known bugs or Limitations:
--------------------------
1.
Sending many alarm messages concurrently with InstantDB as database will
not work (deadlock leading to transaction timeout, and delay on servlet
display) This can occur with every database that cannot handle multithreading
properly.

2.
The display pages are not automatically refreshed when a new alarm is
arrived. To be done in a future version.

3.
Filter names cannot contain "space" characters.

4.
The first time you run this application, the table will be created in the
database. An error message will be printed by EJBServer because it tries
to drop the table, but it does not exist. Ignore it.
