| 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sdnplatform.sync.internal.AbstractStoreClient<K,V>
org.sdnplatform.sync.internal.DefaultStoreClient<K,V>
K - the key typeV - the value typepublic class DefaultStoreClient<K,V>
Default implementation of a store client used for accessing a store locally in process.
| Nested Class Summary | |
|---|---|
protected  class | 
DefaultStoreClient.StoreClientIterator
 | 
| Field Summary | |
|---|---|
protected static org.slf4j.Logger | 
logger
 | 
| Constructor Summary | |
|---|---|
DefaultStoreClient(IStore<K,V> delegate,
                   IInconsistencyResolver<Versioned<V>> resolver,
                   AbstractSyncManager syncManager,
                   java.lang.Class<K> keyClass,
                   com.fasterxml.jackson.core.type.TypeReference<K> keyType)
 | 
|
| Method Summary | |
|---|---|
 void | 
addStoreListener(IStoreListener<K> listener)
Add a listener that will be notified about changes to the given store.  | 
protected  Versioned<V> | 
defaultValue(Versioned<V> defaultValue)
 | 
 IClosableIterator<java.util.Map.Entry<K,Versioned<V>>> | 
entries()
Get an iterator that will get all the entries in the store.  | 
 Versioned<V> | 
get(K key,
    Versioned<V> defaultValue)
Get the versioned value associated with the given key or the defaultValue if no value is associated with the key.  | 
protected  Versioned<V> | 
getItemOrThrow(K key,
               Versioned<V> defaultValue,
               java.util.List<Versioned<V>> items)
 | 
protected  java.util.List<IVersion> | 
getVersions(K key)
Get the versions for a key  | 
protected  Versioned<V> | 
handleGet(K key,
          Versioned<V> defaultValue,
          java.util.List<Versioned<V>> raw)
 | 
 IVersion | 
put(K key,
    Versioned<V> versioned)
Put the given Versioned value into the store for the given key if the version is greater to or concurrent with existing values.  | 
| Methods inherited from class org.sdnplatform.sync.internal.AbstractStoreClient | 
|---|
delete, delete, get, getValue, getValue, put, putIfNotObsolete | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
protected static final org.slf4j.Logger logger
| Constructor Detail | 
|---|
public DefaultStoreClient(IStore<K,V> delegate,
                          IInconsistencyResolver<Versioned<V>> resolver,
                          AbstractSyncManager syncManager,
                          java.lang.Class<K> keyClass,
                          com.fasterxml.jackson.core.type.TypeReference<K> keyType)
| Method Detail | 
|---|
public Versioned<V> get(K key,
                        Versioned<V> defaultValue)
                 throws SyncException
IStoreClient
key - The key for which to fetch the value.
SyncException
public IClosableIterator<java.util.Map.Entry<K,Versioned<V>>> entries()
                                                               throws SyncException
IStoreClientIClosableIterator when you are
 finished with it or there may be resource leaks.  An example of how you
 should use this iterator to ensure that it is closed even if there are
 exceptions follows:
 
 IClosableIterator iter = store.entries();
 try {
     // do your iteration
 } finally {
     iter.close();
 }
 
 Another important caveat is that because IClosableIterator
 extends Iterator, there is no checked exception declared in
 Iterator.next().  Because of this, calling
 Iterator.next() on the iterator returned here may throw a
 SyncRuntimeException wrapping a SyncException such as might be
 returned by IStoreClient.get(Object)
SyncException
public IVersion put(K key,
                    Versioned<V> versioned)
             throws SyncException
IStoreClient
key - The keyversioned - The value and its versioned
ObsoleteVersionException
SyncExceptionpublic void addStoreListener(IStoreListener<K> listener)
IStoreClient
listener - the IStoreListener that will receive the
 notifications
protected java.util.List<IVersion> getVersions(K key)
                                        throws SyncException
AbstractStoreClient
getVersions in class AbstractStoreClient<K,V>key - the key
SyncException
protected Versioned<V> handleGet(K key,
                                 Versioned<V> defaultValue,
                                 java.util.List<Versioned<V>> raw)
                          throws InconsistentDataException
InconsistentDataExceptionprotected Versioned<V> defaultValue(Versioned<V> defaultValue)
protected Versioned<V> getItemOrThrow(K key,
                                      Versioned<V> defaultValue,
                                      java.util.List<Versioned<V>> items)
                               throws InconsistentDataException
InconsistentDataException
  | 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||