ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alan Bram" <>
Subject can I subclass Condition to create my own conditions for "waitfor" task?
Date Fri, 19 Sep 2003 22:06:54 GMT

I've written an Ant task that I will use in running unit tests (under CruiseControl).  The
task waits for my JBoss server to complete its start-up process.  It works via access to the
JBoss JMX MBean for the Main Deployer, so that I know it's really ready before I start my

I've patterned my code after the Ant "waitfor" task, in terms of allowing the user to specify
frequency and time limit, both value and units independently, because I think that's pretty
cool.  (I hate having to guess whether a time was specified in milliseconds, or seconds, or

However, I suddenly realized that instead of making my code *like* Ant's "waitfor" task, it
would be really cool if I could actually re-use it.  It seemed like I almost could, if only
I could make up my own Condition (i.e.,
 The ConditionBase class (which is the base class of WaitFor) knows about only a fixed set
of types of Condition's.  It seemed like I could almost add my own if I subclassed WaitFor,
by adding my own addMyCondition() method.  But it looks like that won't quite work, because
ConditionBase keeps its "conditions" field private.

Does anyone see a good way to make this work?

I suppose maybe I could just override the getConditions() method to ignore all other Condition's
and just return my Condition.  But that seems a bit ugly?

I thank you in advance for any thoughts on this matter.

 - Alan Bram

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

View raw message