|
From: Thierry T. <te...@ya...> - 2005-05-11 07:23:05
|
Matt and Michael, Some works are made on commons validator and valang in the spring modules project... Thierry --- "Michael E. Moores" <mm...@re...> a écrit: > Is Valang abstracted from MVC and http requests? > I need a validator that I can plug into my POJOs, > which are app server > classes, > NOT web server classes. > > Matt Raible wrote: > > > Hey guys, > > > > I have the following section in one of my Spring > Live chapters. I > > haven't seen much activity on the "declarative > validation" front in > > Spring MVC - so I want to make sure this is still > valid. > > > > Thanks, > > > > Matt > > > > *Springs Future Declarative Validation Framework > > *At the time of this writing, Commons Validator is > the only > > declarative validation framework that's been > released to support > > Spring MVC. There is another declarative validator > (the _Valang > > Validator_) that's part of the Spring Modules > project, but it hasn't > > been released yet. As far as declarative > validation being part of > > Spring - there are plans for it, but it hasn't > been developed yet. I > > asked Keith Donald to provide me with a few > details about it, and here > > are the key features/differentiators he sent me: > > A simple, consistent interface for defining new > validation rules > > (rule providers simply implement a single "boolean > test(argument)" > > method). > > Support for bean property expressions (for > example, minProperty must > > be less than maxProperty). The property access > strategy will be > > pluggable and not limited to java beans (for > example, allowing > > map-backed storage, or buffered "form objects" on > the rich client side > > of the house). > > Support for complex nested expressions > (and/or/not), and all > > relational operators (>, >=, <, <=, !=, ==). > > Support for applying different sets of rules > based on context or > > use-case. > > A reporting subsystem capable of iterating over > rule structures, > > performing validation, and capturing/generating > error message results. > > This allows you to assemble complex rules > on-the-fly without having to > > hard code a lot of static messages; the reporter > is capable of > > generating rule messages from the underlying > structures automatically. > > Report field typing hints (the rules associated > with a field to let > > the user know what they're expected to type). > > Integration with Spring Rich Client Platform > (RCP) and Spring MVC > > environments. > > > > ------------------------------------------------------- > This SF.Net email is sponsored by Oracle Space > Sweepstakes > Want to be the first software developer in space? > Enter now for the Oracle Space Sweepstakes! > http://ads.osdn.com/?ad_ids93&alloc_id281&op=click > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > Take a look at my blog: http://templth.blogspot.com/ __________________________________________________________________ Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails ! Créez votre Yahoo! Mail sur http://fr.mail.yahoo.com/ |
|
From: Oliver H. <Ol...@ou...> - 2005-05-11 22:36:13
|
Steven, > I didn't know Keith had plans for a declarative validation solution. > I'm looking forward to hear his ideas on the subject. Keith's already started work on his declarative validation framework! The code is in the sandbox's org.springframework.rules package. There's also a page about it in the wiki: http://opensource.atlassian.com/confluence/spring/display/DOC/Declarativ e+Validation?focusedCommentId=3D132 From my (very brief) look at what you've done with Valang it appears there is a strong synergy between the 2 projects. Your functions and predicates packages have a lot of similarities with Keith's closure and constraint packages. I suspect that it wouldn't be hard to reimplement your Valang parser so that it generated Keith's Rules.=20 Ollie |
|
From: Steven D. <ste...@gm...> - 2005-05-12 09:22:55
|
Thanks for the pointer Oliver. I couldn't find the declarative part of
Keith rules system in the sandbox but I guess it's a work in progress.
For me the declarative part is the most important part of a validation
tool. How the back-end is implemented is of minor importance to me as
long as it does restrict the validation functionality. The predicates
offered by commons collections are a perfect fit for me. It allows the
valang parser to return a common interface that's reusable elsewhere.
Based on Keith's wish list I feel valang currently fulfills them all
except the second to last:
* We want a framework that focuses on validating business
objects, not one that is coupled with the presentation tier or any
view, form, or controller technology.
Valang does this but implementing Spring's Validator interface.
* We want a framework that makes it easy to define new rules, and
makes rules top-level-objects that can be reused in other contexts
(and are not tightly coupled with the framework.)
Valang uses the Predicate interface from commons collections
and as such creates rules that are reusable elsewhere.
* We want a framework which supports expressions using relational
operators (<,>,<=3D,>=3D,=3D=3D,!), logical operators (and/or), and
conditionals to allow for the creation of semantic business rules in
addition to simple syntax checks.
The valang parser offers a range of language constructs that
go beyond these requirements and that will be extended over time.
* We want a framework that is capable of reporting rich,
internationalized validation results on rule evaluation.
Valang offers i18n support, thanks to feedback of C=E8sar Ordi=F1ana=
.
* We want a framework that is capable of generating typing hints
and other visual indicators for rules that constrain bean property
values to enhance an application's usability and overall user
experience.
I'm not sure what the requirements are but I'm sire this can be ad=
ded.
* And for the Swing crowd, we want something that works just as
well in a web-app environment as it does in a rich-client environment.
For me this is a duplicate of the first requirement.
Regarding the design goals I think valang also scores a number of hits:
* The design should make it extremely easy to define new rules
and integrate those rules into the rest of the framework.
I'm not sure if "rule" means an actual rule (ex. "age >=3D 18")
or an operator test. Adding rules to valang is extremely simple. The
way valang handles operator test is currenlty sub-optimal when it
comes to extending but this can be improved.
o To facilitate this, the design should decouple rule
evaluation from results reporting.
Valang does this.
* The design should cleary decouple the validation of values from
how those values are retrieved. This allows the value checks to be
more easily reused.
Valang retrieves bean values in one place. This mechanism is
currently not pluggable but this can also be improved, for example by
means of the visitor pattern.
o For example, the act of retrieving a bean property value
should be decoupled from taking that value and testing it against one
or more constraints. The constraints should have no knowledge of how
the value was obtained.
Valang does this.
* The design should provide pluggable rules sources. Initially we
plan to support programatically defined sources and commons-attributes
sources, but others such as xml-based or scripting based should be
possible.
Although the factory bean currently does not support this you
could for example provide your own predicate instance instead of
having them created by valang parser.
* The design should leverage Spring's existing infrastructure
where appropriate and should in general not re-invent the wheel.
I think valang currenlty does this but I'm sure there's room
for improvement.
* The framework should provide a library of out-of-the-box rules
and regularly integrate back community contributions over time.
Valang does this I think. I've incorporate all the feedback I
received thus far. Valang is currently scheduled for release with
spring modules 0.3.
In general valang isn't final yet. I'm happy to discuss with anyone
how valang can be improved. I'm also open to merge valang with other
initiatives for the sake of creating the most usable and flexible
tool. There currently aren't a lot of solutions available in
declarative validation land and valang is currently nothing more than
a attempt to provide a solution.
I thinks its strongest point is the parser that can be an alternative
to programmatic declaration. I keep extending the parser's
functionality and while we keep the discussion of how declarative
validation should be done alive we will have a strong evaluation
language available if and when we will have an outcome.
Steven
On 5/12/05, Oliver Hutchison <Ol...@ou...> wrote:
> Steven,
>=20
> > I didn't know Keith had plans for a declarative validation solution.
> > I'm looking forward to hear his ideas on the subject.
>=20
> Keith's already started work on his declarative validation framework!
> The code is in the sandbox's org.springframework.rules package. There's
> also a page about it in the wiki:
> http://opensource.atlassian.com/confluence/spring/display/DOC/Declarativ
> e+Validation?focusedCommentId=3D132
>=20
> From my (very brief) look at what you've done with Valang it appears
> there is a strong synergy between the 2 projects. Your functions and
> predicates packages have a lot of similarities with Keith's closure and
> constraint packages. I suspect that it wouldn't be hard to reimplement
> your Valang parser so that it generated Keith's Rules.
>=20
> Ollie
>=20
> -------------------------------------------------------
> This SF.Net email is sponsored by Oracle Space Sweepstakes
> Want to be the first software developer in space?
> Enter now for the Oracle Space Sweepstakes!
> http://ads.osdn.com/?ad_ids93&alloc_id=16281&opclick
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>=20
>=20
--=20
"If you want to be a different fish, you gotta jump out of the school."
-- Captain Beefheart
|
|
From: Oliver H. <Ol...@ou...> - 2005-05-13 01:35:50
|
> Thanks for the pointer Oliver. I couldn't find the=20
> declarative part of Keith rules system in the sandbox but I=20
> guess it's a work in progress.
The Rules class is where you declare your validation. eg.
new Rules(Owner.class) {
protected void initRules() {
add("firstName", getNameValueConstraint());
add("lastName", getNameValueConstraint());
add(not(eqProperty("firstName", "lastName")));
add("address", required());
}
private Constraint getNameValueConstraint() {
return all(new Constraint[] { required(), maxLength(25),
regexp("[a-zA-Z]*", "alphabetic") });
}
};
This code is out the pet clinic sample app for SpringRich.
Ollie
|