b5752e44cb2d512886dd932d84e00c86368a7c77
[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.lang.*;\r
40 import java.util.*;\r
41 import java.sql.*;\r
42 import freemarker.template.*;\r
43 import mir.entity.*;\r
44 \r
45 \r
46 /**\r
47  * Implementiert Interface für die Speicherschicht.\r
48  * Bislang gibt es in der Bibliothek nur die Möglichkeit\r
49  * in einer Datenbank zu speichern.\r
50  * @author RK\r
51  * @version     29.6.1999\r
52  */\r
53 public interface StorageObject {\r
54 \r
55   /**\r
56    * Dokumentation siehe Database.java\r
57    * @param id\r
58    * @return Entity\r
59    * @exception StorageObjectException\r
60    */\r
61   abstract public Entity selectById(String id) throws StorageObjectException;\r
62 \r
63   /**\r
64    * Dokumentation siehe Database.java\r
65    * @param aField\r
66    * @param aValue\r
67    * @return EntityList\r
68    * @exception StorageObjectException\r
69    */\r
70   abstract public EntityList selectByFieldValue(String aField, String aValue) throws\r
71       StorageObjectException;\r
72 \r
73   /**\r
74    * Dokumentation siehe Database.java\r
75    * @param whereClause\r
76    * @return EntityList\r
77    * @exception StorageObjectException\r
78    */\r
79   abstract public EntityList selectByWhereClause(String whereClause) throws\r
80       StorageObjectException;\r
81 \r
82   /**\r
83    * Dokumentation siehe Database.java\r
84    * @param whereClause\r
85    * @param offset\r
86    * @return EntityList\r
87    * @exception StorageObjectException\r
88    */\r
89   abstract public EntityList selectByWhereClause(String whereClause, int offset) throws\r
90       StorageObjectException;\r
91 \r
92   /**\r
93    * Dokumentation siehe Database.java\r
94    * @param whereClause\r
95    * @param orderBy\r
96    * @param offset\r
97    * @return EntityList\r
98    * @exception StorageObjectException\r
99    */\r
100   abstract public EntityList selectByWhereClause(String whereClause,\r
101                                                  String orderBy,\r
102                                                  int offset) throws\r
103       StorageObjectException;\r
104 \r
105   /**\r
106    * Dokumentation siehe Database.java\r
107    * @param whereClause\r
108    * @param orderBy\r
109    * @param offset\r
110    * @param limit\r
111    * @return EntityList\r
112    * @exception StorageObjectException\r
113    */\r
114   abstract public EntityList selectByWhereClause(String whereClause,\r
115                                                  String orderBy,\r
116                                                  int offset, int limit) throws\r
117       StorageObjectException;\r
118 \r
119   /**\r
120    * Dokumentation siehe Database.java\r
121    * @param id\r
122    * @return boolen\r
123    * @exception StorageObjectException\r
124    */\r
125   abstract public boolean delete(String id) throws StorageObjectException;\r
126 \r
127   /**\r
128    * Dokumentation siehe Database.java\r
129    * @return ArrayList\r
130    * @exception StorageObjectException\r
131    */\r
132   abstract public ArrayList getFields() throws StorageObjectException;\r
133 \r
134   /**\r
135    * Dokumentation siehe Database.java\r
136    * @return int[]\r
137    * @exception StorageObjectException\r
138    */\r
139   abstract public int[] getTypes() throws StorageObjectException;\r
140 \r
141   /**\r
142    * Dokumentation siehe Database.java\r
143    * @return ArrayList\r
144    * @exception StorageObjectException\r
145    */\r
146   abstract public ArrayList getLabels() throws StorageObjectException;\r
147 \r
148   /**\r
149    * Dokumentation siehe Database.java\r
150    * @param a\r
151    * @exception StorageObjectException\r
152    */\r
153   abstract public void update(Entity a) throws StorageObjectException;\r
154 \r
155   /**\r
156    * Dokumentation siehe Database.java\r
157    * @param a\r
158    * @return String id\r
159    * @exception StorageObjectException\r
160    */\r
161   abstract public String insert(Entity a) throws StorageObjectException;\r
162 \r
163   /**\r
164    * Dokumentation siehe Database.java\r
165    * @return Class Klasse der Entity\r
166    */\r
167   abstract public Class getEntityClass();\r
168 \r
169   /**\r
170    * put your documentation comment here\r
171    * @return\r
172    */\r
173   abstract public String getIdName();\r
174 \r
175   /**\r
176    * Dokumentation siehe Database.java\r
177    * @return String\r
178    */\r
179   abstract public String getTableName();\r
180 \r
181   /**\r
182    * Dokumentation siehe Database.java\r
183    * @return SimpleHash\r
184    */\r
185   abstract public SimpleHash getHashData();\r
186 \r
187   /**\r
188    * Dokumentation siehe Database.java\r
189    * @return Connection\r
190    * @exception StorageObjectException\r
191    */\r
192   abstract public Connection getPooledCon() throws StorageObjectException;\r
193 \r
194   /**\r
195    * Dokumentation siehe Database.java\r
196    * @param a\r
197    * @param sql\r
198    * @return ResultSet\r
199    * @exception StorageObjectException, SQLException\r
200    */\r
201   abstract public ResultSet executeSql(Statement a, String sql) throws\r
202       StorageObjectException,\r
203       SQLException;\r
204 \r
205   /**\r
206    * Dokumentation siehe Database.java\r
207    * @param con\r
208    * @param stmt\r
209    */\r
210   abstract public void freeConnection(Connection con, Statement stmt) throws\r
211       StorageObjectException;\r
212 \r
213   /**\r
214    * Dokumentation siehe Database.java\r
215    * @return\r
216    */\r
217   abstract public SimpleList getPopupData() throws StorageObjectException;\r
218 \r
219   abstract public int executeUpdate(Statement a, String sql) throws\r
220       StorageObjectException, SQLException;\r
221 \r
222   abstract public int executeUpdate(String sql) throws StorageObjectException,\r
223       SQLException;\r
224 \r
225   abstract public int getSize(String where) throws SQLException,\r
226       StorageObjectException;\r
227 }\r
228 \r
229 \r
230 \r