3832N/A<!--
3832N/A ! CDDL HEADER START
3832N/A !
3832N/A ! The contents of this file are subject to the terms of the
3832N/A ! Common Development and Distribution License, Version 1.0 only
3832N/A ! (the "License"). You may not use this file except in compliance
3832N/A ! with the License.
3832N/A !
6982N/A ! You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
6982N/A ! or http://forgerock.org/license/CDDLv1.0.html.
3832N/A ! See the License for the specific language governing permissions
3832N/A ! and limitations under the License.
3832N/A !
3832N/A ! When distributing Covered Code, include this CDDL HEADER in each
6982N/A ! file and include the License file at legal-notices/CDDLv1_0.txt.
6982N/A ! If applicable, add the following below this CDDL HEADER, with the
6982N/A ! fields enclosed by brackets "[]" replaced with your own identifying
6982N/A ! information:
3832N/A ! Portions Copyright [yyyy] [name of copyright owner]
3832N/A !
3832N/A ! CDDL HEADER END
3832N/A !
3832N/A !
4458N/A ! Copyright 2008-2009 Sun Microsystems, Inc.
3832N/A ! -->
3832N/A<project name="dependencies">
3832N/A <description>
3832N/A Manage dependencies.
3832N/A </description>
3832N/A
3832N/A <!-- Download all the dependencies -->
3832N/A <target name="download">
3832N/A <mkdir dir="${archives.dir}"/>
3832N/A
3832N/A <!-- STAF and other services -->
3832N/A <var name="list" value="${staf.archive},${stax.archive},${email.archive}"/>
3832N/A <var name="list" value="${list},${event.archive},${eventmanager.archive}"/>
4978N/A <var name="list" value="${list},${http.archive},${wc.archive}"/>
3832N/A <mkdir dir="${tmp.dir}"/>
3832N/A <for list="${list}" param="archive">
3832N/A <sequential>
3832N/A <var name="rc" unset="true"/>
3832N/A <var name="ext" unset="true"/>
3832N/A <var name="url" unset="true"/>
3832N/A
4714N/A <trycatch property="error" reference="referror">
4714N/A <try>
4714N/A <propertyregex property="ext"
4714N/A input="@{archive}"
4714N/A regexp=".*\.(.*)"
4714N/A select="\1"
4714N/A casesensitive="false"/>
3832N/A
4714N/A <echo>Checking @{archive} archive...</echo>
4714N/A <switch value="${ext}">
4714N/A <case value="gz">
4714N/A <!-- gz files -->
4714N/A <gunzip src="${archives.dir}/@{archive}"
4714N/A dest="${tmp.dir}"/>
4714N/A </case>
4714N/A <case value="zip">
4714N/A <!-- zip files -->
4714N/A <unzip src="${archives.dir}/@{archive}"
4714N/A dest="${tmp.dir}"/>
4714N/A </case>
4714N/A <default>
4714N/A </default>
4714N/A </switch>
3832N/A
4714N/A <var name="rc" value="0"/>
4714N/A </try>
3832N/A
4714N/A <catch>
4714N/A <echo>ERROR: ${error}</echo>
4714N/A <var name="rc" value="-1"/>
4714N/A </catch>
4714N/A </trycatch>
3832N/A
3832N/A <if>
3832N/A <or>
3832N/A <not>
3832N/A <equals arg1="${rc}" arg2="0"/>
3832N/A </not>
3832N/A <not>
3832N/A <available file="${archives.dir}/@{archive}"/>
3832N/A </not>
3832N/A </or>
3832N/A <then>
3832N/A <if>
4978N/A <equals arg1="@{archive}" arg2="${wc.archive}"/>
3832N/A <then>
3832N/A <!-- Tomcat url -->
4978N/A <var name="url" value="${wc.url}"/>
3832N/A </then>
3832N/A <else>
3832N/A <!-- Other url -->
3832N/A <var name="url" value="${staf.url}"/>
3832N/A </else>
3832N/A </if>
3832N/A <get src="${url}/@{archive}"
3832N/A dest="${archives.dir}/@{archive}"/>
3832N/A </then>
3832N/A </if>
3832N/A </sequential>
3832N/A </for>
3832N/A <delete includeemptydirs="true">
3832N/A <fileset dir="${tmp.dir}" includes="**/*"/>
3832N/A </delete>
3832N/A </target>
3832N/A
3832N/A <!-- Remove current dependencies -->
3832N/A <target name="remove">
3832N/A <delete dir="${archives.dir}">
3832N/A <include name="STAF${staf.version}*"/>
3832N/A <include name="${stax.archive}"/>
3832N/A <include name="${email.archive}"/>
3832N/A <include name="${event.archive}"/>
3832N/A <include name="${eventmanager.archive}"/>
3832N/A <include name="${http.archive}"/>
4978N/A <include name="${wc.archive}"/>
3832N/A </delete>
3832N/A </target>
3832N/A
3832N/A <!-- Remove old dependencies -->
3832N/A <target name="removeold">
3832N/A <delete dir="${archives.dir}">
3832N/A <exclude name="STAF${staf.version}*"/>
3832N/A <exclude name="${stax.archive}"/>
3832N/A <exclude name="${email.archive}"/>
3832N/A <exclude name="${event.archive}"/>
3832N/A <exclude name="${eventmanager.archive}"/>
3832N/A <exclude name="${http.archive}"/>
4978N/A <exclude name="${wc.archive}"/>
3832N/A </delete>
3832N/A </target>
3832N/A
3832N/A <!-- Remove all the dependencies -->
3832N/A <target name="removeall">
3832N/A <delete dir="${archives.dir}"/>
3832N/A </target>
3832N/A</project>