KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mckoi > database > TableDataSource


1 /**
2  * com.mckoi.database.TableDataSource 17 Nov 2000
3  *
4  * Mckoi SQL Database ( http://www.mckoi.com/database )
5  * Copyright (C) 2000, 2001, 2002 Diehl and Associates, Inc.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * Version 2 as published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License Version 2 for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * Version 2 along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19  *
20  * Change Log:
21  *
22  *
23  */

24
25 package com.mckoi.database;
26
27 /**
28  * This interface represents the source of data in a table. This is an
29  * abstraction that is used to read data from within a table.
30  * <p>
31  * The entire contents of a table can be completely represented by
32  * implementations of this interface.
33  *
34  * @author Tobias Downer
35  */

36
37 public interface TableDataSource {
38
39   /**
40    * Returns the TransactionSystem object that describes global properties
41    * about the data source that generated this object.
42    */

43   TransactionSystem getSystem();
44
45   /**
46    * Returns a DataTableDef object that defines the layout of the table that
47    * this data is in.
48    * <p>
49    * This may return 'null' if there is no table definition.
50    */

51   DataTableDef getDataTableDef();
52
53   /**
54    * Returns the number of rows in this data source.
55    * <p>
56    * NOTE: Returns 'n' - getCellContents(column, row) is not necessarily valid
57    * for row = [0..n]. Use 'rowEnumerator' to generate an iterator for valid
58    * row values over this data source.
59    */

60   int getRowCount();
61
62   /**
63    * Returns an iterator that is used to sequentually step through all valid
64    * rows in this source. The iterator is guarenteed to return exactly
65    * 'getRowCount' elements. The row elements returned by this iterator
66    * are used in 'getCellContents' in the 'row' parameter.
67    * <p>
68    * Note that this object is only defined if entries in the table are not
69    * added/remove during the lifetime of this iterator. If entries are added
70    * or removed from the table while this iterator is open, then calls to
71    * 'nextRowIndex' will be undefined.
72    */

73   RowEnumeration rowEnumeration();
74
75   /**
76    * Returns the SelectableScheme that we use as an index for rows in the
77    * given column of this source. The SelectableScheme is used to determine
78    * the relationship between cells in a column.
79    * <p>
80    * ISSUE: The scheme returned here should not have the 'insert' or 'remove'
81    * methods called (ie. it should be considered immutable). Perhaps we
82    * should make a MutableSelectableScheme interface to guarentee this
83    * constraint.
84    */

85   SelectableScheme getColumnScheme(int column);
86
87   /**
88    * Returns an object that represents the information in the given cell
89    * in the table. This may be an expensive operation, so calls to it
90    * should be kept to a minimum. Note that the offset between two
91    * rows is not necessarily 1. Use 'rowEnumeration' to create a row iterator.
92    */

93   TObject getCellContents(int column, int row);
94
95 }
96
Popular Tags