home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Visual Cafe Pro v1.0 / SOURCE.BIN / DbDataStore.java < prev    next >
Encoding:
Java Source  |  1997-06-19  |  3.9 KB  |  110 lines

  1. /*
  2.  * DbDataStore.java   1.0   12 Jan 1997
  3.  *
  4.  * Copyright (c) 1996 Krumel & Associates, Inc.  All Rights Reserved.
  5.  *
  6.  * This software is provided as is.  Krumel & Associates shall not be liable
  7.  * for any damages suffered by licensee as a result of using, modifying or
  8.  * distributing this software or its derivatives.
  9.  */
  10.  
  11. package symantec.itools.db.awt;
  12.  
  13. /**
  14.  * Interface defines the APIs required by classes that act a source of data
  15.  * for a DbDataSource.  Norally, implementors of this interface read data from
  16.  * a SQL query.  When a DbDataStore is set in a DbDataSource, the source will
  17.  * query whether the store caches data.  If not, the data source will perform
  18.  * data caching.  Data source caching would be required for JDBC type stores
  19.  * since JDBC does not support scrollable cursors.  This interface is designed
  20.  * to work in conjunction with the DbUpdater and MetaTable interfaces.<p>
  21.  * All rows coming from DbDataSource are 0 relative<br>
  22.  * All cols coming from DbDataSource are 1 relative
  23.  *
  24.  */
  25. public interface DbDataStore {
  26.     /**
  27.      * Sets the database data source that requests data and possibly
  28.      * caches the SQL data.
  29.      */
  30.     public void setDbDataSource(DbDataSource ds);
  31.  
  32.     /**
  33.      * Called by a DbDataSource to determine if the store provides its own
  34.      * caching services.
  35.      * @return true if the cache provides scrollable caching.
  36.      */
  37.     public boolean supportsCaching();
  38.  
  39.     /**
  40.      * Sets the fetch mode for getting data.  When fetch mode is enabled,
  41.      * a grid expects to rapidly read lots of data for read only purposes.
  42.      * Knowing this can allow some data stores to more efficiently get the
  43.      * data.  The Grid provides a guarentee that the current data row will
  44.      * not be changed
  45.      * @param mode true if fetch mode is to be entered
  46.      */
  47.     public void fetchMode(boolean mode);
  48.  
  49.     /**
  50.      * Gets the last row that exists within the specified range.
  51.      * @param top The first row in the range
  52.      * @param bottom The last row in the range
  53.      * @exception   DataNotAvailable The requested data is not present
  54.      */
  55.     public int validDataRowRange(int top, int bottom) throws DataNotAvailable;
  56.  
  57.     /**
  58.      * Gets the data element for the specified result set position
  59.      * @exception   DataNotAvailable The requested data is not present
  60.      */
  61.     public Data getData(int row, int col) throws DataNotAvailable;
  62.  
  63.     /**
  64.      * Sets a new value in a result set position.  The method is only
  65.      * called when the store supports caching.
  66.      * @param row The row to update
  67.      * @param col The column to update
  68.      * @param data The data element that holds the new value
  69.      * @exception   DataNotAvailable The requested data is not present
  70.      */
  71.     public void update(int row, int col, Data data) throws TypeNotSupported;
  72.  
  73.     /**
  74.      * Requests the data store get the values from the database again.
  75.      * @exception   TypeNotSupported If the data source does not support the type of
  76.      *          action requested or is not successful
  77.      */
  78.     public void refresh();
  79.  
  80.     public void undoRow(int row) throws TypeNotSupported;
  81.  
  82.     /**
  83.      * Requests the data store clear all cached data.
  84.      */
  85.     public void clear();
  86.  
  87.     /**
  88.      * Gets the number of rows actually retrieved from the database.
  89.      */
  90.     public int rowsRetrieved();
  91.  
  92.     /**
  93.      * Requests the store to get all of the elements in the result set.
  94.      */
  95.     public int fetchAllRows();
  96.  
  97.     /**
  98.      * Gets the state of the specified row number as defined in the RowState class
  99.      */
  100.     public int rowState(int row);
  101.  
  102.     /**
  103.      * Sets the current row in the data store.
  104.      * @exception   TypeNotSupported If the data source does not support the type of
  105.      *          action requested or is not successful
  106.      */
  107.     public void setCurrentRow(int row) throws TypeNotSupported;
  108.  
  109.     public Object getSynchronizationObject();
  110. }