<?xml version="1.0" encoding="UTF-8"?>
<section version="5.0" xmlns="http://docbook.org/ns/docbook"
                       xmlns:xlink="http://www.w3.org/1999/xlink"
                       xmlns:xi="http://www.w3.org/2001/XInclude"
                       xmlns:svg="http://www.w3.org/2000/svg"
                       xmlns:mml="http://www.w3.org/1998/Math/MathML"
                       xmlns:html="http://www.w3.org/1999/xhtml"
                       xmlns:db="http://docbook.org/ns/docbook"
                       xml:lang="en" xml:id="admin.JSR160_support">

  <info>
    <title>JSR 160 support in JOnAS</title>
  </info>

  <section xml:id="JSR160-Target">
    <info>
      <title>Target Audience and Rationale</title>
    </info>

    <para>JOnAS provides support for remote connection to the MBean server in a standard way based on the JMX Remote API.</para>

  </section>

  <section xml:id="JSR160-Explained">
    <info>
      <title>What is JSR 160 ?</title>
    </info>

     <para>The JSR 160 specifies the JMX Remote API which extends the JMX specification by providing a standard way to
     connect to remote JMX-enabled applications.</para>

    <para>Currently, JSR 160 has defined a mandatory connector based on RMI
    (that supports both RMI/JRMP and RMI/IIOP).</para>


  </section>

  <section xml:id="JSR160-Connectors">
    <info>
      <title>Connector servers created by JOnAS</title>
    </info>

    <para>JSR 160 support implies providing standard connector server objects.
    The JMX service creates at start-up one or several such objects, depending
    on the protocols configuration (defined in
    <code> carol.properties </code> file). To create a client connector, the
    client side needs to know the URL of the connector server. Below we
    present the URLs that can be used by the clients depending on the protocol
    they choose.</para>



    <para>Currently only 2 protocols can be used by JSR-160 connectors:
    RMI/JRMP and RMI/IIOP.</para>



    <section>
        <info>
        <title>Using a RMI/JRMP Connector</title>
        </info>
        <para>This connector can be used if the <code> jrmp </code> protocol
    is set in the <code> carol.protocols </code> list.
        </para>
        <para> The client has
    to construct a <code> JMXServiceURL </code> using the following <code>
    String </code> , possibly modified according to the JOnAS-specific
    configuration: <code>
    service:jmx:rmi:///jndi/rmi://host:port/jrmpconnector_ jonasServerName
    </code> where <code> host </code> is the host on which is running the
    JOnAS server to be managed. The <code> port </code> number is given in the
    <code> carol.properties </code> file. </para> <para> Then, a <code>
    JMXConnector </code> has to be created and connected to the connector
    server using the JMX Remote API.
       </para>
     </section>



    <section>
      <info>
        <title>Example 1:</title>
      </info>

      <screen>

  Hashtable environment = null;
  JMXServiceURL address = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://host:1099/jrmpconnector_jonas");
  JMXConnector connector = JMXConnectorFactory.newJMXConnector(address, environment);
  connector.connect(environment);
      </screen>
    </section>

    <section>
      <info>
        <title>Using a RMI/IIOP Connector</title>
      </info>
      <para>This connector can be used if the <code> iiop </code> protocol
    is set in the <code> carol.protocols </code> list.
      </para>
      <para> The client code
    is similar to the JRMP case, but the <code> String </code> to be used to
    construct the <code> JMXServiceURL </code> must adhere to the following
    model: <code> "service:jmx:iiop:///jndi/iiop://host:port/iiopconnector_
    jonasServerName" </code>
    </para>
    </section>



    <section>
      <info>
        <title>Example 2:</title>
      </info>

      <screen>

  Hashtable environment = null;
  JMXServiceURL address = new JMXServiceURL("service:jmx:iiop:///jndi/iiop://host:2001/iiopconnector_jonas");
  JMXConnector connector = JMXConnectorFactory.newJMXConnector(address, environment);
  connector.connect(environment);
      </screen>
    </section>


  </section>
</section>
