org.infinispan.schematic

## Interface SchematicDb

- All Superinterfaces:
    org.infinispan.lifecycle.Lifecycle
  All Known Implementing Classes:
    CacheSchematicDb

      public interface SchematicDb
      extends org.infinispan.lifecycle.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.
    `SchematicEntry` | `get(String key)` Get the entry with the supplied key.
    `org.infinispan.util.concurrent.NotifyingFuture<SchematicEntry>` | `getAsync(String key)` Asynchronous version of `get(String)`.
    `org.infinispan.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()` Return whether explicit `locking` is used when editing `document content` or `metadata`.
    `boolean` | `lock(Collection<String> keys)` 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, 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.
    `org.infinispan.util.concurrent.NotifyingFuture<SchematicEntry>` | `putAsync(String key, Binary binaryContent, Document metadata)` Asynchronous version of `put(String, Binary, Document)`.
    `org.infinispan.util.concurrent.NotifyingFuture<SchematicEntry>` | `putAsync(String key, Document document, Document metadata)` Asynchronous version of `put(String, Document, Document)`.
    `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.
    `org.infinispan.util.concurrent.NotifyingFuture<SchematicEntry>` | `putIfAbsentAsync(String key, Binary binaryContent, Document metadata)` Asynchronous version of `putIfAbsent(String, Binary, Document)`.
    `org.infinispan.util.concurrent.NotifyingFuture<SchematicEntry>` | `putIfAbsentAsync(String key, Document document, Document metadata)` Asynchronous version of `putIfAbsent(String, Document, Document)`.
    `SchematicEntry` | `remove(String key)` Remove the existing document at the given key.
    `org.infinispan.util.concurrent.NotifyingFuture<SchematicEntry>` | `removeAsync(String key)` Asynchronous version of `remove(String)`.
    `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.
    `org.infinispan.util.concurrent.NotifyingFuture<SchematicEntry>` | `replaceAsync(String key, Binary binaryContent, Document metadata)` Asynchronous version of `replace(String, Binary, Document)`.
    `org.infinispan.util.concurrent.NotifyingFuture<SchematicEntry>` | `replaceAsync(String key, Document document, Document metadata)` Asynchronous version of `replace(String, Document, Document)`.
    `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`.

    - ### 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

    - #### getDescription

          String getDescription()

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

    - #### getSchemaLibrary

          SchemaLibrary getSchemaLibrary()

      Get the reference to the SchemaLibrary for this database.
      Returns:
        the schema library; never null

    - #### getCache

          org.infinispan.Cache<String,SchematicEntry> getCache()

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

    - #### validateAll

          Map<String,SchemaLibrary.Results> validateAll()

      Validate all JSON documents stored within this database, using this database's `JSON Schema library`. This method works even when the database is distributed, and it blocks until the task is completed.
      Returns:
        the map of document keys to validation results for all of the JSON documents in the database that are affiliated with a schema and that had at least one validation error or warning

    - #### validate

          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`. This method works even when the database is distributed, and it blocks until the task is completed.
      Parameters:
        `firstKey` - the first key of the document that is to be validated
        `additionalKeys` - the additional keys of the documents that are to be validated
      Returns:
        the map of document keys to validation results for all of the JSON documents in the database that are affiliated with a schema and that had at least one validation error or warning

    - #### validate

          SchemaLibrary.Results validate(String key)

      Validate the JSON document store at the specified key.
      Parameters:
        `key` - the key or identifier for the document
      Returns:
        the validation results; or null if there is no JSON document for the given key

    - #### 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

    - #### 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,
                           Document metadata)

      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
        `metadata` - the metadata that is to be stored; may be null if there is no metadata
      Returns:
        the entry previously stored at this key, or null if there was no entry with the supplied key
      See Also:
        `put(String, Binary, Document)`, `putIfAbsent(String, Binary, Document)`, `putIfAbsent(String, Document, Document)`

    - #### put

          SchematicEntry put(String key,
                           Binary binaryContent,
                           Document metadata)

      Store the supplied binary value and metadata at the given key.
      Parameters:
        `key` - the key or identifier for the document
        `binaryContent` - the binary content that is to be stored
        `metadata` - the metadata that is to be stored; may be null if there is no metadata
      Returns:
        the entry that was previously stored at this key, or null if there was no entry with the supplied key

    - #### 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:
        `put(String, Binary, Document)`, `putIfAbsent(String, Binary, Document)`, `putIfAbsent(String, Document, Document)`

    - #### putIfAbsent

          SchematicEntry putIfAbsent(String key,
                                   Document document,
                                   Document metadata)

      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
        `metadata` - the metadata that is to be stored; may be null if there is no metadata
      Returns:
        the existing entry for the supplied key, or null if there was no entry and the put was successful

    - #### putIfAbsent

          SchematicEntry putIfAbsent(String key,
                                   Binary binaryContent,
                                   Document metadata)

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

    - #### putIfAbsent

          SchematicEntry putIfAbsent(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 existing entry for the supplied key, or null if there was no entry and the put was successful
      See Also:
        `put(String, Binary, Document)`, `putIfAbsent(String, Binary, Document)`, `putIfAbsent(String, Document, Document)`

    - #### replace

          SchematicEntry replace(String key,
                               Document document,
                               Document metadata)

      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)
        `metadata` - the metadata that is to be stored with the replacement document; may be null if there is no metadata for the replacement
      Returns:
        the entry that was replaced, or null if nothing was replaced

    - #### replace

          SchematicEntry replace(String key,
                               Binary binaryContent,
                               Document metadata)

      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 document at the given key.
      Parameters:
        `key` - the key or identifier for the document
        `binaryContent` - 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 replacement
      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(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

    - #### isExplicitLockingEnabled

          boolean isExplicitLockingEnabled()

      Return whether explicit `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.
      Returns:
        true if explicit locking is enabled, or false otherwise

    - #### getAsync

          org.infinispan.util.concurrent.NotifyingFuture<SchematicEntry> getAsync(String key)

      Asynchronous version of `get(String)`. This method does not block on remote calls, even if the library cache mode is synchronous.
      Parameters:
        `key` - the key or identifier for the document
      Returns:
        a future containing the entry at the given key; never null

    - #### putAsync

          org.infinispan.util.concurrent.NotifyingFuture<SchematicEntry> putAsync(String key,
                                                                                Document document,
                                                                                Document metadata)

      Asynchronous version of `put(String, Document, Document)`. This method does not block on remote calls, even if the library cache mode is synchronous.
      Parameters:
        `key` - the key or identifier for the document
        `document` - the document that is to be stored
        `metadata` - the metadata that is to be stored; may be null if there is no metadata
      Returns:
        a future containing the old document that was previously stored at this key; never null

    - #### putAsync

          org.infinispan.util.concurrent.NotifyingFuture<SchematicEntry> putAsync(String key,
                                                                                Binary binaryContent,
                                                                                Document metadata)

      Asynchronous version of `put(String, Binary, Document)`. This method does not block on remote calls, even if the library cache mode is synchronous.
      Parameters:
        `key` - the key or identifier for the document
        `binaryContent` - the binary content that is to be stored
        `metadata` - the metadata that is to be stored; may be null if there is no metadata
      Returns:
        a future containing the old document that was previously stored at this key; never null

    - #### putIfAbsentAsync

          org.infinispan.util.concurrent.NotifyingFuture<SchematicEntry> putIfAbsentAsync(String key,
                                                                                        Document document,
                                                                                        Document metadata)

      Asynchronous version of `putIfAbsent(String, Document, Document)`. This method does not block on remote calls, even
      Parameters:
        `key` - the key or identifier for the document
        `document` - the document that is to be stored
        `metadata` - the metadata that is to be stored; may be null if there is no metadata
      Returns:
        a future containing the existing document, or the null if there was no existing document at the supplied key

    - #### putIfAbsentAsync

          org.infinispan.util.concurrent.NotifyingFuture<SchematicEntry> putIfAbsentAsync(String key,
                                                                                        Binary binaryContent,
                                                                                        Document metadata)

      Asynchronous version of `putIfAbsent(String, Binary, Document)`. This method does not block on remote calls, even
      Parameters:
        `key` - the key or identifier for the document
        `binaryContent` - the binary content that is to be stored
        `metadata` - the metadata that is to be stored; may be null if there is no metadata
      Returns:
        a future containing the existing document, or the null if there was no existing document at the supplied key

    - #### replaceAsync

          org.infinispan.util.concurrent.NotifyingFuture<SchematicEntry> replaceAsync(String key,
                                                                                    Document document,
                                                                                    Document metadata)

      Asynchronous version of `replace(String, Document, Document)`. This method does not block on remote calls, even if the library cache mode is synchronous.
      Parameters:
        `key` - the key or identifier for the document
        `document` - 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 replacement
      Returns:
        a future containing the entry that was replaced; never null

    - #### replaceAsync

          org.infinispan.util.concurrent.NotifyingFuture<SchematicEntry> replaceAsync(String key,
                                                                                    Binary binaryContent,
                                                                                    Document metadata)

      Asynchronous version of `replace(String, Binary, Document)`. This method does not block on remote calls, even if the library cache mode is synchronous.
      Parameters:
        `key` - the key or identifier for the document
        `binaryContent` - the new binary content that is to replace the existing content (or document)
        `metadata` - the metadata that is to be stored with the replacement document; may be null if there is no metadata for the replacement
      Returns:
        a future containing the entry that was replaced; never null

    - #### removeAsync

          org.infinispan.util.concurrent.NotifyingFuture<SchematicEntry> removeAsync(String key)

      Asynchronous version of `remove(String)`. This method does not block on remote calls, even if the library cache mode is synchronous.
      Parameters:
        `key` - the key or identifier for the document
      Returns:
        a future containing the old entry that was removed; never null

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