KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hsqldb > util > DataAccessPoint


1 /* Copyright (c) 2001-2005, The HSQL Development Group
2  * All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  * Redistributions of source code must retain the above copyright notice, this
8  * list of conditions and the following disclaimer.
9  *
10  * Redistributions in binary form must reproduce the above copyright notice,
11  * this list of conditions and the following disclaimer in the documentation
12  * and/or other materials provided with the distribution.
13  *
14  * Neither the name of the HSQL Development Group nor the names of its
15  * contributors may be used to endorse or promote products derived from this
16  * software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG,
22  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */

30
31
32 package org.hsqldb.util;
33
34 import java.io.Serializable JavaDoc;
35 import java.util.Vector JavaDoc;
36
37 /**
38  * Database Transfer Tool
39  * @author Nicolas BAZIN, INGENICO
40  * @version 1.7.0
41  */

42 class DataAccessPoint implements Serializable JavaDoc {
43
44     Traceable tracer;
45     TransferHelper helper;
46     String JavaDoc databaseToConvert;
47
48     public DataAccessPoint() {
49
50         tracer = null;
51         helper = HelperFactory.getHelper("");
52         databaseToConvert = "";
53     }
54
55     public DataAccessPoint(Traceable t) {
56
57         tracer = t;
58         helper = HelperFactory.getHelper("");
59
60         helper.set(null, t, "\'");
61
62         databaseToConvert = "";
63     }
64
65     boolean isConnected() {
66         return false;
67     }
68
69     boolean getAutoCommit() throws DataAccessPointException {
70         return false;
71     }
72
73     void commit() throws DataAccessPointException {}
74
75     void rollback() throws DataAccessPointException {}
76
77     void setAutoCommit(boolean flag) throws DataAccessPointException {}
78
79     boolean execute(String JavaDoc statement) throws DataAccessPointException {
80         return false;
81     }
82
83     TransferResultSet getData(String JavaDoc statement)
84     throws DataAccessPointException {
85         return null;
86     }
87
88     void putData(String JavaDoc statement, TransferResultSet r,
89                  int iMaxRows) throws DataAccessPointException {}
90
91     Vector JavaDoc getSchemas() throws DataAccessPointException {
92         return new Vector JavaDoc();
93     }
94
95     Vector JavaDoc getCatalog() throws DataAccessPointException {
96         return new Vector JavaDoc();
97     }
98
99     void setCatalog(String JavaDoc sCatalog) throws DataAccessPointException {}
100
101     Vector JavaDoc getTables(String JavaDoc sCatalog,
102                      String JavaDoc[] sSchemas) throws DataAccessPointException {
103         return new Vector JavaDoc();
104     }
105
106     void getTableStructure(TransferTable SQLCommands,
107                            DataAccessPoint Dest)
108                            throws DataAccessPointException {
109         throw new DataAccessPointException("Nothing to Parse");
110     }
111
112     void close() throws DataAccessPointException {}
113
114     void beginDataTransfer() throws DataAccessPointException {
115
116         try {
117             helper.beginDataTransfer();
118         } catch (Exception JavaDoc e) {
119             throw new DataAccessPointException(e.getMessage());
120         }
121     }
122
123     void endDataTransfer() throws DataAccessPointException {
124
125         try {
126             helper.endDataTransfer();
127         } catch (Exception JavaDoc e) {
128             throw new DataAccessPointException(e.getMessage());
129         }
130     }
131
132     /**
133      * @return Returns the helper.
134      */

135     public TransferHelper getHelper() {
136         return helper;
137     }
138 }
139
Popular Tags