home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / VCafe / prosrc.bin / DbDataStore.java < prev    next >
Encoding:
Java Source  |  1998-03-18  |  5.6 KB  |  140 lines

  1. /*
  2.  * Copyright (c) 1997 Krumel & Associates, Inc. All Rights Reserved.
  3.  *
  4.  * www.krumel.com - controls@krumel.com
  5.  *
  6.  * Permission is given to the buyer of this package for one software
  7.  * developer to use this software on one CPU (one workstation) and to make
  8.  * one backup copy.  You may uitilize and/or modify this class for use in your
  9.  * projects.  You may distribute or sell any executable which results from
  10.  * using this code in yur application, except a utility or class of similar
  11.  * nature to this product.  You may distribute this product in compiled
  12.  * form only, but soley to be used with your cmpiled executable product
  13.  * for the puposes of dynamic loading. You may NOT redistribute the source
  14.  * code in any form or make it accessible through a network or other
  15.  * distribution media to others. Please refer to the file "copyright.html"
  16.  * for further important copyright and licensing information.
  17.  *
  18.  * The source code is the confidential and proprietary information
  19.  * of Krumel & Associates, Inc. ("Confidential Information").  You shall
  20.  * not disclose such Confidential Information and shall use it only in
  21.  * accordance with the terms of the license agreement you entered into
  22.  * with Krumel & Associates, Inc..
  23.  
  24.  * KRUMEL & ASSOCIATES MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE
  25.  * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT
  26.  * NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  27.  * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. KRUMEL & ASSOCIATES SHALL NOT
  28.  * BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING,
  29.  * MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
  30.  */
  31.  
  32. package symantec.itools.db.awt;
  33.  
  34. /**
  35.  * Interface defines the APIs required by classes that act a source of data
  36.  * for a DbDataSource.  Norally, implementors of this interface read data from
  37.  * a SQL query.  When a DbDataStore is set in a DbDataSource, the source will
  38.  * query whether the store caches data.  If not, the data source will perform
  39.  * data caching.  Data source caching would be required for JDBC type stores
  40.  * since JDBC does not support scrollable cursors.  This interface is designed
  41.  * to work in conjunction with the DbUpdater and MetaTable interfaces.<p>
  42.  * All rows coming from DbDataSource are 0 relative<br>
  43.  * All cols coming from DbDataSource are 1 relative
  44.  *
  45.  */
  46. public interface DbDataStore extends java.io.Serializable {
  47.     /**
  48.      * Sets the database data source that requests data and possibly
  49.      * caches the SQL data.
  50.      */
  51.     public void setDbDataSource(DbDataSource ds);
  52.  
  53.     /**
  54.      * Called by a DbDataSource to determine if the store provides its own
  55.      * caching services.
  56.      * @return true if the cache provides scrollable caching.
  57.      */
  58.     public boolean supportsCaching();
  59.  
  60.     /**
  61.      * Sets the fetch mode for getting data.  When fetch mode is enabled,
  62.      * a TableView expects to rapidly read lots of data for read only purposes.
  63.      * Knowing this can allow some data stores to more efficiently get the
  64.      * data.  The TableView provides a guarentee that the current data row will
  65.      * not be changed
  66.      * @param mode true if fetch mode is to be entered
  67.      */
  68.     public void fetchMode(boolean mode);
  69.  
  70.     /**
  71.      * Gets the last row that exists within the specified range.
  72.      * @param top The first row in the range
  73.      * @param bottom The last row in the range
  74.      * @exception   DataNotAvailable The requested data is not present
  75.      */
  76.     public int validDataRowRange(int top, int bottom) throws DataNotAvailable;
  77.  
  78.     /**
  79.      * Gets the data element for the specified result set position
  80.      * @exception   DataNotAvailable The requested data is not present
  81.      */
  82.     public Data getData(int row, int col) throws DataNotAvailable;
  83.  
  84.     /**
  85.      * Sets a new value in a result set position.  The method is only
  86.      * called when the store supports caching.
  87.      * @param row The row to update
  88.      * @param col The column to update
  89.      * @param data The data element that holds the new value
  90.      * @exception TypeNotSupported
  91.      * if the data store does not support the type of action requested
  92.      * or is not successful
  93.      */
  94.     public void update(int row, int col, Data data) throws TypeNotSupported;
  95.  
  96.     /**
  97.      * Requests the data store get the values from the database again.
  98.      */
  99.     public void refresh();
  100.  
  101.     /**
  102.      * Requests that any actions performed on a row be undone. The meaning
  103.      * is left open and is interpreted as appropriate for the type of
  104.      * data store.
  105.      *
  106.      * @param row the zero-relative row index
  107.      * @exception TypeNotSupported
  108.      * if the data store does not support the type of action requested
  109.      * or is not successful
  110.      */
  111.     public void undoRow(int row) throws TypeNotSupported;
  112.  
  113.     /**
  114.      * Requests the data store clear all cached data.
  115.      */
  116.     public void clear();
  117.  
  118.     /**
  119.      * Gets the number of rows actually retrieved from the database.
  120.      */
  121.     public int rowsRetrieved();
  122.  
  123.     /**
  124.      * Requests the store to get all of the elements in the result set.
  125.      */
  126.     public int fetchAllRows();
  127.  
  128.     /**
  129.      * Gets the state of the specified row number as defined in the RowState class
  130.      */
  131.     public int rowState(int row);
  132.  
  133.     /**
  134.      * Sets the current row in the data store.
  135.      * @exception   TypeNotSupported If the data source does not support the type of
  136.      *          action requested or is not successful
  137.      */
  138.     public void setCurrentRow(int row) throws TypeNotSupported;
  139. }
  140.