ant-dev mailing list archives

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

> 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="testing.box"    os="linux"   ftphost="a" ftpuser="b"
ftppassword="c" email="d@e.fg"/>
	<deployment id="production.box" os="solaris" ftphost="h" ftpuser="i"
ftppassword="j" email="k@l.mn" />
	<deployment id="windows.box"    os="win2k"   ftphost="o" ftpuser="p"
ftppassword="q" email="r@u.st"/>
	<deployment id="linux.box"      os="linux"   ftphost="u" ftpuser="v"
ftppassword="w" email="x@y.za"/>
</deployset>


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

<deployset deploysetref="my.deployset" key="${deployment.box}"
propertyprefix="deploy.box"/>
<echo>
	Preparing to deploy to:
	ftphost = ${deploy.box.ftphost}
	ftpuser = ${deploy.box.ftpuser}
</echo>

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 (deployment.box) 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="${deployment.box}"
propertyprefix="deploy.box"/>

<echo>
	Preparing to deploy to:
	ftphost = ${deploy.box.ftphost}
	ftpuser = ${deploy.box.ftpuser}
</echo>


Would something like this help?


John-Mason Shackelford

Software Developer
NCS Pearson - Measurement Services
2510 North Dodge St.
Iowa City, IA 52245
319-354-9200x6214
shacjo@ncs.com



**************************************************************************** 
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:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message