<!--
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements. See the NOTICE file
 distributed with this work for additional information
 regarding copyright ownership. The ASF licenses this file
 to you under the Apache License, Version 2.0 (the
 "License"); you may not use this file except in compliance
 with the License. You may obtain a copy of the License at
 
 http://www.apache.org/licenses/LICENSE-2.0
 
 Unless required by applicable law or agreed to in writing,
 software distributed under the License is distributed on an
 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 KIND, either express or implied. See the License for the
 specific language governing permissions and limitations
 under the License.
-->
<project name="wssec11" default="download">
    <property name="build.dir" location="target"/>
    <target name="download.internal" if="needsToDownload">
        <mkdir dir="${build.dir}/generated/src/main/resources/certs"/>
        <mkdir dir="${build.dir}/wsdl"/>
        <get src="http://131.107.72.15/ilab/Certs/Certs.zip" dest="${build.dir}/Certs.zip"/>
        <get src="http://131.107.153.205/Security_WsSecurity_Service_Indigo/WsSecurity11.svc?wsdl" dest="${build.dir}/wsdl/WsSecurity11.wsdl"/>
        <get src="http://131.107.153.205/Security_WsSecurity_Service_Indigo/WsSecurity11.svc?wsdl=wsdl0" dest="${build.dir}/wsdl/WsSecurity11_policy.wsdl"/>
        <get src="http://131.107.153.205/Security_WsSecurity_Service_Indigo/WsSecurity11.svc?xsd=xsd0" dest="${build.dir}/wsdl/WsSecurity11_0.xsd"/>
        <get src="http://131.107.153.205/Security_WsSecurity_Service_Indigo/WsSecurity11.svc?xsd=xsd1" dest="${build.dir}/wsdl/WsSecurity11_1.xsd"/>
        <get src="http://131.107.153.205/Security_WsSecurity_Service_Indigo/WsSecurity11.svc?xsd=xsd2" dest="${build.dir}/wsdl/WsSecurity11_2.xsd"/>
        <get src="http://131.107.153.205/Security_WsSecurity_Service_Indigo/WsSecurity11.svc?xsd=xsd3" dest="${build.dir}/wsdl/WsSecurity11_3.xsd"/>
        <antcall target="transform"/>
        <unzip src="${build.dir}/Certs.zip" dest="${build.dir}/generated/src/main/resources/certs"/>
    </target>

    <target name="transform">
        <mkdir dir="${build.dir}/wsdl2"/>
        <xslt basedir="${build.dir}/wsdl" destdir="${build.dir}/wsdl2"
            style="src/style/makelocal.xsl" extension=".xml">
            <mapper type="identity"/>
        </xslt>
    </target>


    <target name="download">
        <mkdir dir="${build.dir}"/>
        <condition property="needsToDownload">
          <not>
            <available file="${build.dir}/Certs.zip"/>
          </not>
        </condition>
        <antcall target="download.internal"/>
    </target>
</project>
