You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "KARR, DAVID (ATTSI)" <dk...@att.com> on 2011/03/02 00:31:34 UTC

JAXB: Any way to incorporate restrictions into annotations?

This isn't strictly a CXF question, but I figure people here would be
doing JAXB deep dives.

How do people deal with the need to specify types with length (and
other) restrictions in the generated schema?  I don't see a way to
specify that in JAXB annotations.

Perhaps the only reasonable way is to have a hand-coded "simple types"
schema along with the generated JAXB schema, which references some of
those simple types?

RE: JAXB: Any way to incorporate restrictions into annotations?

Posted by Jason Chaffee <jc...@ebates.com>.
Doesn't help much when you are using JAXB because that is what the JAX specs support.


-----Original Message-----
From: Hannes Holtzhausen [mailto:hannes.holtzhausen@gmail.com]
Sent: Tue 3/1/2011 9:09 PM
To: users@cxf.apache.org
Cc: Jason Chaffee; Daniel Kulp
Subject: Re: JAXB: Any way to incorporate restrictions into annotations?
 
Have a look at XMLBeans If you are looking for an XML binding
technology that supports the
full XSD spec but still provides a Java bean style API for accessing
and generating the XML.

This is also not a 100% code first approach, you need to start with an
XSD to generate XMLBeans.
But you can do a code first web service once you have generated the XMLBeans.

http://cxf.apache.org/docs/xmlbeans.html
http://xmlbeans.apache.org/

Cheers
Hannes


Re: JAXB: Any way to incorporate restrictions into annotations?

Posted by Jason Pell <ja...@gmail.com>.
Ok - was not my original code and would be happy to avoid it - I'll give it a look.

Thanks for the suggestion 

Sent from my iPhone

On Mar 4, 2011, at 1:30, Daniel Kulp <dk...@apache.org> wrote:

> On Thursday 03 March 2011 12:59:08 AM Jason Pell wrote:
>> The classes from jaxb facets are copied into a copy of the source for
>> jaxb-API and jaxb-ri. The javax into the API and the com into the ri. The
>> SchemaGenerator class has been enhanced by the jaxb-facets dev and
>> replaces the existing one. It's a matter of building the jaxb-API copying
>> the new jar into the Ri and rebuilding that. Then the jaxb api an ri are
>> deployed to nexus with a custom version (so as not to clash)
>> 
>> It's nasty as hell but with this done the schema is generated with the
>> additional checks and Cxf schema validation works flawlessly with them.
> 
> I guess my question is:
> 
> Why do you need to stick your new annotations into the 
> javax.xml.bind.annotation package?  
> 
> Once you do that, it would REQUIRE a new version of JAXB which would take all 
> kinds of time and votes and all kinds of junk.    A vendor implementation of 
> JAXB is free to add new annotations, just not in that package.   For example, 
> the eclipselink Moxy folks have added a bunch of annotations to JAXB, but they 
> are in their own package. 
> 
> Thus, my suggestion would be to move those new annotations to 
> com.sun.xml.bind.annotations
> or similar and then you would just need the jaxb-impl replacement.      No 
> endorsing or anything outside of the normal.  
> 
> Dan
> 
> 
>> 
>> 
>> Sent from my iPhone
>> 
>> On Mar 3, 2011, at 15:40, "Jason Chaffee" <jc...@ebates.com> wrote:
>>> Good stuff, Jason.
>>> 
>>> When I am not mobile I would to ask a couple of questions on how it plugs
>>> into jaxb
>>> 
>>> Sent from my iPhone
>>> 
>>> On Mar 2, 2011, at 8:09 PM, "Jason Pell" <ja...@pellcorp.com> wrote:
>>>> Ok and now I have updated my maven build so I don't need the endorsed
>>>> directory at all.
>>>> 
>>>> The only outstanding issue is that if you try and open projects in
>>>> eclipse that use these enhanced annotations eclipse will report
>>>> errors.  To fix this you will need to have the jars in your
>>>> jre/lib/endorsed on your developer machine
>>>> 
>>>> You build machine and operational env do not need them.
>>>> 
>>>> For what its worth this is how I did it.  I put this in the parent
>>>> pom.xml file.
>>>> 
>>>> <build>
>>>> 
>>>>      <pluginManagement>
>>>> 
>>>>          <plugins>
>>>> 
>>>>           <plugin>
>>>> 
>>>>              <groupId>org.apache.maven.plugins</groupId>
>>>>              <artifactId>maven-dependency-plugin</artifactId>
>>>>              <version>2.1</version>
>>>>              <configuration>
>>>> 
>>>>                  <outputDirectory>${project.build.directory}/endorsed</
>>>>                  outputDirectory>
>>>> 
>>>>              </configuration>
>>>>              <executions>
>>>> 
>>>>                <execution>
>>>> 
>>>>                  <id>copy-endorsed</id>
>>>>                  <phase>generate-sources</phase>
>>>>                  <goals>
>>>> 
>>>>                    <goal>copy</goal>
>>>> 
>>>>                  </goals>
>>>>                  <configuration>
>>>> 
>>>>                    <artifactItems>
>>>> 
>>>>                      <artifactItem>
>>>> 
>>>>                          <groupId>javax.xml.bind</groupId>
>>>>                          <artifactId>jaxb-api</artifactId>
>>>>                          <version>2.2.1-custom</version>
>>>>                          <overWrite>true</overWrite>
>>>>                          <destFileName>jaxb-api.jar</destFileName>
>>>> 
>>>>                      </artifactItem>
>>>> 
>>>>                      <artifactItem>
>>>> 
>>>>                          <groupId>javax.xml.ws</groupId>
>>>> 
>>>>                            <artifactId>jaxws-api</artifactId>
>>>>                            <version>2.2.1</version>
>>>> 
>>>>                          <overWrite>true</overWrite>
>>>>                          <destFileName>jaxws-api.jar</destFileName>
>>>> 
>>>>                      </artifactItem>
>>>> 
>>>>                    </artifactItems>
>>>> 
>>>>                  </configuration>
>>>> 
>>>>                </execution>
>>>> 
>>>>              </executions>
>>>> 
>>>>            </plugin>
>>>> 
>>>>          </plugins>
>>>> 
>>>>      </pluginManagement>
>>>> 
>>>>      <plugins>
>>>> 
>>>>            <plugin>
>>>> 
>>>>                 <groupId>org.apache.maven.plugins</groupId>
>>>>                 <artifactId>maven-compiler-plugin</artifactId>
>>>>                 <configuration>
>>>> 
>>>>                   <compilerArguments>
>>>> 
>>>>                     <endorseddirs>${project.build.directory}/endorsed</
>>>>                     endorseddirs>
>>>> 
>>>>                   </compilerArguments>
>>>> 
>>>>                 </configuration>
>>>> 
>>>>           </plugin>
>>>> 
>>>>          <plugin>
>>>> 
>>>>              <groupId>org.apache.maven.plugins</groupId>
>>>>              <artifactId>maven-surefire-plugin</artifactId>
>>>>              <configuration>
>>>> 
>>>>                <systemPropertyVariables>
>>>> 
>>>> <java.endorsed.dirs>${project.build.directory}/endorsed</java.endorsed.d
>>>> irs>
>>>> 
>>>>                </systemPropertyVariables>
>>>> 
>>>>              </configuration>
>>>> 
>>>>            </plugin>
>>>> 
>>>>      </plugins>
>>>> 
>>>>  </build>
>>>> 
>>>> And this in the particular projects where I needed to use the jaxb or
>>>> jaxws annotations that are not in 2.1
>>>> 
>>>> <build>
>>>> 
>>>>      <plugins>
>>>> 
>>>>          <plugin>
>>>> 
>>>>              <artifactId>maven-dependency-plugin</artifactId>
>>>> 
>>>>          </plugin>
>>>> 
>>>>      </plugins>
>>>> 
>>>>  </build>
>>>> 
>>>> I am done now :-)
>>>> 
>>>> Cheers
>>>> Jason
>>>> 
>>>> On Thu, Mar 3, 2011 at 1:24 PM, Jason Pell <ja...@pellcorp.com> wrote:
>>>>> Yep confirmed it - it just requires the endorsed jars for building,
>>>>> not for runtime.  My operational
>>>>> environments have had their endorsed dirs blown away and still running
>>>>> nicely.  My build server
>>>>> still requires the jars.
>>>>> 
>>>>> On Thu, Mar 3, 2011 at 12:51 PM, Jason Pell <ja...@pellcorp.com> wrote:
>>>>>> Hi,
>>>>>> 
>>>>>> I decided I was curious enough to see if it would work without having
>>>>>> to change the endorsed directory.
>>>>>> 
>>>>>> I deleted the jars out of the endorsed directory and started up my
>>>>>> application again and executed a web service which uses both jaxws
>>>>>> 2.2.1 and jaxb 2.2 + facets stuff and it started up perfectly fine
>>>>>> WITHOUT an endorsed directory.  What it looks like for me is that when
>>>>>> you compile the code you will probably need these jars in the endorsed
>>>>>> directory.  But as long as at runtime you have them in the classpath
>>>>>> it works fine.
>>>>>> 
>>>>>> Does that sound correct to others? Thats certainly my experience.
>>>>>> 
>>>>>> Thanks
>>>>>> Jason
>>>>>> 
>>>>>> On Thu, Mar 3, 2011 at 12:11 PM, Jason Pell <ja...@pellcorp.com> wrote:
>>>>>>> Hi,
>>>>>>> 
>>>>>>> I did not try too hard to avoid putting it into the endorsed
>>>>>>> directory.
>>>>>>> 
>>>>>>> However it occurs to me that if you are using JDK 6, you already have
>>>>>>> that problem using JAXB 2.2 anyway as JDK 6 uses JAXB 2.1.  If there
>>>>>>> is a way to use JAXB 2.2 in CXF without putting jars into the
>>>>>>> endorsed directory then the same can apply to the jaxb-facets
>>>>>>> enhanced jaxb-api.
>>>>>>> 
>>>>>>> One way would be to define the endorsed dirs system property instead
>>>>>>> and point it to a directory within your application.  I have not even
>>>>>>> looked at this as we can modify the JRE and it was easier to do that.
>>>>>>> 
>>>>>>> Cheers
>>>>>>> Jason
>>>>>>> 
>>>>>>> On Thu, Mar 3, 2011 at 11:13 AM, Jason Chaffee <jc...@ebates.com> 
> wrote:
>>>>>>>> This is exactly what we wanting, except it doesn't seem to support
>>>>>>>> key restrictions...but it does support other constraints.  However,
>>>>>>>> I cannot add any jars to the endorsed directory do to some
>>>>>>>> operational constraints so it won't help me much, but it is still
>>>>>>>> nice to know.
>>>>>>>> 
>>>>>>>> Jason
>>>>>>>> 
>>>>>>>> 
>>>>>>>> -----Original Message-----
>>>>>>>> From: jasonmpell@gmail.com on behalf of Jason Pell
>>>>>>>> Sent: Wed 3/2/2011 2:53 PM
>>>>>>>> To: users@cxf.apache.org
>>>>>>>> Cc: Hannes Holtzhausen; Jason Chaffee; Daniel Kulp
>>>>>>>> Subject: Re: JAXB: Any way to incorporate restrictions into
>>>>>>>> annotations?
>>>>>>>> 
>>>>>>>> Hi,
>>>>>>>> 
>>>>>>>> I am using jaxb-facets with CXF and it works very nicely.
>>>>>>>> 
>>>>>>>> http://www.infosys.tuwien.ac.at/staff/hummer/tools/jaxb-facets.html
>>>>>>>> http://java.net/projects/jaxb/lists/dev/archive/2011-02/message/0
>>>>>>>> 
>>>>>>>> I did have to hack jaxb-api and jaxb-impl and put the hacked
>>>>>>>> jaxb-api into jre/lib/endorsed and override the
>>>>>>>> impl in CXF, but it works so well I was surprised.  I have since
>>>>>>>> added Date and Datetime validation and at some
>>>>>>>> point will need to add Decimal as well.
>>>>>>>> 
>>>>>>>> If you want to get hold of my updated jaxb-api and jaxb-impl let me
>>>>>>>> know.  I can provide my enhancements to the original code from
>>>>>>>> hummer@nfosys.tuwien.ac.at
>>>>>>>> 
>>>>>>>> Its a real hack but it does exactly what I need and I have done it
>>>>>>>> in such a way that if at some point its built into jaxb I can back
>>>>>>>> out my changes
>>>>>>>> and make use of the core release again.
>>>>>>>> 
>>>>>>>> Cheers
>>>>>>>> Jason
>>>>>>>> 
>>>>>>>> On Wed, Mar 2, 2011 at 4:09 PM, Hannes Holtzhausen
>>>>>>>> 
>>>>>>>> <ha...@gmail.com> wrote:
>>>>>>>>> Have a look at XMLBeans If you are looking for an XML binding
>>>>>>>>> technology that supports the
>>>>>>>>> full XSD spec but still provides a Java bean style API for
>>>>>>>>> accessing and generating the XML.
>>>>>>>>> 
>>>>>>>>> This is also not a 100% code first approach, you need to start with
>>>>>>>>> an XSD to generate XMLBeans.
>>>>>>>>> But you can do a code first web service once you have generated the
>>>>>>>>> XMLBeans.
>>>>>>>>> 
>>>>>>>>> http://cxf.apache.org/docs/xmlbeans.html
>>>>>>>>> http://xmlbeans.apache.org/
>>>>>>>>> 
>>>>>>>>> Cheers
>>>>>>>>> Hannes
> 
> -- 
> Daniel Kulp
> dkulp@apache.org
> http://dankulp.com/blog
> Talend - http://www.talend.com

Re: JAXB: Any way to incorporate restrictions into annotations?

Posted by Daniel Kulp <dk...@apache.org>.
On Thursday 03 March 2011 12:59:08 AM Jason Pell wrote:
> The classes from jaxb facets are copied into a copy of the source for
> jaxb-API and jaxb-ri. The javax into the API and the com into the ri. The
> SchemaGenerator class has been enhanced by the jaxb-facets dev and
> replaces the existing one. It's a matter of building the jaxb-API copying
> the new jar into the Ri and rebuilding that. Then the jaxb api an ri are
> deployed to nexus with a custom version (so as not to clash)
> 
> It's nasty as hell but with this done the schema is generated with the
> additional checks and Cxf schema validation works flawlessly with them.

I guess my question is:

Why do you need to stick your new annotations into the 
javax.xml.bind.annotation package?  

Once you do that, it would REQUIRE a new version of JAXB which would take all 
kinds of time and votes and all kinds of junk.    A vendor implementation of 
JAXB is free to add new annotations, just not in that package.   For example, 
the eclipselink Moxy folks have added a bunch of annotations to JAXB, but they 
are in their own package. 

Thus, my suggestion would be to move those new annotations to 
com.sun.xml.bind.annotations
or similar and then you would just need the jaxb-impl replacement.      No 
endorsing or anything outside of the normal.  

Dan


> 
> 
> Sent from my iPhone
> 
> On Mar 3, 2011, at 15:40, "Jason Chaffee" <jc...@ebates.com> wrote:
> > Good stuff, Jason.
> > 
> > When I am not mobile I would to ask a couple of questions on how it plugs
> > into jaxb
> > 
> > Sent from my iPhone
> > 
> > On Mar 2, 2011, at 8:09 PM, "Jason Pell" <ja...@pellcorp.com> wrote:
> >> Ok and now I have updated my maven build so I don't need the endorsed
> >> directory at all.
> >> 
> >> The only outstanding issue is that if you try and open projects in
> >> eclipse that use these enhanced annotations eclipse will report
> >> errors.  To fix this you will need to have the jars in your
> >> jre/lib/endorsed on your developer machine
> >> 
> >> You build machine and operational env do not need them.
> >> 
> >> For what its worth this is how I did it.  I put this in the parent
> >> pom.xml file.
> >> 
> >> <build>
> >> 
> >>       <pluginManagement>
> >>       
> >>           <plugins>
> >>           
> >>            <plugin>
> >>            
> >>               <groupId>org.apache.maven.plugins</groupId>
> >>               <artifactId>maven-dependency-plugin</artifactId>
> >>               <version>2.1</version>
> >>               <configuration>
> >>               
> >>                   <outputDirectory>${project.build.directory}/endorsed</
> >>                   outputDirectory>
> >>               
> >>               </configuration>
> >>               <executions>
> >>               
> >>                 <execution>
> >>                 
> >>                   <id>copy-endorsed</id>
> >>                   <phase>generate-sources</phase>
> >>                   <goals>
> >>                   
> >>                     <goal>copy</goal>
> >>                   
> >>                   </goals>
> >>                   <configuration>
> >>                   
> >>                     <artifactItems>
> >>                     
> >>                       <artifactItem>
> >>                       
> >>                           <groupId>javax.xml.bind</groupId>
> >>                           <artifactId>jaxb-api</artifactId>
> >>                           <version>2.2.1-custom</version>
> >>                           <overWrite>true</overWrite>
> >>                           <destFileName>jaxb-api.jar</destFileName>
> >>                       
> >>                       </artifactItem>
> >>                       
> >>                       <artifactItem>
> >>                       
> >>                           <groupId>javax.xml.ws</groupId>
> >>                           
> >>                             <artifactId>jaxws-api</artifactId>
> >>                             <version>2.2.1</version>
> >>                           
> >>                           <overWrite>true</overWrite>
> >>                           <destFileName>jaxws-api.jar</destFileName>
> >>                       
> >>                       </artifactItem>
> >>                     
> >>                     </artifactItems>
> >>                   
> >>                   </configuration>
> >>                 
> >>                 </execution>
> >>               
> >>               </executions>
> >>             
> >>             </plugin>
> >>           
> >>           </plugins>
> >>       
> >>       </pluginManagement>
> >>       
> >>       <plugins>
> >>       
> >>             <plugin>
> >>             
> >>                  <groupId>org.apache.maven.plugins</groupId>
> >>                  <artifactId>maven-compiler-plugin</artifactId>
> >>                  <configuration>
> >>                  
> >>                    <compilerArguments>
> >>                    
> >>                      <endorseddirs>${project.build.directory}/endorsed</
> >>                      endorseddirs>
> >>                    
> >>                    </compilerArguments>
> >>                  
> >>                  </configuration>
> >>            
> >>            </plugin>
> >>           
> >>           <plugin>
> >>           
> >>               <groupId>org.apache.maven.plugins</groupId>
> >>               <artifactId>maven-surefire-plugin</artifactId>
> >>               <configuration>
> >>               
> >>                 <systemPropertyVariables>
> >> 
> >> <java.endorsed.dirs>${project.build.directory}/endorsed</java.endorsed.d
> >> irs>
> >> 
> >>                 </systemPropertyVariables>
> >>               
> >>               </configuration>
> >>             
> >>             </plugin>
> >>       
> >>       </plugins>
> >>   
> >>   </build>
> >> 
> >> And this in the particular projects where I needed to use the jaxb or
> >> jaxws annotations that are not in 2.1
> >> 
> >> <build>
> >> 
> >>       <plugins>
> >>       
> >>           <plugin>
> >>           
> >>               <artifactId>maven-dependency-plugin</artifactId>
> >>           
> >>           </plugin>
> >>       
> >>       </plugins>
> >>   
> >>   </build>
> >> 
> >> I am done now :-)
> >> 
> >> Cheers
> >> Jason
> >> 
> >> On Thu, Mar 3, 2011 at 1:24 PM, Jason Pell <ja...@pellcorp.com> wrote:
> >>> Yep confirmed it - it just requires the endorsed jars for building,
> >>> not for runtime.  My operational
> >>> environments have had their endorsed dirs blown away and still running
> >>> nicely.  My build server
> >>> still requires the jars.
> >>> 
> >>> On Thu, Mar 3, 2011 at 12:51 PM, Jason Pell <ja...@pellcorp.com> wrote:
> >>>> Hi,
> >>>> 
> >>>> I decided I was curious enough to see if it would work without having
> >>>> to change the endorsed directory.
> >>>> 
> >>>> I deleted the jars out of the endorsed directory and started up my
> >>>> application again and executed a web service which uses both jaxws
> >>>> 2.2.1 and jaxb 2.2 + facets stuff and it started up perfectly fine
> >>>> WITHOUT an endorsed directory.  What it looks like for me is that when
> >>>> you compile the code you will probably need these jars in the endorsed
> >>>> directory.  But as long as at runtime you have them in the classpath
> >>>> it works fine.
> >>>> 
> >>>> Does that sound correct to others? Thats certainly my experience.
> >>>> 
> >>>> Thanks
> >>>> Jason
> >>>> 
> >>>> On Thu, Mar 3, 2011 at 12:11 PM, Jason Pell <ja...@pellcorp.com> wrote:
> >>>>> Hi,
> >>>>> 
> >>>>> I did not try too hard to avoid putting it into the endorsed
> >>>>> directory.
> >>>>> 
> >>>>> However it occurs to me that if you are using JDK 6, you already have
> >>>>> that problem using JAXB 2.2 anyway as JDK 6 uses JAXB 2.1.  If there
> >>>>> is a way to use JAXB 2.2 in CXF without putting jars into the
> >>>>> endorsed directory then the same can apply to the jaxb-facets
> >>>>> enhanced jaxb-api.
> >>>>> 
> >>>>> One way would be to define the endorsed dirs system property instead
> >>>>> and point it to a directory within your application.  I have not even
> >>>>> looked at this as we can modify the JRE and it was easier to do that.
> >>>>> 
> >>>>> Cheers
> >>>>> Jason
> >>>>> 
> >>>>> On Thu, Mar 3, 2011 at 11:13 AM, Jason Chaffee <jc...@ebates.com> 
wrote:
> >>>>>> This is exactly what we wanting, except it doesn't seem to support
> >>>>>> key restrictions...but it does support other constraints.  However,
> >>>>>> I cannot add any jars to the endorsed directory do to some
> >>>>>> operational constraints so it won't help me much, but it is still
> >>>>>> nice to know.
> >>>>>> 
> >>>>>> Jason
> >>>>>> 
> >>>>>> 
> >>>>>> -----Original Message-----
> >>>>>> From: jasonmpell@gmail.com on behalf of Jason Pell
> >>>>>> Sent: Wed 3/2/2011 2:53 PM
> >>>>>> To: users@cxf.apache.org
> >>>>>> Cc: Hannes Holtzhausen; Jason Chaffee; Daniel Kulp
> >>>>>> Subject: Re: JAXB: Any way to incorporate restrictions into
> >>>>>> annotations?
> >>>>>> 
> >>>>>> Hi,
> >>>>>> 
> >>>>>> I am using jaxb-facets with CXF and it works very nicely.
> >>>>>> 
> >>>>>> http://www.infosys.tuwien.ac.at/staff/hummer/tools/jaxb-facets.html
> >>>>>> http://java.net/projects/jaxb/lists/dev/archive/2011-02/message/0
> >>>>>> 
> >>>>>> I did have to hack jaxb-api and jaxb-impl and put the hacked
> >>>>>> jaxb-api into jre/lib/endorsed and override the
> >>>>>> impl in CXF, but it works so well I was surprised.  I have since
> >>>>>> added Date and Datetime validation and at some
> >>>>>> point will need to add Decimal as well.
> >>>>>> 
> >>>>>> If you want to get hold of my updated jaxb-api and jaxb-impl let me
> >>>>>> know.  I can provide my enhancements to the original code from
> >>>>>> hummer@nfosys.tuwien.ac.at
> >>>>>> 
> >>>>>> Its a real hack but it does exactly what I need and I have done it
> >>>>>> in such a way that if at some point its built into jaxb I can back
> >>>>>> out my changes
> >>>>>> and make use of the core release again.
> >>>>>> 
> >>>>>> Cheers
> >>>>>> Jason
> >>>>>> 
> >>>>>> On Wed, Mar 2, 2011 at 4:09 PM, Hannes Holtzhausen
> >>>>>> 
> >>>>>> <ha...@gmail.com> wrote:
> >>>>>>> Have a look at XMLBeans If you are looking for an XML binding
> >>>>>>> technology that supports the
> >>>>>>> full XSD spec but still provides a Java bean style API for
> >>>>>>> accessing and generating the XML.
> >>>>>>> 
> >>>>>>> This is also not a 100% code first approach, you need to start with
> >>>>>>> an XSD to generate XMLBeans.
> >>>>>>> But you can do a code first web service once you have generated the
> >>>>>>> XMLBeans.
> >>>>>>> 
> >>>>>>> http://cxf.apache.org/docs/xmlbeans.html
> >>>>>>> http://xmlbeans.apache.org/
> >>>>>>> 
> >>>>>>> Cheers
> >>>>>>> Hannes

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

Re: JAXB: Any way to incorporate restrictions into annotations?

Posted by Jason Pell <ja...@gmail.com>.
The classes from jaxb facets are copied into a copy of the source for jaxb-API and jaxb-ri. The javax into the API and the com into the ri. The SchemaGenerator class has been enhanced by the jaxb-facets dev and replaces the existing one. It's a matter of building the jaxb-API copying the new jar into the Ri and rebuilding that. Then the jaxb api an ri are deployed to nexus with a custom version (so as not to clash)

It's nasty as hell but with this done the schema is generated with the additional checks and Cxf schema validation works flawlessly with them.



Sent from my iPhone

On Mar 3, 2011, at 15:40, "Jason Chaffee" <jc...@ebates.com> wrote:

> Good stuff, Jason.
> 
> When I am not mobile I would to ask a couple of questions on how it plugs into jaxb
> 
> Sent from my iPhone
> 
> On Mar 2, 2011, at 8:09 PM, "Jason Pell" <ja...@pellcorp.com> wrote:
> 
>> Ok and now I have updated my maven build so I don't need the endorsed
>> directory at all.
>> 
>> The only outstanding issue is that if you try and open projects in
>> eclipse that use these enhanced annotations eclipse will report
>> errors.  To fix this you will need to have the jars in your
>> jre/lib/endorsed on your developer machine
>> 
>> You build machine and operational env do not need them.
>> 
>> For what its worth this is how I did it.  I put this in the parent pom.xml file.
>> 
>> <build>
>>       <pluginManagement>
>>           <plugins>
>>            <plugin>
>>               <groupId>org.apache.maven.plugins</groupId>
>>               <artifactId>maven-dependency-plugin</artifactId>
>>               <version>2.1</version>
>>               <configuration>
>>                   <outputDirectory>${project.build.directory}/endorsed</outputDirectory>
>>               </configuration>
>>               <executions>
>>                 <execution>
>>                   <id>copy-endorsed</id>
>>                   <phase>generate-sources</phase>
>>                   <goals>
>>                     <goal>copy</goal>
>>                   </goals>
>>                   <configuration>
>>                     <artifactItems>
>>                       <artifactItem>
>>                           <groupId>javax.xml.bind</groupId>
>>                           <artifactId>jaxb-api</artifactId>
>>                           <version>2.2.1-custom</version>
>>                           <overWrite>true</overWrite>
>>                           <destFileName>jaxb-api.jar</destFileName>
>>                       </artifactItem>
>> 
>>                       <artifactItem>
>>                           <groupId>javax.xml.ws</groupId>
>>                             <artifactId>jaxws-api</artifactId>
>>                             <version>2.2.1</version>
>>                           <overWrite>true</overWrite>
>>                           <destFileName>jaxws-api.jar</destFileName>
>>                       </artifactItem>
>>                     </artifactItems>
>>                   </configuration>
>>                 </execution>
>>               </executions>
>>             </plugin>
>>           </plugins>
>>       </pluginManagement>
>> 
>>       <plugins>
>>             <plugin>
>>                  <groupId>org.apache.maven.plugins</groupId>
>>                  <artifactId>maven-compiler-plugin</artifactId>
>>                  <configuration>
>>                    <compilerArguments>
>>                      <endorseddirs>${project.build.directory}/endorsed</endorseddirs>
>>                    </compilerArguments>
>>                  </configuration>
>>            </plugin>
>> 
>>           <plugin>
>>               <groupId>org.apache.maven.plugins</groupId>
>>               <artifactId>maven-surefire-plugin</artifactId>
>>               <configuration>
>>                 <systemPropertyVariables>
>> 
>> <java.endorsed.dirs>${project.build.directory}/endorsed</java.endorsed.dirs>
>>                 </systemPropertyVariables>
>>               </configuration>
>>             </plugin>
>>       </plugins>
>>   </build>
>> 
>> 
>> And this in the particular projects where I needed to use the jaxb or
>> jaxws annotations that are not in 2.1
>> 
>> <build>
>>       <plugins>
>>           <plugin>
>>               <artifactId>maven-dependency-plugin</artifactId>
>>           </plugin>
>>       </plugins>
>>   </build>
>> 
>> I am done now :-)
>> 
>> Cheers
>> Jason
>> 
>> On Thu, Mar 3, 2011 at 1:24 PM, Jason Pell <ja...@pellcorp.com> wrote:
>>> Yep confirmed it - it just requires the endorsed jars for building,
>>> not for runtime.  My operational
>>> environments have had their endorsed dirs blown away and still running
>>> nicely.  My build server
>>> still requires the jars.
>>> 
>>> On Thu, Mar 3, 2011 at 12:51 PM, Jason Pell <ja...@pellcorp.com> wrote:
>>>> Hi,
>>>> 
>>>> I decided I was curious enough to see if it would work without having
>>>> to change the endorsed directory.
>>>> 
>>>> I deleted the jars out of the endorsed directory and started up my
>>>> application again and executed a web service which uses both jaxws
>>>> 2.2.1 and jaxb 2.2 + facets stuff and it started up perfectly fine
>>>> WITHOUT an endorsed directory.  What it looks like for me is that when
>>>> you compile the code you will probably need these jars in the endorsed
>>>> directory.  But as long as at runtime you have them in the classpath
>>>> it works fine.
>>>> 
>>>> Does that sound correct to others? Thats certainly my experience.
>>>> 
>>>> Thanks
>>>> Jason
>>>> 
>>>> On Thu, Mar 3, 2011 at 12:11 PM, Jason Pell <ja...@pellcorp.com> wrote:
>>>>> Hi,
>>>>> 
>>>>> I did not try too hard to avoid putting it into the endorsed directory.
>>>>> 
>>>>> However it occurs to me that if you are using JDK 6, you already have
>>>>> that problem using JAXB 2.2 anyway as JDK 6 uses JAXB 2.1.  If there
>>>>> is a way to use JAXB 2.2 in CXF without putting jars into the endorsed
>>>>> directory then the same can apply to the jaxb-facets enhanced
>>>>> jaxb-api.
>>>>> 
>>>>> One way would be to define the endorsed dirs system property instead
>>>>> and point it to a directory within your application.  I have not even
>>>>> looked at this as we can modify the JRE and it was easier to do that.
>>>>> 
>>>>> Cheers
>>>>> Jason
>>>>> 
>>>>> On Thu, Mar 3, 2011 at 11:13 AM, Jason Chaffee <jc...@ebates.com> wrote:
>>>>>> This is exactly what we wanting, except it doesn't seem to support key restrictions...but it does support other constraints.  However, I cannot add any jars to the endorsed directory do to some operational constraints so it won't help me much, but it is still nice to know.
>>>>>> 
>>>>>> Jason
>>>>>> 
>>>>>> 
>>>>>> -----Original Message-----
>>>>>> From: jasonmpell@gmail.com on behalf of Jason Pell
>>>>>> Sent: Wed 3/2/2011 2:53 PM
>>>>>> To: users@cxf.apache.org
>>>>>> Cc: Hannes Holtzhausen; Jason Chaffee; Daniel Kulp
>>>>>> Subject: Re: JAXB: Any way to incorporate restrictions into annotations?
>>>>>> 
>>>>>> Hi,
>>>>>> 
>>>>>> I am using jaxb-facets with CXF and it works very nicely.
>>>>>> 
>>>>>> http://www.infosys.tuwien.ac.at/staff/hummer/tools/jaxb-facets.html
>>>>>> http://java.net/projects/jaxb/lists/dev/archive/2011-02/message/0
>>>>>> 
>>>>>> I did have to hack jaxb-api and jaxb-impl and put the hacked jaxb-api
>>>>>> into jre/lib/endorsed and override the
>>>>>> impl in CXF, but it works so well I was surprised.  I have since added
>>>>>> Date and Datetime validation and at some
>>>>>> point will need to add Decimal as well.
>>>>>> 
>>>>>> If you want to get hold of my updated jaxb-api and jaxb-impl let me
>>>>>> know.  I can provide my enhancements to the original code from
>>>>>> hummer@nfosys.tuwien.ac.at
>>>>>> 
>>>>>> Its a real hack but it does exactly what I need and I have done it in
>>>>>> such a way that if at some point its built into jaxb I can back out my
>>>>>> changes
>>>>>> and make use of the core release again.
>>>>>> 
>>>>>> Cheers
>>>>>> Jason
>>>>>> 
>>>>>> On Wed, Mar 2, 2011 at 4:09 PM, Hannes Holtzhausen
>>>>>> <ha...@gmail.com> wrote:
>>>>>>> Have a look at XMLBeans If you are looking for an XML binding
>>>>>>> technology that supports the
>>>>>>> full XSD spec but still provides a Java bean style API for accessing
>>>>>>> and generating the XML.
>>>>>>> 
>>>>>>> This is also not a 100% code first approach, you need to start with an
>>>>>>> XSD to generate XMLBeans.
>>>>>>> But you can do a code first web service once you have generated the XMLBeans.
>>>>>>> 
>>>>>>> http://cxf.apache.org/docs/xmlbeans.html
>>>>>>> http://xmlbeans.apache.org/
>>>>>>> 
>>>>>>> Cheers
>>>>>>> Hannes
>>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>> 

Re: JAXB: Any way to incorporate restrictions into annotations?

Posted by Jason Chaffee <jc...@ebates.com>.
Good stuff, Jason.

When I am not mobile I would to ask a couple of questions on how it  
plugs into jaxb

Sent from my iPhone

On Mar 2, 2011, at 8:09 PM, "Jason Pell" <ja...@pellcorp.com> wrote:

> Ok and now I have updated my maven build so I don't need the endorsed
> directory at all.
>
> The only outstanding issue is that if you try and open projects in
> eclipse that use these enhanced annotations eclipse will report
> errors.  To fix this you will need to have the jars in your
> jre/lib/endorsed on your developer machine
>
> You build machine and operational env do not need them.
>
> For what its worth this is how I did it.  I put this in the parent  
> pom.xml file.
>
> <build>
>        <pluginManagement>
>            <plugins>
>             <plugin>
>                <groupId>org.apache.maven.plugins</groupId>
>                <artifactId>maven-dependency-plugin</artifactId>
>                <version>2.1</version>
>                <configuration>
>                    <outputDirectory>${project.build.directory}/ 
> endorsed</outputDirectory>
>                </configuration>
>                <executions>
>                  <execution>
>                    <id>copy-endorsed</id>
>                    <phase>generate-sources</phase>
>                    <goals>
>                      <goal>copy</goal>
>                    </goals>
>                    <configuration>
>                      <artifactItems>
>                        <artifactItem>
>                            <groupId>javax.xml.bind</groupId>
>                            <artifactId>jaxb-api</artifactId>
>                            <version>2.2.1-custom</version>
>                            <overWrite>true</overWrite>
>                            <destFileName>jaxb-api.jar</destFileName>
>                        </artifactItem>
>
>                        <artifactItem>
>                            <groupId>javax.xml.ws</groupId>
>                              <artifactId>jaxws-api</artifactId>
>                              <version>2.2.1</version>
>                            <overWrite>true</overWrite>
>                            <destFileName>jaxws-api.jar</destFileName>
>                        </artifactItem>
>                      </artifactItems>
>                    </configuration>
>                  </execution>
>                </executions>
>              </plugin>
>            </plugins>
>        </pluginManagement>
>
>        <plugins>
>              <plugin>
>                   <groupId>org.apache.maven.plugins</groupId>
>                   <artifactId>maven-compiler-plugin</artifactId>
>                   <configuration>
>                     <compilerArguments>
>                       <endorseddirs>${project.build.directory}/ 
> endorsed</endorseddirs>
>                     </compilerArguments>
>                   </configuration>
>             </plugin>
>
>            <plugin>
>                <groupId>org.apache.maven.plugins</groupId>
>                <artifactId>maven-surefire-plugin</artifactId>
>                <configuration>
>                  <systemPropertyVariables>
>
> <java.endorsed.dirs>${project.build.directory}/endorsed</ 
> java.endorsed.dirs>
>                  </systemPropertyVariables>
>                </configuration>
>              </plugin>
>        </plugins>
>    </build>
>
>
> And this in the particular projects where I needed to use the jaxb or
> jaxws annotations that are not in 2.1
>
> <build>
>        <plugins>
>            <plugin>
>                <artifactId>maven-dependency-plugin</artifactId>
>            </plugin>
>        </plugins>
>    </build>
>
> I am done now :-)
>
> Cheers
> Jason
>
> On Thu, Mar 3, 2011 at 1:24 PM, Jason Pell <ja...@pellcorp.com> wrote:
>> Yep confirmed it - it just requires the endorsed jars for building,
>> not for runtime.  My operational
>> environments have had their endorsed dirs blown away and still  
>> running
>> nicely.  My build server
>> still requires the jars.
>>
>> On Thu, Mar 3, 2011 at 12:51 PM, Jason Pell <ja...@pellcorp.com>  
>> wrote:
>>> Hi,
>>>
>>> I decided I was curious enough to see if it would work without  
>>> having
>>> to change the endorsed directory.
>>>
>>> I deleted the jars out of the endorsed directory and started up my
>>> application again and executed a web service which uses both jaxws
>>> 2.2.1 and jaxb 2.2 + facets stuff and it started up perfectly fine
>>> WITHOUT an endorsed directory.  What it looks like for me is that  
>>> when
>>> you compile the code you will probably need these jars in the  
>>> endorsed
>>> directory.  But as long as at runtime you have them in the classpath
>>> it works fine.
>>>
>>> Does that sound correct to others? Thats certainly my experience.
>>>
>>> Thanks
>>> Jason
>>>
>>> On Thu, Mar 3, 2011 at 12:11 PM, Jason Pell <ja...@pellcorp.com>  
>>> wrote:
>>>> Hi,
>>>>
>>>> I did not try too hard to avoid putting it into the endorsed  
>>>> directory.
>>>>
>>>> However it occurs to me that if you are using JDK 6, you already  
>>>> have
>>>> that problem using JAXB 2.2 anyway as JDK 6 uses JAXB 2.1.  If  
>>>> there
>>>> is a way to use JAXB 2.2 in CXF without putting jars into the  
>>>> endorsed
>>>> directory then the same can apply to the jaxb-facets enhanced
>>>> jaxb-api.
>>>>
>>>> One way would be to define the endorsed dirs system property  
>>>> instead
>>>> and point it to a directory within your application.  I have not  
>>>> even
>>>> looked at this as we can modify the JRE and it was easier to do  
>>>> that.
>>>>
>>>> Cheers
>>>> Jason
>>>>
>>>> On Thu, Mar 3, 2011 at 11:13 AM, Jason Chaffee  
>>>> <jc...@ebates.com> wrote:
>>>>> This is exactly what we wanting, except it doesn't seem to  
>>>>> support key restrictions...but it does support other  
>>>>> constraints.  However, I cannot add any jars to the endorsed  
>>>>> directory do to some operational constraints so it won't help me  
>>>>> much, but it is still nice to know.
>>>>>
>>>>> Jason
>>>>>
>>>>>
>>>>> -----Original Message-----
>>>>> From: jasonmpell@gmail.com on behalf of Jason Pell
>>>>> Sent: Wed 3/2/2011 2:53 PM
>>>>> To: users@cxf.apache.org
>>>>> Cc: Hannes Holtzhausen; Jason Chaffee; Daniel Kulp
>>>>> Subject: Re: JAXB: Any way to incorporate restrictions into  
>>>>> annotations?
>>>>>
>>>>> Hi,
>>>>>
>>>>> I am using jaxb-facets with CXF and it works very nicely.
>>>>>
>>>>> http://www.infosys.tuwien.ac.at/staff/hummer/tools/jaxb- 
>>>>> facets.html
>>>>> http://java.net/projects/jaxb/lists/dev/archive/2011-02/message/0
>>>>>
>>>>> I did have to hack jaxb-api and jaxb-impl and put the hacked  
>>>>> jaxb-api
>>>>> into jre/lib/endorsed and override the
>>>>> impl in CXF, but it works so well I was surprised.  I have since  
>>>>> added
>>>>> Date and Datetime validation and at some
>>>>> point will need to add Decimal as well.
>>>>>
>>>>> If you want to get hold of my updated jaxb-api and jaxb-impl let  
>>>>> me
>>>>> know.  I can provide my enhancements to the original code from
>>>>> hummer@nfosys.tuwien.ac.at
>>>>>
>>>>> Its a real hack but it does exactly what I need and I have done  
>>>>> it in
>>>>> such a way that if at some point its built into jaxb I can back  
>>>>> out my
>>>>> changes
>>>>> and make use of the core release again.
>>>>>
>>>>> Cheers
>>>>> Jason
>>>>>
>>>>> On Wed, Mar 2, 2011 at 4:09 PM, Hannes Holtzhausen
>>>>> <ha...@gmail.com> wrote:
>>>>>> Have a look at XMLBeans If you are looking for an XML binding
>>>>>> technology that supports the
>>>>>> full XSD spec but still provides a Java bean style API for  
>>>>>> accessing
>>>>>> and generating the XML.
>>>>>>
>>>>>> This is also not a 100% code first approach, you need to start  
>>>>>> with an
>>>>>> XSD to generate XMLBeans.
>>>>>> But you can do a code first web service once you have generated  
>>>>>> the XMLBeans.
>>>>>>
>>>>>> http://cxf.apache.org/docs/xmlbeans.html
>>>>>> http://xmlbeans.apache.org/
>>>>>>
>>>>>> Cheers
>>>>>> Hannes
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>

Re: JAXB: Any way to incorporate restrictions into annotations?

Posted by Jason Pell <ja...@pellcorp.com>.
Ok and now I have updated my maven build so I don't need the endorsed
directory at all.

The only outstanding issue is that if you try and open projects in
eclipse that use these enhanced annotations eclipse will report
errors.  To fix this you will need to have the jars in your
jre/lib/endorsed on your developer machine

You build machine and operational env do not need them.

For what its worth this is how I did it.  I put this in the parent pom.xml file.

<build>
		<pluginManagement>
			<plugins>
			 <plugin>
		        <groupId>org.apache.maven.plugins</groupId>
		        <artifactId>maven-dependency-plugin</artifactId>
				<version>2.1</version>
				<configuration>
					<outputDirectory>${project.build.directory}/endorsed</outputDirectory>
				</configuration>
		        <executions>
		          <execution>
					<id>copy-endorsed</id>
		            <phase>generate-sources</phase>
		            <goals>
		              <goal>copy</goal>
		            </goals>
		            <configuration>
		              <artifactItems>
		                <artifactItem>
							<groupId>javax.xml.bind</groupId>
							<artifactId>jaxb-api</artifactId>
							<version>2.2.1-custom</version>
							<overWrite>true</overWrite>
							<destFileName>jaxb-api.jar</destFileName>
		                </artifactItem>

						<artifactItem>
							<groupId>javax.xml.ws</groupId>
  							<artifactId>jaxws-api</artifactId>
  							<version>2.2.1</version>
							<overWrite>true</overWrite>
							<destFileName>jaxws-api.jar</destFileName>
		                </artifactItem>
		              </artifactItems>
		            </configuration>
		          </execution>
		        </executions>
		      </plugin>
			</plugins>
		</pluginManagement>
		
		<plugins>
			  <plugin>
			       <groupId>org.apache.maven.plugins</groupId>
			       <artifactId>maven-compiler-plugin</artifactId>
			       <configuration>
			         <compilerArguments>
			           <endorseddirs>${project.build.directory}/endorsed</endorseddirs>
			         </compilerArguments>
			       </configuration>
		     </plugin>

			<plugin>
		        <groupId>org.apache.maven.plugins</groupId>
		        <artifactId>maven-surefire-plugin</artifactId>
		        <configuration>
		          <systemPropertyVariables>
		
<java.endorsed.dirs>${project.build.directory}/endorsed</java.endorsed.dirs>
		          </systemPropertyVariables>
		        </configuration>
		      </plugin>
		</plugins>
	</build>


And this in the particular projects where I needed to use the jaxb or
jaxws annotations that are not in 2.1

<build>
		<plugins>
			<plugin>
		        <artifactId>maven-dependency-plugin</artifactId>
			</plugin>
		</plugins>
	</build>

I am done now :-)

Cheers
Jason

On Thu, Mar 3, 2011 at 1:24 PM, Jason Pell <ja...@pellcorp.com> wrote:
> Yep confirmed it - it just requires the endorsed jars for building,
> not for runtime.  My operational
> environments have had their endorsed dirs blown away and still running
> nicely.  My build server
> still requires the jars.
>
> On Thu, Mar 3, 2011 at 12:51 PM, Jason Pell <ja...@pellcorp.com> wrote:
>> Hi,
>>
>> I decided I was curious enough to see if it would work without having
>> to change the endorsed directory.
>>
>> I deleted the jars out of the endorsed directory and started up my
>> application again and executed a web service which uses both jaxws
>> 2.2.1 and jaxb 2.2 + facets stuff and it started up perfectly fine
>> WITHOUT an endorsed directory.  What it looks like for me is that when
>> you compile the code you will probably need these jars in the endorsed
>> directory.  But as long as at runtime you have them in the classpath
>> it works fine.
>>
>> Does that sound correct to others?  Thats certainly my experience.
>>
>> Thanks
>> Jason
>>
>> On Thu, Mar 3, 2011 at 12:11 PM, Jason Pell <ja...@pellcorp.com> wrote:
>>> Hi,
>>>
>>> I did not try too hard to avoid putting it into the endorsed directory.
>>>
>>> However it occurs to me that if you are using JDK 6, you already have
>>> that problem using JAXB 2.2 anyway as JDK 6 uses JAXB 2.1.  If there
>>> is a way to use JAXB 2.2 in CXF without putting jars into the endorsed
>>> directory then the same can apply to the jaxb-facets enhanced
>>> jaxb-api.
>>>
>>> One way would be to define the endorsed dirs system property instead
>>> and point it to a directory within your application.  I have not even
>>> looked at this as we can modify the JRE and it was easier to do that.
>>>
>>> Cheers
>>> Jason
>>>
>>> On Thu, Mar 3, 2011 at 11:13 AM, Jason Chaffee <jc...@ebates.com> wrote:
>>>> This is exactly what we wanting, except it doesn't seem to support key restrictions...but it does support other constraints.  However, I cannot add any jars to the endorsed directory do to some operational constraints so it won't help me much, but it is still nice to know.
>>>>
>>>> Jason
>>>>
>>>>
>>>> -----Original Message-----
>>>> From: jasonmpell@gmail.com on behalf of Jason Pell
>>>> Sent: Wed 3/2/2011 2:53 PM
>>>> To: users@cxf.apache.org
>>>> Cc: Hannes Holtzhausen; Jason Chaffee; Daniel Kulp
>>>> Subject: Re: JAXB: Any way to incorporate restrictions into annotations?
>>>>
>>>> Hi,
>>>>
>>>> I am using jaxb-facets with CXF and it works very nicely.
>>>>
>>>> http://www.infosys.tuwien.ac.at/staff/hummer/tools/jaxb-facets.html
>>>> http://java.net/projects/jaxb/lists/dev/archive/2011-02/message/0
>>>>
>>>> I did have to hack jaxb-api and jaxb-impl and put the hacked jaxb-api
>>>> into jre/lib/endorsed and override the
>>>> impl in CXF, but it works so well I was surprised.  I have since added
>>>> Date and Datetime validation and at some
>>>> point will need to add Decimal as well.
>>>>
>>>> If you want to get hold of my updated jaxb-api and jaxb-impl let me
>>>> know.  I can provide my enhancements to the original code from
>>>> hummer@nfosys.tuwien.ac.at
>>>>
>>>> Its a real hack but it does exactly what I need and I have done it in
>>>> such a way that if at some point its built into jaxb I can back out my
>>>> changes
>>>> and make use of the core release again.
>>>>
>>>> Cheers
>>>> Jason
>>>>
>>>> On Wed, Mar 2, 2011 at 4:09 PM, Hannes Holtzhausen
>>>> <ha...@gmail.com> wrote:
>>>>> Have a look at XMLBeans If you are looking for an XML binding
>>>>> technology that supports the
>>>>> full XSD spec but still provides a Java bean style API for accessing
>>>>> and generating the XML.
>>>>>
>>>>> This is also not a 100% code first approach, you need to start with an
>>>>> XSD to generate XMLBeans.
>>>>> But you can do a code first web service once you have generated the XMLBeans.
>>>>>
>>>>> http://cxf.apache.org/docs/xmlbeans.html
>>>>> http://xmlbeans.apache.org/
>>>>>
>>>>> Cheers
>>>>> Hannes
>>>>>
>>>>
>>>>
>>>
>>
>

Re: JAXB: Any way to incorporate restrictions into annotations?

Posted by Jason Pell <ja...@pellcorp.com>.
Yep confirmed it - it just requires the endorsed jars for building,
not for runtime.  My operational
environments have had their endorsed dirs blown away and still running
nicely.  My build server
still requires the jars.

On Thu, Mar 3, 2011 at 12:51 PM, Jason Pell <ja...@pellcorp.com> wrote:
> Hi,
>
> I decided I was curious enough to see if it would work without having
> to change the endorsed directory.
>
> I deleted the jars out of the endorsed directory and started up my
> application again and executed a web service which uses both jaxws
> 2.2.1 and jaxb 2.2 + facets stuff and it started up perfectly fine
> WITHOUT an endorsed directory.  What it looks like for me is that when
> you compile the code you will probably need these jars in the endorsed
> directory.  But as long as at runtime you have them in the classpath
> it works fine.
>
> Does that sound correct to others?  Thats certainly my experience.
>
> Thanks
> Jason
>
> On Thu, Mar 3, 2011 at 12:11 PM, Jason Pell <ja...@pellcorp.com> wrote:
>> Hi,
>>
>> I did not try too hard to avoid putting it into the endorsed directory.
>>
>> However it occurs to me that if you are using JDK 6, you already have
>> that problem using JAXB 2.2 anyway as JDK 6 uses JAXB 2.1.  If there
>> is a way to use JAXB 2.2 in CXF without putting jars into the endorsed
>> directory then the same can apply to the jaxb-facets enhanced
>> jaxb-api.
>>
>> One way would be to define the endorsed dirs system property instead
>> and point it to a directory within your application.  I have not even
>> looked at this as we can modify the JRE and it was easier to do that.
>>
>> Cheers
>> Jason
>>
>> On Thu, Mar 3, 2011 at 11:13 AM, Jason Chaffee <jc...@ebates.com> wrote:
>>> This is exactly what we wanting, except it doesn't seem to support key restrictions...but it does support other constraints.  However, I cannot add any jars to the endorsed directory do to some operational constraints so it won't help me much, but it is still nice to know.
>>>
>>> Jason
>>>
>>>
>>> -----Original Message-----
>>> From: jasonmpell@gmail.com on behalf of Jason Pell
>>> Sent: Wed 3/2/2011 2:53 PM
>>> To: users@cxf.apache.org
>>> Cc: Hannes Holtzhausen; Jason Chaffee; Daniel Kulp
>>> Subject: Re: JAXB: Any way to incorporate restrictions into annotations?
>>>
>>> Hi,
>>>
>>> I am using jaxb-facets with CXF and it works very nicely.
>>>
>>> http://www.infosys.tuwien.ac.at/staff/hummer/tools/jaxb-facets.html
>>> http://java.net/projects/jaxb/lists/dev/archive/2011-02/message/0
>>>
>>> I did have to hack jaxb-api and jaxb-impl and put the hacked jaxb-api
>>> into jre/lib/endorsed and override the
>>> impl in CXF, but it works so well I was surprised.  I have since added
>>> Date and Datetime validation and at some
>>> point will need to add Decimal as well.
>>>
>>> If you want to get hold of my updated jaxb-api and jaxb-impl let me
>>> know.  I can provide my enhancements to the original code from
>>> hummer@nfosys.tuwien.ac.at
>>>
>>> Its a real hack but it does exactly what I need and I have done it in
>>> such a way that if at some point its built into jaxb I can back out my
>>> changes
>>> and make use of the core release again.
>>>
>>> Cheers
>>> Jason
>>>
>>> On Wed, Mar 2, 2011 at 4:09 PM, Hannes Holtzhausen
>>> <ha...@gmail.com> wrote:
>>>> Have a look at XMLBeans If you are looking for an XML binding
>>>> technology that supports the
>>>> full XSD spec but still provides a Java bean style API for accessing
>>>> and generating the XML.
>>>>
>>>> This is also not a 100% code first approach, you need to start with an
>>>> XSD to generate XMLBeans.
>>>> But you can do a code first web service once you have generated the XMLBeans.
>>>>
>>>> http://cxf.apache.org/docs/xmlbeans.html
>>>> http://xmlbeans.apache.org/
>>>>
>>>> Cheers
>>>> Hannes
>>>>
>>>
>>>
>>
>

Re: JAXB: Any way to incorporate restrictions into annotations?

Posted by Jason Pell <ja...@pellcorp.com>.
Hi,

I decided I was curious enough to see if it would work without having
to change the endorsed directory.

I deleted the jars out of the endorsed directory and started up my
application again and executed a web service which uses both jaxws
2.2.1 and jaxb 2.2 + facets stuff and it started up perfectly fine
WITHOUT an endorsed directory.  What it looks like for me is that when
you compile the code you will probably need these jars in the endorsed
directory.  But as long as at runtime you have them in the classpath
it works fine.

Does that sound correct to others?  Thats certainly my experience.

Thanks
Jason

On Thu, Mar 3, 2011 at 12:11 PM, Jason Pell <ja...@pellcorp.com> wrote:
> Hi,
>
> I did not try too hard to avoid putting it into the endorsed directory.
>
> However it occurs to me that if you are using JDK 6, you already have
> that problem using JAXB 2.2 anyway as JDK 6 uses JAXB 2.1.  If there
> is a way to use JAXB 2.2 in CXF without putting jars into the endorsed
> directory then the same can apply to the jaxb-facets enhanced
> jaxb-api.
>
> One way would be to define the endorsed dirs system property instead
> and point it to a directory within your application.  I have not even
> looked at this as we can modify the JRE and it was easier to do that.
>
> Cheers
> Jason
>
> On Thu, Mar 3, 2011 at 11:13 AM, Jason Chaffee <jc...@ebates.com> wrote:
>> This is exactly what we wanting, except it doesn't seem to support key restrictions...but it does support other constraints.  However, I cannot add any jars to the endorsed directory do to some operational constraints so it won't help me much, but it is still nice to know.
>>
>> Jason
>>
>>
>> -----Original Message-----
>> From: jasonmpell@gmail.com on behalf of Jason Pell
>> Sent: Wed 3/2/2011 2:53 PM
>> To: users@cxf.apache.org
>> Cc: Hannes Holtzhausen; Jason Chaffee; Daniel Kulp
>> Subject: Re: JAXB: Any way to incorporate restrictions into annotations?
>>
>> Hi,
>>
>> I am using jaxb-facets with CXF and it works very nicely.
>>
>> http://www.infosys.tuwien.ac.at/staff/hummer/tools/jaxb-facets.html
>> http://java.net/projects/jaxb/lists/dev/archive/2011-02/message/0
>>
>> I did have to hack jaxb-api and jaxb-impl and put the hacked jaxb-api
>> into jre/lib/endorsed and override the
>> impl in CXF, but it works so well I was surprised.  I have since added
>> Date and Datetime validation and at some
>> point will need to add Decimal as well.
>>
>> If you want to get hold of my updated jaxb-api and jaxb-impl let me
>> know.  I can provide my enhancements to the original code from
>> hummer@nfosys.tuwien.ac.at
>>
>> Its a real hack but it does exactly what I need and I have done it in
>> such a way that if at some point its built into jaxb I can back out my
>> changes
>> and make use of the core release again.
>>
>> Cheers
>> Jason
>>
>> On Wed, Mar 2, 2011 at 4:09 PM, Hannes Holtzhausen
>> <ha...@gmail.com> wrote:
>>> Have a look at XMLBeans If you are looking for an XML binding
>>> technology that supports the
>>> full XSD spec but still provides a Java bean style API for accessing
>>> and generating the XML.
>>>
>>> This is also not a 100% code first approach, you need to start with an
>>> XSD to generate XMLBeans.
>>> But you can do a code first web service once you have generated the XMLBeans.
>>>
>>> http://cxf.apache.org/docs/xmlbeans.html
>>> http://xmlbeans.apache.org/
>>>
>>> Cheers
>>> Hannes
>>>
>>
>>
>

Re: JAXB: Any way to incorporate restrictions into annotations?

Posted by Jason Pell <ja...@pellcorp.com>.
Hi,

I did not try too hard to avoid putting it into the endorsed directory.

However it occurs to me that if you are using JDK 6, you already have
that problem using JAXB 2.2 anyway as JDK 6 uses JAXB 2.1.  If there
is a way to use JAXB 2.2 in CXF without putting jars into the endorsed
directory then the same can apply to the jaxb-facets enhanced
jaxb-api.

One way would be to define the endorsed dirs system property instead
and point it to a directory within your application.  I have not even
looked at this as we can modify the JRE and it was easier to do that.

Cheers
Jason

On Thu, Mar 3, 2011 at 11:13 AM, Jason Chaffee <jc...@ebates.com> wrote:
> This is exactly what we wanting, except it doesn't seem to support key restrictions...but it does support other constraints.  However, I cannot add any jars to the endorsed directory do to some operational constraints so it won't help me much, but it is still nice to know.
>
> Jason
>
>
> -----Original Message-----
> From: jasonmpell@gmail.com on behalf of Jason Pell
> Sent: Wed 3/2/2011 2:53 PM
> To: users@cxf.apache.org
> Cc: Hannes Holtzhausen; Jason Chaffee; Daniel Kulp
> Subject: Re: JAXB: Any way to incorporate restrictions into annotations?
>
> Hi,
>
> I am using jaxb-facets with CXF and it works very nicely.
>
> http://www.infosys.tuwien.ac.at/staff/hummer/tools/jaxb-facets.html
> http://java.net/projects/jaxb/lists/dev/archive/2011-02/message/0
>
> I did have to hack jaxb-api and jaxb-impl and put the hacked jaxb-api
> into jre/lib/endorsed and override the
> impl in CXF, but it works so well I was surprised.  I have since added
> Date and Datetime validation and at some
> point will need to add Decimal as well.
>
> If you want to get hold of my updated jaxb-api and jaxb-impl let me
> know.  I can provide my enhancements to the original code from
> hummer@nfosys.tuwien.ac.at
>
> Its a real hack but it does exactly what I need and I have done it in
> such a way that if at some point its built into jaxb I can back out my
> changes
> and make use of the core release again.
>
> Cheers
> Jason
>
> On Wed, Mar 2, 2011 at 4:09 PM, Hannes Holtzhausen
> <ha...@gmail.com> wrote:
>> Have a look at XMLBeans If you are looking for an XML binding
>> technology that supports the
>> full XSD spec but still provides a Java bean style API for accessing
>> and generating the XML.
>>
>> This is also not a 100% code first approach, you need to start with an
>> XSD to generate XMLBeans.
>> But you can do a code first web service once you have generated the XMLBeans.
>>
>> http://cxf.apache.org/docs/xmlbeans.html
>> http://xmlbeans.apache.org/
>>
>> Cheers
>> Hannes
>>
>
>

RE: JAXB: Any way to incorporate restrictions into annotations?

Posted by Jason Chaffee <jc...@ebates.com>.
This is exactly what we wanting, except it doesn't seem to support key restrictions...but it does support other constraints.  However, I cannot add any jars to the endorsed directory do to some operational constraints so it won't help me much, but it is still nice to know.

Jason


-----Original Message-----
From: jasonmpell@gmail.com on behalf of Jason Pell
Sent: Wed 3/2/2011 2:53 PM
To: users@cxf.apache.org
Cc: Hannes Holtzhausen; Jason Chaffee; Daniel Kulp
Subject: Re: JAXB: Any way to incorporate restrictions into annotations?
 
Hi,

I am using jaxb-facets with CXF and it works very nicely.

http://www.infosys.tuwien.ac.at/staff/hummer/tools/jaxb-facets.html
http://java.net/projects/jaxb/lists/dev/archive/2011-02/message/0

I did have to hack jaxb-api and jaxb-impl and put the hacked jaxb-api
into jre/lib/endorsed and override the
impl in CXF, but it works so well I was surprised.  I have since added
Date and Datetime validation and at some
point will need to add Decimal as well.

If you want to get hold of my updated jaxb-api and jaxb-impl let me
know.  I can provide my enhancements to the original code from
hummer@nfosys.tuwien.ac.at

Its a real hack but it does exactly what I need and I have done it in
such a way that if at some point its built into jaxb I can back out my
changes
and make use of the core release again.

Cheers
Jason

On Wed, Mar 2, 2011 at 4:09 PM, Hannes Holtzhausen
<ha...@gmail.com> wrote:
> Have a look at XMLBeans If you are looking for an XML binding
> technology that supports the
> full XSD spec but still provides a Java bean style API for accessing
> and generating the XML.
>
> This is also not a 100% code first approach, you need to start with an
> XSD to generate XMLBeans.
> But you can do a code first web service once you have generated the XMLBeans.
>
> http://cxf.apache.org/docs/xmlbeans.html
> http://xmlbeans.apache.org/
>
> Cheers
> Hannes
>


Re: JAXB: Any way to incorporate restrictions into annotations?

Posted by Jason Pell <ja...@pellcorp.com>.
Hi,

I am using jaxb-facets with CXF and it works very nicely.

http://www.infosys.tuwien.ac.at/staff/hummer/tools/jaxb-facets.html
http://java.net/projects/jaxb/lists/dev/archive/2011-02/message/0

I did have to hack jaxb-api and jaxb-impl and put the hacked jaxb-api
into jre/lib/endorsed and override the
impl in CXF, but it works so well I was surprised.  I have since added
Date and Datetime validation and at some
point will need to add Decimal as well.

If you want to get hold of my updated jaxb-api and jaxb-impl let me
know.  I can provide my enhancements to the original code from
hummer@nfosys.tuwien.ac.at

Its a real hack but it does exactly what I need and I have done it in
such a way that if at some point its built into jaxb I can back out my
changes
and make use of the core release again.

Cheers
Jason

On Wed, Mar 2, 2011 at 4:09 PM, Hannes Holtzhausen
<ha...@gmail.com> wrote:
> Have a look at XMLBeans If you are looking for an XML binding
> technology that supports the
> full XSD spec but still provides a Java bean style API for accessing
> and generating the XML.
>
> This is also not a 100% code first approach, you need to start with an
> XSD to generate XMLBeans.
> But you can do a code first web service once you have generated the XMLBeans.
>
> http://cxf.apache.org/docs/xmlbeans.html
> http://xmlbeans.apache.org/
>
> Cheers
> Hannes
>

Re: JAXB: Any way to incorporate restrictions into annotations?

Posted by Hannes Holtzhausen <ha...@gmail.com>.
Have a look at XMLBeans If you are looking for an XML binding
technology that supports the
full XSD spec but still provides a Java bean style API for accessing
and generating the XML.

This is also not a 100% code first approach, you need to start with an
XSD to generate XMLBeans.
But you can do a code first web service once you have generated the XMLBeans.

http://cxf.apache.org/docs/xmlbeans.html
http://xmlbeans.apache.org/

Cheers
Hannes

Re: JAXB: Any way to incorporate restrictions into annotations?

Posted by Jason Chaffee <jc...@ebates.com>.
Jaxb needs a 3.0 spec that is basically a rewrite.  The fact that it  
doesn't work with interfaces is beyond perplexing.

Jason

On Mar 1, 2011, at 8:01 PM, "Jason Chaffee" <jc...@ebates.com> wrote:

> This is what my understanding is as well.  Was just really hoping  
> soneone knew something I didn't.  :)
>
> Jason
>
> On Mar 1, 2011, at 7:23 PM, "Daniel Kulp" <dk...@apache.org> wrote:
>
>> On Tuesday 01 March 2011 7:27:16 PM Jason Chaffee wrote:
>>> The question is how to do these things with annotations.   That is  
>>> why
>>> you were given xsd examples because we know how to do them in the  
>>> XSD.
>>> But in a code-first approach, you would want to specify these in the
>>> annotations and then generate the schema from it.  That is the  
>>> question,
>>> how to do that.
>>
>> I really don't think you can.  JAXB doesn't really have anything  
>> for those
>> types of things.   I also looked at the EclipseLink Moxy custom  
>> annotations
>> and didn't see anything there either.  :-(
>>
>> Dan
>>
>>
>>
>>>
>>> Jason
>>>
>>> -----Original Message-----
>>> From: KARR, DAVID (ATTSI) [mailto:dk068x@att.com]
>>> Sent: Tuesday, March 01, 2011 4:19 PM
>>> To: users@cxf.apache.org
>>> Subject: RE: JAXB: Any way to incorporate restrictions into  
>>> annotations?
>>>
>>>> -----Original Message-----
>>>> From: Jason Chaffee [mailto:jchaffee@ebates.com]
>>>> Sent: Tuesday, March 01, 2011 4:04 PM
>>>> To: users@cxf.apache.org
>>>> Subject: RE: JAXB: Any way to incorporate restrictions into
>>>> annotations?
>>>>
>>>> I can give an example,
>>>>
>>>> How do I do either of these with annotations:
>>>> <!-- Custom restriction for name -->
>>>> <xs:simpleType name="name">
>>>>
>>>>   <xs:restriction base="xs:string">
>>>>
>>>>     <xs:pattern value="[a-zA-Z0-9_\.][a-zA-Z0-9_\-\.]*" />
>>>>
>>>>   </xs:restriction>
>>>>
>>>> </xs:simpleType>
>>>>
>>>> OR a key
>>>>
>>>> <!-- Custom key for address name in user -->
>>>> <xs:element name="user" type="user">
>>>>
>>>>   <xs:key name="nameKey">
>>>>
>>>>     <xs:selector xpath="addresses/address" />
>>>>     <xs:field xpath="name" />
>>>>
>>>>   </xs:key>
>>>>
>>>> </xs:element>
>>>
>>> Yeah.  I didn't mean elaborate on the schema, I meant on the
>>> annotations.  However, I think I've figured that out in the  
>>> meantime, at
>>> least for type references.  I believe you would use
>>> '@XmlSchemaType(name="nameKey")", for example, correct?
>>>
>>> I have no idea how you could deal with "xs:key" references.
>>>
>>>> -----Original Message-----
>>>> From: KARR, DAVID (ATTSI) [mailto:dk068x@att.com]
>>>> Sent: Tuesday, March 01, 2011 3:49 PM
>>>> To: users@cxf.apache.org
>>>> Subject: RE: JAXB: Any way to incorporate restrictions into
>>>> annotations?
>>>>
>>>>> -----Original Message-----
>>>>> From: jbradfor [mailto:jbradfor@amfam.com]
>>>>> Sent: Tuesday, March 01, 2011 3:46 PM
>>>>> To: users@cxf.apache.org
>>>>> Subject: Re: JAXB: Any way to incorporate restrictions into
>>>>> annotations?
>>>>>
>>>>> We use SimpleTypes, range restrictions (which will not gen but  
>>>>> will
>>>>> validate,
>>>>> if requested), and Enums for name/value pairs.
>>>>
>>>> Could you please elaborate, for instance range restrictions?
>>
>> -- 
>> Daniel Kulp
>> dkulp@apache.org
>> http://dankulp.com/blog
>> Talend - http://www.talend.com

Re: JAXB: Any way to incorporate restrictions into annotations?

Posted by Jason Chaffee <jc...@ebates.com>.
This is what my understanding is as well.  Was just really hoping  
soneone knew something I didn't.  :)

Jason

On Mar 1, 2011, at 7:23 PM, "Daniel Kulp" <dk...@apache.org> wrote:

> On Tuesday 01 March 2011 7:27:16 PM Jason Chaffee wrote:
>> The question is how to do these things with annotations.   That is  
>> why
>> you were given xsd examples because we know how to do them in the  
>> XSD.
>> But in a code-first approach, you would want to specify these in the
>> annotations and then generate the schema from it.  That is the  
>> question,
>> how to do that.
>
> I really don't think you can.  JAXB doesn't really have anything for  
> those
> types of things.   I also looked at the EclipseLink Moxy custom  
> annotations
> and didn't see anything there either.  :-(
>
> Dan
>
>
>
>>
>> Jason
>>
>> -----Original Message-----
>> From: KARR, DAVID (ATTSI) [mailto:dk068x@att.com]
>> Sent: Tuesday, March 01, 2011 4:19 PM
>> To: users@cxf.apache.org
>> Subject: RE: JAXB: Any way to incorporate restrictions into  
>> annotations?
>>
>>> -----Original Message-----
>>> From: Jason Chaffee [mailto:jchaffee@ebates.com]
>>> Sent: Tuesday, March 01, 2011 4:04 PM
>>> To: users@cxf.apache.org
>>> Subject: RE: JAXB: Any way to incorporate restrictions into
>>> annotations?
>>>
>>> I can give an example,
>>>
>>> How do I do either of these with annotations:
>>>  <!-- Custom restriction for name -->
>>>  <xs:simpleType name="name">
>>>
>>>    <xs:restriction base="xs:string">
>>>
>>>      <xs:pattern value="[a-zA-Z0-9_\.][a-zA-Z0-9_\-\.]*" />
>>>
>>>    </xs:restriction>
>>>
>>>  </xs:simpleType>
>>>
>>> OR a key
>>>
>>>  <!-- Custom key for address name in user -->
>>>  <xs:element name="user" type="user">
>>>
>>>    <xs:key name="nameKey">
>>>
>>>      <xs:selector xpath="addresses/address" />
>>>      <xs:field xpath="name" />
>>>
>>>    </xs:key>
>>>
>>>  </xs:element>
>>
>> Yeah.  I didn't mean elaborate on the schema, I meant on the
>> annotations.  However, I think I've figured that out in the  
>> meantime, at
>> least for type references.  I believe you would use
>> '@XmlSchemaType(name="nameKey")", for example, correct?
>>
>> I have no idea how you could deal with "xs:key" references.
>>
>>> -----Original Message-----
>>> From: KARR, DAVID (ATTSI) [mailto:dk068x@att.com]
>>> Sent: Tuesday, March 01, 2011 3:49 PM
>>> To: users@cxf.apache.org
>>> Subject: RE: JAXB: Any way to incorporate restrictions into
>>> annotations?
>>>
>>>> -----Original Message-----
>>>> From: jbradfor [mailto:jbradfor@amfam.com]
>>>> Sent: Tuesday, March 01, 2011 3:46 PM
>>>> To: users@cxf.apache.org
>>>> Subject: Re: JAXB: Any way to incorporate restrictions into
>>>> annotations?
>>>>
>>>> We use SimpleTypes, range restrictions (which will not gen but will
>>>> validate,
>>>> if requested), and Enums for name/value pairs.
>>>
>>> Could you please elaborate, for instance range restrictions?
>
> -- 
> Daniel Kulp
> dkulp@apache.org
> http://dankulp.com/blog
> Talend - http://www.talend.com

Re: JAXB: Any way to incorporate restrictions into annotations?

Posted by Daniel Kulp <dk...@apache.org>.
On Tuesday 01 March 2011 7:27:16 PM Jason Chaffee wrote:
> The question is how to do these things with annotations.   That is why
> you were given xsd examples because we know how to do them in the XSD.
> But in a code-first approach, you would want to specify these in the
> annotations and then generate the schema from it.  That is the question,
> how to do that.

I really don't think you can.  JAXB doesn't really have anything for those 
types of things.   I also looked at the EclipseLink Moxy custom annotations 
and didn't see anything there either.  :-(

Dan



> 
> Jason
> 
> -----Original Message-----
> From: KARR, DAVID (ATTSI) [mailto:dk068x@att.com]
> Sent: Tuesday, March 01, 2011 4:19 PM
> To: users@cxf.apache.org
> Subject: RE: JAXB: Any way to incorporate restrictions into annotations?
> 
> > -----Original Message-----
> > From: Jason Chaffee [mailto:jchaffee@ebates.com]
> > Sent: Tuesday, March 01, 2011 4:04 PM
> > To: users@cxf.apache.org
> > Subject: RE: JAXB: Any way to incorporate restrictions into
> > annotations?
> > 
> > I can give an example,
> > 
> > How do I do either of these with annotations:
> >   <!-- Custom restriction for name -->
> >   <xs:simpleType name="name">
> >   
> >     <xs:restriction base="xs:string">
> >     
> >       <xs:pattern value="[a-zA-Z0-9_\.][a-zA-Z0-9_\-\.]*" />
> >     
> >     </xs:restriction>
> >   
> >   </xs:simpleType>
> > 
> > OR a key
> > 
> >   <!-- Custom key for address name in user -->
> >   <xs:element name="user" type="user">
> >   
> >     <xs:key name="nameKey">
> >     
> >       <xs:selector xpath="addresses/address" />
> >       <xs:field xpath="name" />
> >     
> >     </xs:key>
> >   
> >   </xs:element>
> 
> Yeah.  I didn't mean elaborate on the schema, I meant on the
> annotations.  However, I think I've figured that out in the meantime, at
> least for type references.  I believe you would use
> '@XmlSchemaType(name="nameKey")", for example, correct?
> 
> I have no idea how you could deal with "xs:key" references.
> 
> > -----Original Message-----
> > From: KARR, DAVID (ATTSI) [mailto:dk068x@att.com]
> > Sent: Tuesday, March 01, 2011 3:49 PM
> > To: users@cxf.apache.org
> > Subject: RE: JAXB: Any way to incorporate restrictions into
> > annotations?
> > 
> > > -----Original Message-----
> > > From: jbradfor [mailto:jbradfor@amfam.com]
> > > Sent: Tuesday, March 01, 2011 3:46 PM
> > > To: users@cxf.apache.org
> > > Subject: Re: JAXB: Any way to incorporate restrictions into
> > > annotations?
> > > 
> > > We use SimpleTypes, range restrictions (which will not gen but will
> > > validate,
> > > if requested), and Enums for name/value pairs.
> > 
> > Could you please elaborate, for instance range restrictions?

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

RE: JAXB: Any way to incorporate restrictions into annotations?

Posted by Jason Chaffee <jc...@ebates.com>.
The question is how to do these things with annotations.   That is why
you were given xsd examples because we know how to do them in the XSD.
But in a code-first approach, you would want to specify these in the
annotations and then generate the schema from it.  That is the question,
how to do that.

Jason

-----Original Message-----
From: KARR, DAVID (ATTSI) [mailto:dk068x@att.com] 
Sent: Tuesday, March 01, 2011 4:19 PM
To: users@cxf.apache.org
Subject: RE: JAXB: Any way to incorporate restrictions into annotations?

> -----Original Message-----
> From: Jason Chaffee [mailto:jchaffee@ebates.com]
> Sent: Tuesday, March 01, 2011 4:04 PM
> To: users@cxf.apache.org
> Subject: RE: JAXB: Any way to incorporate restrictions into
> annotations?
> 
> I can give an example,
> 
> How do I do either of these with annotations:
> 
> 
>   <!-- Custom restriction for name -->
>   <xs:simpleType name="name">
>     <xs:restriction base="xs:string">
>       <xs:pattern value="[a-zA-Z0-9_\.][a-zA-Z0-9_\-\.]*" />
>     </xs:restriction>
>   </xs:simpleType>
> 
> OR a key
> 
>   <!-- Custom key for address name in user -->
>   <xs:element name="user" type="user">
>     <xs:key name="nameKey">
>       <xs:selector xpath="addresses/address" />
>       <xs:field xpath="name" />
>     </xs:key>
>   </xs:element>

Yeah.  I didn't mean elaborate on the schema, I meant on the
annotations.  However, I think I've figured that out in the meantime, at
least for type references.  I believe you would use
'@XmlSchemaType(name="nameKey")", for example, correct?

I have no idea how you could deal with "xs:key" references.

> -----Original Message-----
> From: KARR, DAVID (ATTSI) [mailto:dk068x@att.com]
> Sent: Tuesday, March 01, 2011 3:49 PM
> To: users@cxf.apache.org
> Subject: RE: JAXB: Any way to incorporate restrictions into
> annotations?
> 
> > -----Original Message-----
> > From: jbradfor [mailto:jbradfor@amfam.com]
> > Sent: Tuesday, March 01, 2011 3:46 PM
> > To: users@cxf.apache.org
> > Subject: Re: JAXB: Any way to incorporate restrictions into
> > annotations?
> >
> > We use SimpleTypes, range restrictions (which will not gen but will
> > validate,
> > if requested), and Enums for name/value pairs.
> 
> Could you please elaborate, for instance range restrictions?

RE: JAXB: Any way to incorporate restrictions into annotations?

Posted by "KARR, DAVID (ATTSI)" <dk...@att.com>.
> -----Original Message-----
> From: Jason Chaffee [mailto:jchaffee@ebates.com]
> Sent: Tuesday, March 01, 2011 4:04 PM
> To: users@cxf.apache.org
> Subject: RE: JAXB: Any way to incorporate restrictions into
> annotations?
> 
> I can give an example,
> 
> How do I do either of these with annotations:
> 
> 
>   <!-- Custom restriction for name -->
>   <xs:simpleType name="name">
>     <xs:restriction base="xs:string">
>       <xs:pattern value="[a-zA-Z0-9_\.][a-zA-Z0-9_\-\.]*" />
>     </xs:restriction>
>   </xs:simpleType>
> 
> OR a key
> 
>   <!-- Custom key for address name in user -->
>   <xs:element name="user" type="user">
>     <xs:key name="nameKey">
>       <xs:selector xpath="addresses/address" />
>       <xs:field xpath="name" />
>     </xs:key>
>   </xs:element>

Yeah.  I didn't mean elaborate on the schema, I meant on the
annotations.  However, I think I've figured that out in the meantime, at
least for type references.  I believe you would use
'@XmlSchemaType(name="nameKey")", for example, correct?

I have no idea how you could deal with "xs:key" references.

> -----Original Message-----
> From: KARR, DAVID (ATTSI) [mailto:dk068x@att.com]
> Sent: Tuesday, March 01, 2011 3:49 PM
> To: users@cxf.apache.org
> Subject: RE: JAXB: Any way to incorporate restrictions into
> annotations?
> 
> > -----Original Message-----
> > From: jbradfor [mailto:jbradfor@amfam.com]
> > Sent: Tuesday, March 01, 2011 3:46 PM
> > To: users@cxf.apache.org
> > Subject: Re: JAXB: Any way to incorporate restrictions into
> > annotations?
> >
> > We use SimpleTypes, range restrictions (which will not gen but will
> > validate,
> > if requested), and Enums for name/value pairs.
> 
> Could you please elaborate, for instance range restrictions?

RE: JAXB: Any way to incorporate restrictions into annotations?

Posted by Jason Chaffee <jc...@ebates.com>.
I can give an example,

How do I do either of these with annotations:


  <!-- Custom restriction for name -->
  <xs:simpleType name="name">
    <xs:restriction base="xs:string">
      <xs:pattern value="[a-zA-Z0-9_\.][a-zA-Z0-9_\-\.]*" />
    </xs:restriction>
  </xs:simpleType>

OR a key

  <!-- Custom key for address name in user -->
  <xs:element name="user" type="user">
    <xs:key name="nameKey">
      <xs:selector xpath="addresses/address" />
      <xs:field xpath="name" />
    </xs:key>
  </xs:element>


-----Original Message-----
From: KARR, DAVID (ATTSI) [mailto:dk068x@att.com] 
Sent: Tuesday, March 01, 2011 3:49 PM
To: users@cxf.apache.org
Subject: RE: JAXB: Any way to incorporate restrictions into annotations?

> -----Original Message-----
> From: jbradfor [mailto:jbradfor@amfam.com]
> Sent: Tuesday, March 01, 2011 3:46 PM
> To: users@cxf.apache.org
> Subject: Re: JAXB: Any way to incorporate restrictions into
> annotations?
> 
> We use SimpleTypes, range restrictions (which will not gen but will
> validate,
> if requested), and Enums for name/value pairs.

Could you please elaborate, for instance range restrictions?

RE: JAXB: Any way to incorporate restrictions into annotations?

Posted by "KARR, DAVID (ATTSI)" <dk...@att.com>.
> -----Original Message-----
> From: jbradfor [mailto:jbradfor@amfam.com]
> Sent: Tuesday, March 01, 2011 3:46 PM
> To: users@cxf.apache.org
> Subject: Re: JAXB: Any way to incorporate restrictions into
> annotations?
> 
> We use SimpleTypes, range restrictions (which will not gen but will
> validate,
> if requested), and Enums for name/value pairs.

Could you please elaborate, for instance range restrictions?

Re: JAXB: Any way to incorporate restrictions into annotations?

Posted by jbradfor <jb...@amfam.com>.
We use SimpleTypes, range restrictions (which will not gen but will validate,
if requested), and Enums for name/value pairs.

-- 
View this message in context: http://cxf.547215.n5.nabble.com/JAXB-Any-way-to-incorporate-restrictions-into-annotations-tp3405878p3405887.html
Sent from the cxf-user mailing list archive at Nabble.com.