I've made some validation enhancements as per
https://jira.duraspace.org/browse/FCREPO-1026, these are currently in the
fcrepo-1026 branch on GitHub. Some documentation is in the Fedora 3.6
documentation space at
https://wiki.duraspace.org/display/FEDORA36/Validation
I've some questions on how far to take this, so feedback is welcomed.
The current implementation:
* allows configuration of the XML ingest validation via a new DOManager
fedora.fcfg parameter (with a suitable warning in the documentation about
decreasing the level of validation)
* allows all objects to be validated when they are modified, with the API
operation being failed if the resulting object would be invalid
Object validation is configured via spring (see doobjectvalidator.xml in the
server/config/spring directory) - by default it is turned off, so
out-of-the-box there's no performance hit. This feature enables for
instance ECM validation to be turned on for every object modification to
enforce repository content conformance with the CModel specification via
ECM. Certainly this isn't for everyone, but there are use cases. Custom
validators can be written and added that validate the Java Fedora object
(rather than the XML). Any number of validators can be added, these will
execute in turn until (if) one fails.
Questions and thoughts:
* HTTP response code for REST API operations: Currently if an ingest fails
XML validation this is reported via HTTP status code 500 (Server Error). To
maintain consistency with the existing behaviour, object validation failures
will also result in this code, with the text of the exception containing
details of the validation failure. I'd suggest that maybe 400 - Bad Request
[1] might be more appropriate for both of these; but this would essentially
represent a REST API change - would that be acceptable for a Fedora 3.6
release? If this change was made I'd suggest implementing this by catching
ObjectValidityException at the API level, and extending this exception to
contain details of the validation failure for the response body (rather than
the 500 exception reporting that occurs currently).
* Validate API method. Currently this performs the ECM validation as it did
in previous releases. This could be modified to perform object validation
as specified in the spring config for this - would this make sense? It
should be configurable so that custom validation can be plugged into the
validate API method *without* enforcing validation on object commital of
course.
* Comments on the implementation and code in that branch are most welcome
Thanks
Steve
[1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Fedora-commons-developers mailing list
Fedora-commons-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fedora-commons-developers