The inputValidators are not meant to be coupled with the Peer system.
If you wanted a Windows2000LoginValidator, you could write it, and
then use it in any application.
My example of using peer.getInputValidator(SOME_COLUMN), actually
handles almost all our (the stuff I work on) needs.
The turbine stuff is only one front end, we use the Peer stuff in
other (non-web) applications that access the same data. Having
the peer binding allows for a write once definition. No other
applications that use the peer, need to re-write the same definitions.
> It is most likely that people will use a database, but what if people
> are writing simple apps where the data is stored in flat files, or
> we create a Turbine app that is a front-end for modify LDAP entries?
> How would we validate LDAP entries using what you have committed.
I COMPLETELY agree with you. That's why the inputValidators are
not coupled with any specific object. You can use them in form
definitions, with a specific peer, or whatever.
>From the stuff I see and the stuff I have used Turbine for,
a majority of input validation can be done by defining a single attribute
for the column. It's easy, it's quick, it has no learning curve.
And absolutely, it will not handle every situation. All
I wanted was a hook so that I can use my own input validation.
I am not specifiying a policy, only a mechanism. Also, if you
don't use it, there is no code bulk.
So the last thing I want to do is ruffle feathers :) I think Turbine
is great, and now refuse to do any web development without it.
Another alternative would be that if the inputValidator attribute is
set for a column, then a singleton based utility is used to form
the association between the peer/column and the validator.
In the Peer code you would have:
static {
util = TheTool.getInstance();
util.add(peer, Column, "org.apache..EmailValidator");
}
Then in your code...
iv = util.getValidator(peer, column);
iv.validate(input)
<or>
util.validate(peer, parameterParser)
<or>
map.put("email", new EmailValidator());
map.put("name", new NotEmptyValidor());
util.validate(map, parameterParser);
We can drop the set/get stuff out of BasePeer.
Only Peers that define the attribute get the static code.
I still need the set/get stuff in Column.java
This could be a win-win. You get your decoupling, I get
the hook so people can use their own mechanism for input validation.
mike
(hopefully, I can go to java-one, and we can meet and discuss
this with a bunch of napkins).
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]