ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <>
Subject [RFC] AbstractTestlet with extended functionality
Date Fri, 30 Jun 2000 03:12:45 GMT

I have another request that I am not 100% sure about yet but are just
throwing it out for comments. A couple of my tasks are getting rediculously
large - mainly due to huge number of property setters. Also I am getting an
increasing amount of  validation code in execute method. So what I would
like to suggest is some work at delegating more responsibility to
AbstractTestlet classs and less to the other classes in Ant. Essentially
what I would like to see is that the interface for Task be reduced to simply

void execute( TaskContext context )

TaskContext would hold all parameters and also give access to functionality
like path transformation etc.

However as this would brake 100% of current tasks there may be use in
creating an AbstractTasklet that implements some of the missing
functionality. Any of the old tasks can simply inherit from AbstractTasklet
and work as they do now.

The most important things that AbstractTasklet does is implement:

void execute( TaskContext context )

It would implement it in a manner such that it gets all parameters, then
through reflection sets them all in the same way that they are set now. It
would then call init() and execute() of the task. This would mean that all
tasks would work as they do now as long as they inherited from void
AbstractTasklet. However this would allow some tasks to do all sorts of
wierd and wonderful things, including partial automatic validation. This
would greatly reduce the work needed to write a new task and similar
approaches have been taken in other frameworks. Servlets already do this
partially via Generic/HttpServlet and I do it in a few of my own frameworks
(Gamelet,Testlet etc) so it is not too radical. It just makes writing tasks
so much easier :P.

Thoughts ?



| "Nearly all men can stand adversity, but if you want |
| to test a man's character, give him power."          |
|       -Abraham Lincoln                               |

View raw message