<?xml version="1.0"?>
<!--
  NOTE: This copyright does *not* cover user programs that use HQ
  program services by normal system calls through the application
  program interfaces provided as part of the Hyperic Plug-in Development
  Kit or the Hyperic Client Development Kit - this is merely considered
  normal use of the program, and does *not* fall under the heading of
  "derived work".
  
  Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
  This file is part of HQ.
  
  HQ is free software; you can redistribute it and/or modify
  it under the terms version 2 of the GNU General Public License as
  published by the Free Software Foundation. This program is distributed
  in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
  even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  PARTICULAR PURPOSE. See the GNU General Public License for more
  details.
  
  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  USA.
 -->

<plugin name="jonas">

  <classpath>
    <include name="pdk/lib/mx4j"/>
  </classpath>

  <filter name="template"
          value="${OBJECT_NAME}:${alias}"/>

  <server name="Jonas" version="4.7">

    <property name="domain" value="jonas"/>

    <property name="OBJECT_NAME"
              value="${domain}:j2eeType=J2EEServer,name=jonas"/>

    <property name="JVM_OBJECT_NAME"
              value="${domain}:j2eeType=JVM,J2EEServer=jonas,name=jonas"/>

    <!-- derive installpath from -Djonas.base=... -->
    <property name="PROC_HOME_PROPERTY"
              value="jonas.base"/>

    <property name="DEFAULT_CONF"
              value="conf/jonas.properties"/>

    <!-- XXX need to support time-stamp format -->
    <property name="DEFAULT_LOG_FILE"
              value="logs/jonas.log"/>

    <config>
      <option name="jmx.url"
              description="JMX URL to MBeanServer"
              default="service:jmx:rmi:///jndi/rmi://localhost:1099/jrmpconnector_jonas"/>

      <option name="jmx.username"
              description="JMX username"
              default="system"/>

      <option name="jmx.password"
              description="JMX password"
              type="secret"/>
    </config>

    <properties>
       <property name="serverVersion"
                 description="Server Version"/>

       <property name="serverVendor"
                 description="Server Vendor"/>

       <property name="${JVM_OBJECT_NAME}:javaVersion"
                 description="Java Version"/>

       <property name="${JVM_OBJECT_NAME}:javaVendor"
                 description="Java Vendor"/>
    </properties>

    <plugin type="log_track"
            class="org.hyperic.hq.product.Log4JLogTrackPlugin"/>

    <plugin type="autoinventory"
            class="org.hyperic.hq.product.jmx.MxServerDetector"/>

    <plugin type="measurement"
            class="org.hyperic.hq.product.jmx.MxMeasurementPlugin"/>

    <plugin type="control"
            class="org.hyperic.hq.product.jmx.MxServerControlPlugin"/>

    <actions include="start,stop,restart,runGC"/>

    <metric name="Availability"
            indicator="true"/>

    <metric name="Used Memory"
            alias="currentUsedMemory"
            units="KB"
            indicator="true"/>

    <metric name="Total Memory"
            alias="currentTotalMemory"
            units="KB"
            indicator="true"/>

    <service name="Database">
      <property name="OBJECT_NAME"
                value="${domain}:type=service,name=database"/>

       <properties>
         <property name="DataSourcePropertiesFiles"
                   description="Data Source Properties Files"/>
       </properties>

      <plugin type="autoinventory"/>

      <metric name="Availability"
              indicator="true"/>

      <metric name="Data Sources"
              alias="CurrentNumberOfDataSource"
              indicator="true"/>

      <metric name="Open Connections"
              alias="TotalCurrentNumberOfJDBCConnectionOpen"
              indicator="true"/>
    </service>

   <service name="Resource">
      <property name="OBJECT_NAME"
                value="${domain}:type=service,name=resource"/>

       <properties>
         <property name="RarsDirectory"
                   description="Rars Directory"/>

         <property name="AutoloadDirectories"
                   description="Autoload Directories"/>
       </properties>

      <plugin type="autoinventory"/>

      <metric name="Availability"
              indicator="true"/>

      <metric name="Resources"
              alias="CurrentNumberOfResources"
              indicator="true"/>

      <metric name="Rars"
              alias="CurrentNumberOfRars"
              indicator="true"/>
    </service>
  </server>
</plugin>
