------------------------------------
<?xml version="1.0"?>
<project name="cond3" default="end" basedir=".">
<!--==================================================================
Determine which server is the target.
==================================================================-->
<target name="getserver" description="Determine which server is the
target">
<input message="Which server should receive the files? 1. Foo 2. Bar 3.
Test"
validargs="1,2,3"
addproperty="server.choice"
defaultvalue="2"/>
<condition property="servername" value="foo">
<equals arg1="${server.choice}" arg2="1"/>
</condition>
<condition property="servername" value="bar">
<equals arg1="${server.choice}" arg2="2"/>
</condition>
<condition property="servername" value="test">
<equals arg1="${server.choice}" arg2="3"/>
</condition>
</target>
<!--==================================================================
Load the properties file for the appropriate server.
==================================================================-->
<target name="getprops" depends="getserver" description="Get the
appropriate properties file depending on the server which was chosen">
<property file="server.${servername}.properties"/>
</target>
<!--==================================================================
Get the userid and password for the desired server.
==================================================================-->
<target name="getlogin" depends="getprops" description="Get userid and
password for server.">
<input message="Please supply the userid for the ${server} server:"
addproperty="userid" defaultvalue="dougb"/>
<input message="Please supply the password for the ${server} server:"
addproperty="password" defaultvalue="dougbpw"/>
</target>
<!--==================================================================
Execute the appropriate upload target, depending on which server
was chosen.
==================================================================-->
<target name="upload" depends="getlogin" description="Upload to the
selected server.">
<antcall target="upload-${servername}"/>
</target>
<!--==================================================================
Upload to the 'foo' server.
==================================================================-->
<target name="upload-foo" description="Upload to the foo
server.">
<echo message="Uploading to foo...."/>
<echoproperties prefix="server"/>
</target>
<!--==================================================================
Upload to the 'bar' server.
==================================================================-->
<target name="upload-bar" description="Upload to the bar
server.">
<echo message="Uploading to bar...."/>
<echoproperties prefix="server"/>
</target>
<!--==================================================================
Upload to the 'test' server.
==================================================================-->
<target name="upload-test" description="Upload to the test
server.">
<echo message="Uploading to test...."/>
<echoproperties prefix="server"/>
</target>
<!--==================================================================
Display a message to the user.
==================================================================-->
<target name="end" depends="upload" description="Display a
message.">
<echo message="Uploads to server ${servername} are complete."/>
</target>
</project>
------------------------------------