org.infinispan.schematic

## Interface SchematicDb

- All Superinterfaces:
    Lifecycle
  All Known Implementing Classes:
    CacheSchematicDb

      public interface SchematicDb
      extends Lifecycle

  A store for JSON documents and other binary content, plus a library of JSON Schema documents used to describe and validate the stored documents.
  Since:
    5.1

- - ### Method Summary

    Methods
    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.
    `SchematicEntry` | `replace(String key, Document document)` Replace the existing document and metadata at the given key with the document that is supplied.

    - ### Methods inherited from interface org.infinispan.lifecycle.Lifecycle

      `start, stop`

- - ### Method Detail

    - #### getName

          String getName()

      Get the name of this database.
      Returns:
        the library name; never null

    - #### getCache

          Cache<String,SchematicEntry> getCache()

      Get the cache that backs this schematic database.
      Returns:
        the Infinispan cache; never null

    - #### get

          SchematicEntry get(String key)

      Get the entry with the supplied key.
      Parameters:
        `key` - the key or identifier for the document
      Returns:
        the entry, or null if there was no document with the supplied key

    - #### editContent

          EditableDocument editContent(String key,
                                     boolean createIfMissing)

      Get an editor for the entry with the supplied key. This method will automatically try to acquire the lock for this entry. The resulting editor will operate upon a copy of the entry and the database will be updated as part of the transaction. See also `editContent(String, boolean, boolean)` if the lock is known to have already been acquired.
      Parameters:
        `key` - the key or identifier for the document
        `createIfMissing` - true if a new entry should be created and added to the database if an existing entry does not exist
      Returns:
        the entry, or null if there was no document with the supplied key
      See Also:
        `editContent(String, boolean, boolean)`

    - #### editContent

          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. If `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.
      Parameters:
        `key` - the key or identifier for the document
        `createIfMissing` - true if a new entry should be created and added to the database if an existing entry does not exist
        `acquireLock` - 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 transaction
      Returns:
        the entry, or null if there was no document with the supplied key

    - #### containsKey

          boolean containsKey(String key)

      Determine whether the database contains an entry with the supplied key.
      Parameters:
        `key` - the key or identifier for the document
      Returns:
        true if the database contains an entry with this key, or false otherwise

    - #### put

          SchematicEntry put(String key,
                           Document document)

      Store the supplied document and metadata at the given key.
      Parameters:
        `key` - the key or identifier for the document
        `document` - the document that is to be stored
      Returns:
        the entry previously stored at this key, or null if there was no entry with the supplied key
      See Also:
        `putIfAbsent(String, Document)`

    - #### put

          SchematicEntry put(Document entryDocument)

      Store the supplied document and metadata at the given key.
      Parameters:
        `entryDocument` - the document that contains the metadata document, content document, and key
      Returns:
        the entry previously stored at this key, or null if there was no entry with the supplied key
      See Also:
        `putIfAbsent(String, Document)`

    - #### putIfAbsent

          SchematicEntry putIfAbsent(String key,
                                   Document document)

      Store the supplied document and metadata at the given key.
      Parameters:
        `key` - the key or identifier for the document
        `document` - the document that is to be stored
      Returns:
        the existing entry for the supplied key, or null if there was no entry and the put was successful

    - #### replace

          SchematicEntry replace(String key,
                               Document document)

      Replace the existing document and metadata at the given key with the document that is supplied. This method does nothing if there is not an existing entry at the given key.
      Parameters:
        `key` - the key or identifier for the document
        `document` - the new document that is to replace the existing document (or binary content)
      Returns:
        the entry that was replaced, or null if nothing was replaced

    - #### remove

          SchematicEntry remove(String key)

      Remove the existing document at the given key.
      Parameters:
        `key` - the key or identifier for the document
      Returns:
        the entry that was removed, or null if there was no document with the supplied key

    - #### lock

          boolean lock(String key)

      Lock all of the documents with the given keys. This must be called within the context of an existing transaction, and all locks will be held until the completion of the transaction.
      Parameters:
        `key` - the key for the document that is to be locked
      Returns:
        true if the documents were locked (or if locking is not required), or false if not all of the documents could be locked

    - #### lock

          boolean lock(Collection<String> keys)

      Lock all of the documents with the given keys. This must be called within the context of an existing transaction, and all locks will be held until the completion of the transaction.
      Parameters:
        `keys` - the set of keys identifying the documents that are to be locked
      Returns:
        true if the documents were locked (or if locking is not required), or false if not all of the documents could be locked

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.