commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Don Brown <mr...@twdata.org>
Subject Re: [validator] BSF script validator
Date Tue, 25 May 2004 16:19:46 GMT
Done, but how does maven handle building /contrib code? Or do we assume 
if someone wants to build the code, they will copy it and its unit tests 
over into the main directories first?

Don

David Graham wrote:

>Go ahead an open a bugzilla ticket for code to be attached to.  If we're
>going to distribute validators like this they should probably be in a
>separate download so the core validator framework stays separate and we
>can manage dependencies better.
>
>David
>
>--- Don Brown <mrdon@twdata.org> wrote:
>  
>
>>I wrote a validator that uses scripting snippets to determine validity. 
>>
>>The validator uses Jakarta BSF so supports any scripting language 
>>supported by BSF like BeanShell, JavaScript, Jython, Groovy (I believe),
>>
>>etc.
>>
>>I was starting to refactor out my app's validation code to be usable by 
>>commons-validator, when I realized most of the resulting validations 
>>ended up being one line.  For example, to make sure a particular 
>>employee existed, the validation was simply "empFacade.getEmployee(key) 
>>!= null".  Rather than writing a ton of one line validator or shoving 
>>them all into one umbrella validator, I decided to write this validator.
>>
>>
>>Here is an example of its use:
>>
>><field property="value" depends="bsf">
>>  <var>
>>    <var-name>eval</var-name>
>>    <var-value>value.equals("foo")</var-value>
>>  </var>
>></field>
>>
>>The validator works and the unit tests pass, but I'm still working on a 
>>clean way to pass it business objects.  Right now, if you want to put 
>>variables in the scope, you need to create your own BSFManager and 
>>BSFEngine beforehand and add them as Validator parameters.  For simple 
>>cases with just BeanShell, neither are required, just the usual target 
>>object and Field.
>>
>>Again, I can submit the code, unit tests, and patches if needed.  I 
>>certainly do appreciate how flexible validator is to be able to support 
>>many types of implementations.
>>
>>Don
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>>
>>    
>>
>
>
>
>	
>		
>__________________________________
>Do you Yahoo!?
>Yahoo! Domains – Claim yours for only $14.70/year
>http://smallbusiness.promotions.yahoo.com/offer 
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message