users@jaxb.java.net

Re: Plugin development and debug

From: Marcos <marcos_at_softingsystems.com.br>
Date: Wed, 10 Jan 2007 13:38:05 -0300

First of all thanks for your answer Hanson ;-)

I solved this problem with a different approach (I think it's nice to
post it here ;-)).

My current IDE is netbeans 5.5 and below is what I've done.:

1.) Create a new Java Application project.

2.) Create the following directory/files structure.:
    - root
       + build
       + dist
       + nbproject
       - src
          - META-INF
             - services
                com.sun.tools.xjc.Plugin
       - xmlschemas
          myschema.xsd
       build.xml
       manifest.mf

3.) Put the following libraries on project's classpath.:
    jaxb-api.jar
    activation.jar
    jaxb-impl.jar
    jsr173_1.0_api.jar
    jaxb-xjc.jar

4.) Create your plugin class inside of some package, in my case.:
    - com.sun.tools.xjc.addon.property_listener_injector
       PluginImpl.java

5.) Put the name of the plugin implementation inside of the file
"META-INF/services/com.sun.tools.xjc.Plugin", mine's content is.:
    com.sun.tools.xjc.addon.property_listener_injector.PluginImpl

6.) Create a main class that simply delegates to the class XJCFacade as
follows.:
     /*
     * XJCFacadeLauncher.java
     *
     * Created on 10 de Janeiro de 2007, 09:54
     *
     * To change this template, choose Tools | Template Manager
     * and open the template in the editor.
     */

    package com.softing.launcher;

    import com.sun.tools.xjc.XJCFacade;

    /**
     *
     * @author marcos
     */
    public class XJCFacadeLauncher {
   
        /** Creates a new instance of XJCFacadeLauncher */
        public XJCFacadeLauncher() {
        }

        public static void main(String[] args) throws Throwable {
            XJCFacade.main(args); // Simply delegates to the façade ;-)
        }
   
    }

7.) In the project's properties dialog customize the arguments passed to
the main method, in my case.:
    "-nv" "-p" "com.softing.etl.beans" "-d" "./src"
"./xmlschemas/myschema.xsd" "-Xinject-listener-code"

8.) Now it's just compile the project (1.5 compatible), put a breakpoint
on the desired plugin's line and hit F5 (debug shortcut in a Netbeans
application)

Expect this could be useful
Regards
Marcos

Hanson Char escreveu:

> I guess remote debugging will do, which can be used for any running jvm.
>
> Example ant setup:
>
> http://hansonchar.blogspot.com/2006/08/enable-remote-debugging-jmx-etc-from.html
> <http://hansonchar.blogspot.com/2006/08/enable-remote-debugging-jmx-etc-from.html>
>
> Hanson
>
> On 1/9/07, *marcos_at_softingsystems.com.br
> <mailto:marcos_at_softingsystems.com.br>* < marcos_at_softingsystems.com.br
> <mailto:marcos_at_softingsystems.com.br>> wrote:
>
> Hi all,
>
> I'm trying to setup an environment to debug pre-existent JAXB
> plugins.
> I'm basically running the xjc from ant.
>
> Question.: How can I debug / setup an environment for plugin
> debugging ?
>
> Thank you very much
> Marcos
>
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> <mailto:users-unsubscribe_at_jaxb.dev.java.net>
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
> <mailto:users-help_at_jaxb.dev.java.net>
>
>