org.infinispan.schematic.internal

## Class CacheSchematicDb

- java.lang.Object
- - org.infinispan.schematic.internal.CacheSchematicDb

- All Implemented Interfaces:
    Lifecycle, SchematicDb

      public class CacheSchematicDb
      extends Object
      implements SchematicDb

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CacheSchematicDb(AdvancedCache<String,SchematicEntry> store)`

  - ### 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.
    `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()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### CacheSchematicDb

          public CacheSchematicDb(AdvancedCache<String,SchematicEntry> store)

  - ### Method Detail

    - #### start

          public void start()

      Specified by:
        `start` in interface `Lifecycle`

    - #### stop

          public void stop()

      Specified by:
        `stop` in interface `Lifecycle`

    - #### getName

          public String getName()

      Description copied from interface: `SchematicDb`
      Get the name of this database.
      Specified by:
        `getName` in interface `SchematicDb`
      Returns:
        the library name; never null

    - #### getCache

          public Cache<String,SchematicEntry> getCache()

      Description copied from interface: `SchematicDb`
      Get the cache that backs this schematic database.
      Specified by:
        `getCache` in interface `SchematicDb`
      Returns:
        the Infinispan cache; never null

    - #### get

          public SchematicEntry get(String key)

      Description copied from interface: `SchematicDb`
      Get the entry with the supplied key.
      Specified by:
        `get` in interface `SchematicDb`
      Parameters:
        `key` - the key or identifier for the document
      Returns:
        the entry, or null if there was no document with the supplied key

    - #### containsKey

          public boolean containsKey(String key)

      Description copied from interface: `SchematicDb`
      Determine whether the database contains an entry with the supplied key.
      Specified by:
        `containsKey` in interface `SchematicDb`
      Parameters:
        `key` - the key or identifier for the document
      Returns:
        true if the database contains an entry with this key, or false otherwise

    - #### put

          public SchematicEntry put(String key,
                           Document document)

      Description copied from interface: `SchematicDb`
      Store the supplied document and metadata at the given key.
      Specified by:
        `put` in interface `SchematicDb`
      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:
        `SchematicDb.putIfAbsent(String, Document)`

    - #### removedResult

          protected SchematicEntry removedResult(String key,
                                     SchematicEntry entry)

    - #### put

          public SchematicEntry put(Document entryDocument)

      Description copied from interface: `SchematicDb`
      Store the supplied document and metadata at the given key.
      Specified by:
        `put` in interface `SchematicDb`
      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:
        `SchematicDb.putIfAbsent(String, Document)`

    - #### putIfAbsent

          public SchematicEntry putIfAbsent(String key,
                                   Document document)

      Description copied from interface: `SchematicDb`
      Store the supplied document and metadata at the given key.
      Specified by:
        `putIfAbsent` in interface `SchematicDb`
      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

          public SchematicEntry replace(String key,
                               Document document)

      Description copied from interface: `SchematicDb`
      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.
      Specified by:
        `replace` in interface `SchematicDb`
      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

          public SchematicEntry remove(String key)

      Description copied from interface: `SchematicDb`
      Remove the existing document at the given key.
      Specified by:
        `remove` in interface `SchematicDb`
      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

    - #### editContent

          public EditableDocument editContent(String key,
                                     boolean createIfMissing)

      Description copied from interface: `SchematicDb`
      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 `SchematicDb.editContent(String, boolean, boolean)` if the lock is known to have already been acquired.
      Specified by:
        `editContent` in interface `SchematicDb`
      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:
        `SchematicDb.editContent(String, boolean, boolean)`

    - #### editContent

          public EditableDocument editContent(String key,
                                     boolean createIfMissing,
                                     boolean acquireLock)

      Description copied from interface: `SchematicDb`
      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.
      Specified by:
        `editContent` in interface `SchematicDb`
      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

    - #### lock

          public boolean lock(Collection<String> keys)

      Description copied from interface: `SchematicDb`
      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.
      Specified by:
        `lock` in interface `SchematicDb`
      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

    - #### lock

          public boolean lock(String key)

      Description copied from interface: `SchematicDb`
      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.
      Specified by:
        `lock` in interface `SchematicDb`
      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

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