net.javacrumbs.springws.test.validator
Class SchemaRequestValidator

java.lang.Object
  extended by net.javacrumbs.springws.test.validator.SchemaRequestValidator
All Implemented Interfaces:
RequestProcessor, org.springframework.beans.factory.InitializingBean, org.springframework.core.Ordered

public class SchemaRequestValidator
extends java.lang.Object
implements org.springframework.beans.factory.InitializingBean, RequestProcessor, org.springframework.core.Ordered

Validates message using provided schema(s). Similar to the AbstractValidatingInterceptor.

Author:
Lukas Krecan

Field Summary
protected  org.apache.commons.logging.Log logger
           
 
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Constructor Summary
SchemaRequestValidator()
           
 
Method Summary
 void afterPropertiesSet()
           
 int getOrder()
           
 java.lang.String getSchemaLanguage()
           
 org.springframework.core.io.Resource[] getSchemas()
          Returns the schema resources to use for validation.
 SchemaValidator getSchemaValidator()
           
 org.springframework.xml.validation.XmlValidator getValidator()
           
 org.springframework.ws.WebServiceMessage processRequest(java.net.URI uri, org.springframework.ws.WebServiceMessageFactory messageFactory, org.springframework.ws.WebServiceMessage request)
          Processes the request.
 void setOrder(int order)
           
 void setSchema(org.springframework.core.io.Resource schema)
          Sets the schema resource to use for validation.
 void setSchemaLanguage(java.lang.String schemaLanguage)
          Sets the schema language.
 void setSchemas(org.springframework.core.io.Resource[] schemas)
          Sets the schema resources to use for validation.
 void setSchemaValidator(SchemaValidator schemaValidator)
           
 void setValidator(org.springframework.xml.validation.XmlValidator validator)
           
 void setXsdSchema(org.springframework.xml.xsd.XsdSchema schema)
          Sets the XsdSchema to use for validation.
 void setXsdSchemaCollection(org.springframework.xml.xsd.XsdSchemaCollection schemaCollection)
          Sets the XsdSchemaCollection to use for validation.
protected  void validateRequest(java.net.URI uri, org.springframework.ws.WebServiceMessage message)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger
Constructor Detail

SchemaRequestValidator

public SchemaRequestValidator()
Method Detail

processRequest

public org.springframework.ws.WebServiceMessage processRequest(java.net.URI uri,
                                                               org.springframework.ws.WebServiceMessageFactory messageFactory,
                                                               org.springframework.ws.WebServiceMessage request)
                                                        throws java.io.IOException
Description copied from interface: RequestProcessor
Processes the request. It can either validate the request or generate a response based on the request. Can return null if it does not apply to given request or throw an exception if appropriate.

Specified by:
processRequest in interface RequestProcessor
Returns:
Throws:
java.io.IOException

validateRequest

protected void validateRequest(java.net.URI uri,
                               org.springframework.ws.WebServiceMessage message)
                        throws java.io.IOException
Throws:
java.io.IOException

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.io.IOException
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
java.io.IOException

getSchemaLanguage

public java.lang.String getSchemaLanguage()

setSchemaLanguage

public void setSchemaLanguage(java.lang.String schemaLanguage)
Sets the schema language. Default is the W3C XML Schema: http://www.w3.org/2001/XMLSchema".

See Also:
XmlValidatorFactory.SCHEMA_W3C_XML, XmlValidatorFactory.SCHEMA_RELAX_NG

getSchemas

public org.springframework.core.io.Resource[] getSchemas()
Returns the schema resources to use for validation.


setSchema

public void setSchema(org.springframework.core.io.Resource schema)
Sets the schema resource to use for validation. Setting this property, xsdSchemaCollection, schema, or schemas is required.


setSchemas

public void setSchemas(org.springframework.core.io.Resource[] schemas)
Sets the schema resources to use for validation. Setting this property, xsdSchemaCollection, schema, or schemas is required.


setXsdSchema

public void setXsdSchema(org.springframework.xml.xsd.XsdSchema schema)
                  throws java.io.IOException
Sets the XsdSchema to use for validation. Setting this property, xsdSchemaCollection, schema, or schemas is required.

Parameters:
schema - the xsd schema to use
Throws:
java.io.IOException - in case of I/O errors

setXsdSchemaCollection

public void setXsdSchemaCollection(org.springframework.xml.xsd.XsdSchemaCollection schemaCollection)
                            throws java.io.IOException
Sets the XsdSchemaCollection to use for validation. Setting this property, xsdSchema, schema, or schemas is required.

Parameters:
schemaCollection - the xsd schema collection to use
Throws:
java.io.IOException - in case of I/O errors

getValidator

public org.springframework.xml.validation.XmlValidator getValidator()

setValidator

public void setValidator(org.springframework.xml.validation.XmlValidator validator)

getOrder

public int getOrder()
Specified by:
getOrder in interface org.springframework.core.Ordered

setOrder

public void setOrder(int order)

getSchemaValidator

public SchemaValidator getSchemaValidator()

setSchemaValidator

public void setSchemaValidator(SchemaValidator schemaValidator)


Copyright © 2011. All Rights Reserved.