Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > ee5115d1de8d9cf1c36a33cc4513700b > files > 1059

mx4j-manual-3.0.1-9.mga4.noarch.rpm

<html><head><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter&nbsp;2.&nbsp;JMX 1.2 Explained</title><link href="styles.css" type="text/css" rel="stylesheet"><meta content="DocBook XSL Stylesheets V1.78.1" name="generator"><link rel="home" href="index.html" title="MX4J English Documentation"><link rel="up" href="index.html" title="MX4J English Documentation"><link rel="prev" href="ch01s02.html" title="License"><link rel="next" href="ch02s02.html" title="Support for remote API"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table summary="Navigation header" width="100%"><tr><th align="center" colspan="3">Chapter&nbsp;2.&nbsp;JMX 1.2 Explained</th></tr><tr><td align="left" width="20%"><a accesskey="p" href="ch01s02.html">Prev</a>&nbsp;</td><th align="center" width="60%">&nbsp;</th><td align="right" width="20%">&nbsp;<a accesskey="n" href="ch02s02.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="N10082"></a>Chapter&nbsp;2.&nbsp;JMX 1.2 Explained</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="section"><a href="ch02.html#N10085">
      <code class="classname">javax.management.ObjectName</code> changes
   </a></span></dt><dd><dl><dt><span class="section"><a href="ch02.html#N1008B">The
         <code class="classname">getInstance()</code> methods
      </a></span></dt><dt><span class="section"><a href="ch02.html#N100D1">The
         <code class="classname">quote()</code> and
         <code class="classname">unquote()</code> methods
      </a></span></dt></dl></dd><dt><span class="section"><a href="ch02s02.html">Support for remote API</a></span></dt><dd><dl><dt><span class="section"><a href="ch02s02.html#N100F9">Overview</a></span></dt><dt><span class="section"><a href="ch02s02.html#N10105">The
         <code class="classname">javax.management.MBeanServer</code> class inherits from
         <code class="classname">javax.management.MBeanServerConnection</code>
      </a></span></dt></dl></dd><dt><span class="section"><a href="ch02s03.html">The
      <code class="classname">javax.management.MBeanServerBuilder</code> class
   </a></span></dt><dd><dl><dt><span class="section"><a href="ch02s03.html#N10122">Introduction</a></span></dt><dt><span class="section"><a href="ch02s03.html#N1014C">How to use MX4J's
         <code class="classname">MBeanServer</code> implementation with Sun's JMX Reference Implementation.
      </a></span></dt><dt><span class="section"><a href="ch02s03.html#N10163">How to "decorate"
         <code class="classname">MBeanServer</code> methods.
      </a></span></dt><dt><span class="section"><a href="ch02s03.html#N10249">More complex
         <code class="classname">MBeanServer</code> "decorations".
      </a></span></dt><dt><span class="section"><a href="ch02s03.html#N1026F">Possible usages of MBeanServer "decorators"</a></span></dt></dl></dd><dt><span class="section"><a href="ch02s04.html">The
      <code class="classname">javax.management.MBeanServerInvocationHandler</code> class
   </a></span></dt><dd><dl><dt><span class="section"><a href="ch02s04.html#N1028D">Introduction</a></span></dt><dt><span class="section"><a href="ch02s04.html#N102B9">MBeanServerInvocationHandler usage</a></span></dt><dt><span class="section"><a href="ch02s04.html#N102FD">Porting examples for
         <code class="classname">mx4j.util.StandardMBeanProxy</code>
      </a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="N10085"></a>
      <code class="classname">javax.management.ObjectName</code> changes
   </h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="N1008B"></a>The
         <code class="classname">getInstance()</code> methods
      </h3></div></div></div><p>
         JMX 1.2 introduced four overloaded static version of the
         <code class="classname">getInstance()</code> method:
         <br>
         <br>
         <span style="color: red">&lt;funcdef&gt;
            <code class="function">public static ObjectName getInstance(String name)</code>
         &lt;/funcdef&gt;</span>
         <br>
         <span style="color: red">&lt;funcdef&gt;
            <code class="function">public static ObjectName getInstance(ObjectName name)</code>
         &lt;/funcdef&gt;</span>
         <br>
         <span style="color: red">&lt;funcdef&gt;
            <code class="function">public static ObjectName getInstance(String name, Hashtable properties)</code>
         &lt;/funcdef&gt;</span>
         <br>
         <span style="color: red">&lt;funcdef&gt;
            <code class="function">public static ObjectName getInstance(String domain, String key, String value)</code>
         &lt;/funcdef&gt;</span>
      </p><p>
         The first version is the preferred way to create ObjectNames, and should be used instead of using the
         <span class="emphasis"><em>new</em></span> Java keyword.
         <br>
         Creating a new ObjectName from a string is expensive because require parsing of the string.
         <br>
         JMX implementations may use caching techniques to speed up creation of ObjectNames from strings.
         MX4J does this optimization both in this method and in the ObjectName's constructor; it is likely that other
         implementations perform the optimization in getInstance(), but not in the ObjectName's constructor, so choosing
         to use getInstance() ensure coherent behaviors.
      </p><p>
         The second version is mostly used to convert ObjectName subclasses to plain ObjectName.
         <br>
         This is useful in a secure environment where evil ObjectName subclasses can try to bypass security checks
         done when
         <code class="classname">javax.management.MBeanPermission</code>s are checked to see if access to
         the MBean with the given ObjectName is allowed or not.
      </p><p>
         The third and the fourth version are just a replacement for the usage of the
         <span class="emphasis"><em>new</em></span> Java keyword,
         and offer mostly syntactic sugar to your code.
      </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="N100D1"></a>The
         <code class="classname">quote()</code> and
         <code class="classname">unquote()</code> methods
      </h3></div></div></div><p>
         JMX 1.2 introduced a way to "quote" the value of ObjectName's properties that is, to allow special
         characters to be present in the properties values of an ObjectName.
      </p><p>
         A simple example of this feature is to specify an LDAP name as an ObjectName property value.
         <br>
         Since the comma is a reserved character that separates ObjectName properties, it would have been
         impossible to specify an LDAP name as an ObjectName property.
      </p><p>
         Let's suppose to have a distinguished name of 'uid=guest,ou=project,o=company', and to build an
         ObjectName with a property called 'dname' whose value is the distinguished name.
         <br>
         Without quoting, the ObjectName is:
      </p><p>:dname=uid=guest,ou=project,o=company</p><p>
         which leads to an invalid ObjectName.
      </p><p>
         Using quoting, instead, it becomes:
      </p><p>:dname="uid=guest,ou=project,o=company"</p><p>
         which leads to a valid ObjectName.
      </p><p>
         It is possible also to "unquote" the property value to obtain the original string.
      </p><p>
         The ObjectName class has no knowledge if a value should be quoted or not, so it is responsibility
         of the developer to quote and unquote property values.
         <br>
         It is a good practice to do so in those cases where the property value is chosen by users, for example
         by inputting it in a web form or in a swing gui.
      </p><p>Refer to the javadoc of the ObjectName class for further information.</p></div></div></div><div class="navfooter"><hr><table summary="Navigation footer" width="100%"><tr><td align="left" width="40%"><a accesskey="p" href="ch01s02.html">Prev</a>&nbsp;</td><td align="center" width="20%">&nbsp;</td><td align="right" width="40%">&nbsp;<a accesskey="n" href="ch02s02.html">Next</a></td></tr><tr><td valign="top" align="left" width="40%">License&nbsp;</td><td align="center" width="20%"><a accesskey="h" href="index.html">Home</a></td><td valign="top" align="right" width="40%">&nbsp;Support for remote API</td></tr></table></div></body></html>