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.
One more question, do you know a good reference to learn how to develop
Eclipse plug ins, I have the *Addison Wesley* *The Java Developer's Guide to
Eclipse* , but it is too huge and long, do you some concise tutorial which
can help me do things like you do :) .
I don't have a "concise tutorial" as such, but in terms of books, I like
"Contributing to Eclipse, Principles, Patterns, and Plugins" by Erich
Gamma and Kent Beck
(http://www.amazon.com/Contributing-Eclipse-Principles-Patterns-Plugins/dp/0321205758).
I'm quite a fan of TDD, and this particular book has quite a lot of
detail on using the PDE JUnit in a test-driven way.
Cheers,
Jon