forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Upayavira">
Subject Re: New CLI, twice as fast :)
Date Fri, 25 Jul 2003 08:15:08 GMT
On Fri, 25 Jul 2003 09:23:54 +0200, "Marc Portier" <>

> >> wouldn't it make the most sense to have a cocoon-cli ant task 
> >> directly? (rather then hooking up through the java task?)

> > Yes it does.

> >> writing such custom ant task (and combined datatypes) should not be 
> >> that difficult and I'ld like to assist. (I also think the cocoon bean 
> >> could largely benefit)

If you know how to code Ant tasks, it shouldn't be hard. If you code the
ant task, I'll try to keep it up to date with any changes to the bean. 

The interface to the bean is pretty simple. What you would want to do is
refactor the o.a.c.Main class into an Ant task. Everything you need is
either in processXConf() or in main(). The main code you'll need is as
simple as:

        CLIListener listener = new Main.CLIListener();
        CocoonBean cocoon = new CocoonBean();

        if (line.hasOption(XCONF_OPT)) {
            // destDir from command line overrides one in xconf file
            destDir = Main.processXConf(cocoon,
            line.getOptionValue(XCONF_OPT), destDir);

        cocoon.addTargets(line.getArgList(), destDir);



You'd need to implement some method to get the values out of the ant task
definition (replacing the processXConf() function, and to add your own
BeanListener implementation (simply to decide what to do with output).

If it is possible to share the processXConf() between the CLI and the Ant
task, then maybe we can factor it out into a CocoonBeanBuilder class.

So, yes, I'd happily help to get this going - especially if someone
provided me/us with a skeleton for the ant task (which I've never done).

> >  - there is an Ant task in the Cocoon scratchpad
> ah, didn't know... probably not based on the new cocoon-bean 
> stuff I presume?

No it doesn't. In some ways the code there is probably better than that
in the bean, but to my mind it makes sense to create an Ant wrapper to
the bean and then develop the bean, than to have multiple instances of
crawlers, etc. (I think there are at least three crawlers in the Cocoon
CVS. Quite unnecessary).

Regards, Upayavira

View raw message