[ https://issues.apache.org/activemq/browse/SM-525?page=all ]
Guillaume Nodet resolved SM-525. -------------------------------- Fix Version/s: 3.0-M3 Resolution: Fixed Assignee: Grant McDonald Author: gnodet Date: Wed Aug 9 17:20:48 2006 New Revision: 430194 URL: http://svn.apache.org/viewvc?rev=430194&view=rev Log: SM-525: Enhancement to ValidateComponent to implement a complete and flexible error handling scheme for schema validation Patch provided by Grant McDonald Added: incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/validation/MessageAggregatingErrorHandler.java incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/validation/MessageAwareErrorHandler.java Modified: incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/validation/CountingErrorHandler.java incubator/servicemix/trunk/servicemix-components/src/main/java/org/apache/servicemix/components/validation/ValidateComponent.java incubator/servicemix/trunk/servicemix-components/src/test/java/org/apache/servicemix/components/validation/ValidationTest.java incubator/servicemix/trunk/servicemix-components/src/test/resources/org/apache/servicemix/components/validation/example.xml > Enhancement to ValidateComponent to implement a complete and flexible error > handling scheme for schema validation > ----------------------------------------------------------------------------------------------------------------- > > Key: SM-525 > URL: https://issues.apache.org/activemq/browse/SM-525 > Project: ServiceMix > Issue Type: Improvement > Components: servicemix-components > Environment: Ubuntu Linux 5.10, Windows XP SP2, ServiceMix HEAD > Reporter: Grant McDonald > Assigned To: Grant McDonald > Fix For: 3.0-M3 > > Attachments: servicemix-components.zip > > Original Estimate: 30 minutes > Remaining Estimate: 30 minutes > > The purpose of this enchancement was to provide the following: > 1) Allow error messages to be captured by the ValidateComponent and sent back > as the content of a fault message; > 2) Preserve existing functionality; and > 3) Provide a framework for extending the functionality > It was noted that the existing functionality only dealt with simple case > valid or not valid schemas. It was decided to make the standard component > more extensible and functional and as such this code is being contributed > back to the ServiceMix project. To this end the following changes have been > made and are available in the attached zip file: > 1) Added MessageAwareErrorHandler interface - this interface extends the > org.xml.sax.ErrorHandler interface and adds contracts for determining if the > error handler has errors, whether it captures messages from the validator, > and what message formats it supports. > 2) Refactored CountingErrorHandler to extend from MessageAwareErrorHandler > and implement the above mentioned methods > 3) Created MessageAggregatingErrorHandler - this class aggregates all > warning, error and fatal error messages into an XML format (via CDATA). It > provides the ability to set the root document path and namespace via > configuration and supports DOMSource, StringSource and String formats for the > encapsulated data. > 4) modified ValidateComponent - added errorHandler property to facilitate > dependency injection, with a default value of CountingErrorHandler to > preserve existing functionality. Refactored the handling of validation > errors to use the new interfaces. errorHandlers which do not support the > capturing of messages will use the previous method of sending the DOMResult > back as the fault message content. errorHandlers which do support the > capture of messages will send the error message xml back as the fault message > content. The src document is now set as a property on the fault message. > Additionally, a null pointer check was added to the init on the > schemaResource.getURL() method call. > A testcase has been added to ValidationTest and the example.xml in the > validation test/resources package demonstrates the configuration of this > functionality. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/activemq/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira