On 9/20/07, David Blevins <[EMAIL PROTECTED]> wrote:
>
>
> On Sep 19, 2007, at 2:37 AM, Jonathan Gallimore wrote:
>
> >>
> >> Gr8 work Jonathan, but if you please I have some comments, I code
> >> is really
> >> cool but it is tightly coupled to Eclipse, can we implement a
> >> common code
> >> that can be used from a command line tool for example, cause I
> >> think beside
> >> the need to have this done from eclipse we need to have it done
> >> from the CLI
> >> of OEJB by migrating the EJB 2.1 EJB to EJB 3.0 ones and maybe
> >> generating a
> >> new EJB Jar or even manipulating the class files on the fly. The
> >> Eclipse
> >> plug in can be good corner stone for an urgently needed OpenEJB
> >> Eclipse plug
> >> in .
> >>
> >
> > Thanks for the quick feedback!
> >
> > You're quite right, at the moment the JavaProjectAnnotationFacade
> > class is tightly coupled to the Eclipse JDT API, although you can
> > pass any implementation of IJavaProjectAnnotationFacade (ok,
> > probably not a great name thinking about it now...) to the
> > OpenEjbXmlConverter, so the mechanism to actually add the
> > annotations is reasonably well separated from the logic that works
> > out what to add.
> >
> > I agree it would be ace to make it work from the command line. I
> > guess I'd still expect it to work with the source rather than
> > modifying classes (otherwise if you edit your code, and recompile,
> > the annotations would be lost, wouldn't they?), so I was just
> > imagining that the command line version would just call the
> > OpenEjbXmlConverter part of the plugin and pointing at a workspace
> > and project, and still using the JDT, just without having Eclipse
> > actually running.
> >
> > I'm not against modifying class files on the fly, indeed I would
> > find it very interesting, although I personally think that adding
> > the annotations to the source is more useful.
>
> Definitely updating the source in a one-time conversion kind of a
> thing is most useful.  For a command line tool it'd probably targeted
> at people not using eclipse or any individual IDE and would probably
> just spit out some sort of terse report (perhpas some stubbed out
> version of their class with the annotations in it) that wouldn't be a
> ready to deploy app but just an aid to either help them convert their
> app or something help them understand how xml and annotations relate.
>
> In code we currently do the reverse to deploy a bean.  We read in the
> ejb-jar.xml if you have one, then we scrape all your classes for
> annotations and fill out the ejb-jar tree we have in memory (it's a
> valid jaxb tree) respecting all of the overriding rules in the EJB
> 3.0 spec, then use that tree to deploy your app just as if it was a
> pure xml app with no annotations at all.
>
> 100% of our annotation processing work is done in this class http://
> svn.apache.org/repos/asf/openejb/trunk/openejb3/container/openejb-
> core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
>
> For the core bit, we'd want something that did exactly what this
> does, but in reverse.  We'd want to take an assumed to be complete
> ejb-jar.xml and build up the annotations.  Except you can't
> instantiate annotations so we'd probably want to create some similar
> tree.  The eclipse (or possibly an intellij) plugin could use that
> tree to update the source and the command line tool could format it
> as a report or something and spit it out to the console or a file.
> There's a sort of "java tree" set of objects in ASM (asm-tree.jar) we
> might be able to use -- haven't looked at it closely with this in
> mind.  If that works, then the core tool would take our ejb-jar.xml
> jaxb tree and create a thin ASM tree with the annotations in it.
>
> I personally don't know anything about Eclipse plugins and how hard
> it would be to directly update the source.  Anyone have any input on
> that?  Don't want to come up with a core tool that is a super big
> pain for the "update the source" version -- which is certainly more
> intriguing.


>From my humble experience about Eclipse plugins, Editing Java source code
from the Eclipse plugin is an easy task - I don't know how to do it - but it
is not a problem cause you will use the JDT of Eclipse . And I believ
Jonathan can say more about .

-David
>
>


-- 
Thanks
- Mohammad Nour

Reply via email to