org.jSyncManager.API.Protocol.Util
Class DLPDatabase
java.lang.Objectorg.jSyncManager.API.Protocol.Util.DLPDatabase
- Serializable
public class DLPDatabase
extends java.lang.Object
implements Serializable
A class representing an entire handheld database.
This class holds a single database. Note that this construct is not directly
readable or writable to or from a handheld device -- instead it's a container class
that can hold all of the other elements that can be read or written to the handheld device.
static char | APP_INFO_DIRTY- A flag to denote that the app info block is dirty (modified).
|
static char | BACKUP_FLAG- A flag to denote that this database should be backed up at sync time.
|
static char | COPY_PREVENTION- A flag to denote that this database should employ copy protection.
|
static char | DB_OPEN- A flag to denote that the database is open.
|
static byte | EXCLUSIVE_MODE- A flag to denote that the database should be opened in exclusive mode.
|
static char | INSTALL_NEWER- A flag to denote that it's okay to write a newer version of this database
with a different name if this database is currently open.
|
static char | NO_VERSION_CHANGE- A flag used when calling JHotSync.setDatabaseInfo() to denote that no version change should be made.
|
static byte | READ_MODE- A flag to denote that the database should be opened in read mode.
|
static byte | READ_MULTI_FLAG- A flag to denote that during a call to read the database list, multiple
entries are allowed in the response.
|
static char | READ_ONLY- A flag to denote that this database is flagged as read-only.
|
static char | RESET_AFTER_INSTALL- A flag to denote that the handheld should be reset after the installation of this database.
|
static char | RESOURCE_DATABASE- A flag to denote that this is a resource (application) database.
|
static byte | SEARCH_RAM_BASED_DB_FLAG- A flag to denate that we want to query RAM-based databases.
|
static byte | SEARCH_ROM_BASED_DB_FLAG- A flag to denate that we want to query ROM-based databases.
|
static byte | SHOW_SECRET- A flag to denote that secret records should be shown.
|
static byte | WRITE_MODE- A flag to denote that the database should be opened in write mode.
|
protected Vector | data
|
DLPDatabase()- DLPDatabase default constructor
|
DLPDatabase(boolean flag, DLPDatabaseInfo dlpdatabaseinfo)- DLPDatabase constructor, with a flag denoting whether this is a resource DB
or not, and the DLPDatabaseInfo block.
|
APP_INFO_DIRTY
public static final char APP_INFO_DIRTY
A flag to denote that the app info block is dirty (modified).
BACKUP_FLAG
public static final char BACKUP_FLAG
A flag to denote that this database should be backed up at sync time.
COPY_PREVENTION
public static final char COPY_PREVENTION
A flag to denote that this database should employ copy protection.
Copy protection is typically used to prevent IR beaming of the database.
DB_OPEN
public static final char DB_OPEN
A flag to denote that the database is open.
EXCLUSIVE_MODE
public static final byte EXCLUSIVE_MODE
A flag to denote that the database should be opened in exclusive mode.
INSTALL_NEWER
public static final char INSTALL_NEWER
A flag to denote that it's okay to write a newer version of this database
with a different name if this database is currently open.
NO_VERSION_CHANGE
public static final char NO_VERSION_CHANGE
A flag used when calling JHotSync.setDatabaseInfo() to denote that no version change should be made.
READ_MODE
public static final byte READ_MODE
A flag to denote that the database should be opened in read mode.
READ_MULTI_FLAG
public static final byte READ_MULTI_FLAG
A flag to denote that during a call to read the database list, multiple
entries are allowed in the response.
READ_ONLY
public static final char READ_ONLY
A flag to denote that this database is flagged as read-only.
RESET_AFTER_INSTALL
public static final char RESET_AFTER_INSTALL
A flag to denote that the handheld should be reset after the installation of this database.
RESOURCE_DATABASE
public static final char RESOURCE_DATABASE
A flag to denote that this is a resource (application) database.
SEARCH_RAM_BASED_DB_FLAG
public static final byte SEARCH_RAM_BASED_DB_FLAG
A flag to denate that we want to query RAM-based databases.
SEARCH_ROM_BASED_DB_FLAG
public static final byte SEARCH_ROM_BASED_DB_FLAG
A flag to denate that we want to query ROM-based databases.
SHOW_SECRET
public static final byte SHOW_SECRET
A flag to denote that secret records should be shown.
WRITE_MODE
public static final byte WRITE_MODE
A flag to denote that the database should be opened in write mode.
data
protected Vector data
DLPDatabase
protected DLPDatabase()
DLPDatabase default constructor
DLPDatabase
public DLPDatabase(boolean flag,
DLPDatabaseInfo dlpdatabaseinfo)DLPDatabase constructor, with a flag denoting whether this is a resource DB
or not, and the DLPDatabaseInfo block.
flag - true if this is a resource (application) database, false otherwise.dlpdatabaseinfo - DLPDatabaseInfo block.
addElement
public void addElement(DLPRecord dlprecord)
Add an element in the form of a DLPRecord to the database.
dlprecord - DLPRecord to be inserted.
addElement
public void addElement(DLPResource dlpresource)
Add an element in the form of a DLPResource to the database.
dlpresource - DLPResource to be inserted.
exportDatabase
public void exportDatabase(String s)
Export this database to a File.
s - path and name of file to export to.
getApplicationBlock
public DLPBlock getApplicationBlock()
Get this databases application block.
- this databases application block, or null if one is not present.
getDatabaseInfo
public DLPDatabaseInfo getDatabaseInfo()
Get this database information object.
- this database information object.
getElement
public Object getElement(int i)
Get an element from the database by index.
i - index of the element requested.
- the selected element of data.
getElements
public int getElements()
Get the number of elements in the database.
- the number of elements in the database.
getSortBlock
public DLPBlock getSortBlock()
Get the sort block for this database.
- the sort block for this database, or null if one isn't present.
importFromFile
public static DLPDatabase importFromFile(File filename)
throws DatabaseFormatExceptionImport a database from the specified File object.
filename - the File object to import from.
- DLPDatabase the database read from the specified File object.
importFromFile
public static DLPDatabase importFromFile(String filename)
throws DatabaseFormatExceptionImport a database from the specified file.
filename - filename to import from.
- DLPDatabase the database object contained in the specified file.
importFromURL
public static DLPDatabase importFromURL(URL url)
throws DatabaseFormatExceptionImport a database from the specified URL.
url - the URL object to read from.
- DLPDatabase the database read and parsed from the requested URL.
isResourceDB
public boolean isResourceDB()
Return boolean denoting whether this is a Resource DB or not.
Database on PalmOS-bassed systems are one of two types -- either they are
application databases, comprising an executable program or library made up of resources,
or they are information databases, containing data elements.
- true if this is a resource database, false otherwise.
setApplicationBlock
public void setApplicationBlock(DLPBlock dlpblock)
Set the ApplicationBlock for this database.
dlpblock - the ApplicationBlock for this database.
setDatabaseInfo
protected void setDatabaseInfo(DLPDatabaseInfo dlpdatabaseinfo)
Set the Database Info object for this database.
dlpdatabaseinfo - the Database Info object for this database.
setIsResourceDB
protected void setIsResourceDB(boolean flag)
Set the flag denoting whether this is a Resource DB or not.
flag - true if this is a resource database, false otherwise.
setSortBlock
public void setSortBlock(DLPBlock dlpblock)
Set the Sort Block for this database.
dlpblock - the Sort Block for this database.
toString
public String toString()
Displays the contents of this DLPDatabase object as human-readable Strings.
Note that the results of this method may differ depending on the source of the data it contains.
A DLPDatabase object built in Java code using DLPBlock, DLPRecord, and/or DLPResource sub-classes
will display the results of those classes toString() methods. Data read from the handheld
or a PRC/PDB file in and of these generic types won't be up-casted to their parser types,
and thus will be displayed in human-readable hex dump format.
- a human-readable String of the data contained within this DLPDatabase.