
Copyright (C) BULL S.A. 1998-2002



The lb JOnAS example:
---------------------

This example illustrates the use of local interfaces.
There are two beans "Manac" and "Manager".
This is a good example for understanding what must be done for a local client 
(session bean) collocated with an entity bean providing local interfaces.

This JOnAS example is inspired by the 'manac' JOnAS stress test:
	jonas_tests/stress/src/org/objectweb/jonas/stests/manac

The "Manac" bean is an entity bean with container-managed persistence.
Component and Home interfaces of this bean are local interfaces.
This is an account. Its balance cannot be negative (rollback is set in this case).

The "Manager" bean is a stateful session bean and allows to manage the "Manac" bean,
i.e. to move amounts from an account to an other.


"Client" is the client of the "Manager" session bean.
It performs the following steps:
- initialization of the database table of accounts if no -ni argument.
  (A specified number of accounts are created with a default balance 1000).
- transfer of a specified 'value' from an account to an other account is,
  'loops' times; (accounts are choosen randomly).
- last, check of the total of the balances of all accounts.
Its usage is:
	Client [-ni] [-a accounts] [-m value] [-l loops]
(Client -a 4 -m 100 -l 10 is the default usage)


Compiling this example:
-----------------------
On $JONAS_ROOT/example/src/lb, 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 example:
---------------------
Your database access should be configured: a properties files defining a
  Datasource object should be defined in $JONAS_ROOT/config (e.g. InstantDB1.properties),
  and the property jonas.service.dbm.datasources of the jonas.properties file should
  be set to the name of this datasource description file (e.g. InstantDB1). See JOnAS
  documentation for more details.

On Unix:
Run an EJB Server to make beans available to clients:
	cd $JONAS_ROOT/examples/src/lb	
	EJBServer &
Run the client program:
	. $JONAS_ROOT/bin/unix/config_env	# set CLASSPATH
	java lb.Client
(You can re-run the client with various arguments values.)

On Windows:
Run an EJB Server to make beans available to clients:
	cd %JONAS_ROOT%\examples\src\lb
	EJBServer
Run the client program:
	config_env	# set CLASSPATH
	java lb.Client
(You can re-run the client with various arguments values.)
	
