001: /*
002:
003: Derby - Class org.apache.derby.client.am.ClientJDBCObjectFactory
004:
005: Licensed to the Apache Software Foundation (ASF) under one or more
006: contributor license agreements. See the NOTICE file distributed with
007: this work for additional information regarding copyright ownership.
008: The ASF licenses this file to You under the Apache License, Version 2.0
009: (the "License"); you may not use this file except in compliance with
010: the License. You may obtain a copy of the License at
011:
012: http://www.apache.org/licenses/LICENSE-2.0
013:
014: Unless required by applicable law or agreed to in writing, software
015: distributed under the License is distributed on an "AS IS" BASIS,
016: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: See the License for the specific language governing permissions and
018: limitations under the License.
019:
020: */
021:
022: package org.apache.derby.client.am;
023:
024: import org.apache.derby.client.ClientPooledConnection;
025: import org.apache.derby.jdbc.ClientDataSource;
026: import java.sql.SQLException;
027: import org.apache.derby.jdbc.ClientBaseDataSource;
028:
029: /**
030: *
031: * The methods of this interface are used to return JDBC interface
032: * implementations to the user depending on the JDBC version supported
033: * by the jdk
034: *
035: */
036:
037: public interface ClientJDBCObjectFactory {
038:
039: /**
040: * This method is used to return an instance of
041: * ClientPooledConnection (or ClientPooledConnection40) class which
042: * implements javax.sql.PooledConnection
043: */
044: ClientPooledConnection newClientPooledConnection(
045: ClientBaseDataSource ds, LogWriter logWriter, String user,
046: String password) throws SQLException;
047:
048: /**
049: * This method is used to return an instance of
050: * ClientPooledConnection(or ClientPooledConnection40) class which
051: * implements javax.sql.PooledConnection
052: */
053: ClientPooledConnection newClientPooledConnection(
054: ClientBaseDataSource ds, LogWriter logWriter, String user,
055: String password, int rmId) throws SQLException;
056:
057: /**
058: * Returns an instance of org.apache.derby.client.am.CallableStatement.
059: * or CallableStatement40 which implements java.sql.CallableStatement
060: *
061: * @param agent The instance of NetAgent associated with this
062: * CallableStatement object.
063: * @param connection The connection object associated with this
064: * PreparedStatement Object.
065: * @param sql A String object that is the SQL statement to be sent
066: * to the database.
067: * @param type One of the ResultSet type constants
068: * @param concurrency One of the ResultSet concurrency constants
069: * @param holdability One of the ResultSet holdability constants
070: * @param cpc The PooledConnection object that will be used to
071: * notify the PooledConnection reference of the Error
072: * Occurred and the Close events.
073: * @return a CallableStatement object
074: * @throws SqlException
075: */
076: CallableStatement newCallableStatement(Agent agent,
077: org.apache.derby.client.am.Connection connection,
078: String sql, int type, int concurrency, int holdability,
079: ClientPooledConnection cpc) throws SqlException;
080:
081: /**
082: * Returns an instance of LogicalConnection.
083: * This method returns an instance of LogicalConnection
084: * (or LogicalConnection40) which implements java.sql.Connection.
085: */
086: LogicalConnection newLogicalConnection(
087: org.apache.derby.client.am.Connection physicalConnection,
088: ClientPooledConnection pooledConnection)
089: throws SqlException;
090:
091: /**
092: * This method returns an instance of PreparedStatement
093: * (or PreparedStatement40) which implements java.sql.PreparedStatement
094: * It has the ClientPooledConnection as one of its parameters
095: * this is used to raise the Statement Events when the prepared
096: * statement is closed
097: *
098: * @param agent The instance of NetAgent associated with this
099: * 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 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,
148: String sql, int type, int concurrency, int holdability,
149: int autoGeneratedKeys, String[] columnNames,
150: ClientPooledConnection cpc) throws SqlException;
151:
152: /**
153: * This method returns an instance of NetConnection (or NetConnection40) class
154: * which extends from org.apache.derby.client.am.Connection
155: * this implements the java.sql.Connection interface
156: */
157: org.apache.derby.client.am.Connection newNetConnection(
158: LogWriter netLogWriter, String databaseName,
159: java.util.Properties properties) throws SqlException;
160:
161: /**
162: * This method returns an instance of NetConnection (or NetConnection40) class
163: * which extends from org.apache.derby.client.am.Connection
164: * this implements the java.sql.Connection interface
165: */
166: org.apache.derby.client.am.Connection newNetConnection(
167: LogWriter netLogWriter,
168: org.apache.derby.jdbc.ClientBaseDataSource clientDataSource,
169: String user, String password) throws SqlException;
170:
171: /**
172: * This method returns an instance of NetConnection (or NetConnection40)
173: * class which extends from org.apache.derby.client.am.Connection
174: * this implements the java.sql.Connection interface
175: */
176: org.apache.derby.client.am.Connection newNetConnection(
177: LogWriter netLogWriter, int driverManagerLoginTimeout,
178: String serverName, int portNumber, String databaseName,
179: java.util.Properties properties) throws SqlException;
180:
181: /**
182: * This method returns an instance of NetConnection (or NetConnection40)
183: * class which extends from org.apache.derby.client.am.Connection
184: * this implements the java.sql.Connection interface
185: */
186: org.apache.derby.client.am.Connection newNetConnection(
187: LogWriter netLogWriter, String user, String password,
188: org.apache.derby.jdbc.ClientBaseDataSource dataSource,
189: int rmId, boolean isXAConn) throws SqlException;
190:
191: /**
192: * This methos returns an instance of NetConnection
193: * (or NetConnection40) class which extends from
194: * org.apache.derby.client.am.Connection this implements the
195: * java.sql.Connection interface
196: */
197: org.apache.derby.client.am.Connection newNetConnection(
198: LogWriter netLogWriter, String ipaddr, int portNumber,
199: org.apache.derby.jdbc.ClientBaseDataSource dataSource,
200: boolean isXAConn) throws SqlException;
201:
202: /**
203: * This method returns an instance of NetConnection (or NetConnection40)
204: * class which extends from org.apache.derby.client.am.Connection
205: * this implements the java.sql.Connection interface
206: * This method is used to pass the ClientPooledConnection
207: * object to the NetConnection object which can then be used to pass the
208: * statement events back to the user
209: *
210: * @param netLogWriter placeholder for NetLogWriter object associated with this connection
211: * @param user user id for this connection
212: * @param password password for this connection
213: * @param dataSource The DataSource object passed from the PooledConnection
214: * object from which this constructor was called
215: * @param rmId The Resource Manager ID for XA Connections
216: * @param isXAConn true if this is a XA connection
217: * @param cpc The ClientPooledConnection object from which this
218: * NetConnection constructor was called. This is used
219: * to pass StatementEvents back to the pooledConnection
220: * object
221: * @throws SqlException
222: */
223: org.apache.derby.client.am.Connection newNetConnection(
224: LogWriter netLogWriter, String user, String password,
225: org.apache.derby.jdbc.ClientBaseDataSource dataSource,
226: int rmId, boolean isXAConn, ClientPooledConnection cpc)
227: throws SqlException;
228:
229: /**
230: * This method returns an instance of NetResultSet(or NetResultSet40)
231: * which extends from org.apache.derby.client.am.ResultSet
232: * which implements java.sql.ResultSet
233: */
234: ResultSet newNetResultSet(Agent netAgent,
235: MaterialStatement netStatement, Cursor cursor,
236: int qryprctyp, int sqlcsrhld, int qryattscr, int qryattsns,
237: int qryattset, long qryinsid, int actualResultSetType,
238: int actualResultSetConcurrency,
239: int actualResultSetHoldability) throws SqlException;
240:
241: /**
242: * This method provides an instance of NetDatabaseMetaData
243: * (or NetDatabaseMetaData40) which extends from
244: * org.apache.derby.client.am.DatabaseMetaData which implements
245: * java.sql.DatabaseMetaData
246: */
247: DatabaseMetaData newNetDatabaseMetaData(Agent netAgent,
248: org.apache.derby.client.am.Connection netConnection);
249:
250: /**
251: * This method provides an instance of Statement or Statement40
252: * depending on the jdk version under use
253: * @param agent Agent
254: * @param connection Connection
255: * @return a java.sql.Statement implementation
256: * @throws SqlException
257: *
258: */
259: Statement newStatement(Agent agent,
260: org.apache.derby.client.am.Connection connection)
261: throws SqlException;
262:
263: /**
264: * This method provides an instance of Statement or Statement40
265: * depending on the jdk version under use
266: * @param agent Agent
267: * @param connection Connection
268: * @param type int
269: * @param concurrency int
270: * @param holdability int
271: * @param autoGeneratedKeys int
272: * @param columnNames String[]
273: * @return a java.sql.Statement implementation
274: * @throws SqlException
275: *
276: */
277: Statement newStatement(Agent agent,
278: org.apache.derby.client.am.Connection connection, int type,
279: int concurrency, int holdability, int autoGeneratedKeys,
280: String[] columnNames) throws SqlException;
281:
282: /**
283: * Returns an instanceof ColumnMetaData or ColumnMetaData40 depending
284: * on the jdk version under use
285: *
286: * @param logWriter LogWriter
287: * @return a ColumnMetaData implementation
288: *
289: */
290: ColumnMetaData newColumnMetaData(LogWriter logWriter);
291:
292: /**
293: * Returns an instanceof ColumnMetaData or ColumnMetaData40 depending
294: * on the jdk version under use
295: *
296: * @param logWriter LogWriter
297: * @param upperBound int
298: * @return a ColumnMetaData implementation
299: *
300: */
301: ColumnMetaData newColumnMetaData(LogWriter logWriter, int upperBound);
302:
303: /**
304: *
305: * returns an instance of ParameterMetaData or ParameterMetaData40 depending
306: * on the jdk version under use
307: *
308: * @param columnMetaData ColumnMetaData
309: * @return a ParameterMetaData implementation
310: *
311: */
312: ParameterMetaData newParameterMetaData(ColumnMetaData columnMetaData);
313: }
|