ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erik Hatcher" <jakarta-...@ehatchersolutions.com>
Subject Re: Dynamic createBlaBla methods in Ant tasks using BCEL at runtime
Date Fri, 26 Apr 2002 00:42:29 GMT
I think the best bet is for you to create another base class (DynamicTask?)
that we use, rather than modifying Task.  This would allow folks to get the
dynamic capability if they want with a different parent class, but existing
tasks would not automatically inherit this.

What you've accomplished is quite cool.  Its too bad that Ant still won't
give you the dynamic attributes though, only elements.

No, Ant's tasks do not have deployment descriptors.  There is a
defaults.properties file in ant.jar that defines taskname -> classname
mappings - that is all.

Peter?  Last chance to reconsider the DynamicConfigurator interface patch
that I submitted..... would really be a bonus for Ant 1.5's capabilities,
and only tasks that implement it would get such capabilities.  Pretty pretty
please?!

    Erik



----- Original Message -----
From: "Aslak Helles√ły" <aslak.hellesoy@netcom.no>
To: "Erik Hatcher" <erik@hatcher.net>; <ant-dev@jakarta.apache.org>
Cc: <xdoclet-devel@lists.sourceforge.net>
Sent: Thursday, April 25, 2002 7:27 PM
Subject: Dynamic createBlaBla methods in Ant tasks using BCEL at runtime


> 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
>
>    <subtask
>       name="aslak"
>       implementation-class="com.aslak.AslakServerSubTask"
>
parent-task-class="org.apache.tools.ant.taskdefs.optional.ejb.EjbJar"
>    />
>
> 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:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message