org.mule.module.json.transformers
Class JsonSchemaValidationFilter

java.lang.Object
  extended by org.mule.module.json.transformers.JsonSchemaValidationFilter
All Implemented Interfaces:
MuleContextAware, Initialisable, Filter, JsonSchemaFilter

public class JsonSchemaValidationFilter
extends Object
implements JsonSchemaFilter

Validate a JSON string against either an XML schema or Json schema depending on the schema location attribute.


Field Summary
protected  JsonSchemaFilter delegate
           
 
Fields inherited from interface org.mule.api.lifecycle.Initialisable
PHASE_NAME
 
Constructor Summary
JsonSchemaValidationFilter()
           
 
Method Summary
 boolean accept(MuleMessage msg)
          Check a given message against this filter.
 Validator createValidator()
           
 ErrorHandler getErrorHandler()
           
 LSResourceResolver getResourceResolver()
           
 String getSchemaLanguage()
           
 String getSchemaLocations()
           
 Schema getSchemaObject()
           
 Map<String,Boolean> getValidatorFeatures()
           
 Map<String,Object> getValidatorProperties()
           
 XMLInputFactory getXMLInputFactory()
           
 void initialise()
          Method used to perform any initialisation work.
protected  boolean isJsonSchema(String schema)
           
 boolean isReturnResult()
           
 boolean isUseStaxSource()
           
 void setErrorHandler(ErrorHandler errorHandler)
           
 void setMuleContext(MuleContext muleContext)
           
 void setResourceResolver(LSResourceResolver resourceResolver)
           
 void setReturnResult(boolean returnResult)
           
 void setSchemaLanguage(String schemaLanguage)
           
 void setSchemaLocations(String schemaLocations)
           
 void setSchemaObject(Schema schemaObject)
           
 void setUseStaxSource(boolean useStaxSource)
           
 void setValidatorFeatures(Map<String,Boolean> validatorFeatures)
           
 void setValidatorProperties(Map<String,Object> validatorProperties)
           
 void setXMLInputFactory(XMLInputFactory xmlInputFactory)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

delegate

protected JsonSchemaFilter delegate
Constructor Detail

JsonSchemaValidationFilter

public JsonSchemaValidationFilter()
Method Detail

accept

public boolean accept(MuleMessage msg)
Description copied from interface: Filter
Check a given message against this filter.

Specified by:
accept in interface Filter
Parameters:
msg - a non null message to filter.
Returns:
true if the message matches the filter

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
Throws:
InitialisationException - if a fatal error occurs causing the Mule instance to shutdown
RecoverableException - if an error occurs that can be recovered from

isJsonSchema

protected boolean isJsonSchema(String schema)

setSchemaLocations

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

getSchemaLocations

public String getSchemaLocations()
Specified by:
getSchemaLocations in interface JsonSchemaFilter

createValidator

public Validator createValidator()
                          throws SAXException
Specified by:
createValidator in interface JsonSchemaFilter
Throws:
SAXException

getSchemaLanguage

public String getSchemaLanguage()
Specified by:
getSchemaLanguage in interface JsonSchemaFilter

getSchemaObject

public Schema getSchemaObject()
Specified by:
getSchemaObject in interface JsonSchemaFilter

setSchemaObject

public void setSchemaObject(Schema schemaObject)
Specified by:
setSchemaObject in interface JsonSchemaFilter

getErrorHandler

public ErrorHandler getErrorHandler()
Specified by:
getErrorHandler in interface JsonSchemaFilter

setErrorHandler

public void setErrorHandler(ErrorHandler errorHandler)
Specified by:
setErrorHandler in interface JsonSchemaFilter

getResourceResolver

public LSResourceResolver getResourceResolver()
Specified by:
getResourceResolver in interface JsonSchemaFilter

setResourceResolver

public void setResourceResolver(LSResourceResolver resourceResolver)
Specified by:
setResourceResolver in interface JsonSchemaFilter

getValidatorFeatures

public Map<String,Boolean> getValidatorFeatures()
Specified by:
getValidatorFeatures in interface JsonSchemaFilter

setValidatorFeatures

public void setValidatorFeatures(Map<String,Boolean> validatorFeatures)
Specified by:
setValidatorFeatures in interface JsonSchemaFilter

getValidatorProperties

public Map<String,Object> getValidatorProperties()
Specified by:
getValidatorProperties in interface JsonSchemaFilter

setValidatorProperties

public void setValidatorProperties(Map<String,Object> validatorProperties)
Specified by:
setValidatorProperties in interface JsonSchemaFilter

getXMLInputFactory

public XMLInputFactory getXMLInputFactory()
Specified by:
getXMLInputFactory in interface JsonSchemaFilter

setXMLInputFactory

public void setXMLInputFactory(XMLInputFactory xmlInputFactory)
Specified by:
setXMLInputFactory in interface JsonSchemaFilter

isUseStaxSource

public boolean isUseStaxSource()
Specified by:
isUseStaxSource in interface JsonSchemaFilter

setUseStaxSource

public void setUseStaxSource(boolean useStaxSource)
Specified by:
setUseStaxSource in interface JsonSchemaFilter

isReturnResult

public boolean isReturnResult()
Specified by:
isReturnResult in interface JsonSchemaFilter

setReturnResult

public void setReturnResult(boolean returnResult)
Specified by:
setReturnResult in interface JsonSchemaFilter

setSchemaLanguage

public void setSchemaLanguage(String schemaLanguage)
Specified by:
setSchemaLanguage in interface JsonSchemaFilter


Copyright © 2003-2014 MuleSoft, Inc.. All Rights Reserved.