All Packages  This Package  Class Hierarchy  Class Search  Index

Class com.syncbuilder.storage.Database
java.lang.Object
   |
   +----com.syncbuilder.storage.Database

  Summary

public class  Database
     extends java.lang.Object
{
          // Fields 4
     public static final int OPEN_DEFAULT;
     public static final int OPEN_EXCLUSIVE;
     public static final int OPEN_READ;
     public static final int OPEN_WRITE;

          // Constructors 1
     public Database(Link, int, Char4, String, int, int);

          // Methods 39
     public synchronized void close() throws DlpException;
     public AppBlock createAppBlock();
     public Pref createPref(int);
     public Pref createPref(int, int, boolean);
     public Record createRecord();
     public Record createRecord(RecordID);
     public Resource createResource();
     public Resource createResource(Char4, int);
     public SortBlock createSortBlock();
     public void deleteCategory(int) throws DlpException;
     public void deleteRecord(RecordID) throws DlpException;
     public void deleteRecords() throws DlpException;
     public void deleteResource(Char4, int) throws DlpException;
     public void deleteResources() throws DlpException;
     public AppBlock getAppBlock() throws DlpException;
     public Record getNextModRecord() throws DlpException;
     public Record getNextModRecord(int) throws DlpException;
     public Record getNextRecord(int) throws DlpException;
     public Pref getPref(int) throws DlpException, IOException;
     public Pref getPref(int, boolean) throws DlpException, NoCreatorException, IOException;
     public Record getRecord(RecordID) throws DlpException;
     public Record getRecord(int) throws DlpException;
     public int getRecordCount() throws DlpException;
     public RecordID[] getRecordIDs() throws DlpException;
     public RecordID[] getRecordIDs(boolean) throws DlpException;
     public RecordID[] getRecordIDs(boolean, int) throws DlpException;
     public RecordID[] getRecordIDs(boolean, int, int) throws DlpException;
     public Resource getResource(Char4, int) throws DlpException;
     public Resource getResource(int) throws DlpException;
     public SortBlock getSortBlock() throws DlpException;
     public void moveCategory(int, int) throws DlpException;
     public void purgeRecords() throws DlpException;
     public void putRecord(Record) throws DlpException;
     public void putResource(Resource) throws DlpException;
     public void resetFlags() throws DlpException;
     public void resetNext() throws DlpException;
     public void setAppBlock(AppBlock) throws DlpException;
     public void setPref(Pref) throws DlpException, NoCreatorException, IOException;
     public void setSortBlock(SortBlock) throws DlpException;
}

A representation of an open database. Database is assisted by DatabaseImpl, which provides the neccessary knowledge to treat databases from different applications properly. This is a delegation-/bridge pattern.

Database-objects are supposed to be obtained through the methods of the Dlp class (such as openDB(), openStockDB(), createDB()).

See Also: Dlp, DatabaseImpl


  Cross Reference

Returned By:
Dlp.createDB(), Dlp.createDB(), Dlp.openDB(), Dlp.openDB(), Dlp.openDB(), Dlp.openDB(), Dlp.openStockDB()





  Fields

· OPEN_READ

Summary  |  Top
   public static final int OPEN_READ

Opened for read access


· OPEN_WRITE

Summary  |  Top
   public static final int OPEN_WRITE

Opened for write access


· OPEN_EXCLUSIVE

Summary  |  Top
   public static final int OPEN_EXCLUSIVE

Opened for exclusive access


· OPEN_DEFAULT

Summary  |  Top
   public static final int OPEN_DEFAULT

Opened with default settings (read/write, exclusive)


  Constructors

· Database

Summary  |  Top

   public Database(Link link, 
                   int handle, 
                   Char4 creator, 
                   String dbname, 
                   int dbmode, 
                   int dbcard) 

Construct a Database object.
!!! This constructor shall only be used by Dlp!!! This constructor tries to figure out the proper version of DatabaseImpl by querying the DatabaseImplFactory.

Parameter Description
link an instance of Link
handle a database-handle as returned by DlpImpl.openDB
creator the creator ID of the database
dbname the name of the database
dbmode the mode of the database, use the Database.OPEN_XXX-flags
dbcard the card on which the database is located.



  Methods

· getAppBlock

Summary  |  Top
   public AppBlock getAppBlock()  throws DlpException


· setAppBlock

Summary  |  Top
   public void setAppBlock(AppBlock appblock)  throws DlpException


· createAppBlock

Summary  |  Top
   public AppBlock createAppBlock() 


· getSortBlock

Summary  |  Top
   public SortBlock getSortBlock()  throws DlpException


· setSortBlock

Summary  |  Top
   public void setSortBlock(SortBlock sortblock)  throws DlpException


· createSortBlock

Summary  |  Top
   public SortBlock createSortBlock() 


· getRecord

Summary  |  Top
   public Record getRecord(int index)  throws DlpException


· getRecord

Summary  |  Top
   public Record getRecord(RecordID id)  throws DlpException


· getNextRecord

Summary  |  Top
   public Record getNextRecord(int category)  throws DlpException


· getNextModRecord

Summary  |  Top
   public Record getNextModRecord()  throws DlpException


· getNextModRecord

Summary  |  Top
   public Record getNextModRecord(int category)  throws DlpException


· putRecord

Summary  |  Top
   public void putRecord(Record record)  throws DlpException

Writes a record to the database. If the Record had an unspecified RecordID (0) before it will be assigned a valid RecordID.



· createRecord

Summary  |  Top
   public Record createRecord() 

Create a new Record with an unspecified RecordID (0).



· createRecord

Summary  |  Top
   public Record createRecord(RecordID id) 

Create a new Record with the specified RecordID.



· deleteRecord

Summary  |  Top
   public void deleteRecord(RecordID uid)  throws DlpException

Delete the record with the specified UID from the database.

Parameter Description
uid the UID (not the index!) of the record



· deleteRecords

Summary  |  Top
   public void deleteRecords()  throws DlpException

Delete ALL records in the database. Use with caution!



· getRecordIDs

Summary  |  Top
   public RecordID[] getRecordIDs()  throws DlpException


· getRecordIDs

Summary  |  Top
   public RecordID[] getRecordIDs(boolean sort)  throws DlpException


· getRecordIDs

Summary  |  Top
   public RecordID[] getRecordIDs(boolean sort, 
                                  int start)  throws DlpException


· getRecordIDs

Summary  |  Top
   public RecordID[] getRecordIDs(boolean sort, 
                                  int start, 
                                  int max)  throws DlpException


· purgeRecords

Summary  |  Top
   public void purgeRecords()  throws DlpException

Deletes all records which are marked as archived or deleted



· createResource

Summary  |  Top
   public Resource createResource() 


· createResource

Summary  |  Top
   public Resource createResource(Char4 type, 
                                  int id) 


· getResource

Summary  |  Top
   public Resource getResource(int index)  throws DlpException


· getResource

Summary  |  Top
   public Resource getResource(Char4 type, 
                               int id)  throws DlpException


· putResource

Summary  |  Top
   public void putResource(Resource resource)  throws DlpException


· deleteResource

Summary  |  Top
   public void deleteResource(Char4 type, 
                              int id)  throws DlpException


· deleteResources

Summary  |  Top
   public void deleteResources()  throws DlpException

Delete ALL resources. Use with caution!



· deleteCategory

Summary  |  Top
   public void deleteCategory(int category)  throws DlpException


· moveCategory

Summary  |  Top
   public void moveCategory(int from, 
                            int to)  throws DlpException


· getPref

Summary  |  Top
   public Pref getPref(int id)  throws DlpException, IOException


· getPref

Summary  |  Top
   public Pref getPref(int id, 
                       boolean backup)  throws DlpException, NoCreatorException, IOException

Get one of the preferences which are associated with the same app as the database.



· setPref

Summary  |  Top
   public void setPref(Pref pref)  throws DlpException, NoCreatorException, IOException


· createPref

Summary  |  Top
   public Pref createPref(int id) 


· createPref

Summary  |  Top
   public Pref createPref(int id, 
                          int version, 
                          boolean backup) 


· close

Summary  |  Top
   public synchronized void close()  throws DlpException

Closes the database. The Database-object shall no longer be used after the invocation of this method!



· resetFlags

Summary  |  Top
   public void resetFlags()  throws DlpException

For record databases, reset all dirty flags. For both record and resource databases, set the last sync time to now.



· resetNext

Summary  |  Top
   public void resetNext()  throws DlpException


· getRecordCount

Summary  |  Top
   public int getRecordCount()  throws DlpException

Return the number of records in the Database



All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7