|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvooga.network.data.DataManager
public abstract class DataManager
The DataManager class is the superclass for both server-side and local data managers. It defines all shared methods for managing data.
Constructor Summary | |
---|---|
protected |
DataManager(java.lang.String mainDir,
VoogaModule module)
Creates a DataManager for the given module using files
stored in the given main directory. |
Method Summary | |
---|---|
boolean |
containsData(java.lang.String table,
java.util.List<java.lang.String> key)
Determines if the manager is storing data with the given key in the given table. |
boolean |
containsData(java.lang.String table,
java.lang.String key)
Determines if the manager is storing data with the given key in the given table. |
boolean |
containsTable(java.lang.String tableName)
Determines if the manager has a table with the given name. |
void |
createTable(java.lang.String tableName)
Creates a table with the given name. |
void |
eraseData(java.lang.String table,
java.util.List<java.lang.String> key)
Erases the data in the given table stored with the given key. |
void |
eraseData(java.lang.String table,
java.lang.String key)
Erases the data in the given table stored with the given key. |
void |
eraseTable(java.lang.String tableName)
Erases the given table from the manager. |
java.util.Map<java.util.List<java.lang.String>,java.lang.Object> |
getAllData(java.lang.String table)
Gets all data stored in the given table. |
java.lang.Object |
getData(java.lang.String table,
java.util.List<java.lang.String> key)
Retrieves the data stored in the given table with the given key. |
java.lang.Object |
getData(java.lang.String table,
java.lang.String key)
Retrieves the data stored in the given table with the given key. |
java.util.Map<java.lang.String,DataTable> |
getMyData()
|
VoogaModule |
getMyModule()
|
protected abstract void |
initialize()
Allows subclasses to perform any additional initialization once the data has been loaded from file. |
java.util.Map<java.lang.String,DataTable> |
loadData()
Loads each file in the module's directory into a map of DataTable s. |
void |
saveData()
Saves all tables that have been updated since the last save to file. |
void |
storeData(java.lang.String table,
java.util.List<java.lang.String> key,
java.lang.Object data)
Stores data in the manager. |
void |
storeData(java.lang.String table,
java.lang.String key,
java.lang.Object data)
Stores data in the manager. |
DataObject |
synchronize(java.lang.String table,
java.util.List<java.lang.String> key,
DataObject local)
Synchronize the DataObject in the specified location with
the given DataObject . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected DataManager(java.lang.String mainDir, VoogaModule module)
DataManager
for the given module using files
stored in the given main directory. This constructor is only used by the
subclasses of DataManager.
mainDir
- module
- Method Detail |
---|
protected abstract void initialize()
public java.util.Map<java.lang.String,DataTable> getMyData()
public VoogaModule getMyModule()
public java.util.Map<java.lang.String,DataTable> loadData()
DataTable
s.
public void storeData(java.lang.String table, java.lang.String key, java.lang.Object data)
table
- The table in which to store data.key
- The key that will be used to retrieve the data.data
- public void storeData(java.lang.String table, java.util.List<java.lang.String> key, java.lang.Object data)
table
- The table in which to store data.key
- The key that will be used to retrieve the data.data
- public void eraseData(java.lang.String table, java.lang.String key)
table
- The table in which the data to be accessed is stored.key
- The data's key.public void eraseData(java.lang.String table, java.util.List<java.lang.String> key)
table
- The table in which the data to be accessed is stored.key
- The data's key.public java.lang.Object getData(java.lang.String table, java.lang.String key)
table
- The table in which the data to be accessed is stored.key
- The data's key.
public java.lang.Object getData(java.lang.String table, java.util.List<java.lang.String> key)
table
- The table in which the data to be accessed is stored.key
- The data's key.
public java.util.Map<java.util.List<java.lang.String>,java.lang.Object> getAllData(java.lang.String table)
table
- The table in which the data to be accessed is stored.
List
, to data.public boolean containsData(java.lang.String table, java.lang.String key)
table
- The table in which the data to be accessed is stored.key
- The data's key.
public boolean containsData(java.lang.String table, java.util.List<java.lang.String> key)
table
- The table in which the data to be accessed is stored.key
- The data's key.
public boolean containsTable(java.lang.String tableName)
tableName
- queried table name
public void createTable(java.lang.String tableName) throws VoogaNetworkException
tableName
- name to be given to new table
VoogaNetworkException
- If the manager already has that table.public void eraseTable(java.lang.String tableName)
tableName
- name of table to be removedpublic DataObject synchronize(java.lang.String table, java.util.List<java.lang.String> key, DataObject local)
DataObject
in the specified location with
the given DataObject
.
table
- The table in which the data to be accessed is stored.key
- The data's key.local
-
DataObject
.public void saveData()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |