Return-Path: Delivered-To: apmail-myfaces-dev-archive@www.apache.org Received: (qmail 85831 invoked from network); 23 Nov 2010 13:05:26 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 23 Nov 2010 13:05:26 -0000 Received: (qmail 28499 invoked by uid 500); 23 Nov 2010 12:59:18 -0000 Delivered-To: apmail-myfaces-dev-archive@myfaces.apache.org Received: (qmail 27298 invoked by uid 500); 23 Nov 2010 12:59:16 -0000 Mailing-List: contact dev-help@myfaces.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "MyFaces Development" Delivered-To: mailing list dev@myfaces.apache.org Received: (qmail 27118 invoked by uid 99); 23 Nov 2010 12:59:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 Nov 2010 12:59:15 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of rdebusscher@gmail.com designates 209.85.214.53 as permitted sender) Received: from [209.85.214.53] (HELO mail-bw0-f53.google.com) (209.85.214.53) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 Nov 2010 12:59:11 +0000 Received: by bwz7 with SMTP id 7so8075986bwz.12 for ; Tue, 23 Nov 2010 04:58:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:x-goomoji-body:date:message-id:subject:from:to :content-type; bh=cPss5MK5ymPXlwmrQOaWB7K0YpVG+8iFvz+FrqH5mhc=; b=ElmGeTQbXcjfSGiVa1EkfDi0jS/ui0ec39JVHWVddm4r32zZ8M6M+Y5V72wV/yrN1S GDG4PKBSemkYEci8m6qesBeRBJU0Fw2DGHR20BNj9baKqOpV011lm4rgjZCdqKu4klwR aSM6shOLd197XzE2XJDhuXLmPUpKE2eNg9xNE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:x-goomoji-body:date:message-id :subject:from:to:content-type; b=B0i1BP4g96S47PxyVohh+GWGZv3PcCckA906MsJviBSrVU7fDm/g1duMtUaU/zD5Aj ktG+wFpzx84QIqefaL5nrCiPobf/LPIpC54MlhXjU8dy1HgIVbWDST/Ioy4J3ss3d3GH O0iYrhrMaSM0236y812cP06gLVzk1AudakEyg= MIME-Version: 1.0 Received: by 10.204.52.134 with SMTP id i6mr6630146bkg.27.1290517129418; Tue, 23 Nov 2010 04:58:49 -0800 (PST) Received: by 10.204.70.11 with HTTP; Tue, 23 Nov 2010 04:58:49 -0800 (PST) In-Reply-To: References: X-Goomoji-Body: true Date: Tue, 23 Nov 2010 13:58:49 +0100 Message-ID: Subject: Re: [Codi] Idea for new functionality: method parameter validation From: Rudy De Busscher To: MyFaces Development Content-Type: multipart/related; boundary=001636c5bfdd135f3b0495b7ef2c --001636c5bfdd135f3b0495b7ef2c Content-Type: multipart/alternative; boundary=001636c5bfdd135f360495b7ef2b --001636c5bfdd135f360495b7ef2b Content-Type: text/plain; charset=ISO-8859-1 I'll clean up the code a bit and try to post it here on thursday. regards Rudy. On 22 November 2010 22:24, Gerhard wrote: > hi, > > -1 > we would only have disadvantages with such a dependency between both > frameworks. > > since we have a bv module in codi for bv artifacts which are enhanced via > cdi mechanisms - we should implement it there. > > regards, > gerhard > > http://www.irian.at > > Your JSF powerhouse - > JSF Consulting, Development and > Courses in English and German > > Professional Support for Apache MyFaces > > > > 2010/11/22 Jakob Korherr > >> ... sorry.. I meant "CODI and ext-val". >> >> 2010/11/22 Jakob Korherr >> >> Hi Rudy, >>> >>> Nice idea! >>> >>> If we don't want to put it directly into CODI, we could create a CODI >>> add-on for it in ext-val, because CODI and ext-cdi kinda overlap here. >>> >>> Regards, >>> Jakob >>> >>> 2010/11/22 Gerhard >>> >>> hi rudy, >>>> >>>> basically it's a nice idea. >>>> for further discussions we would need your implementation. >>>> >>>> regards, >>>> gerhard >>>> >>>> http://www.irian.at >>>> >>>> Your JSF powerhouse - >>>> JSF Consulting, Development and >>>> Courses in English and German >>>> >>>> Professional Support for Apache MyFaces >>>> >>>> >>>> >>>> 2010/11/22 Rudy De Busscher >>>> >>>> Hi all, >>>>> >>>>> BeanValidation is promoted as *THE validation framework* in the EE >>>>> environment. it can already be used in JPA and JSF. In the future they >>>>> plan to have it also in other areas like JAX-RS. >>>>> >>>>> Another area where we could start using it, is with CDI. With the >>>>> creation of an Interceptor, it is possible to develop a mechanism that allow >>>>> validation of method parameter values. >>>>> >>>>> Aparently Apache BVal is taking this up (thx Gerhard for the input, see >>>>> here >>>>> http://carinae.net/2010/04/automatic-validation-method-calls-with-jsr-303-appendix-c/), but a generic solution could be made available in Codi. Since there is >>>>> no method forseen in the BeanValidation spec to validate a value based on an >>>>> annotation (only methods for validating a property within a class or a >>>>> complete object), I was forced to create a hack with dynamically created >>>>> classes. >>>>> >>>>> But in a POC I was able to use the following declarations >>>>> >>>>> * @ParameterValidation >>>>> public String sayHelloMinimumLength(@Size(min = 3) String name) { >>>>> return "Hello "+name; >>>>> } >>>>> >>>>> @ParameterValidation >>>>> public String sayHello(@NotNull @Valid Person person) { >>>>> return "Hello "+person.getLastName(); >>>>> }* >>>>> >>>>> And I did some small (but successful) tests in the following >>>>> environments >>>>> - Plain SE (JUnit tests) >>>>> - Tomcat 6 >>>>> - JBoss 6 (M5) >>>>> >>>>> The performance is also acceptable. Executing 1000 tests on the >>>>> sayHelloMinimumLength method as described above, adds about 300 ms (in >>>>> total, so 0.3 ms per call). >>>>> >>>>> So with this message I would like to have the opinion of the community >>>>> about adding such functionality to Codi. I think we have 3 options: >>>>> >>>>> 1) Add it to Codi itself (I think the BV module is the best candidate) >>>>> 2) Put the logic in an add-on because it is useful but not all projects >>>>> can/will use it. >>>>> 3) Spend our time to other topics because it is useless. [?] >>>>> >>>>> If you like the idea, I do some further work on the code an supply a >>>>> patch or the add-on. >>>>> >>>>> Regards >>>>> Rudy. >>>>> >>>>> >>>> >>> >>> >>> -- >>> Jakob Korherr >>> >>> blog: http://www.jakobk.com >>> twitter: http://twitter.com/jakobkorherr >>> work: http://www.irian.at >>> >> >> >> >> -- >> Jakob Korherr >> >> blog: http://www.jakobk.com >> twitter: http://twitter.com/jakobkorherr >> work: http://www.irian.at >> > > --001636c5bfdd135f360495b7ef2b Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I'll clean up the code a bit and try to post it here on thursday.
regards
Rudy.

On 22 November 2010 22= :24, Gerhard <gerhard.petracek@gmail.com> wrote:
hi,

-1
we would only have disadvantages with such a dependency = between both frameworks.

since we have a bv module in codi for bv artifacts whic= h are enhanced via cdi mechanisms - we should implement it there.

regards,
gerhard

http://www.irian.at

Y= our JSF powerhouse -
JSF Consulting, Development and
Courses in Engli= sh and German

Professional Support for Apache MyFaces



2010/11/22 Jakob Korherr <jakob.korherr@gmail.com>
... sorry.. I meant "CODI and ext-val".

2010/11/22 Jakob Korherr <jakob.korherr@gmail.com>

Hi Rudy,

Nice idea!

If we don't want to put it directly i= nto CODI, we could create a CODI add-on for it in ext-val, because CODI and= ext-cdi kinda overlap here.

Regards,
Jakob

2010/11/22 Gerhard <gerhard.petracek@gmail.com>

hi rudy,

basically it's a nice idea.
for f= urther discussions we would need your implementation.

<= div>regards,
gerhard

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in = English and German

Professional Support for Apache MyFaces



2010/11/22 Rudy De Bussch= er <rdebusscher@gmail.com>

Hi all,

BeanValidation is promoted as THE validation framework in the EE environment. =A0it can already be used in JPA and JSF. =A0In th= e future they plan to have it also in other areas like JAX-RS.

Anoth= er area where we could start using it, is with CDI. =A0With the creation of= an Interceptor, it is possible to develop a mechanism that allow validatio= n of method parameter values.

Aparently Apache BVal is taking this up (thx Gerhard for the input, see= here http://carinae.net/2010/04/a= utomatic-validation-method-calls-with-jsr-303-appendix-c/ ), but a gene= ric solution could be made available in Codi. =A0Since there is no method f= orseen in the BeanValidation spec to validate a value based on an annotatio= n (only methods for validating a property within a class or a complete obje= ct), I was forced to create a hack with dynamically created classes.

But in a POC I was able to use the following declarations

= =A0 =A0@ParameterValidation
=A0 =A0public String sayHelloMinimumLength(= @Size(min =3D 3) String name) {
=A0 =A0 =A0 =A0return "Hello "= ;+name;
=A0 =A0}

=A0 =A0@ParameterValidation
=A0 =A0public String sayHello(@NotNull= @Valid Person person) {
=A0 =A0 =A0 =A0return "Hello "+perso= n.getLastName();
=A0 =A0}


And I did some small (but successf= ul) tests in the following environments
- Plain SE (JUnit tests)
- Tomcat 6
- JBoss 6 (M5)

The perform= ance is also acceptable. =A0Executing 1000 tests on the sayHelloMinimumLeng= th method as described above, adds about 300 ms (in total, so 0.3 ms per ca= ll).

So with this message I would like to have the opinion of the community = about adding such functionality to Codi. =A0I think we have 3 options:
<= br>1) Add it to Codi itself (I think the BV module is the best candidate) 2) Put the logic in an add-on because it is useful but not all projects can= /will use it.
3) Spend our time to other topics because it is useless. <= img goomoji=3D"gtalk.330" style=3D"margin: 0pt 0.2ex; vertical-align: middl= e;" src=3D"cid:gtalk.330@goomoji.gmail">

If you like the idea, I do some further work on the code an supply a pa= tch or the add-on.

Regards
Rudy.





--
Jakob Korherr

blog: http://www.jakobk.com
twitter: http://twitter.com/jakobkorherr
work:
http://www.irian.at=


--001636c5bfdd135f360495b7ef2b-- --001636c5bfdd135f3b0495b7ef2c Content-Type: image/png; name="330.png" Content-Transfer-Encoding: base64 X-Attachment-Id: gtalk.330@goomoji.gmail Content-ID: iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAABGdBTUEAANbY1E9YMgAAAhpJREFU KFNdUt9Lk2EU/q6l9VXbnP1Qu4i6yD8gXKOLwCySQZi5EMQI06gGdiku6K7UvvzRMMLWZXUZYfZD WHURXVQQ5pqrdIaUa6hlQ8bZ9z6d835sq154+M573vO85znP9xoAjCLI2uyhftd5/j6kG74URX2f OJ7gXA9/fX/XlkmD5uG+xopcoM6FtqYaIN2u0dZUi0DdRkSOVKzTgHnsHyKTGunm9vUGvw93xw8h k+yAWurSkFhyDf4qFG5VE9cGNZEluGnIvahmjgOrEeDXPWDtAfC904HEklvtg0q2goa9WeZsNVj/ BXtyH7B8DlA5xGIxWJYFZC9rlPZ8JjX2Uz+Y0ysdH6kPzVx0FrJM02QdhtOFUdrL+tHtdB1yPzfY vc/aiEyXPguHwwgGeYyfMY3SXtbSGeBrB2hs27xB0aoycXkAyCeB3LPyjBJLTs408ZQQ0yL1sTYm 242Fyf1lwn/QZyJ1Vkt9Keb02E/q9eDvxnZi+s5ufIsfxNp0s4bEknsbrXbMmQqIOZeko5dGPGnp mp9vR3qiHu/Hd+FVvwevByt1LLn8Av/b1EnQiHeFrm3a4TyAKxsuFu7vBVb4Rp6VFk/j90yLhsS2 SEyFULhdq/j1tApHOu6hYU9CvTkKlWiBHT8A9fGEdk+gZkOOvFFvhkkhIRWJnTRameDb0nR9ywu6 6rJ4+Cl27gtjjuM4zxRheTVFkuAPpRIkcs7CiskAAAAASUVORK5CYII= --001636c5bfdd135f3b0495b7ef2c--