<?xml version="1.0" encoding="UTF-8"?>
<!--

    DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.

    Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.

    The contents of this file are subject to the terms of either the GNU
    General Public License Version 2 only ("GPL") or the Common Development
    and Distribution License("CDDL") (collectively, the "License").  You
    may not use this file except in compliance with the License.  You can
    obtain a copy of the License at
    https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
    or packager/legal/LICENSE.txt.  See the License for the specific
    language governing permissions and limitations under the License.

    When distributing the software, include this License Header Notice in each
    file and include the License file at packager/legal/LICENSE.txt.

    GPL Classpath Exception:
    Oracle designates this particular file as subject to the "Classpath"
    exception as provided by Oracle in the GPL Version 2 section of the License
    file that accompanied this code.

    Modifications:
    If applicable, add the following below the License Header, with the fields
    enclosed by brackets [] replaced by your own identifying information:
    "Portions Copyright [year] [name of copyright owner]"

    Contributor(s):
    If you wish your version of this file to be governed by only the CDDL or
    only the GPL Version 2, indicate your decision by adding "[Contributor]
    elects to include this software in this distribution under the [CDDL or GPL
    Version 2] license."  If you don't indicate a single choice of license, a
    recipient has the option to distribute your version of this file under
    either the CDDL, the GPL Version 2 or to extend the choice of license to
    its licensees as provided above.  However, if you add GPL Version 2 code
    and therefore, elected the GPL Version 2 license, then the option applies
    only if the new code is made subject to such option by the copyright
    holder.

-->

<project name="rules" >


 <!-- ==================== imports =========================== -->

 <property name="rulesdir" value="${basedir}/src/buildant"/>
 <property name="extjars" value="${basedir}/extlib"/>

 <!-- load the initial OS settings -->
 <import file="${rulesdir}/defs.xml"/>

 <!-- load any overriding properties -->
 <property file="${basedir}/build.properties"/>

 <!-- load default properties -->
 <property file="${rulesdir}/default.properties"/>

 <!-- load version string information -->
 <property file="${rulesdir}/../buildcfg/version.gmk"/>


 <!-- load the definitions file -->
 <import file="${rulesdir}/paths.xml"/>

 <!-- load the jar files rules -->
 <import file="${rulesdir}/jarrules.xml"/>

 <!-- load the dist (install) rules -->
 <import file="${rulesdir}/distrules.xml"/>

 <!-- load the C rules -->
 <import file="${rulesdir}/crules.xml"/>


  <target name="environment">
     <echo message="----------------------------"/>
     <echo message="      General environment"/>
     <echo message="----------------------------"/>
     <echo message="family       : ${family}"/>
     <echo message="arch         :${arch}"/>
     <echo message="os           :${os}"/>
     <echo message="os.name      :${os.name}"/>
     <echo message="jmqexternal  :${jmqexternal}"/>
     <echo message="----------------------------"/>
     <echo message="      jar locations"/>
     <echo message="----------------------------"/>
     <echo message="javaeehome     :${javaeehome}"/>
     <echo message="servlethome    :${servlethome}"/>
     <echo message="grizzlyhome    :${grizzlyhome}"/>
     <echo message="jtahome        :${jtahome}"/>
     <echo message="javahelphome   :${javahelphome}"/>
     <echo message="jafhome        :${jafhome}"/>
     <echo message="javamailhome   :${javamailhome}"/>
     <echo message="audithome      :${audithome}"/>
     <echo message="connectorhome  :${connectorhome}"/>
     <echo message="j2eemgthome    :${j2eemgthome}"/>
     <echo message="jaxphome       :${jaxphome}"/>
     <echo message="soaphome       :${soaphome}"/>
     <echo message="jndihome       :${jndihome}"/>
     <echo message="jndifshome     :${jndifshome}"/>
     <echo message="dom4jhome      :${dom4jhome}"/>
     <echo message="jemmyhome      :${jemmyhome}"/>
     <echo message="ccargs         :${ccargs}"/>
     <echo message="cincludes	   :${cincludes}"/>
     <echo message="----------------------------"/>
  </target>


  <!-- ===================== general Rules ============================== -->
  <!--  the basic targets are supported are:
             - all [clean, build, deploy, test]
             - build [build,docs]
             - test
             - clean
             - docs
             - deploy [install image, zip bundle]
    -->

  <target name="all" 
          depends="clean, build, deploy, test"
          description="Builds the MQ product">
  </target>

  <target name="build" 
          depends="buildjava, buildversion, buildprops, buildetc, build_resources, buildimages, buildhelp, buildjars, buildwars, builddocs"
          description="Builds the MQ product">
  </target>

  <target name="javadebug" 
          depends="setdebug, buildjava"
          description="Builds the debug java sources">
  </target>

  <target name="builddebug" 
          depends="javadebug, buildversion, buildprops, buildetc, build_resources, buildimages, buildhelp, buildjars, buildwars, builddocs"
          description="Builds the MQ product with debug.">
  </target>


  <target name="builddocs" 
          depends="javadocs"
          description="Builds the MQ javadocs">
  </target>

  <target name="test" 
          description="Builds the test worksapce for MQ product">
         <echo message="Not implemented"/>
  </target>

  <target name="clean" 
          description="clean up binary information">
         <delete dir="${binary.dir}" failonerror="false"/>
  </target>

  <target name="setjavaeehome" depends="checkjavaeehome" unless="javaeehomeset">
        <property name="javaeehome" value=""/>
  </target>

  <target name="checkjavaeehome">
        <condition property="javaeehomeset">
            <isset property="$javaeehome"/>
        </condition>
  </target>

  <target name="setgrizzlyhome" depends="checkgrizzlyhome" unless="grizzlyhomeset">
        <property name="grizzlyhome" value=""/>
  </target>

  <target name="checkgrizzlyhome">
        <condition property="grizzlyhomeset">
            <isset property="$grizzlyhome"/>
        </condition>
  </target>

  <target name="setjavahelphome" depends="checkjavahelphome" unless="javahelphomeset">
        <property name="javahelphome" value=""/>
  </target>

  <target name="checkjavahelphome">
        <condition property="javahelphomeset">
            <isset property="$javahelphome"/>
        </condition>
  </target>

  <target name="deploy" 
	  depends="setgrizzlyhome, setjavahelphome"
	  description="Builds Install Image">
        <echo message="### Calling target install"/> 
	<ant antfile="${rulesdir}/distrules.xml" target="install"/>
        <echo message="### Done install"/>
        <echo message="### Calling target bundles"/> 
	<ant antfile="${rulesdir}/distrules.xml" target="bundles"/>
        <echo message="### Done bundles"/>
  </target>



 <!-- ==================== Compilation Classpath =========================== -->
    <!-- Include all JAR files that will be included in /WEB-INF/lib -->
    <!-- *** CUSTOMIZE HERE AS REQUIRED BY YOUR APPLICATION *** -->
<!--
-->
  <path id="platform.classpath">
    <pathelement location="${javaeehome}/javaee-api-6.0.jar"/>
    <pathelement location="${javaeehome}/javaee-api-6.jar"/>
    <pathelement location="${javaeehome}/javaee-api-6.0-SNAPSHOT.jar"/>
    <pathelement location="${audithome}/Audit.jarx"/>
    <pathelement location="${javahelphome}/jhall.jar"/>
    <pathelement location="${grizzlyhome}/grizzly.jar"/>
    <pathelement location="${classes.dir}"/>

  </path>
  <!-- ================= General initialization ======================== -->
  <target name="init">
     <tstamp>
         <format property="builddate" pattern="MM/dd/yyyy HH:mm:ss" locale="en"/>
     </tstamp>
     <!--  do other stuff -->
  </target>
 <!-- ==================== javadocs =========================== -->

     <target name="cleandocs">
         <delete dir="${javadocs.dir}" failonerror="false"/>
     </target>
     <target name="javadocs">
        <echo message="### Build the MQ javadocs"/>
        <mkdir dir="${javadocs.dir}"/>
        <javadoc packagenames="com.sun.messaging, com.sun.messaging.jms, com.sun.messaging.jms.management.server, com.sun.messaging.xml, javax.jms, javax.xml.messaging, com.sun.messaging.jms.notification"
	         sourcepath="${base_javasrc.dir}"
		 destdir="${javadocs.dir}"
		 version="true"
		 use="true"
		 windowtitle="${JMQ_SOFTWARE_NAME_SHORT}, v4.5.1 API Specification">
        <classpath refid="platform.classpath"/>
   	<doctitle><![CDATA[<h1>${JMQ_SOFTWARE_NAME_SHORT}, v4.5.1 API Specification</h1>]]></doctitle>
   	<header><![CDATA[${JMQ_SOFTWARE_NAME_SHORT}, v4.5.1 API Specification]]></header>
    	<bottom><![CDATA[<font size="-1"><i>Copyright (c) 2011, Oracle and/or its affiliates.  All rights reserved.</i></font>]]></bottom>
    	<tag name="todo" scope="all" description="To do:"/>
    	<link href="http://download.oracle.com/javase/1.5.0/docs/api/"/>
	</javadoc>

     </target>

  <!-- ================== Help file Rules     ========================== -->
     <target name="cleanhelp">
         <delete dir="${helpinstall.dir}"/>
     </target>

     <target name="buildhelp">
        <echo message="### Installing help files"/>
        <mkdir dir="${helpinstall.dir}"/>
        <unzip src="${base_helpsrc.zip}"
               dest="${helpinstall.dir}"/>
     </target>

  <!-- ==================    etc file Rules    ========================== -->
     <target name="cleanetc">
         <delete dir="${archetc.dir}"/>
     </target>

     <target name="buildetc" 
          depends="buildetc-unix, buildetc-windows"
          description="### Builds the etc files ">
        <echo message="### Installing shared etc files from ${base_src.dir}/share/etc to ${archetc.dir}"/>

        <mkdir dir="${archetc.dir}"/>
        <copy todir="${archetc.dir}">
           <fileset dir="${base_src.dir}/share/etc">
           <include name="**/passfile.sample"/>
          </fileset>
        </copy>     
     </target>

     <target name="buildetc-unix" if="isUnix">
        <echo message="### Installing unix etc files from ${base_src.dir}/solaris/etc to ${archetc.dir}"/>
        <mkdir dir="${archetc.dir}"/>
        <copy todir="${archetc.dir}">
           <fileset dir="${base_src.dir}/solaris/etc">
           <include name="**/imqbrokerd.conf"/>
           <include name="**/imqenv.conf"/>
          </fileset>
        </copy>     
     </target>

     <target name="buildetc-windows" if="isWindows">
        <echo message="### Installing windows etc files from ${base_src.dir}/win32/etc} to ${archetc.dir}"/>
        <mkdir dir="${archetc.dir}"/>
        <copy todir="${archetc.dir}">
           <fileset dir="${base_src.dir}/win32/etc">
           <include name="**/imqenv.conf"/>
          </fileset>
        </copy>     
     </target>

<!--
        <echo message="### Installing license etc files"/>
        <copy todir="${archetclic.dir}">
           <fileset dir="${licsrc.dir}">
           <include name="**/*lic"/>
           <exclude name="**/*GNUmakefile"/>
          </fileset>
        </copy>     
-->

  <!-- ======================== images Rules =============================== -->
     <target name="cleanimages">
         <delete dir="${imagesinstall.dir}"/>
     </target>

     <target name="buildimages">
        <echo message="### Installing image files"/>
        <mkdir dir="${imagesinstall.dir}"/>
        <copy todir="${imagesinstall.dir}">
           <fileset dir="${imagessrc.dir}">
           <include name="**/*gif"/>
           <exclude name="**/*GNUmakefile"/>
           <exclude name="**/*build.xml"/>
          </fileset>
        </copy>     
     </target>
  <!-- ================== Version file Rules ========================== -->
  <target name="versionclean">
         <delete file="${versionprops}"/>
         <delete file="${brandversionprops}"/>
  </target>

  <target name="buildversion" depends="builddefaultversion, buildbrandversion"
   description="Build version properties files">
	<echo message="### Finished building version properties files"/>
  </target>

  <target name="builddefaultversion"
          depends="init">

       <echo message="### Building version file ${versionprops}"/>
       <echo file="${versionprops}" message="# Property file ${versionprops}${line.separator}"/>
       <echo file="${versionprops}" append="true" message="# ${line.separator}"/>
       <echo file="${versionprops}" append="true" message="# - version file for com.sun.messaging.jmq${line.separator}"/>
       <echo file="${versionprops}" append="true" 
                   message="#${line.separator}"/>
       <echo file="${versionprops}" append="true"  
                   message="imq.version.package=com.sun.messaging.jmq${line.separator}"/>
       <echo file="${versionprops}" append="true"  
                   message="imq.product.name=${JMQ_SOFTWARE_NAME}${line.separator}"/>
       <echo file="${versionprops}" append="true"  
                   message="imq.product.jarname=${JMQ_SOFTWARE_NAME_JAR}${line.separator}"/>
       <echo file="${versionprops}" append="true"  
                   message="imq.product.name.abbrev=${JMQ_SOFTWARE_NAME_ABBREV}${line.separator}"/>
       <echo file="${versionprops}" append="true"  
                   message="imq.product.name.abbrev.lowercase=${JMQ_SOFTWARE_NAME_ABBREV_LOWERCASE}${line.separator}"/>
       <echo file="${versionprops}" append="true"  
                   message="imq.product.name.short=${JMQ_SOFTWARE_NAME_SHORT}${line.separator}"/>
       <echo file="${versionprops}" append="true"  
                   message="imq.product.name.releaseqid=${JMQ_RELEASE_Q_ID}${line.separator}"/>
       <echo file="${versionprops}" append="true"  
                   message="imq.product.releaseqid=${JMQ_RELEASE_Q_ID}${line.separator}"/>
       <echo file="${versionprops}" append="true"  
                   message="imq.product.companyname=${JMQ_COMPANY_NAME}${line.separator}"/>
       <echo file="${versionprops}" append="true"  
                   message="imq.build.date=${builddate}${line.separator}"/>
       <echo file="${versionprops}" append="true"  
                   message="imq.build.number=${JMQ_BUILD_NUMBER}${line.separator}"/>
       <echo file="${versionprops}" append="true"  
                   message="imq.build.letter=${JMQ_BUILD_LETTER}${line.separator}"/>
       <echo file="${versionprops}" append="true"  
                   message="imq.build.milestone=${JMQ_BUILD_MILESTONE}${line.separator}"/>
       <echo file="${versionprops}" append="true"  
                   message="imq.product.major=${JMQ_MAJOR_VERSION}${line.separator}"/>
       <echo file="${versionprops}" append="true"  
                   message="imq.product.minor=${JMQ_MINOR_VERSION}${line.separator}"/>
       <echo file="${versionprops}" append="true"  
                   message="imq.product.micro=${JMQ_MICRO_VERSION}${line.separator}"/>
       <echo file="${versionprops}" append="true"  
                   message="imq.product.servicepack=${JMQ_SERVICE_PACK_VERSION}${line.separator}"/>
       <echo file="${versionprops}" append="true"  
                   message="imq.product.version=${JMQ_MAJOR_VERSION}.${JMQ_MINOR_VERSION}${line.separator}"/>
       <echo file="${versionprops}" append="true"  
                   message="imq.product.versionstr=MQ ${JMQ_MAJOR_VERSION}.${JMQ_MINOR_VERSION}${line.separator}"/>
       <echo file="${versionprops}" append="true"  
                   message="imq.product.urn=${JMQ_PRODUCT_URN}${line.separator}"/>
       <echo file="${versionprops}" append="true"  
                   message="imq.protocol.version=${JMQ_PROTOCOL_VERSION}${line.separator}"/>
       <echo file="${versionprops}" append="true"  
                   message="imq.api.version=${JMQ_API_VERSION}${line.separator}"/>
       <echo file="${versionprops}" append="true"  
                   message="imq.jms.api.version=${JMS_API_VERSION}${line.separator}"/>
       <echo file="${versionprops}" append="true"  
                   message="imq.jmsadmin.spi.version=${JMQ_JMSADMIN_SPI_VERSION}${line.separator}"/>
       <echo file="${versionprops}" append="true"  
                   message="imq.product.buildstr=MQ ${JMQ_MAJOR_VERSION}.${JMQ_MINOR_VERSION} (Build ${JMQ_BUILD_NUMBER}-${JMQ_BUILD_LETTER})${line.separator}"/>
       <echo file="${versionprops}" append="true"  
                   message="imq.product.copyright=${JMQ_COPYRIGHT_DATE} ${JMQ_COMPANY_NAME}${line.separator}"/>
       <echo file="${versionprops}" append="true"  
                   message="imq.product.copyright.date=${JMQ_COPYRIGHT_DATE}${line.separator}"/>
       <echo file="${versionprops}" append="true"  
                   message="imq.product.copyright.long="/>
       <concat destfile="${versionprops}" append="true" fixlastline="true" >
           <path> 
               <pathelement path="${copyrightfile}" />
           </path>
       </concat>  
  </target>

  <target name="buildbrandversion"
          depends="init">

       <echo message="### Building branding version file ${brandversionprops}"/>
       <echo file="${brandversionprops}" message="# Brand Property file ${brandversionprops}${line.separator}"/>
       <echo file="${brandversionprops}" append="true" message="# ${line.separator}"/>
       <echo file="${brandversionprops}" append="true" message="# - branding version file for com.sun.messaging.jmq${line.separator}"/>
       <echo file="${brandversionprops}" append="true" 
                   message="#${line.separator}"/>
       <echo file="${brandversionprops}" append="true"  
                   message="imq.product.name=${JMQ_SOFTWARE_NAME_BRAND}${line.separator}"/>
       <echo file="${brandversionprops}" append="true"  
                   message="imq.product.jarname=${JMQ_SOFTWARE_NAME_BRAND}${line.separator}"/>
       <echo file="${brandversionprops}" append="true"  
                   message="imq.product.urn=${JMQ_PRODUCT_BRAND_URN}${line.separator}"/>
       <echo file="${brandversionprops}" append="true"  
                   message="imq.product.version=${JMQ_MAJOR_VERSION} ${JMQ_MINOR_VERSION}${line.separator}"/>
       <echo file="${brandversionprops}" append="true"  
                   message="imq.product.brand=true${line.separator}"/>
       <echo file="${brandversionprops}" append="true"  
                   message="imq.product.brand.major=${JMQ_MAJOR_VERSION}${line.separator}"/>
       <echo file="${brandversionprops}" append="true"  
                   message="imq.product.brand.minor=${JMQ_MINOR_VERSION}${line.separator}"/>
       <echo file="${brandversionprops}" append="true"  
                   message="imq.product.brand.micro=${JMQ_MICRO_VERSION}${line.separator}"/>
  </target>

  <!-- ================== Property file Rules ========================== -->

  <target name="cleanprops">
     <delete dir="${propsinstall.dir}"/>
  </target>

  <target name="buildprops" 
          description="Install Property Files">
     <mkdir dir="${propsinstall.dir}"/>
     <echo message="### Copying over property files from ${propsrc.dir} to ${propsinstall.dir}"/>
     <echo message="###"/>

     <copy todir="${propsinstall.dir}">
        <fileset dir="${propsrc.dir}">
           <include name="**/*.properties"/>
           <exclude name="**/*ri*.properties"/>
           <exclude name="**/*build.xml"/>
           <exclude name="**/*GNUmakefile*"/>
         </fileset>
     </copy>     


     <!-- Generate a default_linux.properties from default.properties (remove ,syslog) -->

     <copy file="${propsrc.dir}/broker/default.properties" tofile="${propsinstall.dir}/broker/default_linux.properties"/>  
     <replaceregexp match="syslog," replace= "" byline="true">
 	<fileset file="${propsinstall.dir}/broker/default_linux.properties"/>
     </replaceregexp> 

     <!--exec executable = "/bin/sh" os="SunOS,Linux,Solaris">
	<arg line='-c "sed -e &#39;1,$$s/,syslog//&#39; ${propsrc.dir}/broker/default.properties &gt; ${propsinstall.dir}/broker/default_linux.properties"' />
     </exec>
     -->

 <!--
     <echo message="### Updating with OS specific files (if applicable)"/>
     <echo message="###"/>
     <echo message="### Ignore warnings on solaris or linux"/>
     <copy todir="${propsinstall.dir}"
           overwrite="true"
           failonerror="false">
        <fileset dir="${prop_arc_src.dir}">
           <include name="**/*.properties"/>
           <exclude name="**/*ri*.properties"/>
         </fileset>
      </copy>     
-->
  </target>

  <!-- ================== prop file Rules ========================== -->
  <target name="build_resources" 
          description="Install Resource Property Files">
     <mkdir dir="${classes.dir}"/>
     <echo message="### Copying over resource property files"/>
     <echo message="###"/>
     <copy todir="${classes.dir}">
        <fileset dir="${base_javasrc.dir}">
           <include name="**/*.properties"/>
           <exclude name="examples/**/*.properties"/>
         </fileset>
      </copy>     
  </target>

  <!-- ===================== Java Rules ================================= -->

  <target name="buildjava" depends="setjavaeehome, setgrizzlyhome, setjavahelphome, buildjavaclient, buildjavaserver, buildexamples"
   description="Compile Java sources">
       <echo message="### Finished building java classes"/>
  </target>

  <target name="cleanclasses"
   description="Delete build directory">
    <echo message="### Cleaning up ${classes.dir}/"/>
    <delete dir="${classes.dir}/"/>
  </target>

  <target name="cleanjava"
   description="Delete build directory">
    <echo message="### Cleaning up ${classes.dir}/"/>
    <delete dir="${classes.dir}/"/>
  </target>

  <target name="preparejava">
    <!-- Create build directory -->
    <mkdir  dir="${classes.dir}"/>
  </target>


   <target name="setdebug">
       <property name="compile.debug" value="true"/>
       <echo message="### Setting debug flag to ${compile.debug}"/>
   </target>



  <target name="buildjavaclient" 
          depends="preparejava"
          description="Compile Java sources ">

    <echo message="### Building java files under ${package} "/>
    <!-- generate temp file with all excludes -->
    <property name="tmpfile" value="${rulesdir}/temp12.txt"/>
    <concat destfile="${tmpfile}">
        <filelist dir="${rulesdir}" 
            files="excludefiles.txt,serverfiles.txt"/>
    </concat>

    <!-- Compile Java classes as necessary -->
    <javac 
          srcdir="${base_javasrc.dir}"
          listfiles="no"
          verbose="no"
          includes="${package}/**/*java"
          excludesfile="${tmpfile}" 
          destdir="${classes.dir}"
          debug="${compile.debug}"
          deprecation="${compile.deprecation}"
          optimize="${compile.optimize}"
	  source="1.5"
          >
        <classpath refid="platform.classpath"/>
        <src path="${base_javasrc.dir}"/>
    </javac>
    <delete file="${tmpfile}"/>

  </target>


  <target name="buildjavaserver" 
          depends="preparejava"
          description="Compile Java sources ">
    <echo message="### Building java files under ${package} "/>
    <!-- Compile Java classes as necessary 
          listfiles="yes"
     -->
    <javac 
          srcdir="${base_javasrc.dir}"
          includes="${package}/**/*java"
          excludes="${examples_src.dir}/**/*java"
          includesfile="${rulesdir}/serverfiles.txt"
          excludesfile="${rulesdir}/excludefiles.txt"
          destdir="${classes.dir}"
           debug="${compile.debug}"
     deprecation="${compile.deprecation}"
        optimize="${compile.optimize}"
        >
        <classpath refid="platform.classpath"/>
    </javac>
  </target>

  <target name="buildexamples" 
          depends="preparejava"
          description="Compile MQ Java examples">

    <echo message="### Building java files under ${examples_src.dir} "/>

    <!-- Compile Java classes as necessary -->
    <javac 
          srcdir="${examples_src.dir}"
          listfiles="no"
          verbose="no"
          debug="${compile.debug}"
          deprecation="${compile.deprecation}"
          optimize="${compile.optimize}"
          >
        <classpath refid="platform.classpath"/>
    </javac>

  </target>


    <!-- download javaee6-api.jar -->
    <target name="bootstrap1">
        <echo message="get javaee6-api.jar from ${mq.bootstrap.url1}."/>
        <echo message="downloading to ${extjars}"/>
	<mkdir dir="${extjars}"/>
        <exec executable="wget" dir="${extjars}" failonerror="true" >
	    <arg line="--no-check-certificate" />
            <arg line="${mq.bootstrap.url1}" />
	</exec>
	<move file="${extjars}/${mq.bootstrap.jar1}" tofile="${extjars}/javaee-api-6.0.jar"/>
    </target>

    <!-- download grizzly NIO -->
    <target name="bootstrap2">
        <echo message="copy grizzly.jar from ${mq.bootstrap.url2}"/>
        <echo message="downloading to ${extjars}"/>
	<mkdir dir="${extjars}"/>
        <exec executable="wget" dir="${extjars}" failonerror="true" >
	    <arg line="--no-check-certificate" />
            <arg line="${mq.bootstrap.url2}" />
	</exec>
	<move file="${extjars}/${mq.bootstrap.jar2}" tofile="${extjars}/grizzly.jar"/>
    </target>

    <!-- download javahelp jhall.jar -->
    <target name="bootstrap3">
        <echo message="get jhall.jar from ${mq.bootstrap.url3}"/>
        <echo message="downloading to ${extjars}"/>
	<mkdir dir="${extjars}"/>
        <exec executable="wget" dir="${extjars}" failonerror="true" >
	    <arg line="--no-check-certificate" />
            <arg line="${mq.bootstrap.url3}" />
	</exec>
	<move file="${extjars}/${mq.bootstrap.jar3}" tofile="${extjars}/jhall.jar"/>
    </target>

    <target name="bootstrap"
	    depends="bootstrap1, bootstrap2, bootstrap3"
	    description="Bootstrap external dependences for MQ">
    </target>
  <!-- ================== C Rules ========================== 
  <target name="buildc" 
	  description="Builds C Client API">
        <echo message="### Calling target buildcclient"/> 
	<ant antfile="${rulesdir}/crules.xml" target="buildcclient"/>
        <echo message="### Done buildcclient"/>

  </target>

  <target name="buildcdebug" 
          depends="setdebug"
	  description="Builds C Client debug source">
        <echo message="### Calling target buildcclient with debug"/> 
	<ant antfile="${rulesdir}/crules.xml" target="buildcclient"/>
        <echo message="### Done buildcclient with debug"/>

  </target>
  -->
<!-- XXX -->
  <!-- ================== Security file Rules ========================== -->
<!-- XXX -->
  <!-- ================== imqadmin image Rules ========================== -->
<!-- XXX -->
  <!-- ======================== bin Rules =============================== -->
<!-- XXX -->


  <!-- ======================== test broker =============================== -->

  <target name="runbroker" 
          description="Runs the MQ broker">
       <java fork="true"
           classname="com.sun.messaging.jmq.jmsserver.Broker">
	   <sysproperty key="imq.home" value="${archbinary.dir}"/>
	   <arg value="-tty"/>
	   <!--jvmarg value=""/ -->
	   <classpath>
               <pathelement location="${classes.dir}"/>
           </classpath>
       </java>
   </target>

	  
</project>
