costin 2003/03/12 23:02:56 Modified: modeler/src/java/org/apache/commons/modeler package.html Log: Update the docs a bit. Revision Changes Path 1.2 +23 -18 jakarta-commons/modeler/src/java/org/apache/commons/modeler/package.html Index: package.html =================================================================== RCS file: /home/cvs/jakarta-commons/modeler/src/java/org/apache/commons/modeler/package.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- package.html 30 Apr 2002 20:58:52 -0000 1.1 +++ package.html 13 Mar 2003 07:02:56 -0000 1.2 @@ -9,7 +9,7 @@ used within a server-based application that wants to expose management features via JMX. See the <a href="http://java.sun.com/products/JavaManagement/download.html"> -JMX Specification (Version 1.0)</a> for more information about Model MBeans +JMX Specification (Version 1.1)</a> for more information about Model MBeans and other JMX concepts.</p> <p>Model MBeans are very powerful - and the JMX specification includes a @@ -37,13 +37,15 @@ <h3>1. Acquire a JMX Implementation</h3> -<p><em>Modeler</em> has been tested with two different JMX implementations: +<p><em>Modeler</em> has been tested with different JMX implementations: <ul> <li>JMX Reference Implementation (version 1.0.1 or later) - <a href="http://java.sun.com/products/JavaManagement/download.html"> http://java.sun.com/products/JavaManagement/download.html</a></li> <li>MX4J (version 1.0-beta-3 or later) - <a href="http://mx4j.sourceforge.net/">http://mx4j.sourceforge.net</a></li> +<li>JBoss MX + <a href="http://www.jboss.org/">http://www.jboss.org</a></li> </ul> <p>After unpacking the release, you will need to ensure that the appropriate @@ -186,9 +188,9 @@ <pre> InputStream stream = this.getClass().getResourceAsStream ("/com/mycompany/mypackage/mbeans-descriptors.xml"); - Registry.loadRegistry(stream); - stream.close(); Registry registry = Registry.getRegistry(); + registry.loadDescriptors(stream); + stream.close(); </pre> <p>Besides using the configuration file, it is possible to configure the @@ -197,31 +199,34 @@ the standard support for loading a configuration file to be convenient and sufficient.</p> +<p>Modeler will also look for a mbeans-descriptors.xml in the same package +with the class beeing registered and in its parent. If no metadata is found, +modeler will use a number of simple patterns, similar with the ones used by +ant, to determine a reasonable metadata</p> + +<p>In a future version we should also support xdoclet-based generation of the +descriptors</p> + <h3>4. Instantiate Model MBeans As Needed</h3> <p>When your server application needs to instantiate a new MBean and register it with the corresponding <code>MBeanServer</code>, it can execute code like this:</p> + <pre> Group group = ... managed component instance ...; - MBeanServer mserver = registry.getServer(); - ManagedBean managed = registry.findManagedBean("Group"); - String domain = managed.getDomain(); - if (domain == null) { - domain = mserver.getDefaultDomain(); - } - ModelMBean mbean = managed.createMBean(group); - ObjectName oname = ... object name for this mbean ...; - mserver.registerMBean(mbean, oname); + + MBeanServer mserver = registry.getMBeanServer(); + + ObjectName oname="myDomain:type=Group,name=myGroup"; + + registry.registerComponent( group, oname, "Group" ); </pre> <p>After the Model MBean has been created and registered, it is accessible to -JMX clients through the standard JMX client APIs. A comprehensive example -that illustrates these techniques is the administrative web application that -manages a Tomcat 4.1 server, including the ability to save an updated copy of -the <code>conf/server.xml</code> file that represents the current configuration -of all Tomcat components.</p> +JMX clients through the standard JMX client APIs. +</p> </body> </html>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]