org.infinispan.schematic.internal.schema

## Class SchemaDocumentCache

- java.lang.Object
- - org.infinispan.schematic.internal.schema.SchemaDocumentCache

- All Implemented Interfaces:
    Serializable, Validator.SchemaDocumentResolver

      @ThreadSafe
      public class SchemaDocumentCache
      extends Object
      implements Validator.SchemaDocumentResolver, Serializable

  A cache of `SchemaDocument` instances that each have a `validator` that can `validate` JSON Documents. When a SchemaDocument is needed and has not yet been loaded, this cache finds the corresponding JSON Schema `documents` from the `DocumentLibrary`, and uses a `factory` to create the `Validator`.
  Since:
    5.1
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SchemaDocumentCache(DocumentLibrary jsonSchemaDocuments, String defaultMetaSchemaUri)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected Validator.Factory` | `createFactory(URI schemaRefUri, Problems problems)`
    `SchemaDocument` | `get(String uri, Problems problems)` Find the JSON Schema document with the supplied URI, and build the `in-memory representation` (including the `validator`.
    `boolean` | `remove(String uri)` Remove any `SchemaDocument` that was loaded into this cache.
    `void` | `removeAll()` Remove all `SchemaDocument` loaded into this cache.

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

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

- - ### Constructor Detail

    - #### SchemaDocumentCache

          public SchemaDocumentCache(DocumentLibrary jsonSchemaDocuments,
                             String defaultMetaSchemaUri)

  - ### Method Detail

    - #### get

          public SchemaDocument get(String uri,
                           Problems problems)

      Find the JSON Schema document with the supplied URI, and build the `in-memory representation` (including the `validator`.
      Specified by:
        `get` in interface `Validator.SchemaDocumentResolver`
      Parameters:
        `uri` - the URI of the schema being read
        `problems` - the object for recording any problems encountered while loading the schema
      Returns:
        the in-memory `Document` representation, or null if there were fatal errors

    - #### remove

          public boolean remove(String uri)

      Remove any `SchemaDocument` that was loaded into this cache.
      Parameters:
        `uri` - the URI of the schema being read
      Returns:
        true if a SchemaDocument was removed from the cache, or false if this cache did not contain a SchemaDocument for the supplied URI

    - #### removeAll

          public void removeAll()

      Remove all `SchemaDocument` loaded into this cache.

    - #### createFactory

          protected Validator.Factory createFactory(URI schemaRefUri,
                                        Problems problems)

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