ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject AW: Call task from another task
Date Wed, 18 Aug 2004 05:59:52 GMT
Have you tried otherTask.perform();  ?

Jan

> -----Urspr√ľngliche Nachricht-----
> Von: Perkins, Kristian [mailto:Kristian.Perkins@ato.gov.au]
> Gesendet am: Dienstag, 17. August 2004 04:00
> An: Ant Users List
> Betreff: RE: Call task from another task
> 
> Here would be what I would do:
> 
> Put the method in another utility class C and pass in the
> ProjectComponent object you want to log to as an argument. So:
> 
> class C {
> 	static Object utilMeth(ProjectComponent logContext) {
> 	  // do stuff
> 	  if (logContext != null)
> 		logContext.log("logging now");
> 	}
> }
> 
> class A extends Task {
> 	execute(){
> 	  C.utilMeth(this);
> 	}
> }
> 
> .. B is similar to A.
> 
> Or again with the method in class C, make A and B inherit from C.  So:
> 
> abstract class C extends Task {
> 	Object utilMeth() {
> 		log("logging now");
> 	}
> }
> 
> Class A extends C {
> 
> 	void execute() {
> 	    utilMeth();
> 	}
> }
> 
> .. and again similar for class B (it could also be static similar to
> first e.g.).
> 
> Kristian
> 
> 
> -----Original Message-----
> From: news [mailto:news@sea.gmane.org] On Behalf Of Andreas Hartmann
> Sent: Monday, 16 August 2004 6:58 PM
> To: user@ant.apache.org
> Subject: Call task from another task
> 
> 
> Dear Ant community,
> 
> I didn't find any documentation about the correct way
> to call a task A from another task B.
> 
> I don't want to call the execute() method of A, but
> another (utility) method. The utility method could be
> static, but this way I couldn't use the logging mechanism.
> 
> So I need a way to access A from B (A should be set
> up correctly).
> 
> Could someone give me a short pointer to documentation
> about this topic?
> 
> Thanks in advance!
> -- Andreas
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 
> ****************************************************************
>                             IMPORTANT
> 
>  The information transmitted is for the use of the intended 
> recipient only and may contain confidential and/or legally 
> privileged material. Any review, re-transmission, disclosure 
> dissemination or other use of, or taking of any action in 
> reliance upon, this information by persons or entities other 
> than the intended recipient is prohibited and may result in 
> severe penalties.  If you have received this e-mail in error 
> please notify the Privacy Hotline of the Australian Taxation 
> Office, telephone 13 28 69 and delete all copies of this 
> transmission together with any attachments. 
> ****************************************************************
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message