Spring Web Services Framework

org.springframework.xml.xsd.commons
Class CommonsXsdSchemaCollection

java.lang.Object
  extended by org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection
All Implemented Interfaces:
InitializingBean, ResourceLoaderAware, XsdSchemaCollection

public class CommonsXsdSchemaCollection
extends Object
implements XsdSchemaCollection, InitializingBean, ResourceLoaderAware

Implementation of the XsdSchemaCollection that uses Apache WS-Commons XML Schema.

Setting the inline flag to true will result in all referenced schemas (included and imported) being merged into the referred schema. When including the schemas into a WSDL, this greatly simplifies the deloyment of the schemas.

Since:
1.5.0
Author:
Arjen Poutsma
See Also:
Commons XML Schema

Constructor Summary
CommonsXsdSchemaCollection()
          Constructs a new, empty instance of the CommonsXsdSchemaCollection.
CommonsXsdSchemaCollection(Resource[] resources)
          Constructs a new instance of the CommonsXsdSchemaCollection based on the given resources.
 
Method Summary
 void afterPropertiesSet()
           
 XmlValidator createValidator()
          Creates a XmlValidator based on the schemas contained in this collection.
 XsdSchema[] getXsdSchemas()
          Returns all schemas contained in this collection.
 void setInline(boolean inline)
          Defines whether included schemas should be inlinded into the including schema.
 void setResourceLoader(ResourceLoader resourceLoader)
           
 void setUriResolver(URIResolver uriResolver)
          Sets the WS-Commons uri resolver to use when resolving (relative) schemas.
 void setValidationEventHandler(ValidationEventHandler validationEventHandler)
          Sets the WS-Commons validation event handler to use while parsing schemas.
 void setXsds(Resource[] xsdResources)
          Sets the schema resources to be loaded.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CommonsXsdSchemaCollection

public CommonsXsdSchemaCollection()
Constructs a new, empty instance of the CommonsXsdSchemaCollection.

A subsequent call to the setXsds(Resource[]) is required.


CommonsXsdSchemaCollection

public CommonsXsdSchemaCollection(Resource[] resources)
Constructs a new instance of the CommonsXsdSchemaCollection based on the given resources.

Parameters:
resources - the schema resources to load
Method Detail

setXsds

public void setXsds(Resource[] xsdResources)
Sets the schema resources to be loaded.

Parameters:
xsdResources - the schema resources to be loaded

setInline

public void setInline(boolean inline)
Defines whether included schemas should be inlinded into the including schema.

Defaults to false.


setValidationEventHandler

public void setValidationEventHandler(ValidationEventHandler validationEventHandler)
Sets the WS-Commons validation event handler to use while parsing schemas.


setUriResolver

public void setUriResolver(URIResolver uriResolver)
Sets the WS-Commons uri resolver to use when resolving (relative) schemas.

Default is an internal subclass of DefaultURIResolver which correctly handles schemas on the classpath.


setResourceLoader

public void setResourceLoader(ResourceLoader resourceLoader)
Specified by:
setResourceLoader in interface ResourceLoaderAware

afterPropertiesSet

public void afterPropertiesSet()
                        throws IOException
Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
IOException

getXsdSchemas

public XsdSchema[] getXsdSchemas()
Description copied from interface: XsdSchemaCollection
Returns all schemas contained in this collection.

Specified by:
getXsdSchemas in interface XsdSchemaCollection
Returns:
the schemas contained in this collection

createValidator

public XmlValidator createValidator()
                             throws IOException
Description copied from interface: XsdSchemaCollection
Creates a XmlValidator based on the schemas contained in this collection.

Specified by:
createValidator in interface XsdSchemaCollection
Returns:
a validator for this collection
Throws:
IOException - in case of I/O errors

toString

public String toString()
Overrides:
toString in class Object

Spring Web Services Framework

Copyright © 2005-2010 The Spring Web Services Framework. All Rights Reserved.