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 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.
 Validator createValidator()
          Create a validator.
protected  Object getDelayedResult(Source source)
          Get a delayed result.
 ErrorHandler getErrorHandler()
           
 LSResourceResolver getResourceResolver()
           
 String getSchemaLanguage()
           
 String getSchemaLocations()
           
 Schema getSchemaObject()
           
 Map<String,Boolean> getValidatorFeatures()
           
 Map<String,Object> getValidatorProperties()
           
 javax.xml.stream.XMLInputFactory getXMLInputFactory()
           
 void initialise()
          Method used to perform any initialisation work.
 boolean isReturnResult()
           
 boolean isUseStaxSource()
           
protected  InputStream loadSchemaStream(String schemaLocation)
           
protected  Source loadSource(MuleMessage msg)
          Load the source from the specified object.
 void setErrorHandler(ErrorHandler errorHandler)
           
 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(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 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 Object getDelayedResult(Source source)
Get a delayed result.

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

loadSource

protected Source loadSource(MuleMessage msg)
                     throws Exception
Load the source from the specified object.

Parameters:
msg - Encompassing message
Returns:
The source
Throws:
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 InputStream loadSchemaStream(String schemaLocation)
                                throws IOException
Throws:
IOException

createValidator

public Validator createValidator()
                          throws SAXException
Create a validator.

Returns:
The validator.
Throws:
SAXException

getSchemaLocations

public String getSchemaLocations()

setSchemaLocations

public void setSchemaLocations(String schemaLocations)

getSchemaLanguage

public String getSchemaLanguage()

setSchemaLanguage

public void setSchemaLanguage(String schemaLanguage)

getSchemaObject

public Schema getSchemaObject()

setSchemaObject

public void setSchemaObject(Schema schemaObject)

getErrorHandler

public ErrorHandler getErrorHandler()

setErrorHandler

public void setErrorHandler(ErrorHandler errorHandler)

getResourceResolver

public LSResourceResolver getResourceResolver()

setResourceResolver

public void setResourceResolver(LSResourceResolver resourceResolver)

getValidatorFeatures

public Map<String,Boolean> getValidatorFeatures()

setValidatorFeatures

public void setValidatorFeatures(Map<String,Boolean> validatorFeatures)

getValidatorProperties

public Map<String,Object> getValidatorProperties()

setValidatorProperties

public void setValidatorProperties(Map<String,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-2009 MuleSource, Inc.. All Rights Reserved.