ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brett Wooldridge" <br...@irongrid.com>
Subject RE: Dynamic Configurator
Date Thu, 20 Mar 2003 20:14:39 GMT
Looking at the XDoclet code, I see this:

    public Object createDynamicElement(String name) throws BuildException
    {
        if (!isModulesRegistered) {
            registerModules();
            isModulesRegistered = true;
        }

        SubTask subTask = (SubTask) getSubtaskMap().get(name);

        if (subTask == null) {
            throw new BuildException(...);
        }

        subTasks.add(subTask);
        return subTask;
    }

This seems to imply that a new instance of a subtask is not
returned for each call to createDynamicElement(), but instead
a single instance (pulled from a map), is returned.

Is this the required behavior?  I can see why THAT code being
called twice would "do no harm".  However, my code (currently)
roughly looks like:

    public Object createDynamicElement(String name) throws BuildException
    {
        if ("junit".equals(name)) {
            return new JUnitTask();
        }
    }

Which if called twice, of course, results in two JUnitTask objects
being created.

-brett

-----Original Message-----
From: Erik Hatcher [mailto:jakarta-ant@ehatchersolutions.com]
Sent: Thursday, March 20, 2003 12:52 PM
To: Ant Developers List
Subject: Re: Dynamic Configurator

<snip>

The latest XDoclet code uses it, and I've used it for my Lucene <index> 
task and other example tasks for the book, but never to the level 
you're trying it.  Perhaps the XDoclet implementation of it can help?

	Erik


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message