org.opensaml.common.xml
Class SAMLSchemaBuilder

java.lang.Object
  extended by org.opensaml.common.xml.SAMLSchemaBuilder

public class SAMLSchemaBuilder
extends java.lang.Object

A convience builder for creating Schemas for validating SAML 1_0, 1_1, and 2_0. Additional schema may be registered by addExtensionSchema(String) with the given argument a relative or absolute path that will be resolved against the classpath. Note that relative paths are relative to this class. Also, schema files must be provided in the order they are referenced, that is if schema B depends on schema A then schema A must appear first in the list of registered extension schemas. Schemas may use a schema location attribute. These schema locations will be resolved by the ClasspathResolver. If schema locations are used they will be resolved and will meet the aformentioned schema ordering requirement. The schema objects produced here are thread safe and should be re-used, to that end the schema builder will cache created schema using SoftReferences, allowing the VM to reclaim the memory used by schemas if necesary.


Constructor Summary
SAMLSchemaBuilder()
           
 
Method Summary
 void addExtensionSchema(java.lang.String schema)
          Registers a new schema extension.
 java.util.List<java.lang.String> getExtensionSchema()
          Gets an unmodifiable list of currently registered schema extension.
static javax.xml.validation.Schema getSAML10Schema()
          Gets a schema that can validate SAML 1.0, 2.0, and all registered extensions.
static javax.xml.validation.Schema getSAML11Schema()
          Gets a schema that can validate SAML 1.1, 2.0, and all registered extensions.
 void removeSchema(java.lang.String schema)
          Removes a currently registered schema.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SAMLSchemaBuilder

public SAMLSchemaBuilder()
Method Detail

getSAML10Schema

public static javax.xml.validation.Schema getSAML10Schema()
                                                   throws org.xml.sax.SAXException
Gets a schema that can validate SAML 1.0, 2.0, and all registered extensions.

Returns:
schema that can validate SAML 1.0, 2.0, and all registered extensions
Throws:
org.xml.sax.SAXException - thrown if a schema object can not be created

getSAML11Schema

public static javax.xml.validation.Schema getSAML11Schema()
                                                   throws org.xml.sax.SAXException
Gets a schema that can validate SAML 1.1, 2.0, and all registered extensions.

Returns:
schema that can validate SAML 1.1, 2.0, and all registered extensions
Throws:
org.xml.sax.SAXException - thrown if a schema object can not be created

getExtensionSchema

public java.util.List<java.lang.String> getExtensionSchema()
Gets an unmodifiable list of currently registered schema extension.

Returns:
unmodifiable list of currently registered schema extension

addExtensionSchema

public void addExtensionSchema(java.lang.String schema)
Registers a new schema extension. The schema location will be searched for on the classpath.

Parameters:
schema - new schema extension

removeSchema

public void removeSchema(java.lang.String schema)
Removes a currently registered schema.

Parameters:
schema - currently registered schema