ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shackelford, John-Mason" <>
Subject RE: handling external resources
Date Tue, 10 Sep 2002 21:37:53 GMT

> It would be great if there could be some new Ant resource of 
> some kind -- perhaps a new datatype -- that represented a 
> chunk of parsed XML.

Hmmm. I am reading up on the xmlproperty task which is a start but isn't
quite robust enough for our purposes. Seems like what we want is to be able
to take an XML file and return not just dotted properties but whole
DataTypes which can be passed around via refid.

<xmldatatype file="my.xml" datatype="org.apache.etc" id="myid"/>

The task would then call setters on the the object in just the same way that
ant does for xml elements nested within a custom task. Then the data type
could be passed to a task that needs it:

<mytask dataref="myid"/>

Once again, this is pretty left field and I am not sure I would use it much
in regular build file. But here is one example of how I might:

Pehaps I need a DataType to represent a deployment:

<deployment id="my first deployment" ftphost="" ftpuser="" ftppassword=""
email="" os=""/>

And since my script could deploy to a number of different servers
(configurable via a property file) I want a collection of deployments:

<deployset id="my.deployset">
	<deployment id=""    os="linux"   ftphost="a" ftpuser="b"
ftppassword="c" email="d@e.fg"/>
	<deployment id="" os="solaris" ftphost="h" ftpuser="i"
ftppassword="j" email="" />
	<deployment id=""    os="win2k"   ftphost="o" ftpuser="p"
ftppassword="q" email=""/>
	<deployment id=""      os="linux"   ftphost="u" ftpuser="v"
ftppassword="w" email=""/>

I could then select which deployment to use on the basis of a property file:

<deployset deploysetref="my.deployset" key="${}"
	Preparing to deploy to:
	ftphost = ${}
	ftpuser = ${}

This makes it much easier to share the build script with other engineers who
don't need to know about the configuration of the various deployment boxes.
Only one property ( needs to be changed and a whole series of
other properties are set.

By having the xmldatatype tag I could move the deployment definition out of
the build file and into a configuration file. My build script would then
look some thing like:

<xmldatatype file="my.xml" class="org.apache.leftfield.DeploySet"
elementname="deployset" id="my.deployset"/>

<deployset deploysetref="my.deployset" key="${}"

	Preparing to deploy to:
	ftphost = ${}
	ftpuser = ${}

Would something like this help?

John-Mason Shackelford

Software Developer
NCS Pearson - Measurement Services
2510 North Dodge St.
Iowa City, IA 52245

This email may contain confidential material. 
If you were not an intended recipient, 
Please notify the sender and delete all copies. 
We may monitor email to and from our network. 

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message