Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Updated doco to use factory implementation

...

The component is pretty simple and straightforward; its configured with a schema document and optionally an error handler implementing factory implementing the MessageAwareErrorHandlerFactory interface. This factory produces an error handler which conforms to the MessageAwareErrorHandler interface.  If the inbound document is valid, it continues on its way to the ultimate destination. Otherwise a fault is returned in the message exchange.

...

Code Block
xml
xml
<sm:activationSpec componentName="SchemaValidator" service="foo:SchemaValidator" endpoint="SchemaValidator">
    <sm:component>
        <bean class="org.apache.servicemix.components.validation.ValidateComponent">
            <property name="schemaResource" value="classpath:org/apache/servicemix/components/validation/schema.xsd"/>
            <property name="errorHandlererrorHandlerFactory" ref="messageAggregatingErrorHandlermessageAggregatingErrorHandlerFactory"/>
        </bean>
    </sm:component>
</sm:activationSpec>

...

Code Block
xml
xml
<bean id="messageAggregatingErrorHandlermessageAggregatingErrorHandlerFactory" class="org.apache.servicemix.components.validation.MessageAggregatingErrorHandlerMessageAggregatingErrorHandlerFactory">
    <constructor-arg<property indexname="0rootPath" value="Fault/payload/messages"/>
    <constructor-arg<property indexname="1namespace" value="http://www.servicemix.org/fault"/>
    <constructor-arg<property indexname="2includeStackTraces" value="false"/>
</bean>
</beans>

Only the first two properties are mandatory, the includeStackTraces property will default to false and is included in the above configuration to highlight it's use.  If it is set to true the error handler will Constructor arg zero is the rootPath;
constructor arg one is the namespace; and
constructor arg two is an optional boolean value that if true will output stacktraces of the error messages into the fault xml.