Re: How to have JAXB SchemaCompiler generating code for schema elements

2010-02-24 Thread Sergey Beryozkin

Hi Dan

This is useful, I may play with it later on, and the hint to do with causing anonymous types be created is something we can advise 
to code-first users...I needed classes created from element for wadl:representation/@element values be resolved easier but I also 
ended up creating a map of schema element names to type names which I'm using as a last resort to actually resolve 
wadl:representation/@element...


thanks, Sergey

- Original Message - 
From: "Daniel Kulp" 

To: 
Cc: "Sergey Beryozkin" 
Sent: Wednesday, February 24, 2010 5:08 PM
Subject: Re: How to have JAXB SchemaCompiler generating code for schema elements



Since you are mucking in code, if you create a binding customization file that
has a jaxb:globalBindings element with generateElementClass="true" attribute,
it will generate a class for the element.  It's kind of an ugly class though
and possibly not really usable.

Dan


On Tue February 23 2010 12:02:59 pm Sergey Beryozkin wrote:

Hi

I've started working on the wadl-first code generation (well not quite the
wadl-first one yet...) and I'm using the code I've 'borrowed' from the
DynamicClientFactory from cxf-rt-databinding-jaxb. At the moment I can
only see files corresponding to schema types being generated. How can I
configure SchemaCompiler to generate the code for xs:elements ?

thanks, Sergey


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



Re: How to have JAXB SchemaCompiler generating code for schema elements

2010-02-24 Thread Daniel Kulp

Since you are mucking in code, if you create a binding customization file that 
has a jaxb:globalBindings element with generateElementClass="true" attribute, 
it will generate a class for the element.  It's kind of an ugly class though 
and possibly not really usable.

Dan


On Tue February 23 2010 12:02:59 pm Sergey Beryozkin wrote:
> Hi
> 
> I've started working on the wadl-first code generation (well not quite the
> wadl-first one yet...) and I'm using the code I've 'borrowed' from the
> DynamicClientFactory from cxf-rt-databinding-jaxb. At the moment I can
> only see files corresponding to schema types being generated. How can I
> configure SchemaCompiler to generate the code for xs:elements ?
> 
> thanks, Sergey

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


Re: How to have JAXB SchemaCompiler generating code for schema elements

2010-02-24 Thread Daniel Kulp
On Wed February 24 2010 5:42:31 am Sergey Beryozkin wrote:
> Now, the compiler takes care of elements with anonymous complex types, but
> ignores elements referring to public complex types which probably makes
> sense but what does not make sense is that when generating the types only
> in this latter case it omits the @XmlRootElement.
> 
> It is probably not quite that straightforward but it's kind of limiting
> nonetheless, example, code-first - to - wadl/wsdl -back to code does not
> produce the same result, in other words, if we start from a source having
> types with @XmlRootElement the produced schema section will have elements
> referring to public complex types and now when we try to get back to the
> code we have types with no @XmlRootElements... Probably not a big deal for
> JAXRS-based services given that users can configure a JAXBElementProvider
> use JAXBElement under the hood and for real wadl-first cases we can
> recommend users doing elements  with anonymous types if needed.
> 
> Next question : when JAXBContext generates a schema, is it possible to
> configure it to optionally use anonymoos types, may work ok for cases when
> types are not reused across multiple diff elements...

You would need to add an @XmlType(name="") annotation to the type that also 
has the @XmlRootElement annotation on it.   That creates and element for it, 
but not a type so it ends up being anonymous.

Dan



> 
> cheers, Sergey
>   - Original Message -
>   From: Sergey Beryozkin
>   To: dev@cxf.apache.org
>   Sent: Tuesday, February 23, 2010 5:02 PM
>   Subject: How to have JAXB SchemaCompiler generating code for schema
> elements
> 
> 
>   Hi
> 
>   I've started working on the wadl-first code generation (well not quite
> the wadl-first one yet...) and I'm using the code I've 'borrowed' from the
> DynamicClientFactory from cxf-rt-databinding-jaxb. At the moment I can
> only see files corresponding to schema types being generated. How can I
> configure SchemaCompiler to generate the code for xs:elements ?
> 
>   thanks, Sergey

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


Re: How to have JAXB SchemaCompiler generating code for schema elements

2010-02-24 Thread Sergey Beryozkin
Now, the compiler takes care of elements with anonymous complex types, but 
ignores elements referring to public complex types which probably makes sense 
but what does not make sense is that when generating the types only in this 
latter case it omits the @XmlRootElement. 

It is probably not quite that straightforward but it's kind of limiting 
nonetheless, example, code-first - to - wadl/wsdl -back to code does not 
produce the same result, in other words, if we start from a source having types 
with @XmlRootElement the produced schema section will have elements referring 
to public complex types and now when we try to get back to the code we have 
types with no @XmlRootElements... Probably not a big deal for JAXRS-based 
services given that users can configure a JAXBElementProvider use JAXBElement 
under the hood and for real wadl-first cases we can recommend users doing 
elements  with anonymous types if needed.

Next question : when JAXBContext generates a schema, is it possible to 
configure it to optionally use anonymoos types, may work ok for cases when 
types are not reused across multiple diff elements...

cheers, Sergey
  - Original Message - 
  From: Sergey Beryozkin 
  To: dev@cxf.apache.org 
  Sent: Tuesday, February 23, 2010 5:02 PM
  Subject: How to have JAXB SchemaCompiler generating code for schema elements


  Hi

  I've started working on the wadl-first code generation (well not quite the 
wadl-first one yet...) and I'm using the code I've 'borrowed' from the 
DynamicClientFactory from cxf-rt-databinding-jaxb. At the moment I can only see 
files corresponding to schema types being generated.
  How can I configure SchemaCompiler to generate the code for xs:elements ?

  thanks, Sergey

How to have JAXB SchemaCompiler generating code for schema elements

2010-02-23 Thread Sergey Beryozkin
Hi

I've started working on the wadl-first code generation (well not quite the 
wadl-first one yet...) and I'm using the code I've 'borrowed' from the 
DynamicClientFactory from cxf-rt-databinding-jaxb. At the moment I can only see 
files corresponding to schema types being generated.
How can I configure SchemaCompiler to generate the code for xs:elements ?

thanks, Sergey