batchee-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <rmannibu...@gmail.com>
Subject Re: Looking for help on how to add bean validation to BatchProperty injection
Date Wed, 11 Nov 2015 17:18:21 GMT
Hi Scott,

here are the few points I have in mind and which I think we should consider
before just doing a validate(jbatchComponent):

- [potential JBatch API enhancement]  CDI has method validation for CDI
beans already, JBatch is not super friendly with that yet but nothing
prevents us to become - I'd love jbatch to be JAXRS like in term of API and
no more coupled to a type/interface we dont really need in term of runtime
(@Processor TheOutput myProcess(ThePayload instanceToProcess,
@BatchProperty("myConfig") String file, ....) to make a single sample).
This would mean free integration with all frameworks on most of features
including validation and much more since most of transversal features are
done through interception.

- [technical perspective] validating @JBatchProperty values can be done
through CDI/BVal integration using the setters or the constructor instead
of the fieds injection. Open point is: do we want to validate fields
directly in jbatch backbone? The question here is then: do we validate
fields or the jbatch component/instance as a whole? If we validate only
fields it sounds weird to me cause  we have to use
Validator#validateProperty but the only place we have the property would be
the jbatch property bean/producer cause CDI instance can be proxied and
then we wouldnt have the instance itself (said otherwise we are not 100%
sure to be able to call it properly). If we validate the whole instance the
question is then how to define a lifecycle since the user can expect to get
validation done between iterations or only initially depending if he
modifies or not values - which strictly speaking if probably a bad practise
but not forbidden by the spec and can even be required scoping a component.
To summarize this thought, I would push to CDI the field validation
question being said other validations are already built-in AFAIK.


Does it make sense - sorry for the big paragraph ;)?



Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-11-11 8:34 GMT-08:00 Scott Kurz <skurz3@gmail.com>:

> Hi,
>
> As you know if you've been watching the 1.1 spec mailing list, I've been
> thinking of adding the ability to do bean validation upon BatchProperty
> injection (spec Bug 7291).
>
> I would like to code something out but figured I'd stop and ask because
> Romain, I know you have a lot of knowledge here...
>
> So I believe there's already integration between bval & CDI in EE, and of
> course we can use CDI to inject these batch properties today.
>
> Do you know what's missing then?  What's the next step?
>
> Any suggestions appreciated..thanks,
> Scott
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message