public class CacheSchematicDb extends Object implements SchematicDb
Constructor and Description |
---|
CacheSchematicDb(AdvancedCache<String,SchematicEntry> store) |
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(String key)
Determine whether the database contains an entry with the supplied key.
|
EditableDocument |
editContent(String key,
boolean createIfMissing)
Get an editor for the entry with the supplied key.
|
EditableDocument |
editContent(String key,
boolean createIfMissing,
boolean acquireLock)
Get an editor for the entry with the supplied key and say whether the entry should be locked.
|
SchematicEntry |
get(String key)
Get the entry with the supplied key.
|
Cache<String,SchematicEntry> |
getCache()
Get the cache that backs this schematic database.
|
String |
getName()
Get the name of this database.
|
boolean |
lock(Collection<String> keys)
Lock all of the documents with the given keys.
|
boolean |
lock(String key)
Lock all of the documents with the given keys.
|
SchematicEntry |
put(Document entryDocument)
Store the supplied document and metadata at the given key.
|
SchematicEntry |
put(String key,
Document document)
Store the supplied document and metadata at the given key.
|
SchematicEntry |
putIfAbsent(String key,
Document document)
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,
Document document)
Replace the existing document and metadata at the given key with the document that is supplied.
|
void |
start() |
void |
stop() |
public CacheSchematicDb(AdvancedCache<String,SchematicEntry> store)
public String getName()
SchematicDb
getName
in interface SchematicDb
public Cache<String,SchematicEntry> getCache()
SchematicDb
getCache
in interface SchematicDb
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)
SchematicDb
put
in interface SchematicDb
key
- the key or identifier for the documentdocument
- the document that is to be storedSchematicDb.putIfAbsent(String, Document)
protected SchematicEntry removedResult(String key, SchematicEntry entry)
public SchematicEntry put(Document entryDocument)
SchematicDb
put
in interface SchematicDb
entryDocument
- the document that contains the metadata document, content document, and keySchematicDb.putIfAbsent(String, Document)
public SchematicEntry putIfAbsent(String key, Document document)
SchematicDb
putIfAbsent
in interface SchematicDb
key
- the key or identifier for the documentdocument
- the document that is to be storedpublic SchematicEntry replace(String key, Document document)
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)public SchematicEntry remove(String key)
SchematicDb
remove
in interface SchematicDb
key
- the key or identifier for the documentpublic EditableDocument editContent(String key, boolean createIfMissing)
SchematicDb
SchematicDb.editContent(String, boolean, boolean)
if the lock is known to have already been acquired.editContent
in interface SchematicDb
key
- the key or identifier for the documentcreateIfMissing
- true if a new entry should be created and added to the database if an existing entry does not existSchematicDb.editContent(String, boolean, boolean)
public EditableDocument editContent(String key, boolean createIfMissing, boolean acquireLock)
SchematicDb
acquireLock
is
false, then the entry should have been explicitly locked
as part of a transaction before this
method is called. The resulting editor will operate upon a copy of the entry and the database will be updated as part of
the transaction.editContent
in interface SchematicDb
key
- the key or identifier for the documentcreateIfMissing
- true if a new entry should be created and added to the database if an existing entry does not existacquireLock
- true if the lock should be acquired for this entry, or false if the lock is known to have already been
acquired for the current transactionpublic boolean lock(Collection<String> keys)
SchematicDb
lock
in interface SchematicDb
keys
- the set of keys identifying the documents that are to be lockedpublic boolean lock(String key)
SchematicDb
lock
in interface SchematicDb
key
- the key for the document that is to be lockedCopyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.