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.
    `SchematicEntry` | `get(String key)` Get the entry with the supplied key.
    `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.
    `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.
    `SchematicEntry` | `remove(String key)` Remove the existing document at the given key.
    `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.
    `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

          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

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