public interface SchematicDb extends TransactionListener, Lifecycle
Modifier and Type | Method and Description |
---|---|
default 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 content of the given entry with the supplied key.
|
Document |
get(String key)
Get the document with the supplied key.
|
default SchematicEntry |
getEntry(String key)
Get the entry with the supplied key.
|
String |
id()
Returns a unique identifier for this schematic DB.
|
List<String> |
keys()
Returns a set over all the keys present in the DB.
|
List<SchematicEntry> |
load(Collection<String> keys)
Loads a set of documents from the DB returning the corresponding schematic entries.
|
default void |
put(String key,
Document content)
Store the supplied content document at the given key.
|
void |
put(String key,
SchematicEntry entry)
Stores the supplied schematic entry under the given key.
|
default void |
putEntry(Document entryDocument)
Store the supplied document.
|
SchematicEntry |
putIfAbsent(String key,
Document content)
Store the supplied content at the given key.
|
boolean |
remove(String key)
Remove the existing document at the given key.
|
void |
removeAll()
Removes all the entries from this DB.
|
txCommitted, txRolledback, txStarted
String id()
Implementations should make sure that the provided id is unique per storage instance.
In other words, if two SchematicDb
instances of the same type store data in two different places, they should
return a different id.
String
, never null
List<String> keys()
If this method is called within an existing transaction, it should take into account the transient transactional context (i.e. any local but not yet committed changes)
List
instance, never null
Document get(String key)
SchematicEntry
document if one exists.
If this method is called within an existing transaction, it should take into account the transient transactional context (i.e. any local but not yet committed changes)
key
- the key or identifier for the documentList<SchematicEntry> load(Collection<String> keys)
If this method is called within an existing transaction, it should not take into account the transient transactional context (i.e. any local but not yet committed changes) and should always return the latest persisted information.
keys
- an Collection
of keys; never null
List
of entries
; never null
@RequiresTransaction void put(String key, SchematicEntry entry)
key
- a schematic entry id, never null
entry
- a SchematicEntry
instance, never null
@RequiresTransaction EditableDocument editContent(String key, boolean createIfMissing)
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 exist@RequiresTransaction SchematicEntry putIfAbsent(String key, Document content)
Depending on the actual implementation, this may or may not be thread-safe. ModeShape never assumes this is thread-safe when calling it.
key
- the key or identifier for the contentcontent
- the content that is to be stored@RequiresTransaction boolean remove(String key)
key
- the key or identifier for the documenttrue
if the removal was successful, false
otherwise@RequiresTransaction void removeAll()
@RequiresTransaction default void put(String key, Document content)
key
- the key or identifier for the documentcontent
- the document that is to be storedputIfAbsent(String, Document)
default SchematicEntry getEntry(String key)
If this method is called within an existing transaction, it should take into account the transient transactional context (i.e. any local but not yet committed changes)
key
- the key or identifier for the documentdefault boolean containsKey(String key)
If this method is called within an existing transaction, it should take into account the transient transactional context (i.e. any local but not yet committed changes)
key
- the key or identifier for the document@RequiresTransaction default void putEntry(Document entryDocument)
entryDocument
- the document that contains the metadata document and content document.putIfAbsent(String, Document)
Copyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.