Return-Path: Delivered-To: apmail-jakarta-ant-dev-archive@apache.org Received: (qmail 28992 invoked from network); 28 Apr 2002 08:57:21 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 28 Apr 2002 08:57:21 -0000 Received: (qmail 22357 invoked by uid 97); 28 Apr 2002 08:57:30 -0000 Delivered-To: qmlist-jakarta-archive-ant-dev@jakarta.apache.org Received: (qmail 22330 invoked by uid 97); 28 Apr 2002 08:57:29 -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 16612 invoked from network); 25 Apr 2002 23:27:46 -0000 From: =?iso-8859-1?Q?Aslak_Helles=F8y?= To: "Erik Hatcher" , Cc: Subject: Dynamic createBlaBla methods in Ant tasks using BCEL at runtime Date: Fri, 26 Apr 2002 01:27:32 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) Importance: Normal In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Hi Erik, Ant, XDoclet. (I'm crossposting, and I'm not subscribed to ant-dev, so if you want to reach me, please mail me personally or to xdoclet-devel). This is a follow up to some mails Erik Hatcher and Ara Abrahamian (XDoclet admin) posted to ant-dev some weeks ago. I think I know how you (Ant) can incorporate the dynamic BCEL/createBlaBla generation in tasks in the Ant core. We're already doing this in XDoclet and are using it for dynamic modules where we don't know at compile-time what aub-elements a task will have. You'll have to add private final Vector subTasks = new Vector(); // You're trying to avoid the java.util.List aren't you ;-) protected void addSubTask(Object o) { _subTasks.add(o); } protected List/Vector getSubTasks() { return _subTasks; } to org.apache.tools.ant.taskdefs.Task If all ant modules have a deployment descriptor (which they do, don't they?) have a section � la for all classes intended to be used as subtasks you should have all the info you need. We use xdoclet to generate these deployment descriptors for our own plugins. The BCEL-savvy class-loader will insert a method like this public com.aslak.AslakServerSubTask createAslak() { com.aslak.AslakServerSubTask = new com.aslak.AslakServerSubTask(); addSubTask(subTask); return subTask; } into org.apache.tools.ant.taskdefs.optional.ejb.EjbJar P.S. Currently we are in XDoclet generating slightly different and a bit more fragile code: public com.aslak.AslakServerSubTask createAslak() { com.aslak.AslakServerSubTask = new com.aslak.AslakServerSubTask(); _subTasks.add(subTask); return subTask; } -so the BCEL juggling would be a bit modified from what you'll find inside xdoclet.loader.BootstrapClassLoader, but this is something you should definitely consider adding to the Ant core. (IMHO). D.S Do you think this could work for you? Feel free to steal/improve the code under xdoclet.loader Thanks for a great product! (You probably don't hear that too often. People must be taking you for granted now ;-) Cheers, Aslak -- To unsubscribe, e-mail: For additional commands, e-mail: