ModeShape Distribution 3.0.0.Beta4

org.infinispan.schematic.internal
Class InMemoryDocumentLibrary

java.lang.Object
  extended by org.infinispan.schematic.internal.InMemoryDocumentLibrary
All Implemented Interfaces:
Serializable, DocumentLibrary

public class InMemoryDocumentLibrary
extends Object
implements DocumentLibrary, Serializable

See Also:
Serialized Form

Nested Class Summary
protected static class InMemoryDocumentLibrary.ImmediateFuture
           
 
Constructor Summary
InMemoryDocumentLibrary(String name)
           
 
Method Summary
 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).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InMemoryDocumentLibrary

public InMemoryDocumentLibrary(String name)
Method Detail

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

ModeShape Distribution 3.0.0.Beta4

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