users@jaxb.java.net

Re: Plugin for EJB 3.0 annotations

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Fri, 12 Aug 2005 15:24:05 -0700

Scott Allan wrote:
> public boolean run(Outline outline, Options opt, ErrorHandler
> errorHandler) {
> Model m = outline.getModel();
> for ( CElementInfo cei : m.getAllElements())
> {
> System.out.println("test");
> CCustomizations custList = cei.getCustomizations();
> for (CPluginCustomization c : custList){
> ..
> Apparently there are no CElementInfo objects in Model.getAllElements().

Hmm, can I see the schema you used? Does it contain any element
declaration? This part of the code is tested thousand times a day
(literally!), so it's hard to imagine that it's not working correctly.

> I never get to my "test" message so I never get to inspect the
> customizations. At the moment there are no annotations in my schema for
> testing purposes. I'm just trying to see if I can access the elements
> first. When I put the annotations in, I keep getting the message that my
> annotation is in a place that is not allowed. I just want to make sure
> it's not me mis-understanding how it works (and it probably and usually
> is) before I submit a bug.

I think seeing the schema would help. I still suspect a bug in the RI in
terms of making those plugin customizations visible to plugins.

> As for my requirement for selecting whether the annotation will be on
> the getter or setter method, do you think I will be able to control that
> somehow?

XJC needs to expose the structure of the code it generates to plugins.
The outline package is an attempt to do so. We just need to expand it a
bit further so that you can get your hands on properties/methods that we
will generate.

The rest is up to your plug-in to decide to where to put annotations.


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com