Class JsonSchemaValidationFilter

  extended by org.mule.module.xml.filters.AbstractJaxpFilter
      extended by org.mule.module.xml.filters.SchemaValidationFilter
          extended by 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.

Field Summary
protected  JsonToXml jToX
protected  MuleContext muleContext
Fields inherited from class org.mule.module.xml.filters.SchemaValidationFilter
Fields inherited from interface org.mule.api.lifecycle.Initialisable
Constructor Summary
Method Summary
 boolean accept(MuleMessage msg)
          Accepts the message if schema validation passes.
 void initialise()
          Method used to perform any initialisation work.
 void setMuleContext(MuleContext muleContext)
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 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

Field Detail


protected MuleContext muleContext


protected JsonToXml jToX
Constructor Detail


public JsonSchemaValidationFilter()
Method Detail


public boolean accept(MuleMessage msg)
Description copied from class: SchemaValidationFilter
Accepts the message if schema validation passes.

Specified by:
accept in interface Filter
accept in class SchemaValidationFilter
msg - The message.
Whether the message passes schema validation.


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


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
initialise in class SchemaValidationFilter
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.