ModeShape Distribution 3.0.0.Beta4

org.infinispan.schematic.internal
Class CacheSchematicDb

java.lang.Object
  extended by org.infinispan.schematic.internal.CacheSchematicDb
All Implemented Interfaces:
org.infinispan.lifecycle.Lifecycle, SchematicDb

public class CacheSchematicDb
extends Object
implements SchematicDb


Nested Class Summary
protected static class CacheSchematicDb.ResultsCollector
           
protected  class CacheSchematicDb.SchematicEntryProxyFuture
           
 
Constructor Summary
CacheSchematicDb(org.infinispan.Cache<String,SchematicEntry> store)
           
 
Method Summary
 boolean containsKey(String key)
          Determine whether the database contains an entry with the supplied key.
protected  CacheSchematicDb.SchematicEntryProxyFuture future(String key, org.infinispan.util.concurrent.NotifyingFuture<SchematicEntry> future, boolean isRemoved)
           
 SchematicEntry get(String key)
          Get the entry with the supplied key.
 org.infinispan.util.concurrent.NotifyingFuture<SchematicEntry> getAsync(String key)
          Asynchronous version of SchematicDb.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.
protected  SchematicEntry proxy(String key, SchematicEntry entry)
           
 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 SchematicDb.put(String, Binary, Document).
 org.infinispan.util.concurrent.NotifyingFuture<SchematicEntry> putAsync(String key, Document document, Document metadata)
          Asynchronous version of SchematicDb.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 SchematicDb.putIfAbsent(String, Binary, Document).
 org.infinispan.util.concurrent.NotifyingFuture<SchematicEntry> putIfAbsentAsync(String key, Document document, Document metadata)
          Asynchronous version of SchematicDb.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 SchematicDb.remove(String).
protected  SchematicEntry removedResult(String key, SchematicEntry entry)
           
 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 SchematicDb.replace(String, Binary, Document).
 org.infinispan.util.concurrent.NotifyingFuture<SchematicEntry> replaceAsync(String key, Document document, Document metadata)
          Asynchronous version of SchematicDb.replace(String, Document, Document).
protected  CacheSchemaLibrary schemaLibrary(boolean createIfMissing)
           
 void start()
           
 void stop()
           
 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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheSchematicDb

public CacheSchematicDb(org.infinispan.Cache<String,SchematicEntry> store)
Method Detail

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

getDescription

public String getDescription()
Description copied from interface: SchematicDb
Get the description of this database.

Specified by:
getDescription in interface SchematicDb
Returns:
the library description; never null

getCache

public org.infinispan.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

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

getSchemaLibrary

public SchemaLibrary getSchemaLibrary()
Description copied from interface: SchematicDb
Get the reference to the SchemaLibrary for this database.

Specified by:
getSchemaLibrary in interface SchematicDb
Returns:
the schema library; never null

schemaLibrary

protected CacheSchemaLibrary schemaLibrary(boolean createIfMissing)

validateAll

public Map<String,SchemaLibrary.Results> validateAll()
Description copied from interface: SchematicDb
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.

Specified by:
validateAll in interface SchematicDb
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

public Map<String,SchemaLibrary.Results> validate(String firstKey,
                                                  String... additionalKeys)
Description copied from interface: SchematicDb
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.

Specified by:
validate in interface SchematicDb
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

public SchemaLibrary.Results validate(String key)
Description copied from interface: SchematicDb
Validate the JSON document store at the specified key.

Specified by:
validate in interface SchematicDb
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

proxy

protected SchematicEntry proxy(String key,
                               SchematicEntry entry)

removedResult

protected SchematicEntry removedResult(String key,
                                       SchematicEntry entry)

future

protected CacheSchematicDb.SchematicEntryProxyFuture future(String key,
                                                            org.infinispan.util.concurrent.NotifyingFuture<SchematicEntry> future,
                                                            boolean isRemoved)

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,
                          Document metadata)
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
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:
SchematicDb.put(String, Binary, Document), SchematicDb.putIfAbsent(String, Binary, Document), SchematicDb.putIfAbsent(String, Document, Document)

put

public SchematicEntry put(String key,
                          Binary binaryContent,
                          Document metadata)
Description copied from interface: SchematicDb
Store the supplied binary value and metadata at the given key.

Specified by:
put in interface SchematicDb
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

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.put(String, Binary, Document), SchematicDb.putIfAbsent(String, Binary, Document), SchematicDb.putIfAbsent(String, Document, Document)

putIfAbsent

public SchematicEntry putIfAbsent(String key,
                                  Document document,
                                  Document metadata)
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
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

public SchematicEntry putIfAbsent(String key,
                                  Binary binaryContent,
                                  Document metadata)
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
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

public SchematicEntry putIfAbsent(Document entryDocument)
Description copied from interface: SchematicDb
Store the supplied document and metadata at the given key.

Specified by:
putIfAbsent in interface SchematicDb
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:
SchematicDb.put(String, Binary, Document), SchematicDb.putIfAbsent(String, Binary, Document), SchematicDb.putIfAbsent(String, Document, Document)

replace

public SchematicEntry replace(String key,
                              Document document,
                              Document metadata)
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)
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

public SchematicEntry replace(String key,
                              Binary binaryContent,
                              Document metadata)
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 document at the given key.

Specified by:
replace in interface SchematicDb
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

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

getAsync

public org.infinispan.util.concurrent.NotifyingFuture<SchematicEntry> getAsync(String key)
Description copied from interface: SchematicDb
Asynchronous version of SchematicDb.get(String). This method does not block on remote calls, even if the library cache mode is synchronous.

Specified by:
getAsync in interface SchematicDb
Parameters:
key - the key or identifier for the document
Returns:
a future containing the entry at the given key; never null

putAsync

public org.infinispan.util.concurrent.NotifyingFuture<SchematicEntry> putAsync(String key,
                                                                               Document document,
                                                                               Document metadata)
Description copied from interface: SchematicDb
Asynchronous version of SchematicDb.put(String, Document, Document). This method does not block on remote calls, even if the library cache mode is synchronous.

Specified by:
putAsync in interface SchematicDb
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

public org.infinispan.util.concurrent.NotifyingFuture<SchematicEntry> putAsync(String key,
                                                                               Binary binaryContent,
                                                                               Document metadata)
Description copied from interface: SchematicDb
Asynchronous version of SchematicDb.put(String, Binary, Document). This method does not block on remote calls, even if the library cache mode is synchronous.

Specified by:
putAsync in interface SchematicDb
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

public org.infinispan.util.concurrent.NotifyingFuture<SchematicEntry> putIfAbsentAsync(String key,
                                                                                       Document document,
                                                                                       Document metadata)
Description copied from interface: SchematicDb
Asynchronous version of SchematicDb.putIfAbsent(String, Document, Document). This method does not block on remote calls, even

Specified by:
putIfAbsentAsync in interface SchematicDb
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

public org.infinispan.util.concurrent.NotifyingFuture<SchematicEntry> putIfAbsentAsync(String key,
                                                                                       Binary binaryContent,
                                                                                       Document metadata)
Description copied from interface: SchematicDb
Asynchronous version of SchematicDb.putIfAbsent(String, Binary, Document). This method does not block on remote calls, even

Specified by:
putIfAbsentAsync in interface SchematicDb
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

public org.infinispan.util.concurrent.NotifyingFuture<SchematicEntry> replaceAsync(String key,
                                                                                   Document document,
                                                                                   Document metadata)
Description copied from interface: SchematicDb
Asynchronous version of SchematicDb.replace(String, Document, Document). This method does not block on remote calls, even if the library cache mode is synchronous.

Specified by:
replaceAsync 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)
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

public org.infinispan.util.concurrent.NotifyingFuture<SchematicEntry> replaceAsync(String key,
                                                                                   Binary binaryContent,
                                                                                   Document metadata)
Description copied from interface: SchematicDb
Asynchronous version of SchematicDb.replace(String, Binary, Document). This method does not block on remote calls, even if the library cache mode is synchronous.

Specified by:
replaceAsync in interface SchematicDb
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

public org.infinispan.util.concurrent.NotifyingFuture<SchematicEntry> removeAsync(String key)
Description copied from interface: SchematicDb
Asynchronous version of SchematicDb.remove(String). This method does not block on remote calls, even if the library cache mode is synchronous.

Specified by:
removeAsync in interface SchematicDb
Parameters:
key - the key or identifier for the document
Returns:
a future containing the old entry that was removed; never null

ModeShape Distribution 3.0.0.Beta4

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