public final class SchemaRegistry extends Object
All schema registering and downloading is done through this class.
Note that if the id of a schema is not absolute (that is, the URI itself is absolute and it has no fragment part, or an empty fragment), then the whole schema will be considered anonymous.
This class is thread safe.
Constructor and Description |
---|
SchemaRegistry(URIManager manager,
URI namespace,
AddressingMode addressingMode)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addBundle(SchemaBundle bundle)
Load a schema bundle into this registry
|
SchemaContainer |
get(URI uri)
Get a schema container from the given URI
|
SchemaContainer |
register(JsonNode schema)
Register a schema
|
public SchemaRegistry(URIManager manager, URI namespace, AddressingMode addressingMode)
manager
- the URI manager to usenamespace
- this registry's namespaceaddressingMode
- the addressing mode for this registrypublic SchemaContainer register(JsonNode schema)
schema
- the schema to registerpublic SchemaContainer get(URI uri) throws JsonSchemaException
Note that if the URI is relative, it will be resolved against this registry's namespace, if any.
uri
- the URIJsonSchemaException
- impossible to get content at this URIpublic void addBundle(SchemaBundle bundle)
As a schema bundle is guaranteed to have well-formed locators, schemas from a bundle can be directly injected into the cache.
Copyright © 2013. All Rights Reserved.