<?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>

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

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

  <server name="CruiseControl"
          version="2.x">

    <!-- ./cruisecontrol.sh -rmiport 1099 -Dcc.home=$PWD -->
    <property name="PROC_HOME_PROPERTY" value="cc.home"/>

    <property name="PROC_MAIN_CLASS" value="CruiseControlWithJetty"/>

    <property name="DEFAULT_CONF" value="config.xml"/>

    <property name="DEFAULT_LOG_FILE" value="cruisecontrol.log"/>

    <!-- override default jmx.url -->
    <property name="jmx.url"
              value="service:jmx:rmi://localhost/jndi/rmi://localhost:1099/jrmp"/>

    <config include="jmx"/>

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

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

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

    <plugin type="config_track"
            class="org.hyperic.hq.product.ConfigFileTrackPlugin"/>

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

    <metric name="Availability"
            template="ConnectorServer:name=/jndi/jrmp:Active"
            indicator="true"/>

    <service name="Project">
      <property name="OBJECT_NAME"
                value="CruiseControl Project:name=*"/>

      <config>
        <option name="name"
                description="Project name"
                default="connectfour"/>
      </config>

      <plugin type="autoinventory"/>

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

      <actions include="pause,resume,build,buildWithTarget"/>

      <!-- listen for JMX notifications -->
      <plugin type="log_track"
              class="org.hyperic.hq.product.jmx.MxNotificationPlugin"/>

      <properties>
        <property name="BuildInterval"/>
        <property name="LogDir"/>
      </properties>

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

      <metric name="Last Build"
              defaultOn="true"
              collectionType="static"/>

      <metric name="Last Successful Build"
              defaultOn="true"
              collectionType="static"/>
    </service>

  </server>
</plugin>
