org.mule.module.xml.filters
Class SchemaValidationFilter

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

public class SchemaValidationFilter
extends AbstractJaxpFilter
implements Filter, Initialisable

Filter for schema validation.

Author:
Ryan Heaton

Field Summary
static java.lang.String DEFAULT_SCHEMA_LANGUAGE
           
protected  Log logger
           
 
Fields inherited from interface org.mule.api.lifecycle.Initialisable
PHASE_NAME
 
Constructor Summary
SchemaValidationFilter()
           
 
Method Summary
 boolean accept(MuleMessage message)
          Accepts the message if schema validation passes.
 javax.xml.validation.Validator createValidator()
          Create a validator.
protected  java.lang.Object getDelayedResult(javax.xml.transform.Source source)
          Get a delayed result.
 org.xml.sax.ErrorHandler getErrorHandler()
           
 org.w3c.dom.ls.LSResourceResolver getResourceResolver()
           
 java.lang.String getSchemaLanguage()
           
 java.lang.String getSchemaLocations()
           
 javax.xml.validation.Schema getSchemaObject()
           
 java.util.Map<java.lang.String,java.lang.Boolean> getValidatorFeatures()
           
 java.util.Map<java.lang.String,java.lang.Object> getValidatorProperties()
           
 javax.xml.stream.XMLInputFactory getXMLInputFactory()
           
 void initialise()
          Method used to perform any initialisation work.
 boolean isReturnResult()
           
 boolean isUseStaxSource()
           
protected  java.io.InputStream loadSchemaStream(java.lang.String schemaLocation)
           
protected  javax.xml.transform.Source loadSource(MuleMessage msg)
          Load the source from the specified object.
 void setErrorHandler(org.xml.sax.ErrorHandler errorHandler)
           
 void setResourceResolver(org.w3c.dom.ls.LSResourceResolver resourceResolver)
           
 void setReturnResult(boolean returnResult)
           
 void setSchemaLanguage(java.lang.String schemaLanguage)
           
 void setSchemaLocations(java.lang.String schemaLocations)
           
 void setSchemaObject(javax.xml.validation.Schema schemaObject)
           
 void setUseStaxSource(boolean useStaxSource)
           
 void setValidatorFeatures(java.util.Map<java.lang.String,java.lang.Boolean> validatorFeatures)
           
 void setValidatorProperties(java.util.Map<java.lang.String,java.lang.Object> validatorProperties)
           
 void setXMLInputFactory(javax.xml.stream.XMLInputFactory xmlInputFactory)
           
 
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

DEFAULT_SCHEMA_LANGUAGE

public static final java.lang.String DEFAULT_SCHEMA_LANGUAGE
See Also:
Constant Field Values

logger

protected transient Log logger
Constructor Detail

SchemaValidationFilter

public SchemaValidationFilter()
Method Detail

accept

public boolean accept(MuleMessage message)
Accepts the message if schema validation passes.

Specified by:
accept in interface Filter
Parameters:
message - The message.
Returns:
Whether the message passes schema validation.

getDelayedResult

protected java.lang.Object getDelayedResult(javax.xml.transform.Source source)
Get a delayed result.

Parameters:
source - The source.
Returns:
The result.

loadSource

protected javax.xml.transform.Source loadSource(MuleMessage msg)
                                         throws java.lang.Exception
Load the source from the specified object.

Parameters:
msg - Encompassing message
Returns:
The source
Throws:
java.lang.Exception

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

loadSchemaStream

protected java.io.InputStream loadSchemaStream(java.lang.String schemaLocation)
                                        throws java.io.IOException
Throws:
java.io.IOException

createValidator

public javax.xml.validation.Validator createValidator()
                                               throws org.xml.sax.SAXException
Create a validator.

Returns:
The validator.
Throws:
org.xml.sax.SAXException

getSchemaLocations

public java.lang.String getSchemaLocations()

setSchemaLocations

public void setSchemaLocations(java.lang.String schemaLocations)

getSchemaLanguage

public java.lang.String getSchemaLanguage()

setSchemaLanguage

public void setSchemaLanguage(java.lang.String schemaLanguage)

getSchemaObject

public javax.xml.validation.Schema getSchemaObject()

setSchemaObject

public void setSchemaObject(javax.xml.validation.Schema schemaObject)

getErrorHandler

public org.xml.sax.ErrorHandler getErrorHandler()

setErrorHandler

public void setErrorHandler(org.xml.sax.ErrorHandler errorHandler)

getResourceResolver

public org.w3c.dom.ls.LSResourceResolver getResourceResolver()

setResourceResolver

public void setResourceResolver(org.w3c.dom.ls.LSResourceResolver resourceResolver)

getValidatorFeatures

public java.util.Map<java.lang.String,java.lang.Boolean> getValidatorFeatures()

setValidatorFeatures

public void setValidatorFeatures(java.util.Map<java.lang.String,java.lang.Boolean> validatorFeatures)

getValidatorProperties

public java.util.Map<java.lang.String,java.lang.Object> getValidatorProperties()

setValidatorProperties

public void setValidatorProperties(java.util.Map<java.lang.String,java.lang.Object> validatorProperties)

getXMLInputFactory

public javax.xml.stream.XMLInputFactory getXMLInputFactory()

setXMLInputFactory

public void setXMLInputFactory(javax.xml.stream.XMLInputFactory xmlInputFactory)

isUseStaxSource

public boolean isUseStaxSource()

setUseStaxSource

public void setUseStaxSource(boolean useStaxSource)

isReturnResult

public boolean isReturnResult()

setReturnResult

public void setReturnResult(boolean returnResult)


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