You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Pradeep Fernando <pr...@gmail.com> on 2009/06/11 17:00:13 UTC

dynamic SDO databinding to wsdl2Java-CXF.

Hi daniel,


Im doing gsoc project on wsdl2java tooling in tuscany. Now im working on
adding dynamic sdo databinding to CXF tool.

As i came to know dynamic sdo is pretty straight forward. Here[1] is a code
sample found in the tuscany where it generates
classes. (standalone generator).

As you suggested i went through the XMLBeansDatabinding code found in CXF.
So according to my understainding i just have to
use the code found in tuscany sdo generator appropiately between
 initialize()  &
generate()

methods found in databindingProfile.

what i cant understand is there is a Classcollector define in a inner class
inside the generate() method of the XMLBeanstoolingDatabinding
implementation.

public Writer createSourceFile(String typename) throws IOException {
>                     String tn = typename;
>                     if (tn.contains("$")) {
>                         tn = tn.substring(0, tn.indexOf('$'));
>                     }
>                     String pkg = tn.substring(0, tn.lastIndexOf('.'));
>                     tn = tn.substring(tn.lastIndexOf('.') + 1);
>                    classCollector.addTypesClassName(pkg, tn, pkg + "." +
> tn);  <<<<<<<  here
>                     return super.createSourceFile(typename);
>                 }
>             };
>


can you please explain the usage of that that.

Thanks in advance,
Pradeep Fernando.

[1]
https://svn.apache.org/repos/asf/tuscany/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/XSD2JavaGenerator.java

Re: dynamic SDO databinding to wsdl2Java-CXF.

Posted by Daniel Kulp <dk...@apache.org>.
Pradeep,


The ClassCollector is there to prevent duplicate class names from being 
generated and overwriting everything.   JAX-WS has specific rules that say if 
a Type is generated as "FooFault.java", then when we generate the real 
exception, it needs to get mapped to FooFault_Fault and similar.  Basically, 
their is a hierarchy  of precedence as to who gets to "own" the name and who 
needs to mangle it.    The ClassCollector collects the names that have already 
been used so the later generates can mangle if needed.

As far as the inner class, I have no idea why the collector even needs to know 
about inner classes.   There wouldn't ever be a ".java" file for it.  It might 
be possible to get away with not doing anything with the inner classes.  

Does that at all answer the question?

Dan


On Thu June 11 2009 11:00:13 am Pradeep Fernando wrote:
> Hi daniel,
>
>
> Im doing gsoc project on wsdl2java tooling in tuscany. Now im working on
> adding dynamic sdo databinding to CXF tool.
>
> As i came to know dynamic sdo is pretty straight forward. Here[1] is a code
> sample found in the tuscany where it generates
> classes. (standalone generator).
>
> As you suggested i went through the XMLBeansDatabinding code found in CXF.
> So according to my understainding i just have to
> use the code found in tuscany sdo generator appropiately between
>  initialize()  &
> generate()
>
> methods found in databindingProfile.
>
> what i cant understand is there is a Classcollector define in a inner class
> inside the generate() method of the XMLBeanstoolingDatabinding
> implementation.
>
> public Writer createSourceFile(String typename) throws IOException {
>
> >                     String tn = typename;
> >                     if (tn.contains("$")) {
> >                         tn = tn.substring(0, tn.indexOf('$'));
> >                     }
> >                     String pkg = tn.substring(0, tn.lastIndexOf('.'));
> >                     tn = tn.substring(tn.lastIndexOf('.') + 1);
> >                    classCollector.addTypesClassName(pkg, tn, pkg + "." +
> > tn);  <<<<<<<  here
> >                     return super.createSourceFile(typename);
> >                 }
> >             };
>
> can you please explain the usage of that that.
>
> Thanks in advance,
> Pradeep Fernando.
>
> [1]
> https://svn.apache.org/repos/asf/tuscany/java/sdo/tools/src/main/java/org/a
>pache/tuscany/sdo/generate/XSD2JavaGenerator.java

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog