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

This example illustrates the use of local interfaces.
This is a good example for understanding what must be done when a local client
(typically a session bean) is 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

It uses two enterprise beans "Manac" and "Manager".
The "Manac" bean is an entity bean with container-managed persistence.
Its Component and Home interfaces are local interfaces.
This bean represents 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,
  'loops' times; (accounts are choosen randomly).
- last, check the total of the balance of all the 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:
-----------------------
This example is compiled with the others by "ant install" in $JONAS_ROOT/examples.

Running this example:
---------------------
Your database access should be configured: a properties files defining a
  Datasource object should be defined in $JONAS_BASE/conf (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.

1) Run an EJB Server to make beans available to clients:

	jonas start

2) Load the lb.jar if you have not added 'lb.jar' in the ejb service descriptors list :

on UNIX:
	jonas admin -a lb.jar

On Windows:
    jonas admin -a lb.jar

You should see something like this when the bean is loaded :

    Manager available
    Manac available

3) Run the client program:

on UNIX:
	jclient -cp $JONAS_BASE/ejbjars/lb.jar:$JONAS_ROOT/examples/classes  lb.Client
(You can re-run the client with various arguments values.)

On Windows:
	jclient -cp %JONAS_BASE%\ejbjars\lb.jar;%JONAS_ROOT%\examples\classes lb.Client

In fact, the "-cp" option is not useful here, because classes are found in the CLASSPATH.

4) Stop the jonas server
	jonas stop
