Package net.shibboleth.shared.xml
Class SchemaBuilder
java.lang.Object
net.shibboleth.shared.xml.SchemaBuilder
A class for building a
Schema from a set of inputs, allowing for
manipulation of the underlying factory.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumLanguage of the schema files. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanOne time-init flag.private ErrorHandlerCustom error handler.Features to set on factory.private final org.slf4j.LoggerClass logger.Properties to set on factory.private LSResourceResolverMechanism for resolving nested resources like included/imported schemas.private SchemaBuilder.SchemaLanguageLanguage of schemas.Sources of schema material compatible with JAXP. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddSchema(InputStream schemaSource) Add schemas from the given schema input streams.Add schemas from the given schema sources.Add schemas from the given schema resource.Build a schema from the given schema sources.Clear the schemas to be included.setErrorHandler(ErrorHandler handler) Set a custom error handler to use.voidsetFeature(String name, boolean value) Set a feature for theSchemaFactoryto be built.voidsetProperty(String name, Object object) Set the value of a property for theSchemaFactoryto be built.setResourceResolver(LSResourceResolver resolver) Set the resource resolver to use for included/imported schemas.Set the schema language.voidsetSchemaResources(Collection<Resource> schemaResources) Set the schemas to load from the given schema resources (replaces any previously added).voidsetSchemas(Collection<Source> schemaSources) Set the schemas to load from the given schema sources (replaces any previously added).
-
Field Details
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
schemaLang
Language of schemas. -
sources
Sources of schema material compatible with JAXP. -
resourceResolver
Mechanism for resolving nested resources like included/imported schemas. -
errorHandler
Custom error handler. -
features
Features to set on factory. -
properties
Properties to set on factory. -
alreadyBuilt
private boolean alreadyBuiltOne time-init flag.
-
-
Constructor Details
-
SchemaBuilder
public SchemaBuilder()Constructor.
-
-
Method Details
-
setResourceResolver
Set the resource resolver to use for included/imported schemas.If not set, the default resolver will prevent lookup of any schemas not explicitly added.
- Parameters:
resolver- resource resolver- Returns:
- this builder
-
setErrorHandler
Set a custom error handler to use.If not set, a default handler will be used that logs errors before throwing exceptions.
- Parameters:
handler- error handler- Returns:
- this builder
-
setFeature
Set a feature for theSchemaFactoryto be built.- Parameters:
name- The feature name, which is a non-null fully-qualified URI.value- The requested value of the feature (true or false).- See Also:
-
setProperty
Set the value of a property for theSchemaFactoryto be built.- Parameters:
name- The property name, which is a non-null fully-qualified URI.object- The requested value for the property.- See Also:
-
resetSchemas
Clear the schemas to be included.- Returns:
- this builder
-
setSchemas
Set the schemas to load from the given schema sources (replaces any previously added).If the caller wishes to ensure the schemas are loaded in a particular order, the
Collectionimplementation provided must be one that preserves order. The method will add the sources in the order returned by the collection.- Parameters:
schemaSources- schema sources
-
setSchemaResources
Set the schemas to load from the given schema resources (replaces any previously added).If the caller wishes to ensure the schemas are loaded in a particular order, the
Collectionimplementation provided must be one that preserves order. The method will add the sources in the order returned by the collection.- Parameters:
schemaResources- schema resources
-
addSchema
Add schemas from the given schema input streams.- Parameters:
schemaSource- schema input stream- Returns:
- this builder
-
addSchema
Add schemas from the given schema sources.- Parameters:
schemaSource- schema source- Returns:
- this builder
-
buildSchema
Build a schema from the given schema sources.This method is thread-safe, although the various mutating methods to establish the state of the object are not.
- Returns:
- the constructed schema
- Throws:
SAXException- thrown if there is a problem converting the schema sources into a schema