KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > medor > tuple > api > TupleCollection


1 /**
2  * MEDOR: Middleware Enabling Distributed Object Requests
3  *
4  * Copyright (C) 2001-2003 France Telecom R&D
5  * Contact: alexandre.lefebvre@rd.francetelecom.com
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20  *
21  * Initial developers: M. Alia, A. Lefebvre
22  */

23
24 package org.objectweb.medor.tuple.api;
25
26 import org.objectweb.medor.api.TupleStructure;
27 import org.objectweb.medor.api.MedorException;
28
29 /**
30  * This interface represent collections of tuples wich are manipulated by MEDOR.
31  * <p>A TupleCollection is a set of data typically representing the result of
32  * querying a data source result.
33  * Like JDBC ResultSets, a TupleCollection is scrollable over
34  * iteration methods. The number, types and properties of a TupleCollection
35  * object's
36  * attribute are provided by the TupleStructure object returned by the
37  * TupleCollection.getMetaData() method.
38  * <p>
39  * For example, to print all values of the first attribute of a
40  * TupleCollection tc :
41  * <tt>while (!tci.isLast()){<br>
42  * System.out.println(tci.getJavaObject(1));
43  * tci.next();<br>
44  * }</tt>
45  * Methods are provided to enumerate through the attributes of the TupleCollection
46  * This Interface represent also the data flow in the Query Tree wich also represents
47  * the result of a query.
48  */

49 public interface TupleCollection {
50     /**
51      * Retrieves the number,types and stors properties of the data sources of this TupleCollection Object.
52      * @return a TupleCollectionMetaData Object defining teh TupleCollection.
53      * @throws MedorException if a data source access error occurs
54      */

55     TupleStructure getMetaData() throws MedorException;
56
57     /**
58      * Indicates whether the cursor is on the last row of this TupleCollection object.
59      * @return true if the current Tuple is the last one or if the TupleCollection is Empty.
60      * @throws MedorException if data source access error
61      */

62     boolean isLast() throws MedorException;
63
64     /**
65      * Moves the cursor down one row from its current position to the next tuple of this
66      * TupleCollection object.
67      * @return true if move is impossible and false if move is not performed.
68      * @throws MedorException if data source access error
69      */

70     boolean next() throws MedorException;
71
72     /**
73      * Moves the cursor to the first Tuple, row number 1.
74      * @throws MedorException if data source access error
75      */

76     void first() throws MedorException;
77
78     /**
79      * Retrieves the current row Number.
80      * @return -1 if the iterator is out of bounds of the TupleCollection or if it is empty.
81      * @throws MedorException if data source access error.
82      */

83     int getRow() throws MedorException;
84
85     /**
86      * Returns the Tuple value of the current row of this TupleCollection object.
87      * @return the value of the current Tuple.
88      * @throws MedorException if data source access error.
89      */

90     Tuple getTuple() throws MedorException;
91
92     /**
93      * Returns the Tuple value of the designeted row of this TupleCollection object.
94      * @param row :int
95      * @return the a Tuple Number row.
96      * @throws MedorException if data source access error.
97      */

98     Tuple getTuple(int row) throws MedorException;
99
100     /**
101      * Moves the cursor to the given row number in this TupleCollection object.
102      * The first row is row 1, the second is row 2, and so on.
103      * @return true if move is possible
104      * @throws MedorException if row number is invelid or data source access error
105      */

106     boolean row(int row) throws MedorException;
107
108     /**
109      * Tell whether the current TupleCollection Object is empty or no.
110      * @return true if the TupleCollection is empty.
111      * @throws MedorException if data source access error.
112      */

113     boolean isEmpty() throws MedorException;
114
115     /**
116      * It closes the TupleCollection, relaeases used resources
117      * (example : ResultSet). The next uses of the TupleCollection will throw
118      * an exception.
119      */

120     void close() throws MedorException;
121 }
122
Popular Tags