|
- Overview
The DynamicManagement package contains objects that will introspect local or remote objects and create Model MBeans to manage them. It comes with some example servers that show its basic application.
The core of the package is the ObjectIntrospector, which examines an object and dynamically generates a ModelMBean. Support class exists to fetch remotable objects, such as EJB's, and feed them to the ObjectIntrospector. In this way, a local JMX could manage a remote application.
The three example servers show the management of a simple class, a remote EJB, and entire JNDI tree.
- The Main Components
- org.jmx4odp.dyanmicManagement.ObjectIntrospector
The ObjectIntrospector uses introspection to construct a the variuos javax.management.modelmbean descriptor objects. Then using these descriptors, creates a javax.management.modelmbean.RequiredModelMBean that proxies to the orginal introspected object.
- org.jmx4odp.dyanmicManagement.RemoteObjectFetcher
The RemoteObjectFetcher can fetch a handle to a remotable object from a JNDI directory. It can determine if the handle is to an EJB, and if so, it will invoke the create() method and return the handle to the EJB instead of its home object.
The RemoteObjectFetcher can also transverse the entire JNDI tree and hand back an array of Descriptor objects that can be used to create ModelMBeans for the entire directory.
- org.jmx4odp.j4oNet.ModelBeanFactory
The ModelBeanFactory wraps an ObjectIntrospector and a RemoteObjectFetcher in an MBean. This allows a JMX agent to dynamically create ModelMBeans within itself upon request.
- org.jmx4odp.j4oNet.SimpleServer
This example server takes a className as an argument. It then starts up a lightweight JMX agent running an HTTP adaptor. It will then instantiate the class (it can only handle classes with a null constructor), create a ModelMBean for it, and register the MBean with the JMX agent.
- org.jmx4odp.j4oNet.SimpleEjbManager
This example server takes parameters describing the location and remoteInterface for an EJB. It then starts up a lightweight JMX agent running an HTTP adaptor. Then it will use the RemoteObjectFetcher to obtain a handle to the EJB, which it will feed to the ObjectIntrospector. Then it will register the MBean handed back by the ObjectINtrospector with its JMX agent.
By using the HTTP adaptor, you can now access each of the EJB's functions and attributes via a web browser.
It will then instantiate the class (it can only handle classes with a
- org.jmx4odp.j4oNet.SimpleJNDIManager
This is very similar to the SimpleEjbManager. But instead of making a single EJB manageable, this sample server will make the contents of a whole JNDI manageable.
|