You will need to use the nightly build of ant (1.6alpha). an add(Condition condition) method has been added to ConditionBase. This will pick up typedef's conditions.
Usage: Write a condition - a class implementing org.apache.tools.ant.taskdefs.condition.Condition Typedef the condition: <typedef name="my.condition" classname="..." classpath=".."/> The condition can then be used in the waitfor task; <waitfor.. <my.condition attr="x"> <subclass attr="y"> </my.condition> </waitfor> Peter On Friday 19 September 2003 23:06, Alan Bram wrote: > Hello, > > 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 tests. > > 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 whatever.) > > 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., > org.apache.tools.ant.taskdefs.condition.Condition). 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. > > Sincerely, > - Alan Bram > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]