public class CacheSchematicDb extends Object implements SchematicDb
Modifier and Type | Class and Description |
---|---|
protected static class |
CacheSchematicDb.ResultsCollector |
protected class |
CacheSchematicDb.SchematicEntryProxyFuture |
Constructor and Description |
---|
CacheSchematicDb(Cache<String,SchematicEntry> store) |
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(String key)
Determine whether the database contains an entry with the supplied key.
|
protected CacheSchematicDb.SchematicEntryProxyFuture |
future(String key,
NotifyingFuture<SchematicEntry> future,
boolean isRemoved) |
SchematicEntry |
get(String key)
Get the entry with the supplied key.
|
Cache<String,SchematicEntry> |
getCache()
Get the cache that backs this schematic database.
|
String |
getDescription()
Get the description of this database.
|
String |
getName()
Get the name of this database.
|
SchemaLibrary |
getSchemaLibrary()
Get the reference to the SchemaLibrary for this database.
|
boolean |
isExplicitLockingEnabled()
|
boolean |
lock(Collection<String> keys)
Lock all of the documents with the given keys.
|
protected SchematicEntry |
proxy(String key,
SchematicEntry entry) |
SchematicEntry |
put(Document entryDocument)
Store the supplied document and metadata at the given key.
|
SchematicEntry |
put(String key,
Binary binaryContent,
Document metadata)
Store the supplied binary value and metadata at the given key.
|
SchematicEntry |
put(String key,
Document document,
Document metadata)
Store the supplied document and metadata at the given key.
|
SchematicEntry |
putIfAbsent(Document entryDocument)
Store the supplied document and metadata at the given key.
|
SchematicEntry |
putIfAbsent(String key,
Binary binaryContent,
Document metadata)
Store the supplied document and metadata at the given key.
|
SchematicEntry |
putIfAbsent(String key,
Document document,
Document metadata)
Store the supplied document and metadata at the given key.
|
SchematicEntry |
remove(String key)
Remove the existing document at the given key.
|
protected SchematicEntry |
removedResult(String key,
SchematicEntry entry) |
SchematicEntry |
replace(String key,
Binary binaryContent,
Document metadata)
Replace the existing document and metadata at the given key with the document that is supplied.
|
SchematicEntry |
replace(String key,
Document document,
Document metadata)
Replace the existing document and metadata at the given key with the document that is supplied.
|
protected CacheSchemaLibrary |
schemaLibrary(boolean createIfMissing) |
void |
start() |
void |
stop() |
SchemaLibrary.Results |
validate(String key)
Validate the JSON document store at the specified key.
|
Map<String,SchemaLibrary.Results> |
validate(String firstKey,
String... additionalKeys)
Execute a Map-Reduce task to validate all JSON documents stored within this database, using this database's
JSON Schema library . |
Map<String,SchemaLibrary.Results> |
validateAll()
Validate all JSON documents stored within this database, using this database's
JSON Schema
library . |
public CacheSchematicDb(Cache<String,SchematicEntry> store)
public String getName()
SchematicDb
getName
in interface SchematicDb
public String getDescription()
SchematicDb
getDescription
in interface SchematicDb
public Cache<String,SchematicEntry> getCache()
SchematicDb
getCache
in interface SchematicDb
public SchemaLibrary getSchemaLibrary()
SchematicDb
getSchemaLibrary
in interface SchematicDb
protected CacheSchemaLibrary schemaLibrary(boolean createIfMissing)
public Map<String,SchemaLibrary.Results> validateAll()
SchematicDb
JSON Schema
library
. This method works even when the database is distributed, and it blocks until the task is completed.validateAll
in interface SchematicDb
public Map<String,SchemaLibrary.Results> validate(String firstKey, String... additionalKeys)
SchematicDb
JSON Schema library
. This method works even when the database is distributed, and it blocks
until the task is completed.validate
in interface SchematicDb
firstKey
- the first key of the document that is to be validatedadditionalKeys
- the additional keys of the documents that are to be validatedpublic SchemaLibrary.Results validate(String key)
SchematicDb
validate
in interface SchematicDb
key
- the key or identifier for the documentprotected SchematicEntry proxy(String key, SchematicEntry entry)
protected SchematicEntry removedResult(String key, SchematicEntry entry)
protected CacheSchematicDb.SchematicEntryProxyFuture future(String key, NotifyingFuture<SchematicEntry> future, boolean isRemoved)
public SchematicEntry get(String key)
SchematicDb
get
in interface SchematicDb
key
- the key or identifier for the documentpublic boolean containsKey(String key)
SchematicDb
containsKey
in interface SchematicDb
key
- the key or identifier for the documentpublic SchematicEntry put(String key, Document document, Document metadata)
SchematicDb
put
in interface SchematicDb
key
- the key or identifier for the documentdocument
- the document that is to be storedmetadata
- the metadata that is to be stored; may be null if there is no metadataSchematicDb.put(String, Binary, Document)
,
SchematicDb.putIfAbsent(String, Binary, Document)
,
SchematicDb.putIfAbsent(String, Document, Document)
public SchematicEntry put(String key, Binary binaryContent, Document metadata)
SchematicDb
put
in interface SchematicDb
key
- the key or identifier for the documentbinaryContent
- the binary content that is to be storedmetadata
- the metadata that is to be stored; may be null if there is no metadatapublic SchematicEntry put(Document entryDocument)
SchematicDb
put
in interface SchematicDb
entryDocument
- the document that contains the metadata document, content document, and keySchematicDb.put(String, Binary, Document)
,
SchematicDb.putIfAbsent(String, Binary, Document)
,
SchematicDb.putIfAbsent(String, Document, Document)
public SchematicEntry putIfAbsent(String key, Document document, Document metadata)
SchematicDb
putIfAbsent
in interface SchematicDb
key
- the key or identifier for the documentdocument
- the document that is to be storedmetadata
- the metadata that is to be stored; may be null if there is no metadatapublic SchematicEntry putIfAbsent(String key, Binary binaryContent, Document metadata)
SchematicDb
putIfAbsent
in interface SchematicDb
key
- the key or identifier for the documentbinaryContent
- the binary content that is to be storedmetadata
- the metadata that is to be stored; may be null if there is no metadatapublic SchematicEntry putIfAbsent(Document entryDocument)
SchematicDb
putIfAbsent
in interface SchematicDb
entryDocument
- the document that contains the metadata document, content document, and keySchematicDb.put(String, Binary, Document)
,
SchematicDb.putIfAbsent(String, Binary, Document)
,
SchematicDb.putIfAbsent(String, Document, Document)
public SchematicEntry replace(String key, Document document, Document metadata)
SchematicDb
replace
in interface SchematicDb
key
- the key or identifier for the documentdocument
- the new document that is to replace the existing document (or binary content)metadata
- the metadata that is to be stored with the replacement document; may be null if there is no metadata for
the replacementpublic SchematicEntry replace(String key, Binary binaryContent, Document metadata)
SchematicDb
replace
in interface SchematicDb
key
- the key or identifier for the documentbinaryContent
- the binary content that is to replace the existing binary content (or document)metadata
- the metadata that is to be stored with the replacement content; may be null if there is no metadata for the
replacementpublic SchematicEntry remove(String key)
SchematicDb
remove
in interface SchematicDb
key
- the key or identifier for the documentpublic boolean lock(Collection<String> keys)
SchematicDb
lock
in interface SchematicDb
keys
- the set of keys identifying the documents that are to be lockedpublic boolean isExplicitLockingEnabled()
SchematicDb
locking
is used when editing document content
or metadata
. If this method returns true, then it may be useful to
preemptively lock
documents that will be modified during a transactions.isExplicitLockingEnabled
in interface SchematicDb
Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.