org.sdnplatform.sync.internal
Class AbstractSyncManager

java.lang.Object
  extended by org.sdnplatform.sync.internal.AbstractSyncManager
All Implemented Interfaces:
IFloodlightModule, IFloodlightService, ISyncService
Direct Known Subclasses:
RemoteSyncManager, SyncManager

public abstract class AbstractSyncManager
extends java.lang.Object
implements ISyncService, IFloodlightModule

An abstract base class for modules providing ISyncService

Author:
readams

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.sdnplatform.sync.ISyncService
ISyncService.Scope
 
Constructor Summary
AbstractSyncManager()
           
 
Method Summary
abstract  void addListener(java.lang.String storeName, MappingStoreListener listener)
          Add a listener to the specified store
abstract  short getLocalNodeId()
          Get the local ID of the local node
 java.util.Collection<java.lang.Class<? extends IFloodlightService>> getModuleServices()
          Return the list of interfaces that this module implements.
 java.util.Map<java.lang.Class<? extends IFloodlightService>,IFloodlightService> getServiceImpls()
          Instantiate (as needed) and return objects that implement each of the services exported by this module.
abstract  IStore<ByteArray,byte[]> getStore(java.lang.String storeName)
          Get a store object corresponding to the given store name
<K,V> IStoreClient<K,V>
getStoreClient(java.lang.String storeName, java.lang.Class<K> keyClass, java.lang.Class<V> valueClass)
          Get a store client for the given store.
<K,V> IStoreClient<K,V>
getStoreClient(java.lang.String storeName, java.lang.Class<K> keyClass, java.lang.Class<V> valueClass, IInconsistencyResolver<Versioned<V>> resolver)
          Get a store client that will use the provided inconsistency resolver to resolve concurrent updates.
<K,V> IStoreClient<K,V>
getStoreClient(java.lang.String storeName, java.lang.Class<K> keyClass, com.fasterxml.jackson.core.type.TypeReference<K> keyType, java.lang.Class<V> valueClass, com.fasterxml.jackson.core.type.TypeReference<V> valueType, IInconsistencyResolver<Versioned<V>> resolver)
          The "real" version of getStoreClient that will be called by all the others
<K,V> IStoreClient<K,V>
getStoreClient(java.lang.String storeName, com.fasterxml.jackson.core.type.TypeReference<K> keyType, com.fasterxml.jackson.core.type.TypeReference<V> valueType)
          Get a store client for the given store.
<K,V> IStoreClient<K,V>
getStoreClient(java.lang.String storeName, com.fasterxml.jackson.core.type.TypeReference<K> keyType, com.fasterxml.jackson.core.type.TypeReference<V> valueType, IInconsistencyResolver<Versioned<V>> resolver)
          Get a store client that will use the provided inconsistency resolver to resolve concurrent updates.
abstract  void shutdown()
          Shut down the sync manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.sdnplatform.sync.ISyncService
registerPersistentStore, registerStore
 
Methods inherited from interface net.floodlightcontroller.core.module.IFloodlightModule
getModuleDependencies, init, startUp
 

Constructor Detail

AbstractSyncManager

public AbstractSyncManager()
Method Detail

getStoreClient

public <K,V> IStoreClient<K,V> getStoreClient(java.lang.String storeName,
                                              java.lang.Class<K> keyClass,
                                              java.lang.Class<V> valueClass)
                                 throws UnknownStoreException
Description copied from interface: ISyncService
Get a store client for the given store. The store client will use a default inconsistency resolution strategy which will use the timestamps of any concurrent updates and choose the later update

Specified by:
getStoreClient in interface ISyncService
Parameters:
storeName - the name of the store to retrieve
keyClass - the class for the underlying key needed for deserialization
valueClass - the class for the underlying value needed for deserialization
Returns:
the store client
Throws:
UnknownStoreException

getStoreClient

public <K,V> IStoreClient<K,V> getStoreClient(java.lang.String storeName,
                                              com.fasterxml.jackson.core.type.TypeReference<K> keyType,
                                              com.fasterxml.jackson.core.type.TypeReference<V> valueType)
                                 throws UnknownStoreException
Description copied from interface: ISyncService
Get a store client for the given store. The store client will use a default inconsistency resolution strategy which will use the timestamps of any concurrent updates and choose the later update

Specified by:
getStoreClient in interface ISyncService
Parameters:
storeName - the name of the store to retrieve
keyType - the type reference for the underlying key needed for deserialization
valueType - the type reference for the underlying value needed for deserialization
Returns:
the store client
Throws:
UnknownStoreException

getStoreClient

public <K,V> IStoreClient<K,V> getStoreClient(java.lang.String storeName,
                                              com.fasterxml.jackson.core.type.TypeReference<K> keyType,
                                              com.fasterxml.jackson.core.type.TypeReference<V> valueType,
                                              IInconsistencyResolver<Versioned<V>> resolver)
                                 throws UnknownStoreException
Description copied from interface: ISyncService
Get a store client that will use the provided inconsistency resolver to resolve concurrent updates.

Specified by:
getStoreClient in interface ISyncService
Parameters:
storeName - the name of the store to retrieve
keyType - the type reference for the underlying key needed for deserialization
valueType - the type reference for the underlying value needed for deserialization
resolver - the inconsistency resolver to use for the store
Returns:
the store client
Throws:
UnknownStoreException

getStoreClient

public <K,V> IStoreClient<K,V> getStoreClient(java.lang.String storeName,
                                              java.lang.Class<K> keyClass,
                                              java.lang.Class<V> valueClass,
                                              IInconsistencyResolver<Versioned<V>> resolver)
                                 throws UnknownStoreException
Description copied from interface: ISyncService
Get a store client that will use the provided inconsistency resolver to resolve concurrent updates.

Specified by:
getStoreClient in interface ISyncService
Parameters:
storeName - the name of the store to retrieve
keyClass - the class for the underlying key needed for deserialization
valueClass - the class for the underlying value needed for deserialization
resolver - the inconsistency resolver to use for the store
Returns:
the store client
Throws:
UnknownStoreException

getModuleServices

public java.util.Collection<java.lang.Class<? extends IFloodlightService>> getModuleServices()
Description copied from interface: IFloodlightModule
Return the list of interfaces that this module implements. All interfaces must inherit IFloodlightService

Specified by:
getModuleServices in interface IFloodlightModule
Returns:

getServiceImpls

public java.util.Map<java.lang.Class<? extends IFloodlightService>,IFloodlightService> getServiceImpls()
Description copied from interface: IFloodlightModule
Instantiate (as needed) and return objects that implement each of the services exported by this module. The map returned maps the implemented service to the object. The object could be the same object or different objects for different exported services.

Specified by:
getServiceImpls in interface IFloodlightModule
Returns:
The map from service interface class to service implementation

getStoreClient

public <K,V> IStoreClient<K,V> getStoreClient(java.lang.String storeName,
                                              java.lang.Class<K> keyClass,
                                              com.fasterxml.jackson.core.type.TypeReference<K> keyType,
                                              java.lang.Class<V> valueClass,
                                              com.fasterxml.jackson.core.type.TypeReference<V> valueType,
                                              IInconsistencyResolver<Versioned<V>> resolver)
                                 throws UnknownStoreException
The "real" version of getStoreClient that will be called by all the others

Parameters:
storeName - the store name
keyClass - the key class
keyType - the key type
valueClass - the value class
valueType - the value type
resolver - the inconsistency resolver
Returns:
a DefaultStoreClient using the given parameters.
Throws:
UnknownStoreException

getStore

public abstract IStore<ByteArray,byte[]> getStore(java.lang.String storeName)
                                           throws UnknownStoreException
Get a store object corresponding to the given store name

Parameters:
storeName - the store name
Returns:
the IStore
Throws:
UnknownStoreException

getLocalNodeId

public abstract short getLocalNodeId()
Get the local ID of the local node

Returns:
the node ID

addListener

public abstract void addListener(java.lang.String storeName,
                                 MappingStoreListener listener)
                          throws UnknownStoreException
Add a listener to the specified store

Parameters:
storeName - the name of the store
listener - the listener to add
Throws:
UnknownStoreException

shutdown

public abstract void shutdown()
Shut down the sync manager. Tear down any communicating threads