public class InMemorySchemaLibrary extends Object implements SchemaLibrary, org.infinispan.lifecycle.Lifecycle
SchemaLibrary.MismatchedTypeProblem, SchemaLibrary.Problem, SchemaLibrary.ProblemType, SchemaLibrary.Results| Constructor and Description |
|---|
InMemorySchemaLibrary(String name) |
| Modifier and Type | Method and Description |
|---|---|
Document |
convertValues(Document document,
SchemaLibrary.Results results)
Look for fields within the document (including nested documents) whose values are not of the expected type for the given
schema, but whose values can be converted into the expected type.
|
Document |
convertValues(Document document,
String schemaUri)
Look for fields within the document (including nested documents) whose values are not of the expected type for the given
schema, but whose values can be converted into the expected type.
|
Document |
get(String key)
Get the document with the supplied key.
|
org.infinispan.util.concurrent.NotifyingFuture<Document> |
getAsync(String key)
Asynchronous version of
DocumentLibrary.get(String). |
String |
getName()
Get the name of this library.
|
Document |
put(String key,
Document document)
Store the supplied document at the given key.
|
org.infinispan.util.concurrent.NotifyingFuture<Document> |
putAsync(String key,
Document document)
Asynchronous version of
DocumentLibrary.put(String, Document). |
Document |
putIfAbsent(String key,
Document document)
Store the supplied document at the given key.
|
org.infinispan.util.concurrent.NotifyingFuture<Document> |
putIfAbsentAsync(String key,
Document document)
Asynchronous version of
DocumentLibrary.putIfAbsent(String, Document). |
Document |
remove(String key)
Remove the existing document at the given key.
|
org.infinispan.util.concurrent.NotifyingFuture<Document> |
removeAsync(String key)
Asynchronous version of
DocumentLibrary.remove(String). |
Document |
replace(String key,
Document document)
Replace the existing document at the given key with the document that is supplied.
|
org.infinispan.util.concurrent.NotifyingFuture<Document> |
replaceAsync(String key,
Document document)
Asynchronous version of
DocumentLibrary.replace(String, Document). |
void |
start() |
void |
stop() |
SchemaLibrary.Results |
validate(Document document,
String schemaUri)
Validate the supplied document against the JSON Schema with the supplied URI.
|
public InMemorySchemaLibrary(String name)
public void start()
start in interface org.infinispan.lifecycle.Lifecyclepublic void stop()
stop in interface org.infinispan.lifecycle.Lifecyclepublic String getName()
DocumentLibrarygetName in interface DocumentLibrarypublic Document get(String key)
DocumentLibraryget in interface DocumentLibrarykey - the key or identifier for the documentpublic Document put(String key, Document document)
DocumentLibraryput in interface DocumentLibrarykey - the key or identifier for the documentdocument - the document that is to be storedpublic Document putIfAbsent(String key, Document document)
DocumentLibraryputIfAbsent in interface DocumentLibrarykey - the key or identifier for the documentdocument - the document that is to be storedpublic Document replace(String key, Document document)
DocumentLibraryreplace in interface DocumentLibrarykey - the key or identifier for the documentdocument - the document that is to replace the existing documentpublic Document remove(String key)
DocumentLibraryremove in interface DocumentLibrarykey - the key or identifier for the documentpublic org.infinispan.util.concurrent.NotifyingFuture<Document> getAsync(String key)
DocumentLibraryDocumentLibrary.get(String). This method does not block on remote calls, even if the library
cache mode is synchronous.getAsync in interface DocumentLibrarykey - the key or identifier for the documentpublic org.infinispan.util.concurrent.NotifyingFuture<Document> putAsync(String key, Document document)
DocumentLibraryDocumentLibrary.put(String, Document). This method does not block on remote calls, even if the
library cache mode is synchronous.putAsync in interface DocumentLibrarykey - the key or identifier for the documentdocument - the document that is to be storedpublic org.infinispan.util.concurrent.NotifyingFuture<Document> putIfAbsentAsync(String key, Document document)
DocumentLibraryDocumentLibrary.putIfAbsent(String, Document). This method does not block on remote calls, even
if the library cache mode is synchronous.putIfAbsentAsync in interface DocumentLibrarykey - the key or identifier for the documentdocument - the document that is to be storedpublic org.infinispan.util.concurrent.NotifyingFuture<Document> replaceAsync(String key, Document document)
DocumentLibraryDocumentLibrary.replace(String, Document). This method does not block on remote calls, even if
the library cache mode is synchronous.replaceAsync in interface DocumentLibrarykey - the key or identifier for the documentdocument - the document that is to be storedpublic org.infinispan.util.concurrent.NotifyingFuture<Document> removeAsync(String key)
DocumentLibraryDocumentLibrary.remove(String). This method does not block on remote calls, even if the library
cache mode is synchronous.removeAsync in interface DocumentLibrarykey - the key or identifier for the documentpublic SchemaLibrary.Results validate(Document document, String schemaUri)
SchemaLibraryvalidate in interface SchemaLibrarydocument - the document to be validated; may not be nullschemaUri - the URI of the JSON Schema that should be used to validate the document; may not be nullpublic Document convertValues(Document document, SchemaLibrary.Results results)
SchemaLibrary
This is often useful when the results from SchemaLibrary.validate(Document, String) contain only
mismatched type errors. In such a case, the document can be converted and the
resulting document will likely satisfy the schema.
convertValues in interface SchemaLibrarydocument - the document to be validated; may not be nullresults - the results from the SchemaLibrary.validate(Document, String) call; may not be nulldocument if thepublic Document convertValues(Document document, String schemaUri)
SchemaLibrary
This method is similar to SchemaLibrary.convertValues(Document, Results), except that this method automatically runs a JSON
Schema validation to obtain the results. If you've already validated the document, then
instead of calling this method (which would validate a second time) try calling SchemaLibrary.convertValues(Document, Results).
convertValues in interface SchemaLibrarydocument - the document to be validated; may not be nullschemaUri - the URI of the JSON Schema that should be used to validate the document; may not be nulldocument if theCopyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.