From ant-dev-return-36735-qmlist-jakarta-archive-ant-dev=jakarta.apache.org@jakarta.apache.org Mon Aug 05 21:06:12 2002 Return-Path: Delivered-To: apmail-jakarta-ant-dev-archive@apache.org Received: (qmail 68273 invoked from network); 5 Aug 2002 21:06:11 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 5 Aug 2002 21:06:11 -0000 Received: (qmail 19786 invoked by uid 97); 5 Aug 2002 21:06:34 -0000 Delivered-To: qmlist-jakarta-archive-ant-dev@jakarta.apache.org Received: (qmail 19769 invoked by uid 97); 5 Aug 2002 21:06:34 -0000 Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 19757 invoked by uid 98); 5 Aug 2002 21:06:33 -0000 X-Antivirus: nagoya (v4198 created Apr 24 2002) From: "Matt Munz" To: Subject: WaitFor doesn't extend Task so it can't be used as a Task programmatically Date: Mon, 5 Aug 2002 17:06:01 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Hello ant developers, Thanks for creating such an awesome tool! The following is the content of bug #11481, which I just submitted. Any hints / suggestions /ideas would be appreciated... Hi. This is a design issue. Lacking Architecture / Design documents, I'm not sure whether this is a defect or a "feature", but either way, I needed a workaround to use WaitFor that is not required for objects like Copy, and this is an inconsistency that should be addressed. I am writing a Task that uses Parallel, Sequence, and WaitFor. The following code won't work. WaitFor wait; ... Sequential sequence = (Sequential) getProject().createTask("sequential"); sequence.addTask(wait); It won't work because, although WaitFor has an interface compatible with Task, it does not extend Task, but rather its superclass, ProjectComponent. workaround: I created a wrapper class that treats WaitFor like a Task. It is included below. solution: There are several possiblities. I don't think that the workaround is a robust solution. Alternatives include making WaitFor a subclass of Task, and (I like this one) making Task (or something like it) an interface. Such an interface (let's call it ExecutableComponent) would have only one method: public void execute() throws BuildException; Just an idea -- I'm interested in hearing anyone else's ideas on the matter. ---- WaitForTask.java --------- import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Task; import org.apache.tools.ant.taskdefs.WaitFor; /** * The WaitFor Condition object is very much like a Task object. * This class adapts the WaitFor object to the Task API so that it can be executed * as a Task. * @author Matt Munz */ public class WaitForTask extends Task { protected WaitFor fDelegate; public WaitForTask(WaitFor newDelegate) { super(); setDelegate(newDelegate); } public void execute() throws BuildException { delegate().execute(); } protected WaitFor delegate() { return fDelegate; } protected void setDelegate(WaitFor newDelegate) { fDelegate = newDelegate; } } ---------------------- - Matt Munz -- To unsubscribe, e-mail: For additional commands, e-mail: