public class URIManager extends Object
This uses a map of URIDownloader instances to fetch the contents
of a URI as an InputStream, then tries and turns this content into
JSON using an ObjectMapper.
Normally, you will never use this class directly.
SchemaRegistry,
JsonLoader| Modifier and Type | Field and Description |
|---|---|
private Map<String,URIDownloader> |
downloaders
Map of downloaders (schemes as keys,
URIDownloader instances
as values) |
private static ObjectMapper |
mapper
Our object mapper
|
| Constructor and Description |
|---|
URIManager() |
| Modifier and Type | Method and Description |
|---|---|
JsonNode |
getContent(URI uri)
Get the content at a given URI as a
JsonNode |
void |
registerDownloader(String scheme,
URIDownloader downloader)
Register a new downloader for a given URI scheme
|
private static final ObjectMapper mapper
Note that it uses DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS to deserialize,
for accuracy reasons.
NumericKeywordValidatorprivate final Map<String,URIDownloader> downloaders
URIDownloader instances
as values)public void registerDownloader(String scheme, URIDownloader downloader)
scheme - the schemedownloader - the URIDownloader instanceNullPointerException - scheme is nullIllegalArgumentException - scheme is empty, or is already
registeredpublic JsonNode getContent(URI uri) throws JsonSchemaException
JsonNodeuri - the URIJsonSchemaException - scheme is not registered, failed to get
content, or content is not JSONCopyright © 2012. All Rights Reserved.