KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > daffodilwoods > daffodildb > server > sql99 > dql > execution > ServerSessionWrapper


1 package com.daffodilwoods.daffodildb.server.sql99.dql.execution;
2
3 import java.sql.*;
4 import java.sql.Date JavaDoc;
5 import java.util.*;
6 import com.daffodilwoods.daffodildb.server.datadictionarysystem.*;
7 import com.daffodilwoods.daffodildb.server.datasystem.interfaces.*;
8 import com.daffodilwoods.daffodildb.server.serversystem.*;
9 import com.daffodilwoods.daffodildb.server.sessionsystem.*;
10 import com.daffodilwoods.daffodildb.server.sql99.dml.declarecursor.*;
11 import com.daffodilwoods.daffodildb.server.sql99.dql.iterator.*;
12 import com.daffodilwoods.daffodildb.server.sql99.dql.plan.table.*;
13 import com.daffodilwoods.daffodildb.server.sql99.dql.queryexpression.orderbyclause.*;
14 import com.daffodilwoods.daffodildb.server.sql99.expression.booleanvalueexpression.*;
15 import com.daffodilwoods.database.general.*;
16 import com.daffodilwoods.database.resource.*;
17 import com.daffodilwoods.database.sqlinitiator._Order;
18 import com.daffodilwoods.daffodildb.server.sql99.common.TableDetails;
19 import com.daffodilwoods.daffodildb.server.serversystem._StatementExecutionContext;
20 import com.daffodilwoods.daffodildb.server.datadictionarysystem._ColumnCharacteristics;
21 import com.daffodilwoods.daffodildb.server.sessionsystem._UserSession;
22 import com.daffodilwoods.daffodildb.server.datadictionarysystem._DataDictionary;
23 import java.sql.Date JavaDoc;
24 import java.sql.Time JavaDoc;
25 import com.daffodilwoods.daffodildb.server.sessionsystem.SessionTransactionMode;
26 import java.sql.Timestamp JavaDoc;
27 import java.util.TimeZone JavaDoc;
28 import java.util.Properties JavaDoc;
29 import com.daffodilwoods.daffodildb.server.datasystem.interfaces._IndexTable;
30 import java.util.HashMap JavaDoc;
31 import com.daffodilwoods.daffodildb.server.sql99.dml.declarecursor._Cursor;
32 import com.daffodilwoods.daffodildb.server.datadictionarysystem._SequenceManager;
33 import com.daffodilwoods.daffodildb.utils.byteconverter.CbCUsffWbmvfIboemfs;
34 import com.daffodilwoods.daffodildb.server.datasystem.mergesystem.MergeDatabase;
35 import com.daffodilwoods.daffodildb.server.serversystem.triggerInfo._Triggers;
36
37 /**
38  * It represents the wrapper for serversession. It is required to maintain the
39  * type of iterator whether it is UPDATABLE,SCROLLABLE,NONSCROLLABLE. We've to
40  * maintain this type because if resultset is of updatable type, but the select
41  * query on which resultset is taken, does not support updatable type.Then in
42  * this case type is changed in this class. It is also required to maintain
43  * currentschema and currentcatalog for the underlying tables of view. Because
44  * all the underlying table shares the same catalog and same schema as that of
45  * view.
46  * <p>Title: </p>
47  * <p>Description: </p>
48  * <p>Copyright: Copyright (c) 2003</p>
49  * <p>Company: </p>
50  * @author unascribed
51  * @version 1.0
52  */

53
54 public class ServerSessionWrapper implements _ServerSession {
55
56    /**
57     * Represents the type od Resultset.
58     */

59
60    private int iteratorType;
61
62    /**
63     * Represents the serverSession.
64     */

65
66    private _ServerSession serverSession;
67
68    /**
69     * Represents the current schema
70     */

71
72    private String JavaDoc currentSchema;
73
74    /**
75     * Represents the current catalog.
76     */

77
78    private String JavaDoc currentCatalog;
79
80    transient DateTimeFunctions dateTimeFunctions;
81
82    public ServerSessionWrapper(_ServerSession serverSession0) {
83       serverSession = serverSession0;
84       dateTimeFunctions = new DateTimeFunctions();
85    }
86
87    public ServerSessionWrapper(_ServerSession serverSession0, String JavaDoc catalog, String JavaDoc schema) {
88       serverSession = serverSession0;
89       currentCatalog = catalog;
90       currentSchema = schema;
91       dateTimeFunctions = new DateTimeFunctions();
92    }
93
94    /**
95     * Returns the default schema for all tables except the tables which are
96     * involved in view. For the tables of view, default schema of view is
97     * returned.
98     * @return current schema
99     * @throws DException
100     */

101
102    public String JavaDoc getCurrentSchema() throws DException {
103       return currentSchema == null ? serverSession.getCurrentSchema() : currentSchema;
104    }
105
106    /**
107     * Returns the default catalog for all tables except the tables which are
108     * involved in view. For the tables of view, default catalog of view is
109     * returned.
110     * @return current catalog
111     * @throws DException
112     */

113
114    public String JavaDoc getCurrentCatalog() throws DException {
115       return currentCatalog == null ? serverSession.getCurrentCatalog() : currentCatalog;
116    }
117
118    /**
119     * Returns the type of resultset.
120     * @return
121     */

122
123    public int getType() {
124       return iteratorType;
125    }
126
127    /**
128     * All the following methods belong to serversession, so for documentation of
129     * these methods refer to documentation of serversession.
130     */

131
132    public Object JavaDoc execute(String JavaDoc query, int queryTimeOut) throws DException {
133       return serverSession.execute(query, queryTimeOut);
134    }
135
136    public Object JavaDoc executeUpdate(String JavaDoc querys, int queryTimeOut) throws DException {
137       return serverSession.executeParameterised(querys, queryTimeOut);
138    }
139
140    public Object JavaDoc executeQuery(String JavaDoc query, int queryTimeOut) throws DException {
141       return serverSession.executeQuery(query, queryTimeOut);
142    }
143
144    public Object JavaDoc executeParameterised(String JavaDoc query, int queryTimeOut) throws DException {
145       return serverSession.executeParameterised(query, queryTimeOut);
146    }
147
148    public Object JavaDoc executeUpdateParameterised(String JavaDoc querys, int queryTimeOut) throws DException {
149       return serverSession.executeUpdateParameterised(querys, queryTimeOut);
150    }
151
152    public Object JavaDoc executeQueryParameterised(String JavaDoc query, int queryTimeOut) throws DException {
153       return serverSession.executeQueryParameterised(query, queryTimeOut);
154    }
155
156    public _ServerTable getServerTable(QualifiedIdentifier tableName) throws DException {
157       return serverSession.getServerTable(tableName);
158    }
159
160    public _StatementExecutionContext getStatementExecutionContext() throws DException {
161       return serverSession.getStatementExecutionContext();
162    }
163
164    public _ColumnCharacteristics getColumnCharacteristics(QualifiedIdentifier tblName) throws DException {
165       return serverSession.getColumnCharacteristics(tblName);
166    }
167
168    public void rollback() throws DException {
169       serverSession.rollback();
170    }
171
172    public void commit() throws DException {
173       serverSession.commit();
174    }
175
176    public void close() throws DException {
177       serverSession.close();
178    }
179
180    public void setUserSession(_UserSession userSession) throws DException {
181       serverSession.setUserSession(userSession);
182    }
183
184    public _UserSession getUserSession() throws DException {
185       return serverSession.getUserSession();
186    }
187
188    public _ServerSession getGlobalSession() throws DException {
189       return serverSession.getGlobalSession();
190    }
191
192    public boolean makePersistent() throws DException {
193       return serverSession.makePersistent();
194    }
195
196    public boolean prepare() throws DException {
197       return serverSession.prepare();
198    }
199
200    public _ServerSession getSystemServerSession() throws DException {
201       return serverSession.getSystemServerSession();
202    }
203
204    public _DataDictionary getDataDictionary() throws DException {
205       return serverSession.getDataDictionary();
206    }
207
208    public String JavaDoc getDatabaseURL() throws DException {
209       return serverSession.getDatabaseURL();
210    }
211
212    public String JavaDoc getModuleSchema() throws DException {
213       return serverSession.getModuleSchema();
214    }
215
216    public String JavaDoc getModuleCatalog() throws DException {
217       return serverSession.getModuleCatalog();
218    }
219
220    public String JavaDoc getCurrentRole() throws DException {
221       return serverSession.getCurrentRole();
222    }
223
224    public String JavaDoc getCurrentUser() throws DException {
225       return serverSession.getCurrentUser();
226    }
227
228    public Date JavaDoc getDate() throws DException {
229       return dateTimeFunctions.getDate();
230    }
231
232    public Time JavaDoc getTime() throws DException {
233       return dateTimeFunctions.getTime();
234    }
235
236    public void deleteTable(QualifiedIdentifier tableName, boolean dropTable) throws DException {
237       serverSession.deleteTable(tableName, dropTable);
238    }
239
240    public boolean isEnabledAuthorizationIdentifier(String JavaDoc authorizationIdentifier, boolean checkBrowserUser) throws DException {
241       return serverSession.isEnabledAuthorizationIdentifier(authorizationIdentifier, checkBrowserUser);
242    }
243
244    public String JavaDoc getAuthorizationIdentifier() throws DException {
245       return serverSession.getAuthorizationIdentifier();
246    }
247
248    public void setTransactionMode(SessionTransactionMode sessionTransactionMode) throws DException {
249       serverSession.setTransactionMode(sessionTransactionMode);
250    }
251
252    public SessionTransactionMode getTransactionMode() throws DException {
253       return serverSession.getTransactionMode();
254    }
255
256    public void setCurrentCatalog(String JavaDoc currentCatalog) throws DException {
257       serverSession.setCurrentCatalog(currentCatalog);
258    }
259
260    public void setCurrentSchema(String JavaDoc currentSchema) throws DException {
261       serverSession.setCurrentSchema(currentSchema);
262    }
263
264    public Timestamp JavaDoc getTimeStamp() throws DException {
265       return dateTimeFunctions.getTimeStamp();
266    }
267
268    public String JavaDoc getDatabase() throws DException {
269       return serverSession.getDatabase();
270    }
271
272    public int getIsolationLevel() throws DException {
273       return serverSession.getIsolationLevel();
274    }
275
276    public Object JavaDoc getSessionConstant() throws DException {
277       return serverSession.getSessionConstant();
278    }
279
280    public TimeZone JavaDoc getTimeZone() throws DException {
281       return serverSession.getTimeZone();
282    }
283
284    public void createDatabase(String JavaDoc databaseName, Properties JavaDoc prop) throws DException {
285       serverSession.createDatabase(databaseName, prop);
286    }
287
288    public _IndexTable getIndexTable(QualifiedIdentifier tableName) throws DException {
289       return serverSession.getIndexTable(tableName);
290    }
291
292    public void createIndex(QualifiedIdentifier tableName, String JavaDoc indexName, boolean nonUnique) throws DException {
293       serverSession.createIndex(tableName, indexName, nonUnique);
294    }
295
296    public void createTable(QualifiedIdentifier tableName) throws DException {
297       serverSession.createTable(tableName);
298    }
299
300    public void createIndexForSystemTable(QualifiedIdentifier tableName, String JavaDoc indexName) throws DException {
301       serverSession.createIndexForSystemTable(tableName, indexName);
302    }
303
304    public void dropTable(QualifiedIdentifier tableName) throws DException {
305       serverSession.dropTable(tableName);
306    }
307
308    public void dropIndex(QualifiedIdentifier tableName, String JavaDoc indexName) throws DException {
309       serverSession.dropIndex(tableName, indexName);
310    }
311
312    public _Iterator getIndexedIterator(_Iterator iterator, _ExpressionOrderValues orderValues, CbCUsffWbmvfIboemfs tempHandler) throws DException {
313       return serverSession.getIndexedIterator(iterator, orderValues, tempHandler);
314    }
315
316    public HashMap JavaDoc getViewMap() throws DException {
317       return serverSession.getViewMap();
318    }
319
320    public _ViewObject getViewObject(QualifiedIdentifier viewName, boolean checkUserRight) throws DException {
321       return serverSession.getViewObject(viewName, checkUserRight);
322    }
323
324    public boolean getAutoCommit() {
325       return serverSession.getAutoCommit();
326    }
327
328    public Object JavaDoc[] getForeignConstraintCharacteritics(QualifiedIdentifier tableName, String JavaDoc columnName) throws DException {
329       return serverSession.getForeignConstraintCharacteritics(tableName, columnName);
330    }
331
332    public String JavaDoc[] getUniqueInformation(QualifiedIdentifier tableName) throws DException {
333       return serverSession.getUniqueInformation(tableName);
334    }
335
336    public boolean cursorAlreadyCreated(String JavaDoc name) {
337       return serverSession.cursorAlreadyCreated(name);
338    }
339
340    public void addCursor(String JavaDoc cname, _Cursor cur) {
341       serverSession.addCursor(cname, cur);
342    }
343
344    public _Cursor getCursor(String JavaDoc cname) {
345       return serverSession.getCursor(cname);
346    }
347
348    public _SequenceManager getSequenceManager() throws DException {
349       return serverSession.getSequenceManager();
350    }
351
352    public int getEstimatedRowCount(QualifiedIdentifier parm1) throws DException {
353       return serverSession.getEstimatedRowCount(parm1);
354    }
355
356    public Object JavaDoc getSessionId() throws DException {
357       return serverSession.getSessionId();
358    }
359
360    public Object JavaDoc[] createDeepRecordCopy(QualifiedIdentifier tableName, Object JavaDoc[] keys) throws DException {
361       return serverSession.createDeepRecordCopy(tableName, keys);
362    }
363
364    public void startSavePoint() throws DException {
365       serverSession.startSavePoint();
366    }
367
368    public void commitSavePoint() throws DException {
369       serverSession.commitSavePoint();
370    }
371
372    public void rollbackSavePoint() throws DException {
373       serverSession.rollbackSavePoint();
374    }
375
376    public void releaseSavePoint() throws DException {
377    }
378
379    public void alterTable(QualifiedIdentifier tableName, _ColumnCharacteristics cc) throws DException {
380       alterTable(tableName, cc);
381    }
382
383    public boolean isConstraintCheckingDeffered() {
384       return serverSession.isConstraintCheckingDeffered();
385    }
386
387    public void dropDatabase(String JavaDoc databaseName, String JavaDoc userName, String JavaDoc password) throws DException {
388       serverSession.dropDatabase(databaseName, userName, password);
389    }
390
391    public boolean isDataModified() throws DException {
392       return serverSession.isDataModified();
393    }
394
395    public void alterTable(QualifiedIdentifier tableName, _ColumnCharacteristics cc, Object JavaDoc defaultValue) throws DException {
396       serverSession.alterTable(tableName, cc, defaultValue);
397    }
398
399    public void ignoreParallelSavePoint() throws DException {
400       serverSession.ignoreParallelSavePoint();
401    }
402
403    public void allowParallelSavePoint() throws DException {
404       serverSession.allowParallelSavePoint();
405    }
406
407    public void checkImmediateConstraintsOnCommit() throws DException {
408       serverSession.checkImmediateConstraintsOnCommit();
409    }
410
411    public void hideSavePoint() throws DException {
412       serverSession.hideSavePoint();
413    }
414
415    public void unhideSavePoint() throws DException {
416       serverSession.unhideSavePoint();
417    }
418
419    public _Iterator getIterator(QualifiedIdentifier tableName, _SingleTableExecuter ste) throws DException {
420       return serverSession.getIterator(tableName, ste);
421    }
422
423    public _Iterator getForeignKeyIterator(QualifiedIdentifier tableName, _SingleTableExecuter ste, _TableAlias[] tableAliasArray) throws DException {
424       return serverSession.getForeignKeyIterator(tableName, ste, tableAliasArray);
425    }
426
427    public void rollbackSavePoint(String JavaDoc parm1) throws com.daffodilwoods.database.resource.DException {
428       serverSession.rollbackSavePoint(parm1);
429    }
430
431    public void releaseSavePoint(String JavaDoc parm1) throws com.daffodilwoods.database.resource.DException {
432       serverSession.releaseSavePoint(parm1);
433    }
434
435    public void setSavePoint(String JavaDoc parm1) throws com.daffodilwoods.database.resource.DException {
436       serverSession.setSavePoint(parm1);
437    }
438
439    public String JavaDoc setSavePoint() throws com.daffodilwoods.database.resource.DException {
440       return serverSession.setSavePoint();
441    }
442
443    public Object JavaDoc execute(String JavaDoc query, int queryTimeOut, int type) throws DException {
444       /**@todo Implement this com.daffodilwoods.daffodildb.server.serversystem._ServerSession method*/
445       throw new java.lang.UnsupportedOperationException JavaDoc("Method execute() not yet implemented.");
446    }
447
448    public Object JavaDoc executeQuery(String JavaDoc query, int queryTimeOut, int type) throws DException {
449       /**@todo Implement this com.daffodilwoods.daffodildb.server.serversystem._ServerSession method*/
450       throw new java.lang.UnsupportedOperationException JavaDoc("Method executeQueryt() not yet implemented.");
451    }
452
453    public void setType(int type) {
454       iteratorType = type;
455    }
456
457    public void setRole(String JavaDoc roleName) throws DException {
458       /**@todo Implement this com.daffodilwoods.daffodildb.server.serversystem._ServerSession method*/
459       throw new java.lang.UnsupportedOperationException JavaDoc("Method setRole() not yet implemented.");
460    }
461
462    public boolean isActiveAuthorization(String JavaDoc authorization) throws DException {
463       /**@todo Implement this com.daffodilwoods.daffodildb.server.serversystem._ServerSession method*/
464       throw new java.lang.UnsupportedOperationException JavaDoc("Method isActiveAuthorization not yet implemented.");
465    }
466
467    public void createFullTextIndex(QualifiedIdentifier tableName, String JavaDoc indexName, String JavaDoc[] columnName) throws DException {
468       throw new java.lang.UnsupportedOperationException JavaDoc("Method createFullTextIndex() not yet implemented.");
469    }
470
471    public void dropFullTextIndex(QualifiedIdentifier tableName, String JavaDoc indexName) throws DException {
472       throw new java.lang.UnsupportedOperationException JavaDoc("Method dropFullTextIndex() not yet implemented.");
473    }
474
475    public _Iterator getInternalIterator(QualifiedIdentifier tableName, _SingleTableExecuter singleTableExecuter) throws DException {
476       return serverSession.getInternalIterator(tableName, singleTableExecuter);
477    }
478
479    public double getDbVersion() throws DException {
480       return serverSession.getDbVersion();
481
482    }
483
484    public void refereshTable(QualifiedIdentifier tableName,
485                              boolean dropTable) throws DException {
486       serverSession.refereshTable(tableName, dropTable);
487    }
488
489    public _Triggers[] getAfterInsertTrigger(QualifiedIdentifier tableName, _TriggerCharacteristics triggerCharacteristics, _StatementExecutionContext statementExecutionContext) throws DException {
490       return serverSession.getAfterInsertTrigger(tableName, triggerCharacteristics, statementExecutionContext);
491    }
492
493    public _Triggers[] getBeforeInsertTrigger(QualifiedIdentifier tableName, _TriggerCharacteristics triggerCharacteristics, _StatementExecutionContext statementExecutionContext) throws DException {
494       return serverSession.getBeforeInsertTrigger(tableName, triggerCharacteristics, statementExecutionContext);
495    }
496
497    public _Triggers[] getAfterUpdateTrigger(QualifiedIdentifier tableName, _TriggerCharacteristics triggerCharacteristics, _StatementExecutionContext statementExecutionContext, int[] cols) throws DException {
498       return serverSession.getAfterUpdateTrigger(tableName, triggerCharacteristics, statementExecutionContext, cols);
499    }
500
501    public _Triggers[] getBeforeUpdateTrigger(QualifiedIdentifier tableName, _TriggerCharacteristics triggerCharacteristics, _StatementExecutionContext statementExecutionContext, int[] cols) throws DException {
502       return serverSession.getBeforeUpdateTrigger(tableName, triggerCharacteristics, statementExecutionContext, cols);
503    }
504
505    public _Triggers[] getAfterDeleteTrigger(QualifiedIdentifier tableName, _TriggerCharacteristics triggerCharacteristics, _StatementExecutionContext statementExecutionContext) throws DException {
506       return serverSession.getAfterDeleteTrigger(tableName, triggerCharacteristics, statementExecutionContext);
507    }
508
509    public _Triggers[] getBeforeDeleteTrigger(QualifiedIdentifier tableName, _TriggerCharacteristics triggerCharacteristics, _StatementExecutionContext statementExecutionContext) throws DException {
510       return serverSession.getBeforeDeleteTrigger(tableName, triggerCharacteristics, statementExecutionContext);
511    }
512
513    public void refreshTriggerInfo(QualifiedIdentifier tableName) throws DException {
514       serverSession.refreshTriggerInfo(tableName);
515
516    }
517
518    public void refreshTriggers(QualifiedIdentifier tableName) throws DException {
519       serverSession.refreshTriggers(tableName);
520    }
521
522    public _Triggers[] getAfterInsertTriggerOfStatementLevel(QualifiedIdentifier tableName, _TriggerCharacteristics triggerCharacteristics, _StatementExecutionContext statementExecutionContext) throws DException {
523       return serverSession.getAfterInsertTriggerOfStatementLevel(tableName, triggerCharacteristics, statementExecutionContext);
524    }
525
526    public _Triggers[] getBeforeInsertTriggerOfStatementLevel(QualifiedIdentifier tableName, _TriggerCharacteristics triggerCharacteristics, _StatementExecutionContext statementExecutionContext) throws DException {
527       return serverSession.getBeforeInsertTriggerOfStatementLevel(tableName, triggerCharacteristics, statementExecutionContext);
528    }
529
530    public _Triggers[] getAfterUpdateTriggerOfStatementLevel(QualifiedIdentifier tableName, _TriggerCharacteristics triggerCharacteristics, _StatementExecutionContext statementExecutionContext, int[] cols) throws DException {
531       return serverSession.getAfterUpdateTriggerOfStatementLevel(tableName, triggerCharacteristics, statementExecutionContext, cols);
532    }
533
534    public _Triggers[] getBeforeUpdateTriggerOfStatementLevel(QualifiedIdentifier tableName, _TriggerCharacteristics triggerCharacteristics, _StatementExecutionContext statementExecutionContext, int[] cols) throws DException {
535       return serverSession.getBeforeUpdateTriggerOfStatementLevel(tableName, triggerCharacteristics, statementExecutionContext, cols);
536    }
537
538    public _Triggers[] getAfterDeleteTriggerOfStatementLevel(QualifiedIdentifier tableName, _TriggerCharacteristics triggerCharacteristics, _StatementExecutionContext statementExecutionContext) throws DException {
539       return serverSession.getAfterDeleteTriggerOfStatementLevel(tableName, triggerCharacteristics, statementExecutionContext);
540    }
541
542    public _Triggers[] getBeforeDeleteTriggerOfStatementLevel(QualifiedIdentifier tableName, _TriggerCharacteristics triggerCharacteristics, _StatementExecutionContext statementExecutionContext) throws DException {
543       return serverSession.getBeforeDeleteTriggerOfStatementLevel(tableName, triggerCharacteristics, statementExecutionContext);
544    }
545
546    public ArrayList getCreateIndexList() throws DException {
547       return serverSession.getCreateIndexList();
548    }
549
550    public void resetTime() throws DException {
551       dateTimeFunctions.resetTransactionDate();
552    }
553
554    public void refreshConstraint(QualifiedIdentifier tableName) throws DException {
555       serverSession.refreshConstraint(tableName);
556    }
557
558    public int getTypeForPrivilige() throws DException {
559    return -1;
560  }
561
562 }
563
Popular Tags