sorry forget these two Exceptions
[mir.git] / source / mir / storage / StorageObject.java
1 /*\r
2  * Copyright (C) 2001, 2002  The Mir-coders group\r
3  *\r
4  * This file is part of Mir.\r
5  *\r
6  * Mir is free software; you can redistribute it and/or modify\r
7  * it under the terms of the GNU General Public License as published by\r
8  * the Free Software Foundation; either version 2 of the License, or\r
9  * (at your option) any later version.\r
10  *\r
11  * Mir is distributed in the hope that it will be useful,\r
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14  * GNU General Public License for more details.\r
15  *\r
16  * You should have received a copy of the GNU General Public License\r
17  * along with Mir; if not, write to the Free Software\r
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
19  *\r
20  * In addition, as a special exception, The Mir-coders gives permission to link\r
21  * the code of this program with the com.oreilly.servlet library, any library\r
22  * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
23  * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
24  * the above that use the same license as the above), and distribute linked\r
25  * combinations including the two.  You must obey the GNU General Public\r
26  * License in all respects for all of the code used other than the above\r
27  * mentioned libraries.  If you modify this file, you may extend this exception\r
28  * to your version of the file, but you are not obligated to do so.  If you do\r
29  * not wish to do so, delete this exception statement from your version.\r
30  */\r
31 /*\r
32  * Implementiert Interface f?r die Speicherschicht.\r
33  * Bislang gibt es in der Bibliothek nur die M?glichkeit\r
34  * in einer Datenbank zu speichern.\r
35  */\r
36 \r
37 package mir.storage;\r
38 \r
39 import java.sql.Connection;\r
40 import java.sql.ResultSet;\r
41 import java.sql.SQLException;\r
42 import java.sql.Statement;\r
43 import java.util.ArrayList;\r
44 \r
45 import mir.entity.Entity;\r
46 import mir.entity.EntityList;\r
47 import freemarker.template.SimpleHash;\r
48 import freemarker.template.SimpleList;\r
49 \r
50 \r
51 /**\r
52  * Implementiert Interface f?r die Speicherschicht.\r
53  * Bislang gibt es in der Bibliothek nur die M?glichkeit\r
54  * in einer Datenbank zu speichern.\r
55  * @author RK\r
56  * @version     29.6.1999\r
57  */\r
58 public interface StorageObject {\r
59 \r
60   /**\r
61    * Dokumentation siehe Database.java\r
62    * @param id\r
63    * @return Entity\r
64    * @exception StorageObjectException\r
65    */\r
66   abstract public Entity selectById(String id) throws StorageObjectExc;\r
67 \r
68   /**\r
69    * Dokumentation siehe Database.java\r
70    * @param aField\r
71    * @param aValue\r
72    * @return EntityList\r
73    * @exception StorageObjectException\r
74    */\r
75   abstract public EntityList selectByFieldValue(String aField, String aValue) throws\r
76       StorageObjectFailure;\r
77 \r
78   /**\r
79    * Dokumentation siehe Database.java\r
80    * @param whereClause\r
81    * @return EntityList\r
82    * @exception StorageObjectException\r
83    */\r
84   abstract public EntityList selectByWhereClause(String whereClause) throws\r
85       StorageObjectFailure;\r
86 \r
87   /**\r
88    * Dokumentation siehe Database.java\r
89    * @param whereClause\r
90    * @param offset\r
91    * @return EntityList\r
92    * @exception StorageObjectException\r
93    */\r
94   abstract public EntityList selectByWhereClause(String whereClause, int offset) throws\r
95       StorageObjectFailure;\r
96 \r
97   /**\r
98    * Dokumentation siehe Database.java\r
99    * @param whereClause\r
100    * @param orderBy\r
101    * @param offset\r
102    * @return EntityList\r
103    * @exception StorageObjectException\r
104    */\r
105   abstract public EntityList selectByWhereClause(String whereClause,\r
106                                                  String orderBy,\r
107                                                  int offset) throws\r
108       StorageObjectFailure;\r
109 \r
110   /**\r
111    * Dokumentation siehe Database.java\r
112    * @param whereClause\r
113    * @param orderBy\r
114    * @param offset\r
115    * @param limit\r
116    * @return EntityList\r
117    * @exception StorageObjectException\r
118    */\r
119   abstract public EntityList selectByWhereClause(String whereClause,\r
120                                                  String orderBy,\r
121                                                  int offset, int limit) throws\r
122       StorageObjectFailure;\r
123 \r
124   /**\r
125    * Dokumentation siehe Database.java\r
126    * @param id\r
127    * @return boolen\r
128    * @exception StorageObjectException\r
129    */\r
130   abstract public boolean delete(String id) throws StorageObjectFailure;\r
131 \r
132   /**\r
133    * Dokumentation siehe Database.java\r
134    * @return ArrayList\r
135    * @exception StorageObjectException\r
136    */\r
137   abstract public ArrayList getFields() throws StorageObjectFailure;\r
138 \r
139   /**\r
140    * Dokumentation siehe Database.java\r
141    * @return int[]\r
142    * @exception StorageObjectException\r
143    */\r
144   abstract public int[] getTypes() throws StorageObjectFailure;\r
145 \r
146   /**\r
147    * Dokumentation siehe Database.java\r
148    * @return ArrayList\r
149    * @exception StorageObjectException\r
150    */\r
151   abstract public ArrayList getLabels() throws StorageObjectFailure;\r
152 \r
153   /**\r
154    * Dokumentation siehe Database.java\r
155    * @param a\r
156    * @exception StorageObjectException\r
157    */\r
158   abstract public void update(Entity a) throws StorageObjectFailure;\r
159 \r
160   /**\r
161    * Dokumentation siehe Database.java\r
162    * @param a\r
163    * @return String id\r
164    * @exception StorageObjectException\r
165    */\r
166   abstract public String insert(Entity a) throws StorageObjectFailure;\r
167 \r
168   /**\r
169    * Dokumentation siehe Database.java\r
170    * @return Class Klasse der Entity\r
171    */\r
172   abstract public Class getEntityClass();\r
173 \r
174   /**\r
175    * put your documentation comment here\r
176    * @return\r
177    */\r
178   abstract public String getIdName();\r
179 \r
180   /**\r
181    * Dokumentation siehe Database.java\r
182    * @return String\r
183    */\r
184   abstract public String getTableName();\r
185 \r
186   /**\r
187    * Dokumentation siehe Database.java\r
188    * @return SimpleHash\r
189    */\r
190   abstract public SimpleHash getHashData();\r
191 \r
192   /**\r
193    * Dokumentation siehe Database.java\r
194    * @return Connection\r
195    * @exception StorageObjectException\r
196    */\r
197   abstract public Connection getPooledCon() throws StorageObjectFailure;\r
198 \r
199   /**\r
200    * Dokumentation siehe Database.java\r
201    * @param a\r
202    * @param sql\r
203    * @return ResultSet\r
204    * @exception StorageObjectException, SQLException\r
205    */\r
206   abstract public ResultSet executeSql(Statement a, String sql) throws\r
207       StorageObjectFailure,\r
208       SQLException;\r
209 \r
210   /**\r
211    * Dokumentation siehe Database.java\r
212    * @param con\r
213    * @param stmt\r
214    */\r
215   abstract public void freeConnection(Connection con, Statement stmt) throws\r
216       StorageObjectFailure;\r
217 \r
218   /**\r
219    * Dokumentation siehe Database.java\r
220    * @return\r
221    */\r
222   abstract public SimpleList getPopupData() throws StorageObjectFailure;\r
223 \r
224   abstract public int executeUpdate(Statement a, String sql) throws\r
225       StorageObjectFailure, SQLException;\r
226 \r
227   abstract public int executeUpdate(String sql) throws StorageObjectFailure,\r
228       SQLException;\r
229 \r
230   abstract public int getSize(String where) throws SQLException,\r
231       StorageObjectFailure;\r
232 }\r
233 \r
234 \r
235 \r