KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > client > am > ClientJDBCObjectFactory


1 /*
2  
3    Derby - Class org.apache.derby.client.am.ClientJDBCObjectFactory
4  
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to You under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11  
12       http://www.apache.org/licenses/LICENSE-2.0
13  
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19  
20  */

21
22 package org.apache.derby.client.am;
23
24 import org.apache.derby.client.ClientPooledConnection;
25 import org.apache.derby.jdbc.ClientDataSource;
26 import java.sql.SQLException JavaDoc;
27 import org.apache.derby.jdbc.ClientBaseDataSource;
28
29 /**
30  *
31  * The methods of this interface are used to return JDBC interface
32  * implementations to the user depending on the JDBC version supported
33  * by the jdk
34  *
35  */

36
37 public interface ClientJDBCObjectFactory {
38     
39     /**
40      * This method is used to return an instance of
41      * ClientPooledConnection (or ClientPooledConnection40) class which
42      * implements javax.sql.PooledConnection
43      */

44     ClientPooledConnection newClientPooledConnection(ClientBaseDataSource ds,
45             LogWriter logWriter,String JavaDoc user,String JavaDoc password)
46             throws SQLException JavaDoc;
47     
48     /**
49      * This method is used to return an instance of
50      * ClientPooledConnection(or ClientPooledConnection40) class which
51      * implements javax.sql.PooledConnection
52      */

53     ClientPooledConnection newClientPooledConnection(ClientBaseDataSource ds,
54             LogWriter logWriter,String JavaDoc user,String JavaDoc password,int rmId)
55             throws SQLException JavaDoc;
56     
57     /**
58      * Returns an instance of org.apache.derby.client.am.CallableStatement.
59      * or CallableStatement40 which implements java.sql.CallableStatement
60      *
61      * @param agent The instance of NetAgent associated with this
62      * CallableStatement object.
63      * @param connection The connection object associated with this
64      * PreparedStatement Object.
65      * @param sql A String object that is the SQL statement to be sent
66      * to the database.
67      * @param type One of the ResultSet type constants
68      * @param concurrency One of the ResultSet concurrency constants
69      * @param holdability One of the ResultSet holdability constants
70      * @param cpc The PooledConnection object that will be used to
71      * notify the PooledConnection reference of the Error
72      * Occurred and the Close events.
73      * @return a CallableStatement object
74      * @throws SqlException
75      */

76     CallableStatement newCallableStatement(Agent agent,
77             org.apache.derby.client.am.Connection connection, String JavaDoc sql,
78             int type,int concurrency,int holdability,
79             ClientPooledConnection cpc) throws SqlException;
80     
81     /**
82      * Returns an instance of LogicalConnection.
83      * This method returns an instance of LogicalConnection
84      * (or LogicalConnection40) which implements java.sql.Connection.
85      */

86     LogicalConnection newLogicalConnection(
87                     org.apache.derby.client.am.Connection physicalConnection,
88                     ClientPooledConnection pooledConnection)
89         throws SqlException;
90     
91     /**
92      * This method returns an instance of PreparedStatement
93      * (or PreparedStatement40) which implements java.sql.PreparedStatement
94      * It has the ClientPooledConnection as one of its parameters
95      * this is used to raise the Statement Events when the prepared
96      * statement is closed
97      *
98      * @param agent The instance of NetAgent associated with this
99      * CallableStatement object.
100      * @param connection The connection object associated with this
101      * PreparedStatement Object.
102      * @param sql A String object that is the SQL statement to be sent
103      * to the database.
104      * @param section Section
105      * @param cpc The ClientPooledConnection wraps the underlying physical
106      * connection associated with this prepared statement.
107      * It is used to pass the Statement closed and the Statement
108      * error occurred events that occur back to the
109      * ClientPooledConnection.
110      * @return a PreparedStatement object
111      * @throws SqlException
112      */

113     PreparedStatement newPreparedStatement(Agent agent,
114             org.apache.derby.client.am.Connection connection,
115             String JavaDoc sql,Section section,ClientPooledConnection cpc)
116             throws SqlException;
117     
118     /**
119      * Returns an instance of PreparedStatement
120      * (or PreparedStatement40) which implements java.sql.PreparedStatement
121      * It has the ClientPooledConnection as one of its parameters
122      * this is used to raise the Statement Events when the prepared
123      * statement is closed
124      *
125      * @param agent The instance of NetAgent associated with this
126      * CallableStatement object.
127      * @param connection The connection object associated with this
128      * PreparedStatement Object.
129      * @param sql A String object that is the SQL statement
130      * to be sent to the database.
131      * @param type One of the ResultSet type constants.
132      * @param concurrency One of the ResultSet concurrency constants.
133      * @param holdability One of the ResultSet holdability constants.
134      * @param autoGeneratedKeys a flag indicating whether auto-generated
135      * keys should be returned.
136      * @param columnNames an array of column names indicating the columns that
137      * should be returned from the inserted row or rows.
138      * @param cpc The ClientPooledConnection wraps the underlying physical
139      * connection associated with this prepared statement
140      * it is used to pass the Statement closed and the Statement
141      * error occurred events that occur back to the
142      * ClientPooledConnection.
143      * @return a PreparedSatement object
144      * @throws SqlException
145      */

146     PreparedStatement newPreparedStatement(Agent agent,
147             org.apache.derby.client.am.Connection connection,String JavaDoc sql,
148             int type,int concurrency,int holdability,int autoGeneratedKeys,
149             String JavaDoc [] columnNames,ClientPooledConnection cpc)
150             throws SqlException;
151     
152     
153     /**
154      * This method returns an instance of NetConnection (or NetConnection40) class
155      * which extends from org.apache.derby.client.am.Connection
156      * this implements the java.sql.Connection interface
157      */

158     org.apache.derby.client.am.Connection newNetConnection(
159             LogWriter netLogWriter,
160             String JavaDoc databaseName,java.util.Properties JavaDoc properties)
161             throws SqlException;
162     
163     /**
164      * This method returns an instance of NetConnection (or NetConnection40) class
165      * which extends from org.apache.derby.client.am.Connection
166      * this implements the java.sql.Connection interface
167      */

168     org.apache.derby.client.am.Connection newNetConnection(
169             LogWriter netLogWriter,
170             org.apache.derby.jdbc.ClientBaseDataSource clientDataSource,String JavaDoc user,
171             String JavaDoc password) throws SqlException;
172     
173     /**
174      * This method returns an instance of NetConnection (or NetConnection40)
175      * class which extends from org.apache.derby.client.am.Connection
176      * this implements the java.sql.Connection interface
177      */

178     org.apache.derby.client.am.Connection newNetConnection(
179             LogWriter netLogWriter,
180             int driverManagerLoginTimeout,String JavaDoc serverName,
181             int portNumber,String JavaDoc databaseName,java.util.Properties JavaDoc properties)
182             throws SqlException;
183     
184     /**
185      * This method returns an instance of NetConnection (or NetConnection40)
186      * class which extends from org.apache.derby.client.am.Connection
187      * this implements the java.sql.Connection interface
188      */

189     org.apache.derby.client.am.Connection newNetConnection(
190             LogWriter netLogWriter,
191             String JavaDoc user,String JavaDoc password,
192             org.apache.derby.jdbc.ClientBaseDataSource dataSource,int rmId,
193             boolean isXAConn) throws SqlException;
194     
195     /**
196      * This methos returns an instance of NetConnection
197      * (or NetConnection40) class which extends from
198      * org.apache.derby.client.am.Connection this implements the
199      * java.sql.Connection interface
200      */

201     org.apache.derby.client.am.Connection newNetConnection(
202             LogWriter netLogWriter,String JavaDoc ipaddr,
203             int portNumber,org.apache.derby.jdbc.ClientBaseDataSource dataSource,
204             boolean isXAConn) throws SqlException;
205     
206     /**
207      * This method returns an instance of NetConnection (or NetConnection40)
208      * class which extends from org.apache.derby.client.am.Connection
209      * this implements the java.sql.Connection interface
210      * This method is used to pass the ClientPooledConnection
211      * object to the NetConnection object which can then be used to pass the
212      * statement events back to the user
213      *
214      * @param netLogWriter placeholder for NetLogWriter object associated with this connection
215      * @param user user id for this connection
216      * @param password password for this connection
217      * @param dataSource The DataSource object passed from the PooledConnection
218      * object from which this constructor was called
219      * @param rmId The Resource Manager ID for XA Connections
220      * @param isXAConn true if this is a XA connection
221      * @param cpc The ClientPooledConnection object from which this
222      * NetConnection constructor was called. This is used
223      * to pass StatementEvents back to the pooledConnection
224      * object
225      * @throws SqlException
226      */

227     org.apache.derby.client.am.Connection newNetConnection(
228             LogWriter netLogWriter,
229             String JavaDoc user,String JavaDoc password,
230             org.apache.derby.jdbc.ClientBaseDataSource dataSource,int rmId,
231             boolean isXAConn,ClientPooledConnection cpc) throws SqlException;
232     
233     /**
234      * This method returns an instance of NetResultSet(or NetResultSet40)
235      * which extends from org.apache.derby.client.am.ResultSet
236      * which implements java.sql.ResultSet
237      */

238     ResultSet newNetResultSet(Agent netAgent,MaterialStatement netStatement,
239             Cursor cursor,
240             int qryprctyp, int sqlcsrhld, int qryattscr, int qryattsns,
241             int qryattset,long qryinsid,int actualResultSetType,
242             int actualResultSetConcurrency,int actualResultSetHoldability)
243             throws SqlException;
244     
245     /**
246      * This method provides an instance of NetDatabaseMetaData
247      * (or NetDatabaseMetaData40) which extends from
248      * org.apache.derby.client.am.DatabaseMetaData which implements
249      * java.sql.DatabaseMetaData
250      */

251     DatabaseMetaData newNetDatabaseMetaData(Agent netAgent,
252             org.apache.derby.client.am.Connection netConnection);
253     
254     /**
255      * This method provides an instance of Statement or Statement40
256      * depending on the jdk version under use
257      * @param agent Agent
258      * @param connection Connection
259      * @return a java.sql.Statement implementation
260      * @throws SqlException
261      *
262      */

263      Statement newStatement(Agent agent,
264              org.apache.derby.client.am.Connection connection)
265              throws SqlException;
266      
267      /**
268      * This method provides an instance of Statement or Statement40
269      * depending on the jdk version under use
270      * @param agent Agent
271      * @param connection Connection
272      * @param type int
273      * @param concurrency int
274      * @param holdability int
275      * @param autoGeneratedKeys int
276      * @param columnNames String[]
277      * @return a java.sql.Statement implementation
278      * @throws SqlException
279      *
280      */

281      Statement newStatement(Agent agent,
282                      org.apache.derby.client.am.Connection connection, int type,
283                      int concurrency, int holdability,
284                      int autoGeneratedKeys, String JavaDoc[] columnNames)
285                      throws SqlException;
286      
287     /**
288      * Returns an instanceof ColumnMetaData or ColumnMetaData40 depending
289      * on the jdk version under use
290      *
291      * @param logWriter LogWriter
292      * @return a ColumnMetaData implementation
293      *
294      */

295     ColumnMetaData newColumnMetaData(LogWriter logWriter);
296
297     /**
298      * Returns an instanceof ColumnMetaData or ColumnMetaData40 depending
299      * on the jdk version under use
300      *
301      * @param logWriter LogWriter
302      * @param upperBound int
303      * @return a ColumnMetaData implementation
304      *
305      */

306     ColumnMetaData newColumnMetaData(LogWriter logWriter, int upperBound);
307     
308     /**
309      *
310      * returns an instance of ParameterMetaData or ParameterMetaData40 depending
311      * on the jdk version under use
312      *
313      * @param columnMetaData ColumnMetaData
314      * @return a ParameterMetaData implementation
315      *
316      */

317     ParameterMetaData newParameterMetaData(ColumnMetaData columnMetaData);
318 }
319
Popular Tags