KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > daffodilwoods > rmi > RmiConnection


1 package com.daffodilwoods.rmi;
2
3 import java.rmi.RemoteException JavaDoc;
4
5 import com.daffodilwoods.database.resource.DException;
6 import com.daffodilwoods.daffodildb.server.serversystem._Connection;
7 import com.daffodilwoods.daffodildb.server.serversystem._PreparedStatement;
8 import com.daffodilwoods.database.general.QualifiedIdentifier;
9 import com.daffodilwoods.daffodildb.server.datadictionarysystem._ColumnCharacteristics;
10 import com.daffodilwoods.rmi.interfaces.*;
11
12 public class RmiConnection implements _Connection {
13
14   _RmiConnection connection_interface;
15   int type = Integer.MIN_VALUE;
16
17   public RmiConnection(_RmiConnection connection_interface) {
18     this.connection_interface = connection_interface;
19   }
20
21   public Object JavaDoc parseQuery(String JavaDoc query) throws DException {
22     throw new java.lang.UnsupportedOperationException JavaDoc(
23         "Method parseQuery() not yet implemented.");
24   }
25
26   public boolean prepare() throws DException {
27     throw new java.lang.UnsupportedOperationException JavaDoc(
28         "Method prepare() not yet implemented.");
29   }
30
31   public boolean makePersistent() throws DException {
32     throw new java.lang.UnsupportedOperationException JavaDoc(
33         "Method makePersistent() not yet implemented.");
34   }
35
36   public void setTransactionIsolation(int level) throws DException {
37     try {
38       connection_interface.setTransactionIsolation(level);
39     }
40     catch (RemoteException JavaDoc ex) {
41       throw new RuntimeException JavaDoc(ex.getMessage());
42     }
43   }
44
45   public Object JavaDoc[] executeBatch(String JavaDoc query) throws DException {
46     try {
47       Object JavaDoc[] result = connection_interface.executeBatch(query);
48       for (int i = 0; i < result.length; i++) {
49         if (result[i] instanceof _RmiSelectIterator) {
50           result[i] = new RmiSelectIterator( (_RmiSelectIterator) result[i], null, null);
51         }
52       }
53       return result;
54     }
55     catch (RemoteException JavaDoc ex) {
56       throw new RuntimeException JavaDoc(ex.getMessage());
57     }
58
59   }
60
61   public _Connection getSystemConnection() throws DException {
62     try {
63       _RmiConnection object = connection_interface.getSystemConnection();
64       return new RmiConnection(object);
65     }
66     catch (RemoteException JavaDoc ex) {
67       throw new RuntimeException JavaDoc(ex.getMessage());
68     }
69   }
70
71   public void setAutoCommit(boolean autoCommit) throws DException {
72     try {
73       connection_interface.setAutoCommit(autoCommit);
74     }
75     catch (RemoteException JavaDoc re) {
76       throw new RuntimeException JavaDoc(re.getMessage());
77     }
78   }
79
80   public Object JavaDoc executeUpdate(String JavaDoc querys, int queryTimeOut) throws
81       DException {
82     try {
83       return connection_interface.executeUpdate(querys, queryTimeOut);
84     }
85     catch (RemoteException JavaDoc ex) {
86       throw new RuntimeException JavaDoc(ex.getMessage());
87     }
88   }
89
90   public _ColumnCharacteristics getColumnCharacteristics(QualifiedIdentifier
91       tblName) throws DException {
92     throw new java.lang.UnsupportedOperationException JavaDoc(
93         "Method getColumnCharacteristics() not yet implemented.");
94   }
95
96   public void rollback() throws DException {
97     try {
98       connection_interface.rollback();
99     }
100     catch (RemoteException JavaDoc re) {
101       throw new RuntimeException JavaDoc(re.getMessage());
102     }
103   }
104
105   public void commit() throws DException {
106     try {
107       connection_interface.commit();
108     }
109     catch (RemoteException JavaDoc re) {
110       throw new RuntimeException JavaDoc(re.getMessage());
111     }
112   }
113
114   public void close() throws DException {
115     try {
116       connection_interface.close();
117     }
118     catch (RemoteException JavaDoc re) {
119       throw new RuntimeException JavaDoc(re.getMessage());
120     }
121   }
122
123
124   public String JavaDoc getDatabaseURL() throws DException {
125     try {
126       return connection_interface.getDatabaseURL();
127     }
128     catch (RemoteException JavaDoc ex) {
129       throw new RuntimeException JavaDoc(ex.getMessage());
130     }
131   }
132
133   public String JavaDoc getCurrentUser() throws DException {
134     try {
135       return connection_interface.getCurrentUser();
136     }
137     catch (RemoteException JavaDoc ex) {
138       throw new RuntimeException JavaDoc(ex.getMessage());
139     }
140   }
141
142   public String JavaDoc getCurrentCatalog() throws DException {
143     try {
144       return connection_interface.getCurrentCatalog();
145     }
146     catch (RemoteException JavaDoc ex) {
147       throw new RuntimeException JavaDoc(ex.getMessage());
148     }
149   }
150
151   public void setCurrentCatalog(String JavaDoc currentCatalog) throws DException {
152     try {
153       connection_interface.setCurrentCatalog(currentCatalog);
154     }
155     catch (RemoteException JavaDoc re) {
156       throw new RuntimeException JavaDoc(re.getMessage());
157     }
158   }
159
160   public int getIsolationLevel() throws DException {
161     try {
162       return connection_interface.getIsolationLevel();
163     }
164     catch (RemoteException JavaDoc re) {
165       throw new RuntimeException JavaDoc(re.getMessage());
166     }
167   }
168
169   public Object JavaDoc getSessionConstant() throws DException {
170     try {
171       return connection_interface.getSessionConstant();
172     }
173     catch (RemoteException JavaDoc re) {
174       throw new RuntimeException JavaDoc(re.getMessage());
175     }
176   }
177
178   public boolean getAutoCommit() {
179     try {
180       return connection_interface.getAutoCommit();
181     }
182     catch (RemoteException JavaDoc ex) {
183       throw new RuntimeException JavaDoc(ex.getMessage());
184     }
185     catch (DException ex) {
186       throw new RuntimeException JavaDoc(ex.getMessage());
187     }
188   }
189
190   public Object JavaDoc[] createDeepRecordCopy(QualifiedIdentifier tableName,
191                                        Object JavaDoc[] keys) throws DException {
192     try {
193       return connection_interface.createDeepRecordCopy(tableName, keys);
194     }
195     catch (RemoteException JavaDoc ex) {
196       throw new RuntimeException JavaDoc(ex.getMessage());
197     }
198   }
199
200   public void commitSavePoint() throws DException {
201     try {
202       connection_interface.commitSavePoint();
203     }
204     catch (RemoteException JavaDoc ex) {
205       throw new RuntimeException JavaDoc(ex.getMessage());
206     }
207   }
208
209   public boolean isDataModified() throws DException {
210     try {
211       return connection_interface.isDataModified();
212     }
213     catch (RemoteException JavaDoc ex) {
214       throw new RuntimeException JavaDoc(ex.getMessage());
215     }
216
217   }
218
219   public void rollbackSavePoint(String JavaDoc parm1) throws com.daffodilwoods.database.
220
      resource.DException {
221     try {
222       connection_interface.rollbackSavePoint(parm1);
223     }
224     catch (RemoteException JavaDoc ex) {
225       throw new RuntimeException JavaDoc(ex.getMessage());
226     }
227   }
228
229   public void releaseSavePoint(String JavaDoc parm1) throws DException {
230     try {
231       connection_interface.releaseSavePoint(parm1);
232     }
233     catch (RemoteException JavaDoc ex) {
234       throw new RuntimeException JavaDoc(ex.getMessage());
235     }
236   }
237
238   public void setSavePoint(String JavaDoc parm1) throws DException {
239     try {
240       connection_interface.setSavePoint(parm1);
241     }
242     catch (RemoteException JavaDoc ex) {
243       throw new RuntimeException JavaDoc(ex.getMessage());
244     }
245   }
246
247   public String JavaDoc setSavePoint() throws DException {
248     try {
249       return connection_interface.setSavePoint();
250     }
251     catch (RemoteException JavaDoc ex) {
252       throw new RuntimeException JavaDoc(ex.getMessage());
253     }
254   }
255
256   public Object JavaDoc execute(String JavaDoc query, int queryTimeOut, int type) throws
257       DException {
258     try {
259       Object JavaDoc object = connection_interface.execute(query, queryTimeOut, type);
260       if (object instanceof _RmiSelectIterator)
261         return new RmiSelectIterator( (_RmiSelectIterator) object, null, null);
262       return object;
263     }
264     catch (RemoteException JavaDoc ex) {
265       throw new RuntimeException JavaDoc(ex.getMessage());
266     }
267   }
268
269   public Object JavaDoc executeQuery(String JavaDoc query, int queryTimeOut, int type) throws
270       DException {
271     try {
272       Object JavaDoc object = connection_interface.executeQuery(query, queryTimeOut,
273           type);
274       return new RmiSelectIterator( (_RmiSelectIterator) object, null, null);
275     }
276     catch (RemoteException JavaDoc ex) {
277       throw new RuntimeException JavaDoc(ex.getMessage());
278     }
279   }
280
281   public _PreparedStatement getPreparedStatement(String JavaDoc query, int type) throws
282       DException {
283     try {
284       _RmiPreparedStatement object = connection_interface.getPreparedStatement(
285           query, type);
286       RmiPreparedStatement ps = new RmiPreparedStatement(object);
287       ps.setEnv(this, query);
288       return ps;
289     }
290     catch (RemoteException JavaDoc ex) {
291       throw new RuntimeException JavaDoc(ex.getMessage());
292     }
293
294   }
295   public _PreparedStatement getPreparedStatement(String JavaDoc query, int type,int autoGeneratedType,Object JavaDoc autoGenetatedValues) throws DException{
296     try {
297       _RmiPreparedStatement object = connection_interface.getPreparedStatement(
298           query, type,autoGeneratedType,autoGenetatedValues);
299       RmiPreparedStatement ps = new RmiPreparedStatement(object);
300       ps.setEnv(this, query);
301       return ps;
302     }
303     catch (RemoteException JavaDoc ex) {
304       throw new RuntimeException JavaDoc(ex.getMessage());
305     }
306   }
307
308   public Object JavaDoc execute(String JavaDoc query, int queryTimeOut, int type, int queryType,int autoGeneratedType, Object JavaDoc autoGenetatedValues) throws DException{
309     try {
310       Object JavaDoc object = connection_interface.execute(query, queryTimeOut, type,queryType,autoGeneratedType,autoGenetatedValues);
311       if (object instanceof _RmiSelectIterator)
312         return new RmiSelectIterator( (_RmiSelectIterator) object, null, null);
313       return object;
314     }
315     catch (RemoteException JavaDoc ex) {
316       throw new RuntimeException JavaDoc(ex.getMessage());
317     }
318   }
319
320   public boolean isClosed() throws DException{
321      try {
322       return connection_interface.isClosed();
323      }
324      catch (RemoteException JavaDoc ex) {
325        throw new RuntimeException JavaDoc(ex.getMessage());
326      }
327   }
328 }
329
Popular Tags