<?xml version="1.0" encoding="UTF-8"?>
<project name="dpbuddy.getting-started" xmlns:dp="antlib:com.myarch.dpbuddy" >

    <description>
        Simple "getting started" example
        Update dpbuddy.conf and then run it using ant:
        ant deploy -Ddp.env=your_environment
        e.g.
        ant deploy -Ddp.env=test
    </description>

    <property environment="envvars"/>
    <!-- Specify where dpbuddy is installed, we can use an environment variable or a property -->
    <property name="dpbuddy.home" location="${envvars.DPBUDDY_HOME}" />

    <taskdef uri="antlib:com.myarch.dpbuddy">
        <classpath>
            <pathelement location="${dpbuddy.home}/conf"/>
            <!-- We need to exclude Ant jars packages with DPBuddy -->
            <fileset dir="${dpbuddy.home}/lib" excludes="ant-*"/>
        </classpath>
    </taskdef>

    <!-- load our config file, assuming it's in the same directory -->
    <dp:confFile file="dpbuddy.conf" />

    <target name="upload.files"
            description="Upload XSLTs and other relevant files to the local:/ filesystem of our domain">

        <!-- Copy xslts to /xslt directory -->
        <dp:copy dir="services" includes="**/*.xslt" toDir="/xslt" flatten="true" />
        <!-- wsdl/xsd files go to services/wsdl -->
        <dp:copy dir="services" includes="**/*.wsdl **/*.xsd" toDir="/services/wsdl" flatten="true" flushCache="true" />

    </target>

    <target name="import.dp.config"
            description="Import all configuration objects and services into the test domain" >

        <dp:import file="dpconfigs/services.xcfg" resolveVars="true" save="true" assertObjectsUp="true" assertPorts="${wsProxyPort}, ${xmlFirewallPort}"/>

    </target>

    <target name="deploy" depends="upload.files, import.dp.config" description="Updaload files and import config" />

</project>
