<!-- *********************************************************************** -->
<!-- *                                                                     * -->
<!-- *        Copyright (c) 2001-2003 Tortuga Technologies Pty Ltd.        * -->
<!-- *                        All rights reserved.                         * -->
<!-- *                                                                     * -->
<!-- * This is unpublished proprietary source code of Tortuga Technologies * -->
<!-- * Pty Ltd.  The copyright notice above does not evidence any actual   * -->
<!-- * or intended publication of such source code.                        * -->
<!-- *                                                                     * -->
<!-- *********************************************************************** -->
<!-- *                                                                     * -->
<!-- * File:        build.xml                                              * -->
<!-- *                                                                     * -->
<!-- * Description: ANT script to enable automatic reporting from Ozibug   * -->
<!-- *                                                                     * -->
<!-- *********************************************************************** -->
<project name="ozibug" default="help" basedir=".">


 <!--
  Defines the name of who the mailed report should be sent from.
 -->
 <property name="from.name"    value="Report Master"          />
 <property name="from.address" value="nobody@your-domian.com" />

 <!--
  Temporary file where the report is stored before mailing.
  The suffix of this file may be changed to alter the mime type that is
  detected by the mailing command.
 -->
 <property name="tmp.file" value="${java.io.tmpdir}/report.txt" />


 <!-- ********************************************************************** -->
 <!-- *                                                                    * -->
 <!-- * Target:      help                                                  * -->
 <!-- *                                                                    * -->
 <!-- * Description: Print the help for this build file                    * -->
 <!-- *                                                                    * -->
 <!-- ********************************************************************** -->
 <target name="help" description="Help">

  <echo>
   Use the ozibug.report target to execute a named Ozibug report
   and then mail it to a specified email name and address.

   The parameters that can be specified as properties handed into the
   target are defined as follows.

   report.name  -  Ozibug report name
   to.name      -  Display Name of recipient
   to.address   -  Email address of recipient
  </echo>

 </target>


 <!-- ********************************************************************** -->
 <!-- *                                                                    * -->
 <!-- * Target:      ozibug.report                                         * -->
 <!-- *                                                                    * -->
 <!-- * Description: Example generation of a report suitable for cron      * -->
 <!-- *                                                                    * -->
 <!-- * Parameters:  tmp.file     -  script property defined above         * -->
 <!-- *              from.name    -  script property defined above         * -->
 <!-- *              from.address -  script property defined above         * -->
 <!-- *              to.name      -  command line ANT property             * -->
 <!-- *              to.address   -  command line ANT property             * -->
 <!-- *              report.name  -  command line ANT property             * -->
 <!-- *                                                                    * -->
 <!-- ********************************************************************** -->
 <target name="ozibug.report" description="Report generation example">

  <!--
   The following three properties define the individual components of
   hostname, port (including a colon) and the context.  These components
   make up the URL that the Ozibug server can be found at, for example
   http://hostname:port/context
   
   Note: for the standard port (80) the value of the port
         property should be the empty string ("").
  -->
  <property name="host"    value="host.your-domain.com" />
  <property name="port"    value=":8080"                />
  <property name="context" value="ozibug"               />


  <!--
   The fully qualified hostname of the mail server.
  -->
  <property name="mailhost" value="mail.your-domain.com" />


  <!--
   This is the login key which can be found from RSS url
   displayed in the browser address bar.
  -->
  <property name="key" value="ZGV2ZWxvcgvy%3Ac3loSjR0RjAvWjdPNw%3D%3D" />


  <!--
   The name of the report you want to execute, this is usually
   set from the command line of the calling script.
  -->
  <property name="report"  value="${report.name}" />


  <!--
   You can override the report type by setting the following
   properties.  You will also need to substitute the
   "report=${report}" section for "report="${rpt}" on
   line 111 below.
   The report format which can be Summary, Text, XML, CSV or RSS
  <property name="format"  value="Summary" />
  <property name="rpt" value="${report}&amp;outputType=${format}" />
  -->


  <!--
   Put the components together to make the url and query string.
  -->
  <property name="uri" value="action=reports.Reports&amp;report=${report}&amp;key=${key}" />
  <property name="url" value="http://${host}${port}/${context}/Controller" />
  

  <!-- retrieve the report and store it to a local file -->
  <get src="${url}?${uri}" dest="${tmp.file}" />

  <!-- mail the local file to specified recipients -->
  <mail mailhost="${mailhost}" subject="Ozibug report: ${report.name}">
   <from name="${from.name}" address="${from.address}" />
   <to name="${to.name}" address="${to.address}" />
   <message src="${tmp.file}" mimetype="text/plain" />
  </mail>

  <!-- delete the temporary file -->
  <delete file="${tmp.file}" />

 </target>


</project>

