org.springframework.xml.xsd.commons
Class CommonsXsdSchemaCollection

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

public class CommonsXsdSchemaCollection
extends Object
implements XsdSchemaCollection, org.springframework.beans.factory.InitializingBean, org.springframework.context.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(org.springframework.core.io.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(org.springframework.core.io.ResourceLoader resourceLoader)
           
 void setUriResolver(org.apache.ws.commons.schema.resolver.URIResolver uriResolver)
          Sets the WS-Commons uri resolver to use when resolving (relative) schemas.
 void setValidationEventHandler(org.apache.ws.commons.schema.ValidationEventHandler validationEventHandler)
          Sets the WS-Commons validation event handler to use while parsing schemas.
 void setXsds(org.springframework.core.io.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(org.springframework.core.io.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(org.springframework.core.io.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(org.apache.ws.commons.schema.ValidationEventHandler validationEventHandler)
Sets the WS-Commons validation event handler to use while parsing schemas.


setUriResolver

public void setUriResolver(org.apache.ws.commons.schema.resolver.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(org.springframework.core.io.ResourceLoader resourceLoader)
Specified by:
setResourceLoader in interface org.springframework.context.ResourceLoaderAware

afterPropertiesSet

public void afterPropertiesSet()
                        throws IOException
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.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


Copyright © 2010. All Rights Reserved.