dhartford wrote:
Reading through the spec, it looks like the only way to take advantage of JSR-303 implementations is presently documented as annotations. There is a section 7.1 that mentions deployment descriptors, but it is not populated and I am concerned that this will be a second-class citizen and/or implementors ignore this piece due to the perception of second-class citizen.
Hi
The reason why XML has not been populated is because that's a moving target. When annotations and the meta model will be settled, creating the XML DD will be just a matter of transposition. No need to do the job several times. There should be pretty much a one-to-one equivalence between the annotations model and the XML model.
There is no particular agenda besides the initial specification proposal.
That being said, I am quite in favor of annotations and the need for XML DD is, I, think quite marginal and for the fun of it I will ague that with you :)
Quote:
* Clean code models that may have varying validations could be implemented as deployment descriptor files instead of multiple coded models to support different annotation methods.
You can use
http://in.relation.to/Bloggers/BeanValidationSneakPeekPartIIIGroupsAndPartialValidation to apply different validations to the same model. That being said, constraints should generally be mutualized and annotations are great for that.
Quote:
* Tool support that will focus on the deployment descriptor files without having to modify the code.
Tooling support these days spend a lot of energy keeping XML DD and Java Code in sync. Using annotations makes things easier, not harder for them.
Quote:
* Allow compiled applications to change their behavior by modifying deployment descriptors instead of having to recompile (assuming you have the source code -- someone could deploy a pre-built JEE application, but still allow deployment/installation customizations without a coder).
I don't think this is a compelling feature. I have yet to find interesting use cases where you can change constraints on the fly without unit testing your application except when using rule engines. If you test it, compiling it is the least of your issue.
A rule engine externalizes the constraint logic from the constraint rules. But the actual constraint declaration stays in place.
Quote:
I view validations as both data integrity tools as well as business rules -- I would like to strongly support that XML deployment descriptors are still given equal support instead of being a second-class citizen behind annotations.
The spec will treat annotations and XML DD in an equal foot. People will then make their mind from here.
Quote:
p.s. Most good solutions to problems should have common ground and can be solved in multiple languages. A strongly supported XML deployment descriptor format allow for a validation-framework to be implemented in Java, Ruby, .NET, PHP, etc.
Many of the language you describe indeed have some sort of metadata support in the language itself. Bean Validation can be applied easily in ruby and .Net, not sure about PHP but ahem ;)