[bv-dev] Changes in BV XML schemas
Gunnar Morling
gunnar at hibernate.org
Sun Aug 5 09:34:57 EDT 2012
Hi all,
I've created two pull requests for the API [1] and the spec [2] for
* BVAL-295 ("Should validation-configuration and validation-mapping
xsds define a version attribute") and
* BVAL-282 ("Make clear whether it's legal to invoke
Configuration#buildValidatorFactory() several times").
As discussed, there are the following changes now:
* "version" attribute added to the XSDs for XML configuration and
mapping files. The comment within the XSD files is based on those from
other JEE specs. If no version attribute is given, schema version 1.0
is to be assumed. If an unknown schema version is encountered, a
ValidationException shall be thrown.
* Explicitly mentioned that calling
Configuration#buildValidatorFactory() several times is legal. Added an
example for this.
* Added note on mark()/reset() methods to Configuration#addMapping()
and ConfigurationState#getMappingStreams() (streams should preferably
support these methods, if not they'll be wrapped by the BV provider).
Please let me know what you think (is anything unclear, missing etc.)
by either commenting directly on the pull requests or via mail.
--Gunnar
[1] https://github.com/beanvalidation/beanvalidation-api/pull/11
[2] https://github.com/beanvalidation/beanvalidation-spec/pull/9
2012/8/4 Gunnar Morling <gunnar at hibernate.org>:
> Sounds like a good idea. I'll give it a try and see how it works out.
>
> Thanks,
>
> --Gunnar
>
>
> Am 02.08.2012 14:23 schrieb "Sebastian Thomschke"
> <sebastian.thomschke at web.de>:
>
>> +1 for wrapping the stream if necessary and extending the javadoc
>>
>> Regards,
>>
>> Seb
>>
>> On 02.08.2012 14:22, Hardy Ferentschik wrote:
>> > On 1 Jan 2012, at 8:56 AM, Gunnar Morling wrote:
>> >
>> >> Hi all,
>> >>
>> >> I'm currently implementing this change (new mandatory “version“
>> >> attribute in BV 1.1 XML descriptors) within the RI (see HV-595). The basic
>> >> idea is to
>> >>
>> >> * examine the root element for the version attribute using a parser
>> >> (Stax in our case) and then
>> >> * unmarshal the descriptor with JAXB, using the right XSD based on the
>> >> retrieved version.
>> >>
>> >> So I have to access the input streams representing the descriptors
>> >> twice. This is no problem for the streams we're opening ourselves
>> >> (validation.xml), but it could be an issue for streams passed via
>> >> Configuration#addMapping().
>> >>
>> >> I can see the following options now:
>> >>
>> >> * read descriptor streams into a string first which then can be
>> >> processed several times. Alternatively wrap any streams not supporting the
>> >> mark/reset contract into a BufferedInputStream.
>> >> * demand in the spec that any passed input stream must support
>> >> mark/reset. This would also be beneficial for the scenario of creating
>> >> several factories from one Configuration, which we discussed a while ago.
>> >> But obviously this would be a non compatible change for 1.0 clients passing
>> >> non resettable streams to addMapping().
>> > What's about a combination of wrapping into BufferedInputStream and
>> > adding some javadocs. I think wrapping the input stream into a
>> > BufferedInputStream works fine. We can combine this
>> > with a note in the javadocs that recommends to pass a input stream which
>> > supports mark/reset.
>> >
>> > --Hardy
>> >
>> >
>> > _______________________________________________
>> > beanvalidation-dev mailing list
>> > beanvalidation-dev at lists.jboss.org
>> > https://lists.jboss.org/mailman/listinfo/beanvalidation-dev
>>
>> _______________________________________________
>> beanvalidation-dev mailing list
>> beanvalidation-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/beanvalidation-dev
More information about the beanvalidation-dev
mailing list