org.jSyncManager.API.Protocol.Util
Class DLPDatabaseSet
java.lang.Objectorg.jSyncManager.API.Protocol.Util.DLPDatabaseSet
public class DLPDatabaseSet
extends java.lang.Object
A class for the storage and halndling of multiple DLPDatabase objects.
This class holds several databases, and allows for their manipulation,
including serialization and deserialization as a set.
This class does not represent any structure on the handheld. It is a utility
class designed to make it easier to store and query databases.
DLPDatabaseSet()- Create a new empty database set object.
|
DLPDatabaseSet(String filename)- Create a new database set object based on the provided serialization directory.
|
DLPDatabaseSet
public DLPDatabaseSet()
Create a new empty database set object.
DLPDatabaseSet
public DLPDatabaseSet(String filename)
throws ExceptionCreate a new database set object based on the provided serialization directory.
filename - the directory contanining the serialized database information.
addDatabase
public void addDatabase(DLPDatabase db)
Add the specified database to the set.
db - the database to be added to the set.
databaseCount
public int databaseCount()
Return the number of databases in this set.
- the number of databases in this set.
getDatabase
public DLPDatabase getDatabase(String s)
Gets the database specified by name.
If this database isn't currently present in memory, it will first be loaded
from storage.
s - the name of the database to retreive.
- the DLPDatabase object requested.
getDatabase
public DLPDatabase getDatabase(int i)
Retreives the specified database.
If the database hasn't been loaded yet, it will be loaded and deserialized first.
i - the database index to be retreived.
- the DLPDatabase object from the requested index.
getDatabaseInfo
public DLPDatabaseInfo getDatabaseInfo(String s)
Gets the database info object for the database with the specified name.
s - the name of the database to retrieve the info object for.
- the database info object from the specified database.
getDatabaseInfo
public DLPDatabaseInfo getDatabaseInfo(int dbNum)
Gets the database info object from the specified index.
dbNum - the index of the db info object to retrieve.
- the database info object from the specified index.
hasDatabase
public boolean hasDatabase(String s)
Checks to see if this set contains the specified database.
s - the name of the database to check for.
- true if the database is in this set, false otherwise.
isModified
public boolean isModified()
Tests to see if this set has been modified.
- true if this set has been modified, false otherwise.
removeDatabase
public void removeDatabase(String s)
Removes the database with the specified name from this set.
s - the name of the database to remove.
removeDatabase
public void removeDatabase(int i)
Removes the database at the specified index from this set.
i - the index of the database to remove.
writeToFile
public void writeToFile(String directory)
throws IOExceptionWrite this database set to the specified directory.
If the specified directory doesn't exist, this method will attempt to create it first.
directory - the fully qualified path of the directory to write tha databes set to.