org.mule.module.json.transformers
Class JsonSchemaValidationFilter
java.lang.Object
org.mule.module.xml.filters.AbstractJaxpFilter
org.mule.module.xml.filters.SchemaValidationFilter
org.mule.module.json.transformers.JsonSchemaValidationFilter
- All Implemented Interfaces:
- MuleContextAware, Initialisable, Filter
public class JsonSchemaValidationFilter
- extends SchemaValidationFilter
- implements MuleContextAware
Validate a JSON string against an XML schema.
Note:
Ideally, this would call the Validator using STAX. Unfortunately,
1. xalan.jar is needed to avoid bugs in the version of Xalan built into the JRE
2. Xalan does not work with STAX
3. Having Xalan in the classpath overrides the default (STAX-compliant) factories for transformations, validators,
etc with ones that aren't STAX-compliant
The result is that, while the ideal would be to implement this class by validating a STAXSource, that won't be
possible until either we can assume a JRE with bith STAX and a working Xalan fork, or there';s a xalan.jar
that supports StAX.
Methods inherited from class org.mule.module.xml.filters.SchemaValidationFilter |
createValidator, getDelayedResult, getErrorHandler, getResourceResolver, getSchemaLanguage, getSchemaLocations, getSchemaObject, getValidatorFeatures, getValidatorProperties, getXMLInputFactory, isReturnResult, isUseStaxSource, loadSchemaStream, loadSource, setErrorHandler, setResourceResolver, setReturnResult, setSchemaLanguage, setSchemaLocations, setSchemaObject, setUseStaxSource, setValidatorFeatures, setValidatorProperties, setXMLInputFactory |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
muleContext
protected MuleContext muleContext
jToX
protected JsonToXml jToX
JsonSchemaValidationFilter
public JsonSchemaValidationFilter()
accept
public boolean accept(MuleMessage msg)
- Description copied from class:
SchemaValidationFilter
- Accepts the message if schema validation passes.
- Specified by:
accept
in interface Filter
- Overrides:
accept
in class SchemaValidationFilter
- Parameters:
msg
- The message.
- Returns:
- Whether the message passes schema validation.
setMuleContext
public void setMuleContext(MuleContext muleContext)
- Specified by:
setMuleContext
in interface MuleContextAware
initialise
public void initialise()
throws InitialisationException
- Description copied from interface:
Initialisable
- Method used to perform any initialisation work. If a fatal error occurs during
initialisation an
InitialisationException
should be thrown,
causing the Mule instance to shutdown. If the error is recoverable, say by
retrying to connect, a RecoverableException
should be thrown.
There is no guarantee that by throwing a Recoverable exception that the Mule
instance will not shut down.
- Specified by:
initialise
in interface Initialisable
- Overrides:
initialise
in class SchemaValidationFilter
- Throws:
InitialisationException
- if a fatal error occurs causing the Mule instance to shutdown
RecoverableException
- if an error occurs that can be recovered from
Copyright © 2003-2012 MuleSoft, Inc.. All Rights Reserved.