org.infinispan.schematic.internal

## Class CacheSchemaLibrary

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

- All Implemented Interfaces:
    org.infinispan.lifecycle.Lifecycle, DocumentLibrary, SchemaLibrary

      public class CacheSchemaLibrary
      extends Object
      implements SchemaLibrary, org.infinispan.lifecycle.Lifecycle

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `CacheSchemaLibrary.SchemaListener`
    `protected class` | `CacheSchemaLibrary.WrappedFuture`

    - ### Nested classes/interfaces inherited from interface org.infinispan.schematic.SchemaLibrary

      `SchemaLibrary.MismatchedTypeProblem, SchemaLibrary.Problem, SchemaLibrary.ProblemType, SchemaLibrary.Results`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CacheSchemaLibrary(org.infinispan.Cache<String,SchematicEntry> schemaStore)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Document` | `convertValues(Document document, SchemaLibrary.Results results)` Look for fields within the document (including nested documents) whose values are not of the expected type for the given schema, but whose values can be converted into the expected type.
    `Document` | `convertValues(Document document, String schemaUri)` Look for fields within the document (including nested documents) whose values are not of the expected type for the given schema, but whose values can be converted into the expected type.
    `protected Document` | `document(SchematicEntry entry)`
    `protected org.infinispan.util.concurrent.NotifyingFuture<Document>` | `future(org.infinispan.util.concurrent.NotifyingFuture<SchematicEntry> original)`
    `Document` | `get(String key)` Get the document with the supplied key.
    `org.infinispan.util.concurrent.NotifyingFuture<Document>` | `getAsync(String key)` Asynchronous version of `DocumentLibrary.get(String)`.
    `String` | `getName()` Get the name of this library.
    `Document` | `put(String key, Document document)` Store the supplied document at the given key.
    `org.infinispan.util.concurrent.NotifyingFuture<Document>` | `putAsync(String key, Document document)` Asynchronous version of `DocumentLibrary.put(String, Document)`.
    `Document` | `putIfAbsent(String key, Document document)` Store the supplied document at the given key.
    `org.infinispan.util.concurrent.NotifyingFuture<Document>` | `putIfAbsentAsync(String key, Document document)` Asynchronous version of `DocumentLibrary.putIfAbsent(String, Document)`.
    `Document` | `remove(String key)` Remove the existing document at the given key.
    `org.infinispan.util.concurrent.NotifyingFuture<Document>` | `removeAsync(String key)` Asynchronous version of `DocumentLibrary.remove(String)`.
    `Document` | `replace(String key, Document document)` Replace the existing document at the given key with the document that is supplied.
    `org.infinispan.util.concurrent.NotifyingFuture<Document>` | `replaceAsync(String key, Document document)` Asynchronous version of `DocumentLibrary.replace(String, Document)`.
    `void` | `start()`
    `void` | `stop()`
    `protected org.infinispan.Cache<String,SchematicEntry>` | `store()`
    `SchemaLibrary.Results` | `validate(Document document, String schemaUri)` Validate the supplied document against the JSON Schema with the supplied URI.

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

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

- - ### Constructor Detail

    - #### CacheSchemaLibrary

          public CacheSchemaLibrary(org.infinispan.Cache<String,SchematicEntry> schemaStore)

  - ### Method Detail

    - #### start

          public void start()

      Specified by:
        `start` in interface `org.infinispan.lifecycle.Lifecycle`

    - #### stop

          public void stop()

      Specified by:
        `stop` in interface `org.infinispan.lifecycle.Lifecycle`

    - #### store

          protected org.infinispan.Cache<String,SchematicEntry> store()

    - #### getName

          public String getName()

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

    - #### get

          public Document get(String key)

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

    - #### put

          public Document put(String key,
                     Document document)

      Description copied from interface: `DocumentLibrary`
      Store the supplied document at the given key.
      Specified by:
        `put` in interface `DocumentLibrary`
      Parameters:
        `key` - the key or identifier for the document
        `document` - the document that is to be stored
      Returns:
        the document that was previously stored at this key, or null if there was no document with the supplied key

    - #### putIfAbsent

          public Document putIfAbsent(String key,
                             Document document)

      Description copied from interface: `DocumentLibrary`
      Store the supplied document at the given key.
      Specified by:
        `putIfAbsent` in interface `DocumentLibrary`
      Parameters:
        `key` - the key or identifier for the document
        `document` - the document that is to be stored
      Returns:
        the document that was previously stored at this key, or null if there was no document with the supplied key

    - #### replace

          public Document replace(String key,
                         Document document)

      Description copied from interface: `DocumentLibrary`
      Replace the existing document at the given key with the document that is supplied. This method does nothing if there is no document at the given key.
      Specified by:
        `replace` in interface `DocumentLibrary`
      Parameters:
        `key` - the key or identifier for the document
        `document` - the document that is to replace the existing document
      Returns:
        the document that was replaced, or null if nothing was replaced

    - #### remove

          public Document remove(String key)

      Description copied from interface: `DocumentLibrary`
      Remove the existing document at the given key.
      Specified by:
        `remove` in interface `DocumentLibrary`
      Parameters:
        `key` - the key or identifier for the document
      Returns:
        the document that was removed, or null if there was no document with the supplied key

    - #### getAsync

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

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

    - #### putAsync

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

      Description copied from interface: `DocumentLibrary`
      Asynchronous version of `DocumentLibrary.put(String, Document)`. This method does not block on remote calls, even if the library cache mode is synchronous.
      Specified by:
        `putAsync` in interface `DocumentLibrary`
      Parameters:
        `key` - the key or identifier for the document
        `document` - the document that is to be stored
      Returns:
        a future containing the old document that was previously stored at this key; never null

    - #### putIfAbsentAsync

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

      Description copied from interface: `DocumentLibrary`
      Asynchronous version of `DocumentLibrary.putIfAbsent(String, Document)`. This method does not block on remote calls, even if the library cache mode is synchronous.
      Specified by:
        `putIfAbsentAsync` in interface `DocumentLibrary`
      Parameters:
        `key` - the key or identifier for the document
        `document` - the document that is to be stored
      Returns:
        a future containing the existing document or the new document if there was no existing document at the supplied key

    - #### replaceAsync

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

      Description copied from interface: `DocumentLibrary`
      Asynchronous version of `DocumentLibrary.replace(String, Document)`. This method does not block on remote calls, even if the library cache mode is synchronous.
      Specified by:
        `replaceAsync` in interface `DocumentLibrary`
      Parameters:
        `key` - the key or identifier for the document
        `document` - the document that is to be stored
      Returns:
        a future containing the document that was replaced; never null

    - #### removeAsync

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

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

    - #### validate

          public SchemaLibrary.Results validate(Document document,
                                       String schemaUri)

      Description copied from interface: `SchemaLibrary`
      Validate the supplied document against the JSON Schema with the supplied URI.
      Specified by:
        `validate` in interface `SchemaLibrary`
      Parameters:
        `document` - the document to be validated; may not be null
        `schemaUri` - the URI of the JSON Schema that should be used to validate the document; may not be null
      Returns:
        the results of the validation; never null

    - #### convertValues

          public Document convertValues(Document document,
                               SchemaLibrary.Results results)

      Description copied from interface: `SchemaLibrary`
      Look for fields within the document (including nested documents) whose values are not of the expected type for the given schema, but whose values can be converted into the expected type.

      This is often useful when the results from `SchemaLibrary.validate(Document, String)` contain only `mismatched type errors`. In such a case, the document can be converted and the resulting document will likely satisfy the schema.

      Specified by:
        `convertValues` in interface `SchemaLibrary`
      Parameters:
        `document` - the document to be validated; may not be null
        `results` - the results from the `SchemaLibrary.validate(Document, String)` call; may not be null
      Returns:
        the converted document, or the same input `document` if the

    - #### convertValues

          public Document convertValues(Document document,
                               String schemaUri)

      Description copied from interface: `SchemaLibrary`
      Look for fields within the document (including nested documents) whose values are not of the expected type for the given schema, but whose values can be converted into the expected type.

      This method is similar to `SchemaLibrary.convertValues(Document, Results)`, except that this method automatically runs a JSON Schema validation to obtain the results. If you've already `validated` the document, then instead of calling this method (which would validate a second time) try calling `SchemaLibrary.convertValues(Document, Results)`.

      Specified by:
        `convertValues` in interface `SchemaLibrary`
      Parameters:
        `document` - the document to be validated; may not be null
        `schemaUri` - the URI of the JSON Schema that should be used to validate the document; may not be null
      Returns:
        the converted document, or the same input `document` if the

    - #### document

          protected Document document(SchematicEntry entry)

    - #### future

          protected org.infinispan.util.concurrent.NotifyingFuture<Document> future(org.infinispan.util.concurrent.NotifyingFuture<SchematicEntry> original)

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