
	|-----------------------------------------|
	|Implementation of JSR77 MBeans related to|
	|  Resource Adapters and JCA Resources    |
	-------------------------------------------

	Adriana Danes
    Last update the 23/01/2004


This document describes the current implementation based on my
understanding of the JSR77 specification.

It is intended to the developpers od the JOnAS resource service
and to the providers of JCA ResourceAdapters for JOnAS, which 
are aimed to modify the current implementation in order to
make it conformant to the concrete management functions needed
by the components they implement.


MBeans description and implementation
--------------------------------------
JSR 77 defines 5 Managed Object types related to JCA resources.
In the following list we have the JSR77 type name + the class 
implementing it in JOnAS:
- ResourceAdapterModule       + org.objectweb.jonas.resource.internal.ResourceAdapterModule
- ResourceAdapter             + org.objectweb.jonas.resource.internal.ResourceAdapter
- JCAResource                 + org.objectweb.jonas.resource.internal.JCAResource
- JCAConnectionFactory        + org.objectweb.jonas.resource.internal.JCAConnectionFactory
- JCAManagedConnectionFactory + org.objectweb.jonas.resource.internal.JCAManagedConnectionFactory
These MBeans replace the 'old' JmxResourceAdapter MBean, which is aimed to 
be removed finally.

Note that these MBeans are no more in the cathegory of 'standard MBean' as before, 
but 'model MBeans', i.e. dynamic, configurable MBeans (see JMX specification).

As Tomcat, we decided to use a software module in Jakarta Commons, called Modeler,
that makes easier the implementation of 'model MBeans'.
See http://jakarta.apache.org/commons/modeler/docs/api/index.html

The description of the MBeans is given by the mbeans-descriptors.xml file.
Currently very few management attributes are defined: the ones imposed by 
the JSR77 specification (as 'resourceAdapters' attribute for the 
ResourceAdapterModule MBean) + some attributes that were defined by 
the JmxResourceAdapterMBean interface (as 'properties' in ResourceAdapter MBean).

MBeans creation and registration
--------------------------------
The JMX ObjectNames is conforming to the JSR77.3.1.1.1 section.
They can be generated using the org.objectweb.jonas.jmx.J2eeObjectName class.
The 'name' key property should be redefined !

The creation and registration of all the MBean types is currently done
in the createResourceAdapter() method within ResourceServiceImpl class. 
The MBeans creation is completed by updates which implement the navigability
relations between the managed objects, as required by the specification.

The MBeans unregistration is currently done in the unregisterRAR() 
method within ResourceServiceImpl class. It uses the relations
between the different managed objects types.

The stop() method needs to be updated in order to unregister all the 
MBeans as described in the comment lines!

Testing the current code
------------------------
At JOnAS start up the MBeans associated to the 4 RARs installed in 
JONAS_ROOT/rars/autoload are created and registered in JMX.
They can be seen in the JOnAS management console (jonasAdmin application) 
in the following sub-tree : Mbeans / J2EE Mbeans / 'domain name' 
(note that the default domain name is given by the JonAS server name).
Also, you can look to the MBean corresponding to the J2EEServer managed object
in / J2EE Mbeans / 'domain name' / J2EEServer sub-tree.
You can check that the 'deployedObjects' and 'resources' attributes values
contain OBJECT_NAMES of the MBeans associated to the deployed RAR modules,
and associated JCA Resources.
 

To test the unregister of MBeans the ResourceServiceImpl class needs be
modified: change the undeploy boolean private variable to 'true'.
This allows, normally, to unregister the MBeans associated to the first
deployed RAR (corresponding to JDBC_XA). But, strangelly, not only these ones 
are unregistered, but also the MBeans associated to the second RAR ????




