I'm cross-posting (I hope, I'm subscribed using different e-mail addresses)
to the ant-dev e-mail list.
ClassLoader knowledge is not something I possess (yet), so I'm not going to
be able to answer this without doing a lot more homework that I currently
don't have time for - so I'm going to delegate to the other ant-dev folks
for more input.
Could someone help the xdoclet-devel team with some Ant ClassLoader issues?
They've got something quite slick going on with BCEL to enable a task to
have their createXXX methods injected dynamically based on a configuration
file at runtime. Its not quite as dynamic as the DynamicConfigurator that I
submitted, but it does have the advantage of adding dynamic nature without
modifying Ant's core.
In my opinion, having Ant so rigid with the createXXX methods is one of its
biggest drawbacks - it really locks us out of a lot of vendor extensibility.
I applaud the XDoclet folks for giving it a shot to accomplish this given
the constraints we've imposed on them.
Erik
----- Original Message -----
From: "Ara Abrahamian" <[EMAIL PROTECTED]>
To: "Erik Hatcher" <[EMAIL PROTECTED]>
Cc: <[email protected]>
Sent: Wednesday, April 10, 2002 4:06 AM
Subject: RE: [Xdoclet-devel] Making XDoclet more modular (with proof of
concept code)
> BTW, Erik we're experiencing problems when running xdoclet in
> fork=false mode. It's twice slower than fork=true mode and when trying
> to validate the output of an xml subtask we get a
> java.lang.LinkageError. Seems like two versions of the sax parser are
> loaded or something like that.
>
> Do you have any explanation for it? Is fork=true generally faster for
> Ant tasks? And is there any trick (with regard to how
> AntClassLoader/etc works) to loading a sax parser?
>
> Ara.
>
> --- Aslak_Helles�y <[EMAIL PROTECTED]> wrote:
> >
> >
> > > -----Original Message-----
> > > From: Erik Hatcher [mailto:[EMAIL PROTECTED]
> > > Sent: 10. april 2002 01:33
> > > To: [EMAIL PROTECTED]
> > > Cc: Ara Abrahamian; [email protected]
> > > Subject: Re: [Xdoclet-devel] Making XDoclet more modular (with
> > proof of
> > > concept code)
> > >
> > >
> > > Aslak,
> > >
> > > I haven't been following the XDoclet commits closely lately. Have
> > you
> > > gotten it working and have "dynamic" tasks?
> > >
> >
> > Sure, there is one in there. The ejb weblogic subtask. If you take a
> > look at
> > the EjbDocletTask, the createWeblogic() is gone from the source, but
> > Ant
> > happily executes it ;-) I'm using a class loader which instruments
> > the class
> > in the loadClass method. The information about what methods to add is
> > taken
> > from the weblogic-optional.jar's xdoclet.xml deployment descriptor.
> > Take a
> > look at the classes in the xdoclet.loader package as well as the
> > ejbdoclet
> > task in the sample's build.xml and you'll get the picture. The
> > intention is
> > that from now on, all the non-core stuff shall be moved under a
> > structure
> > similar to the core/optional/weblogic stuff.
> >
> > Currently I'm struggling a bit with class loaders, forking and
> > registering
> > the templates, but I think I have a solution in my head.
> >
> > > If you've accomplished this, its very cool! This would be a
> > > useful feature
> > > for <ejbjar> also.
> > >
> > > But I still think its not quite as flexible as I'd like - or maybe
> > it
> > > is....you tell me. I'd like to have a task that could take any
> > number of
> >
> > It's very dynamic indeed, but the BCEL code in the class loader
> > relies on a
> > "java.util.List _subTasks" class attribute to exist in the class to
> > instrument (EjbDocletTask) - so it's a bit fragile. Better comment
> > the field
> > declaration thoroughly as I did.
> >
> > > dynamic attributes - so for example you could have an XDoclet
> > subtask that
> > > takes config params:
> > >
> > > <subtask param1="xyz" blah="foo".../>
> > >
> > > But having a setParam1 and setBlah is not flexible. Can you
> > > accomplish this
> > > with BCEL magic too? I'm guessing not, because you probably need
> > to have
> > > those methods injected at the time of <taskdef> right?
> >
> > Correct, so there must be some meta info available somewhere before
> > the
> > class is instrumented. -Unless you're a super duper classloader guru
> > and
> > reload it afterwards or something.
> >
> > >
> > > I'm just curious where are you are with this and how flexible it
> > > is, and any
> > > issues you still have with it.
> > >
> >
> > I was a complete BCEL newbie, but I got it all working in an evening.
> > My
> > strategy was to code the code I wanted to generate, compile it and
> > pass it
> > through BCEL's Class2HTML (or the fantastic swing gui cck which
> > you'll find
> > on BCEL's SF site). Then it was just a matter of figuring out how to
> > use the
> > BCEL API to reconstruct the bytecode, parameterising whatever you
> > need to
> > parameterise. I used jad to decompile my mutated class (which can
> > easily be
> > written to file with BCEL).
> >
> > > Erik
> > >
> > > p.s. Again I apologize that Ant can't handle dynamic tasks yet.
> > *sigh*
> > >
> >
> > No problem. -But it would be nice if you could take a look at my
> > stuff and
> > figure it out. I'll need some classloading help soon I think.
> >
> > Aslak
> >
> > > ----- Original Message -----
> > > From: <[EMAIL PROTECTED]>
> > > To: "Erik Hatcher" <[EMAIL PROTECTED]>
> > > Cc: "Ara Abrahamian" <[EMAIL PROTECTED]>;
> > > <[email protected]>
> > > Sent: Friday, April 05, 2002 10:34 AM
> > > Subject: Re: [Xdoclet-devel] Making XDoclet more modular (with
> > proof of
> > > concept code)
> > >
> > >
> > > > Here is the proof of concept for the BCEL stuff that inserts
> > > > createBlaBla on the fly. I sent it earlier today, but it seems it
> > > > didn't make it to the list. Weird.
> > > >
> > > > Aslak
> > > >
> > >
> >
> >
> > _______________________________________________
> > Xdoclet-devel mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/xdoclet-devel
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Tax Center - online filing with TurboTax
> http://taxes.yahoo.com/
>
> _______________________________________________
> Xdoclet-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/xdoclet-devel
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>