org.mule.module.json.transformers
Class JsonSchemaXsdValidationFilter

java.lang.Object
  extended by org.mule.module.xml.filters.AbstractJaxpFilter
      extended by org.mule.module.xml.filters.SchemaValidationFilter
          extended by org.mule.module.json.transformers.JsonSchemaXsdValidationFilter
All Implemented Interfaces:
MuleContextAware, Initialisable, Filter, JsonSchemaFilter

public class JsonSchemaXsdValidationFilter
extends SchemaValidationFilter
implements JsonSchemaFilter

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.


Field Summary
protected  JsonToXml jToX
           
protected  MuleContext muleContext
           
 
Fields inherited from class org.mule.module.xml.filters.SchemaValidationFilter
DEFAULT_SCHEMA_LANGUAGE, logger
 
Fields inherited from interface org.mule.api.lifecycle.Initialisable
PHASE_NAME
 
Constructor Summary
JsonSchemaXsdValidationFilter()
           
 
Method Summary
 boolean accept(MuleMessage msg)
           
 void initialise()
           
 void setMuleContext(MuleContext muleContext)
           
 void setSchemaLocations(String schemaLocations)
           
 
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, setSchemaObject, setUseStaxSource, setValidatorFeatures, setValidatorProperties, setXMLInputFactory
 
Methods inherited from class org.mule.module.xml.filters.AbstractJaxpFilter
getDocumentBuilderFactory, setDocumentBuilderFactory, toDOMNode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.mule.module.json.transformers.JsonSchemaFilter
createValidator, getErrorHandler, getResourceResolver, getSchemaLanguage, getSchemaLocations, getSchemaObject, getValidatorFeatures, getValidatorProperties, getXMLInputFactory, isReturnResult, isUseStaxSource, setErrorHandler, setResourceResolver, setReturnResult, setSchemaLanguage, setSchemaObject, setUseStaxSource, setValidatorFeatures, setValidatorProperties, setXMLInputFactory
 

Field Detail

muleContext

protected MuleContext muleContext

jToX

protected JsonToXml jToX
Constructor Detail

JsonSchemaXsdValidationFilter

public JsonSchemaXsdValidationFilter()
Method Detail

accept

public boolean accept(MuleMessage msg)
Specified by:
accept in interface Filter
Overrides:
accept in class SchemaValidationFilter

setMuleContext

public void setMuleContext(MuleContext muleContext)
Specified by:
setMuleContext in interface MuleContextAware

initialise

public void initialise()
                throws InitialisationException
Specified by:
initialise in interface Initialisable
Overrides:
initialise in class SchemaValidationFilter
Throws:
InitialisationException

setSchemaLocations

public void setSchemaLocations(String schemaLocations)
Specified by:
setSchemaLocations in interface JsonSchemaFilter
Overrides:
setSchemaLocations in class SchemaValidationFilter


Copyright © 2003–2014 MuleSoft, Inc.. All rights reserved.