bval-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@gmail.com>
Subject Re: Location of validation.xml
Date Wed, 19 Mar 2014 21:17:50 GMT
I can't think why you would specify mapping files in
[*-INF]/validation.xml just to ignore them. Rather you'd *either* use
this file to configure the default Validator or bootstrap
programmatically and use Configuration#addMapping() for your mappings.
Do you have a use case to help me understand when you would want this
"mixed" behavior?

Matt

On Wed, Mar 19, 2014 at 4:03 PM, Michael Blyakher
<michael.blyakher@gmail.com> wrote:
> I'm prototyping the development efforts for pulling in the 1.1
> implementation into an EE app server, so I need be able to press the right
> buttons on bval so that it is able to handle both the mappings files and
> validation.xml. (I won't be able to control how an application specifies
> it's mappings, but I need to ensure that specifying them in xml under
> WEB-INF works)
>
> My concern was that I was going to run into the same issues loading the
> mappings files as with validation.xml from WEB-INF unless the proposed
> change somehow provided a way to tell bval to skip using the mappings found
> in the provided parsed validation.xml and only use those provided by calling
> Configuration#addMapping(). Otherwise I would call
> Configuration#addMapping(), but bval would still try to find the mappings
> resources itself and fail to do so. Does that make sense?
>
>
> On Wed, Mar 19, 2014 at 12:32 PM, Matt Benson <gudnabrsam@gmail.com> wrote:
>>
>> XML constraint mapping files are separate from xml validation config.
>> So you either provide them via Configuration#addMapping() or in your
>> validation.xml (or whatever you override with).
>>
>> Matt
>>
>> On Wed, Mar 19, 2014 at 11:39 AM, Michael Blyakher
>> <michael.blyakher@gmail.com> wrote:
>> > So if I understand this latest proposal correctly, any bootstrapper (EE
>> > servers specifically) will be able to provide the parsed validation.xml
>> > configuration to the ApacheValidatorConfiguration?
>> >
>> > If so, how will this work with the mappings config files? If for example
>> > I
>> > have my constraints defined in WEB-INF/my-mappings.xml, while
>> > bootstrapping
>> > will I still be able to set the InputStream for that file without bval
>> > trying to do it as well (and not finding this resource at this
>> > location)?
>> > Previously this could be accomplished by specifying
>> > Configuration.ignoreXMLConfiguration, but I don't quite see how that
>> > would
>> > work in this case.
>> >
>> > Thanks,
>> > Mike
>> >
>> >
>> > On Wed, Mar 19, 2014 at 11:11 AM, Romain Manni-Bucau
>> > <rmannibucau@gmail.com>
>> > wrote:
>> >>
>> >> Well if we can avoid to fork/branch tomee before next release would be
>> >> awesome but yes it sonds reasonable and avoiding jvm SPI is awesome
>> >> Romain Manni-Bucau
>> >> Twitter: @rmannibucau
>> >> Blog: http://rmannibucau.wordpress.com/
>> >> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>> >> Github: https://github.com/rmannibucau
>> >>
>> >>
>> >>
>> >> 2014-03-19 17:10 GMT+01:00 Matt Benson <gudnabrsam@gmail.com>:
>> >> > Actually, come to think of it, we don't have to do it as a "services"
>> >> > SPI at all; we can just define the interface and have it be a custom
>> >> > config item for ApacheValidatorConfiguration. This makes it more
>> >> > explicit and TomEE can just specify when bootstrapping--hopefully,
>> >> > anyway. We'll see if there are any gotchas and hopefully we can get
>> >> > it
>> >> > working in a TomEE branch or fork before we set it in stone. Okay?
>> >> >
>> >> > Matt
>> >> >
>> >> > On Wed, Mar 19, 2014 at 11:06 AM, Matt Benson <gudnabrsam@gmail.com>
>> >> > wrote:
>> >> >> Well, in that case I don't see how we can really go wrong there.
>> >> >> I'll
>> >> >> try to remember to do this as I'm hacking BVal in the coming weeks
>> >> >> and
>> >> >> maybe we can then see how it looks in TomEE.
>> >> >>
>> >> >> Matt
>> >> >>
>> >> >> On Wed, Mar 19, 2014 at 11:00 AM, Romain Manni-Bucau
>> >> >> <rmannibucau@gmail.com> wrote:
>> >> >>> that's what I was thinking about but when I hacked 1.1 branch
I was
>> >> >>> really thinking adding it when integrating tomee to avoid a
useless
>> >> >>> or
>> >> >>> wrong SPI.
>> >> >>> Romain Manni-Bucau
>> >> >>> Twitter: @rmannibucau
>> >> >>> Blog: http://rmannibucau.wordpress.com/
>> >> >>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>> >> >>> Github: https://github.com/rmannibucau
>> >> >>>
>> >> >>>
>> >> >>>
>> >> >>> 2014-03-19 16:59 GMT+01:00 Matt Benson <gudnabrsam@gmail.com>:
>> >> >>>> So are you proposing the SPI look more like:
>> >> >>>>
>> >> >>>> public interface DefaultValidationConfigProvider {
>> >> >>>>   org.apache.bval.jsr.xml.ValidationConfigType
>> >> >>>> getDefaultValidationConfig();
>> >> >>>> }
>> >> >>>>
>> >> >>>> ?
>> >> >>>>
>> >> >>>> Matt
>> >> >>>>
>> >> >>>> On Wed, Mar 19, 2014 at 10:57 AM, Romain Manni-Bucau
>> >> >>>> <rmannibucau@gmail.com> wrote:
>> >> >>>>> Cause:
>> >> >>>>> 1) TomEE added some features relying on internal config
>> >> >>>>> (placeholders etc)
>> >> >>>>> 2) TomEE uses its own model for all EE descriptors
whatever the
>> >> >>>>> spec
>> >> >>>>> is
>> >> >>>>>
>> >> >>>>> That's not an issue on BVal side but it will need to
be
>> >> >>>>> integrated
>> >> >>>>> without forking as much as possible
>> >> >>>>>
>> >> >>>>> Romain Manni-Bucau
>> >> >>>>> Twitter: @rmannibucau
>> >> >>>>> Blog: http://rmannibucau.wordpress.com/
>> >> >>>>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>> >> >>>>> Github: https://github.com/rmannibucau
>> >> >>>>>
>> >> >>>>>
>> >> >>>>>
>> >> >>>>> 2014-03-19 16:52 GMT+01:00 Matt Benson <gudnabrsam@gmail.com>:
>> >> >>>>>> Why can't TomEE rely on BVal for parsing? We should
devise
>> >> >>>>>> something
>> >> >>>>>> as simple as possible, whatever the case.
>> >> >>>>>>
>> >> >>>>>> Matt
>> >> >>>>>>
>> >> >>>>>> On Wed, Mar 19, 2014 at 10:45 AM, Romain Manni-Bucau
>> >> >>>>>> <rmannibucau@gmail.com> wrote:
>> >> >>>>>>> well this way we'll need another spi for TomEE
which can't rely
>> >> >>>>>>> on
>> >> >>>>>>> BVal for parsing. That's why I thought sending
the parsing
>> >> >>>>>>> result
>> >> >>>>>>>
>> >> >>>>>>>
>> >> >>>>>>> BTW any urgence on it?
>> >> >>>>>>> Romain Manni-Bucau
>> >> >>>>>>> Twitter: @rmannibucau
>> >> >>>>>>> Blog: http://rmannibucau.wordpress.com/
>> >> >>>>>>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>> >> >>>>>>> Github: https://github.com/rmannibucau
>> >> >>>>>>>
>> >> >>>>>>>
>> >> >>>>>>>
>> >> >>>>>>> 2014-03-19 16:43 GMT+01:00 Matt Benson <mbenson@apache.org>:
>> >> >>>>>>>> I was thinking along the lines Michael
says. e.g.:
>> >> >>>>>>>>
>> >> >>>>>>>> public interface DefaultValidationConfigurationProvider
{
>> >> >>>>>>>>   InputStream getDefaultValidationConfiguration();
>> >> >>>>>>>> }
>> >> >>>>>>>>
>> >> >>>>>>>> Then we use ServiceLoader (functional equivalent
for BVal 1.0,
>> >> >>>>>>>> Java 5)
>> >> >>>>>>>> to find any available implementations.
If none found, we fall
>> >> >>>>>>>> back to:
>> >> >>>>>>>>
>> >> >>>>>>>> class StandardDefaultValidationConfigurationProvider
>> >> >>>>>>>> implements
>> >> >>>>>>>> DefaultValidationConfigurationProvider
{
>> >> >>>>>>>>   final Properties properties;
>> >> >>>>>>>>   StandardDefaultValidationConfigurationProvider(Properties
>> >> >>>>>>>> properties) {
>> >> >>>>>>>>     this.properties = properties;
>> >> >>>>>>>>   }
>> >> >>>>>>>>
>> >> >>>>>>>>   public InputStream getDefaultValidationConfiguration()
{
>> >> >>>>>>>>     // look for property pointing to custom
resource, else
>> >> >>>>>>>> META-INF/validation.xml
>> >> >>>>>>>>     // ensure only one such resource
>> >> >>>>>>>>     // return getResourceAsStream(resourceName)
>> >> >>>>>>>>   }
>> >> >>>>>>>> }
>> >> >>>>>>>>
>> >> >>>>>>>> This way TomEE would simply have to provide:
>> >> >>>>>>>>
>> >> >>>>>>>> WebApplicationDefaultValidationConfigurationProvider
>> >> >>>>>>>> implements
>> >> >>>>>>>> DefaultValidationConfigurationProvider
{
>> >> >>>>>>>>   public InputStream getDefaultValidationConfiguration()
{
>> >> >>>>>>>>     return
>> >> >>>>>>>>
>> >> >>>>>>>> getServletContext().getResourceAsStream("WEB-INF/validation.xml");
>> >> >>>>>>>>   }
>> >> >>>>>>>>
>> >> >>>>>>>>   private static ServletContext getServletContext()
{
>> >> >>>>>>>>     // TBD
>> >> >>>>>>>>   }
>> >> >>>>>>>> }
>> >> >>>>>>>>
>> >> >>>>>>>> Matt
>> >> >>>>>>>>
>> >> >>>>>>>> On Wed, Mar 19, 2014 at 10:28 AM, Romain
Manni-Bucau
>> >> >>>>>>>> <rmannibucau@gmail.com> wrote:
>> >> >>>>>>>>> Actually I'd expect the SPI to give
the processed instance
>> >> >>>>>>>>> and
>> >> >>>>>>>>> not the
>> >> >>>>>>>>> location. That's why i sugegsted to
wait a bit for it to see
>> >> >>>>>>>>> the
>> >> >>>>>>>>> real
>> >> >>>>>>>>> need.
>> >> >>>>>>>>>
>> >> >>>>>>>>>
>> >> >>>>>>>>> Romain Manni-Bucau
>> >> >>>>>>>>> Twitter: @rmannibucau
>> >> >>>>>>>>> Blog: http://rmannibucau.wordpress.com/
>> >> >>>>>>>>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>> >> >>>>>>>>> Github: https://github.com/rmannibucau
>> >> >>>>>>>>>
>> >> >>>>>>>>>
>> >> >>>>>>>>>
>> >> >>>>>>>>> 2014-03-19 16:10 GMT+01:00 Michael
Blyakher
>> >> >>>>>>>>> <michael.blyakher@gmail.com>:
>> >> >>>>>>>>>> How would an SPI like this work?
Would it allow the EE
>> >> >>>>>>>>>> server
>> >> >>>>>>>>>> to specify
>> >> >>>>>>>>>> the location of the validation.xml
(maybe in the form of an
>> >> >>>>>>>>>> InputStream)?
>> >> >>>>>>>>>>
>> >> >>>>>>>>>>
>> >> >>>>>>>>>> On Tue, Mar 18, 2014 at 1:59 PM,
Romain Manni-Bucau
>> >> >>>>>>>>>> <rmannibucau@gmail.com>wrote:
>> >> >>>>>>>>>>
>> >> >>>>>>>>>>> tomee parses it itself and
then create the configuration
>> >> >>>>>>>>>>> itself. I
>> >> >>>>>>>>>>> think we can wait tomee starts
javaee7 to write it since it
>> >> >>>>>>>>>>> should be
>> >> >>>>>>>>>>> very soon (when next release
is done) and it would be the
>> >> >>>>>>>>>>> main
>> >> >>>>>>>>>>> and
>> >> >>>>>>>>>>> more demanding user.
>> >> >>>>>>>>>>> Romain Manni-Bucau
>> >> >>>>>>>>>>> Twitter: @rmannibucau
>> >> >>>>>>>>>>> Blog: http://rmannibucau.wordpress.com/
>> >> >>>>>>>>>>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>> >> >>>>>>>>>>> Github: https://github.com/rmannibucau
>> >> >>>>>>>>>>>
>> >> >>>>>>>>>>>
>> >> >>>>>>>>>>>
>> >> >>>>>>>>>>> 2014-03-18 19:42 GMT+01:00
Matt Benson
>> >> >>>>>>>>>>> <mbenson@apache.org>:
>> >> >>>>>>>>>>> > On Tue, Mar 18, 2014 at
1:01 PM, Michael Blyakher
>> >> >>>>>>>>>>> > <michael.blyakher@gmail.com>
wrote:
>> >> >>>>>>>>>>> >> Hi All,
>> >> >>>>>>>>>>> >>
>> >> >>>>>>>>>>> >> Thanks for the quick
replies, and apologies for not
>> >> >>>>>>>>>>> >> being
>> >> >>>>>>>>>>> >> more specific
>> >> >>>>>>>>>>> - I
>> >> >>>>>>>>>>> >> was quoting the EE
7 Platform spec as I am particularly
>> >> >>>>>>>>>>> >> interested in
>> >> >>>>>>>>>>> using
>> >> >>>>>>>>>>> >> the bval 1.1 implementation
that hasn't been officially
>> >> >>>>>>>>>>> >> released yet.
>> >> >>>>>>>>>>> >>
>> >> >>>>>>>>>>> >> But from what I am
hearing, it is the responsibility of
>> >> >>>>>>>>>>> >> an
>> >> >>>>>>>>>>> >> EE server to
>> >> >>>>>>>>>>> >> handle the WEB-INF
case. I can see how this is possible
>> >> >>>>>>>>>>> >> for
>> >> >>>>>>>>>>> >> the 1.0
>> >> >>>>>>>>>>> >> implementation, as
the server can parse the
>> >> >>>>>>>>>>> >> validation.xml
>> >> >>>>>>>>>>> >> itself and
>> >> >>>>>>>>>>> >> bootstrap the configuration
through the validation spec
>> >> >>>>>>>>>>> >> API's. How would
>> >> >>>>>>>>>>> >> this be done for the
current 1.1 implementation in the
>> >> >>>>>>>>>>> >> bval-1.1 branch
>> >> >>>>>>>>>>> in
>> >> >>>>>>>>>>> >> the repository? I
don't see how the values for the
>> >> >>>>>>>>>>> "executable-validation"
>> >> >>>>>>>>>>> >> element could be provided
to the impl through the
>> >> >>>>>>>>>>> >> validation spec API's.
>> >> >>>>>>>>>>> >>
>> >> >>>>>>>>>>> >
>> >> >>>>>>>>>>> > Well, the
>> >> >>>>>>>>>>>
>> >> >>>>>>>>>>>
>> >> >>>>>>>>>>> http://bval.apache.org/mvnsite/bval-jsr303/apidocs/org/apache/bval/jsr303/ApacheValidatorConfiguration.Properties.html#VALIDATION_XML_PATH
>> >> >>>>>>>>>>> > property can be used to
point to a different resource on
>> >> >>>>>>>>>>> > the
>> >> >>>>>>>>>>> > classpath, but I can't
find any mechanism that could be
>> >> >>>>>>>>>>> > used
>> >> >>>>>>>>>>> > to hook
>> >> >>>>>>>>>>> > up WEB-INF/validation.xml,
and I can't find how TomEE
>> >> >>>>>>>>>>> > does
>> >> >>>>>>>>>>> > it, so
>> >> >>>>>>>>>>> > AFAICT you have indeed
found what I consider a problem.
>> >> >>>>>>>>>>> > Off
>> >> >>>>>>>>>>> > the top of
>> >> >>>>>>>>>>> > my head I think we could
solve it by adding a simple SPI
>> >> >>>>>>>>>>> > to
>> >> >>>>>>>>>>> > discover
>> >> >>>>>>>>>>> > the default validation
configuration resource. Thoughts?
>> >> >>>>>>>>>>> >
>> >> >>>>>>>>>>> > Matt
>> >> >>>>>>>>>>> >
>> >> >>>>>>>>>>> >> Thanks,
>> >> >>>>>>>>>>> >> Michael
>> >> >>>>>>>>>>> >>
>> >> >>>>>>>>>>> >>
>> >> >>>>>>>>>>> >> On Tue, Mar 18, 2014
at 12:13 PM, Romain Manni-Bucau
>> >> >>>>>>>>>>> >> <rmannibucau@gmail.com>wrote:
>> >> >>>>>>>>>>> >>
>> >> >>>>>>>>>>> >>> Hi
>> >> >>>>>>>>>>> >>>
>> >> >>>>>>>>>>> >>> Bval only looks
in META-INF but TomEE for instance
>> >> >>>>>>>>>>> >>> (more
>> >> >>>>>>>>>>> >>> generally EE
>> >> >>>>>>>>>>> >>> servers) handles
WEB-INF case.
>> >> >>>>>>>>>>> >>> Romain Manni-Bucau
>> >> >>>>>>>>>>> >>> Twitter: @rmannibucau
>> >> >>>>>>>>>>> >>> Blog: http://rmannibucau.wordpress.com/
>> >> >>>>>>>>>>> >>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>> >> >>>>>>>>>>> >>> Github: https://github.com/rmannibucau
>> >> >>>>>>>>>>> >>>
>> >> >>>>>>>>>>> >>>
>> >> >>>>>>>>>>> >>>
>> >> >>>>>>>>>>> >>> 2014-03-18 17:50
GMT+01:00 Michael Blyakher <
>> >> >>>>>>>>>>> michael.blyakher@gmail.com>:
>> >> >>>>>>>>>>> >>> > Hi,
>> >> >>>>>>>>>>> >>> >
>> >> >>>>>>>>>>> >>> > Where is
the validation.xml supposed to be for a web
>> >> >>>>>>>>>>> >>> > archive?
The
>> >> >>>>>>>>>>> bval
>> >> >>>>>>>>>>> >>> > spec's only
indicate the "META-INF/validation.xml"
>> >> >>>>>>>>>>> >>> > location,
but the
>> >> >>>>>>>>>>> EE
>> >> >>>>>>>>>>> >>> > platform
spec indicates that for a web archive this
>> >> >>>>>>>>>>> >>> > location
must be
>> >> >>>>>>>>>>> >>> > "WEB-INF/validation.xml".
>> >> >>>>>>>>>>> >>> >
>> >> >>>>>>>>>>> >>> > EE.5.17 -
"The name of the descriptor is
>> >> >>>>>>>>>>> >>> > WEB-INF/validation.xml
for
>> >> >>>>>>>>>>> web
>> >> >>>>>>>>>>> >>> > modules and
META-INF/validation.xml for all other
>> >> >>>>>>>>>>> >>> > types
>> >> >>>>>>>>>>> >>> > of modules."
>> >> >>>>>>>>>>> >>> >
>> >> >>>>>>>>>>> >>> > Given this,
I don't see anywhere in the bval 1.0 or
>> >> >>>>>>>>>>> >>> > 1.1
>> >> >>>>>>>>>>> >>> > code that
>> >> >>>>>>>>>>> handles
>> >> >>>>>>>>>>> >>> > this. Am
I missing something or does this
>> >> >>>>>>>>>>> >>> > implementation
>> >> >>>>>>>>>>> >>> > not handle
>> >> >>>>>>>>>>> this
>> >> >>>>>>>>>>> >>> > case for
web archives?
>> >> >>>>>>>>>>> >>> >
>> >> >>>>>>>>>>> >>> > Thanks,
>> >> >>>>>>>>>>> >>> > Michael
>> >> >>>>>>>>>>> >>>
>> >> >>>>>>>>>>>
>> >
>> >
>
>

Mime
View raw message