|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.floodlightcontroller.storage.AbstractStorageSource
public abstract class AbstractStorageSource
Field Summary | |
---|---|
protected java.util.Set<java.lang.String> |
allTableNames
|
protected ICounterStoreService |
counterStore
|
protected static java.lang.String |
DB_ERROR_EXPLANATION
|
protected static java.util.concurrent.ExecutorService |
defaultExecutorService
|
protected IStorageExceptionHandler |
exceptionHandler
|
protected java.util.concurrent.ExecutorService |
executorService
|
protected static org.slf4j.Logger |
logger
|
protected IRestApiService |
restApi
|
protected static java.lang.String |
STORAGE_DELETE_COUNTER_NAME
|
protected static java.lang.String |
STORAGE_QUERY_COUNTER_NAME
|
protected static java.lang.String |
STORAGE_UPDATE_COUNTER_NAME
|
Constructor Summary | |
---|---|
AbstractStorageSource()
|
Method Summary | |
---|---|
void |
addListener(java.lang.String tableName,
IStorageSourceListener listener)
Add a listener to the specified table. |
abstract IQuery |
createQuery(java.lang.String tableName,
java.lang.String[] columnNames,
IPredicate predicate,
RowOrdering ordering)
Create a query object representing the given query parameters. |
void |
createTable(java.lang.String tableName,
java.util.Set<java.lang.String> indexedColumns)
Create a new table if one does not already exist with the given name. |
void |
deleteMatchingRows(java.lang.String tableName,
IPredicate predicate)
Delete the rows that match the predicate |
java.util.concurrent.Future<?> |
deleteMatchingRowsAsync(java.lang.String tableName,
IPredicate predicate)
Asynchronous version of deleteRows |
void |
deleteRow(java.lang.String tableName,
java.lang.Object rowKey)
Delete the row with the given primary key. |
java.util.concurrent.Future<?> |
deleteRowAsync(java.lang.String tableName,
java.lang.Object rowKey)
Asynchronous version of deleteRow |
protected abstract void |
deleteRowImpl(java.lang.String tableName,
java.lang.Object rowKey)
|
void |
deleteRows(java.lang.String tableName,
java.util.Set<java.lang.Object> rowKeys)
Delete the rows with the given keys. |
java.util.concurrent.Future<?> |
deleteRowsAsync(java.lang.String tableName,
java.util.Set<java.lang.Object> rowKeys)
Asynchronous version of deleteRows |
protected abstract void |
deleteRowsImpl(java.lang.String tableName,
java.util.Set<java.lang.Object> rowKeys)
|
IResultSet |
executeQuery(IQuery query)
Execute a query created with createQuery. |
IResultSet |
executeQuery(java.lang.String tableName,
java.lang.String[] columnNames,
IPredicate predicate,
RowOrdering ordering)
Execute a query created with the given query parameters. |
java.lang.Object[] |
executeQuery(java.lang.String tableName,
java.lang.String[] columnNames,
IPredicate predicate,
RowOrdering ordering,
IRowMapper rowMapper)
Execute a query and call the row mapper to map the results to Java objects. |
java.util.concurrent.Future<IResultSet> |
executeQueryAsync(IQuery query)
Asynchronous variant of executeQuery. |
java.util.concurrent.Future<IResultSet> |
executeQueryAsync(java.lang.String tableName,
java.lang.String[] columnNames,
IPredicate predicate,
RowOrdering ordering)
Asynchronous variant of executeQuery. |
java.util.concurrent.Future<java.lang.Object[]> |
executeQueryAsync(java.lang.String tableName,
java.lang.String[] columnNames,
IPredicate predicate,
RowOrdering ordering,
IRowMapper rowMapper)
Asynchronous variant of executeQuery |
protected abstract IResultSet |
executeQueryImpl(IQuery query)
|
java.util.Set<java.lang.String> |
getAllTableNames()
|
java.util.Collection<java.lang.Class<? extends IFloodlightService>> |
getModuleDependencies()
Get a list of Modules that this module depends on. |
java.util.Collection<java.lang.Class<? extends IFloodlightService>> |
getModuleServices()
Return the list of interfaces that this module implements. |
IResultSet |
getRow(java.lang.String tableName,
java.lang.Object rowKey)
Query for a row with the given ID (primary key). |
java.util.concurrent.Future<?> |
getRowAsync(java.lang.String tableName,
java.lang.Object rowKey)
Asynchronous version of getRow |
protected abstract IResultSet |
getRowImpl(java.lang.String tableName,
java.lang.Object rowKey)
|
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. |
void |
init(FloodlightModuleContext context)
This is a hook for each module to do its internal initialization, e.g., call setService(context.getService("Service")) All module dependencies are resolved when this is called, but not every module is initialized. |
void |
insertRow(java.lang.String tableName,
java.util.Map<java.lang.String,java.lang.Object> values)
Insert a new row in the table with the given column data. |
java.util.concurrent.Future<?> |
insertRowAsync(java.lang.String tableName,
java.util.Map<java.lang.String,java.lang.Object> values)
Asynchronous variant of insertRow. |
protected abstract void |
insertRowImpl(java.lang.String tableName,
java.util.Map<java.lang.String,java.lang.Object> values)
|
void |
notifyListeners(java.util.List<StorageSourceNotification> notifications)
This is logically a private method and should not be called by clients of this interface. |
protected void |
notifyListeners(StorageSourceNotification notification)
|
void |
removeListener(java.lang.String tableName,
IStorageSourceListener listener)
Remove a listener from the specified table. |
java.util.concurrent.Future<?> |
saveAsync(IResultSet resultSet)
Asynchronous version of save |
void |
setCounterStore(CounterStore counterStore)
|
void |
setExceptionHandler(IStorageExceptionHandler exceptionHandler)
Set exception handler to use for asynchronous operations. |
void |
setExecutorService(java.util.concurrent.ExecutorService executorService)
|
abstract void |
setTablePrimaryKeyName(java.lang.String tableName,
java.lang.String primaryKeyName)
Set the column to be used as the primary key for a table. |
void |
startUp(FloodlightModuleContext context)
This is a hook for each module to do its external initializations, e.g., register for callbacks or query for state in other modules It is expected that this function will not block and that modules that want non-event driven CPU will spawn their own threads. |
protected void |
updateCounters(java.lang.String baseName,
java.lang.String tableName)
|
void |
updateMatchingRows(java.lang.String tableName,
IPredicate predicate,
java.util.Map<java.lang.String,java.lang.Object> values)
Update the rows in the given table. |
java.util.concurrent.Future<?> |
updateMatchingRowsAsync(java.lang.String tableName,
IPredicate predicate,
java.util.Map<java.lang.String,java.lang.Object> values)
Asynchronous variant of updateMatchingRows |
protected abstract void |
updateMatchingRowsImpl(java.lang.String tableName,
IPredicate predicate,
java.util.Map<java.lang.String,java.lang.Object> values)
|
void |
updateRow(java.lang.String tableName,
java.util.Map<java.lang.String,java.lang.Object> values)
Update or insert a row in the table with the given column data. |
void |
updateRow(java.lang.String tableName,
java.lang.Object rowKey,
java.util.Map<java.lang.String,java.lang.Object> values)
Update or insert a row in the table with the given row key (primary key) and column names/values. |
java.util.concurrent.Future<?> |
updateRowAsync(java.lang.String tableName,
java.util.Map<java.lang.String,java.lang.Object> values)
Asynchronous version of updateRow |
java.util.concurrent.Future<?> |
updateRowAsync(java.lang.String tableName,
java.lang.Object rowKey,
java.util.Map<java.lang.String,java.lang.Object> values)
Asynchronous variant of updateRow |
protected abstract void |
updateRowImpl(java.lang.String tableName,
java.util.Map<java.lang.String,java.lang.Object> values)
|
protected abstract void |
updateRowImpl(java.lang.String tableName,
java.lang.Object rowKey,
java.util.Map<java.lang.String,java.lang.Object> values)
|
void |
updateRows(java.lang.String tableName,
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> rows)
Update or insert a list of rows in the table. |
java.util.concurrent.Future<?> |
updateRowsAsync(java.lang.String tableName,
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> rows)
Asynchronous variant of updateRows |
protected abstract void |
updateRowsImpl(java.lang.String tableName,
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> rows)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static org.slf4j.Logger logger
protected static java.util.concurrent.ExecutorService defaultExecutorService
protected static final java.lang.String STORAGE_QUERY_COUNTER_NAME
protected static final java.lang.String STORAGE_UPDATE_COUNTER_NAME
protected static final java.lang.String STORAGE_DELETE_COUNTER_NAME
protected java.util.Set<java.lang.String> allTableNames
protected ICounterStoreService counterStore
protected java.util.concurrent.ExecutorService executorService
protected IStorageExceptionHandler exceptionHandler
protected IRestApiService restApi
protected static final java.lang.String DB_ERROR_EXPLANATION
Constructor Detail |
---|
public AbstractStorageSource()
Method Detail |
---|
public void setExecutorService(java.util.concurrent.ExecutorService executorService)
public void setExceptionHandler(IStorageExceptionHandler exceptionHandler)
IStorageSourceService
setExceptionHandler
in interface IStorageSourceService
public abstract void setTablePrimaryKeyName(java.lang.String tableName, java.lang.String primaryKeyName)
IStorageSourceService
setTablePrimaryKeyName
in interface IStorageSourceService
tableName
- The name of the table for which we're setting the keyprimaryKeyName
- The name of column to be used as the primary keypublic void createTable(java.lang.String tableName, java.util.Set<java.lang.String> indexedColumns)
IStorageSourceService
createTable
in interface IStorageSourceService
tableName
- The name of the table to create.indexedColumns
- Which columns should be indexedpublic java.util.Set<java.lang.String> getAllTableNames()
getAllTableNames
in interface IStorageSourceService
public void setCounterStore(CounterStore counterStore)
protected void updateCounters(java.lang.String baseName, java.lang.String tableName)
public abstract IQuery createQuery(java.lang.String tableName, java.lang.String[] columnNames, IPredicate predicate, RowOrdering ordering)
IStorageSourceService
createQuery
in interface IStorageSourceService
tableName
- The name of the table to query.columnNames
- The list of columns to return in the result set.predicate
- The predicate that specifies which rows to return in the result set.ordering
- Specification of order that rows are returned from the result set
returned from executing the query. If the ordering is null, then rows are returned
in an implementation-specific order.
public IResultSet executeQuery(IQuery query)
IStorageSourceService
executeQuery
in interface IStorageSourceService
query
- The query to execute
protected abstract IResultSet executeQueryImpl(IQuery query)
public IResultSet executeQuery(java.lang.String tableName, java.lang.String[] columnNames, IPredicate predicate, RowOrdering ordering)
IStorageSourceService
executeQuery
in interface IStorageSourceService
tableName
- The name of the table to query.columnNames
- The list of columns to return in the result set.predicate
- The predicate that specifies which rows to return in the result set.ordering
- Specification of order that rows are returned from the result set
returned from executing the query. If the ordering is null, then rows are returned
in an implementation-specific order.
public java.lang.Object[] executeQuery(java.lang.String tableName, java.lang.String[] columnNames, IPredicate predicate, RowOrdering ordering, IRowMapper rowMapper)
IStorageSourceService
executeQuery
in interface IStorageSourceService
tableName
- The name of the table to query.columnNames
- The list of columns to return in the result set.predicate
- The predicate that specifies which rows to return in the result set.ordering
- Specification of order that rows are returned from the result set
returned from executing the query. If the ordering is null, then rows are returned
in an implementation-specific order.rowMapper
- The client-supplied object that maps the data in a row in the result
set to a client object.
public java.util.concurrent.Future<IResultSet> executeQueryAsync(IQuery query)
IStorageSourceService
executeQueryAsync
in interface IStorageSourceService
public java.util.concurrent.Future<IResultSet> executeQueryAsync(java.lang.String tableName, java.lang.String[] columnNames, IPredicate predicate, RowOrdering ordering)
IStorageSourceService
executeQueryAsync
in interface IStorageSourceService
public java.util.concurrent.Future<java.lang.Object[]> executeQueryAsync(java.lang.String tableName, java.lang.String[] columnNames, IPredicate predicate, RowOrdering ordering, IRowMapper rowMapper)
IStorageSourceService
executeQueryAsync
in interface IStorageSourceService
public java.util.concurrent.Future<?> insertRowAsync(java.lang.String tableName, java.util.Map<java.lang.String,java.lang.Object> values)
IStorageSourceService
insertRowAsync
in interface IStorageSourceService
public java.util.concurrent.Future<?> updateRowsAsync(java.lang.String tableName, java.util.List<java.util.Map<java.lang.String,java.lang.Object>> rows)
IStorageSourceService
updateRowsAsync
in interface IStorageSourceService
public java.util.concurrent.Future<?> updateMatchingRowsAsync(java.lang.String tableName, IPredicate predicate, java.util.Map<java.lang.String,java.lang.Object> values)
IStorageSourceService
updateMatchingRowsAsync
in interface IStorageSourceService
public java.util.concurrent.Future<?> updateRowAsync(java.lang.String tableName, java.lang.Object rowKey, java.util.Map<java.lang.String,java.lang.Object> values)
IStorageSourceService
updateRowAsync
in interface IStorageSourceService
public java.util.concurrent.Future<?> updateRowAsync(java.lang.String tableName, java.util.Map<java.lang.String,java.lang.Object> values)
IStorageSourceService
updateRowAsync
in interface IStorageSourceService
public java.util.concurrent.Future<?> deleteRowAsync(java.lang.String tableName, java.lang.Object rowKey)
IStorageSourceService
deleteRowAsync
in interface IStorageSourceService
public java.util.concurrent.Future<?> deleteRowsAsync(java.lang.String tableName, java.util.Set<java.lang.Object> rowKeys)
IStorageSourceService
deleteRowsAsync
in interface IStorageSourceService
public java.util.concurrent.Future<?> deleteMatchingRowsAsync(java.lang.String tableName, IPredicate predicate)
IStorageSourceService
deleteMatchingRowsAsync
in interface IStorageSourceService
public java.util.concurrent.Future<?> getRowAsync(java.lang.String tableName, java.lang.Object rowKey)
IStorageSourceService
getRowAsync
in interface IStorageSourceService
public java.util.concurrent.Future<?> saveAsync(IResultSet resultSet)
IStorageSourceService
saveAsync
in interface IStorageSourceService
public void insertRow(java.lang.String tableName, java.util.Map<java.lang.String,java.lang.Object> values)
IStorageSourceService
insertRow
in interface IStorageSourceService
tableName
- The name of the table to which to add the rowvalues
- The map of column names/values to add to the table.protected abstract void insertRowImpl(java.lang.String tableName, java.util.Map<java.lang.String,java.lang.Object> values)
public void updateRows(java.lang.String tableName, java.util.List<java.util.Map<java.lang.String,java.lang.Object>> rows)
IStorageSourceService
updateRows
in interface IStorageSourceService
tableName
- The table to update or insert intoprotected abstract void updateRowsImpl(java.lang.String tableName, java.util.List<java.util.Map<java.lang.String,java.lang.Object>> rows)
public void updateMatchingRows(java.lang.String tableName, IPredicate predicate, java.util.Map<java.lang.String,java.lang.Object> values)
IStorageSourceService
updateMatchingRows
in interface IStorageSourceService
tableName
- The table to updatepredicate
- The predicate to use to select which rows to updatevalues
- The map of column names/values to update the rows.protected abstract void updateMatchingRowsImpl(java.lang.String tableName, IPredicate predicate, java.util.Map<java.lang.String,java.lang.Object> values)
public void updateRow(java.lang.String tableName, java.lang.Object rowKey, java.util.Map<java.lang.String,java.lang.Object> values)
IStorageSourceService
updateRow
in interface IStorageSourceService
tableName
- The table to update or insert intorowKey
- The ID (primary key) of the row to updatevalues
- The map of column names/values to update the rowsprotected abstract void updateRowImpl(java.lang.String tableName, java.lang.Object rowKey, java.util.Map<java.lang.String,java.lang.Object> values)
public void updateRow(java.lang.String tableName, java.util.Map<java.lang.String,java.lang.Object> values)
IStorageSourceService
updateRow
in interface IStorageSourceService
tableName
- The table to update or insert intovalues
- The map of column names/values to update the rowsprotected abstract void updateRowImpl(java.lang.String tableName, java.util.Map<java.lang.String,java.lang.Object> values)
public void deleteRow(java.lang.String tableName, java.lang.Object rowKey)
IStorageSourceService
deleteRow
in interface IStorageSourceService
tableName
- The table from which to delete the rowrowKey
- The primary key of the row to delete.protected abstract void deleteRowImpl(java.lang.String tableName, java.lang.Object rowKey)
public void deleteRows(java.lang.String tableName, java.util.Set<java.lang.Object> rowKeys)
IStorageSourceService
deleteRows
in interface IStorageSourceService
tableName
- The table from which to delete the rowsrowKeys
- The set of primary keys of the rows to delete.protected abstract void deleteRowsImpl(java.lang.String tableName, java.util.Set<java.lang.Object> rowKeys)
public void deleteMatchingRows(java.lang.String tableName, IPredicate predicate)
IStorageSourceService
deleteMatchingRows
in interface IStorageSourceService
public IResultSet getRow(java.lang.String tableName, java.lang.Object rowKey)
IStorageSourceService
getRow
in interface IStorageSourceService
tableName
- The name of the table to queryrowKey
- The primary key of the row
protected abstract IResultSet getRowImpl(java.lang.String tableName, java.lang.Object rowKey)
public void addListener(java.lang.String tableName, IStorageSourceListener listener)
IStorageSourceService
addListener
in interface IStorageSourceService
tableName
- The name of the table to listen for modificationslistener
- The listener instance to callpublic void removeListener(java.lang.String tableName, IStorageSourceListener listener)
IStorageSourceService
removeListener
in interface IStorageSourceService
tableName
- The name of the table with the listenerlistener
- The previously installed listener instanceprotected void notifyListeners(StorageSourceNotification notification)
public void notifyListeners(java.util.List<StorageSourceNotification> notifications)
IStorageSourceService
notifyListeners
in interface IStorageSourceService
notifications
- the notifications to dispatchpublic java.util.Collection<java.lang.Class<? extends IFloodlightService>> getModuleServices()
IFloodlightModule
getModuleServices
in interface IFloodlightModule
public java.util.Map<java.lang.Class<? extends IFloodlightService>,IFloodlightService> getServiceImpls()
IFloodlightModule
getServiceImpls
in interface IFloodlightModule
public java.util.Collection<java.lang.Class<? extends IFloodlightService>> getModuleDependencies()
IFloodlightModule
getModuleDependencies
in interface IFloodlightModule
public void init(FloodlightModuleContext context) throws FloodlightModuleException
IFloodlightModule
init
in interface IFloodlightModule
FloodlightModuleException
public void startUp(FloodlightModuleContext context)
IFloodlightModule
startUp
in interface IFloodlightModule
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |