ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominique Devienne" <ddevie...@gmail.com>
Subject Re: properties handling problem
Date Mon, 31 Jul 2006 14:54:39 GMT
Recursive property expansion can be emulated using a <macrodef>.

<macrodef name="ftp_available">
  <attribute name="hostname" />
  <attribute name="num" />
  <attribute name="server" value="@{hostname}_@{num}" />
  <sequential>
    <echo>Processing ${@{server}_name} (IP: ${@{server}_ip})</echo>
   ...

If you have in your properties file:
host_1_name = foo
host_1_ip = 255.255.255.0

Calling <ftp_available hostname="host" num="1" />

Will display: Processing foo (IP: 255.255.255.0). --DD

On 7/31/06, heisch@yawido.de <heisch@yawido.de> wrote:
> Hi,
> this is Code for deliver files to different systems with a pre-check...
>
> I'll iterate with der foreach-Task.
>
> The Problem is, I don't now how to set the properties.
>
> Properties
> available=availability
> availabledir=/export/home/heisc01/anttest/
> output=output
> hostlist=host_1,host_2,host_3
> hostname=host
>
> I think like this: server="${$hostname}_${num}}"
> but it didn't work..
>
> Could somebody help me..
>
> best regards..
> Beni
>
>
> <!-- =================================
>                      target: Schleife für Verfügbarkeitstest
>                     ================================= -->
>        <target name="availableloop">
>                                <foreach list="1,2,3,4" target="availability"
> param="num" />
>                </target>
>
>        <!-- =================================
>                  target: Verfügbarkeitstest der Systeme als Voraussetzung für
> upload
>                 ================================= -->
>        <target name="availability" description="Checking the systems for
> availability">
>                <echo message="Verfügbarkeitscheck Nr  ${num}"/>
>                <delete file="${available}/*.available"/>
>                <ftp action="get" password="${password}"
> server="${$hostname}_${num}}"
> userid="${username}" remotedir="${availabledir}">
>                        <fileset dir="${available}">
>                                <include name="*.available" />
>                        </fileset>
>                </ftp>
>                <available file="${available}/"${$hostname}_${num}}".available"
> property=""${$hostname}_${num}}".ready"/>
>                <antcall target="upload"></antcall>
>        </target>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message