users@jaxb.java.net

Re: Plugin for EJB 3.0 annotations

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_sun.com>
Date: Wed, 10 Aug 2005 15:00:28 -0700

Scott Allan wrote:
> I'm ready to try to write plugin for EJB 3.0 annotations such as
> @Entity, @Table, etc.
>
> I tried to test out your Code Injector plugin but could not get xjc to
> run. It didn't recognize the -Xinject-code argument.
>
> I changed the com.sun.tools.xjc.Plugin file to read like this:

You don't need to have the Const class listed, but I don't think that's
the cause of the problem either. Your Ant task configuration looks
correct to me.

Try enabling the debug option for the findServices by doing

export ANT_OPTS="-Dcom.sun.tools.xjc.Options.findServices=true"

It displays how XJC is locating the add-ons.

Also check the CLI, to isolate the problem. Try

$ java -jar jaxb-xjc.jar

and see if the help screen shows plugins. Or you can do:

$ java -Dcom.sun.tools.xjc.Options.findServices=true -jar jaxb-xjc.jar

to get the same error.

> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
> xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
> jaxb:extensionBindingPrefixes="xjc"
> jaxb:version="2.0">
>
> how would I declare set both extensionBindingPrefixes xjc and ci?

It's supposed to give you a reasonably helpful message if you miss
something. So I'd like to know what the error message you saw.

Anyway, add:

xmlns:ci="http://jaxb.dev.java.net/plugin/code-injector"

and

jaxb:extensionBindingPrefixes="xjc ci"



-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com