Source Code Cross Referenced for ClientJDBCObjectFactoryImpl.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » client » net » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » db derby 10.2 » org.apache.derby.client.net 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         
003:           Derby - Class org.apache.derby.client.net.ClientJDBCObjectFactoryImpl
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.net;
023:
024:        import java.rmi.UnexpectedException;
025:        import java.sql.Connection;
026:        import java.sql.SQLException;
027:        import org.apache.derby.client.ClientPooledConnection;
028:        import org.apache.derby.client.am.CallableStatement;
029:        import org.apache.derby.client.am.ClientJDBCObjectFactory;
030:        import org.apache.derby.client.am.LogicalConnection;
031:        import org.apache.derby.client.am.ParameterMetaData;
032:        import org.apache.derby.client.am.PreparedStatement;
033:        import org.apache.derby.client.am.Configuration;
034:        import org.apache.derby.client.am.LogWriter;
035:        import org.apache.derby.client.am.Agent;
036:        import org.apache.derby.client.am.Section;
037:        import org.apache.derby.client.am.Statement;
038:        import org.apache.derby.client.am.SqlException;
039:        import org.apache.derby.client.am.Cursor;
040:        import org.apache.derby.jdbc.ClientBaseDataSource;
041:        import org.apache.derby.client.am.ColumnMetaData;
042:
043:        /**
044:         * Implements the the ClientJDBCObjectFactory interface and returns the classes
045:         * that implement the JDBC3.0/2.0 interfaces
046:         * For Eg. newCallableStatement would return
047:         * org.apache.derby.client.am.CallableStatement
048:         */
049:
050:        public class ClientJDBCObjectFactoryImpl implements 
051:                ClientJDBCObjectFactory {
052:            /**
053:             * Returns an instance of org.apache.derby.client.ClientPooledConnection 
054:             */
055:            public ClientPooledConnection newClientPooledConnection(
056:                    ClientBaseDataSource ds, LogWriter logWriter, String user,
057:                    String password) throws SQLException {
058:                return new ClientPooledConnection(ds, logWriter, user, password);
059:            }
060:
061:            /**
062:             * Returns an instance of org.apache.derby.client.ClientPooledConnection 
063:             */
064:            public ClientPooledConnection newClientPooledConnection(
065:                    ClientBaseDataSource ds, LogWriter logWriter, String user,
066:                    String password, int rmId) throws SQLException {
067:                return new ClientPooledConnection(ds, logWriter, user,
068:                        password, rmId);
069:            }
070:
071:            /**
072:             * Returns an instance of org.apache.derby.client.am.CallableStatement.
073:             *
074:             * @param agent       The instance of NetAgent associated with this
075:             *                    CallableStatement object.
076:             * @param connection  The connection object associated with this
077:             *                    PreparedStatement Object.
078:             * @param sql         A String object that is the SQL statement to be sent 
079:             *                    to the database.
080:             * @param type        One of the ResultSet type constants
081:             * @param concurrency One of the ResultSet concurrency constants
082:             * @param holdability One of the ResultSet holdability constants
083:             * @param cpc         The PooledConnection object that will be used to 
084:             *                    notify the PooledConnection reference of the Error 
085:             *                    Occurred and the Close events.
086:             * @return a CallableStatement object
087:             * @throws SqlException
088:             */
089:            public CallableStatement newCallableStatement(Agent agent,
090:                    org.apache.derby.client.am.Connection connection,
091:                    String sql, int type, int concurrency, int holdability,
092:                    ClientPooledConnection cpc) throws SqlException {
093:                return new CallableStatement(agent, connection, sql, type,
094:                        concurrency, holdability, cpc);
095:            }
096:
097:            /**
098:             * Returns an instance of org.apache.derby.client.am.LogicalConnection
099:             */
100:            public LogicalConnection newLogicalConnection(
101:                    org.apache.derby.client.am.Connection physicalConnection,
102:                    ClientPooledConnection pooledConnection)
103:                    throws SqlException {
104:                return new LogicalConnection(physicalConnection,
105:                        pooledConnection);
106:            }
107:
108:            /**
109:             * This method returns an instance of PreparedStatement
110:             * which implements java.sql.PreparedStatement. It has the
111:             * ClientPooledConnection as one of its parameters
112:             * this is used to raise the Statement Events when the prepared
113:             * statement is closed.
114:             *
115:             * @param agent The instance of NetAgent associated with this
116:             *              CallableStatement object.
117:             * @param connection The connection object associated with this
118:             *                   PreparedStatement Object.
119:             * @param sql        A String object that is the SQL statement to be sent
120:             *                   to the database.
121:             * @param section    Section
122:             * @param cpc The ClientPooledConnection wraps the underlying physical
123:             *            connection associated with this prepared statement.
124:             *            It is used to pass the Statement closed and the Statement
125:             *            error occurred events that occur back to the
126:             *            ClientPooledConnection.
127:             * @return a PreparedStatement object
128:             * @throws SqlException
129:             */
130:            public PreparedStatement newPreparedStatement(Agent agent,
131:                    org.apache.derby.client.am.Connection connection,
132:                    String sql, Section section, ClientPooledConnection cpc)
133:                    throws SqlException {
134:                return new PreparedStatement(agent, connection, sql, section,
135:                        cpc);
136:            }
137:
138:            /**
139:             *
140:             * This method returns an instance of PreparedStatement
141:             * which implements java.sql.PreparedStatement.
142:             * It has the ClientPooledConnection as one of its parameters
143:             * this is used to raise the Statement Events when the prepared
144:             * statement is closed.
145:             *
146:             * @param agent The instance of NetAgent associated with this
147:             *              CallableStatement object.
148:             * @param connection  The connection object associated with this
149:             *                    PreparedStatement Object.
150:             * @param sql         A String object that is the SQL statement
151:             *                    to be sent to the database.
152:             * @param type        One of the ResultSet type constants.
153:             * @param concurrency One of the ResultSet concurrency constants.
154:             * @param holdability One of the ResultSet holdability constants.
155:             * @param autoGeneratedKeys a flag indicating whether auto-generated
156:             *                          keys should be returned.
157:             * @param columnNames an array of column names indicating the columns that
158:             *                    should be returned from the inserted row or rows.
159:             * @param cpc The ClientPooledConnection wraps the underlying physical
160:             *            connection associated with this prepared statement
161:             *            it is used to pass the Statement closed and the Statement
162:             *            error occurred events that occur back to the
163:             *            ClientPooledConnection.
164:             * @return a PreparedStatement object
165:             * @throws SqlException
166:             *
167:             */
168:            public PreparedStatement newPreparedStatement(Agent agent,
169:                    org.apache.derby.client.am.Connection connection,
170:                    String sql, int type, int concurrency, int holdability,
171:                    int autoGeneratedKeys, String[] columnNames,
172:                    ClientPooledConnection cpc) throws SqlException {
173:                return new PreparedStatement(agent, connection, sql, type,
174:                        concurrency, holdability, autoGeneratedKeys,
175:                        columnNames, cpc);
176:            }
177:
178:            /**
179:             * returns an instance of org.apache.derby.client.net.NetConnection
180:             */
181:            public org.apache.derby.client.am.Connection newNetConnection(
182:                    org.apache.derby.client.am.LogWriter netLogWriter,
183:                    String databaseName, java.util.Properties properties)
184:                    throws SqlException {
185:                return (org.apache.derby.client.am.Connection) (new NetConnection(
186:                        (NetLogWriter) netLogWriter, databaseName, properties));
187:            }
188:
189:            /**
190:             * returns an instance of org.apache.derby.client.net.NetConnection
191:             */
192:            public org.apache.derby.client.am.Connection newNetConnection(
193:                    org.apache.derby.client.am.LogWriter netLogWriter,
194:                    org.apache.derby.jdbc.ClientBaseDataSource clientDataSource,
195:                    String user, String password) throws SqlException {
196:                return (org.apache.derby.client.am.Connection) (new NetConnection(
197:                        (NetLogWriter) netLogWriter, clientDataSource, user,
198:                        password));
199:            }
200:
201:            /**
202:             * returns an instance of org.apache.derby.client.net.NetConnection
203:             */
204:            public org.apache.derby.client.am.Connection newNetConnection(
205:                    org.apache.derby.client.am.LogWriter netLogWriter,
206:                    int driverManagerLoginTimeout, String serverName,
207:                    int portNumber, String databaseName,
208:                    java.util.Properties properties) throws SqlException {
209:                return (org.apache.derby.client.am.Connection) (new NetConnection(
210:                        (NetLogWriter) netLogWriter, driverManagerLoginTimeout,
211:                        serverName, portNumber, databaseName, properties));
212:            }
213:
214:            /**
215:             * returns an instance of org.apache.derby.client.net.NetConnection
216:             */
217:            public org.apache.derby.client.am.Connection newNetConnection(
218:                    org.apache.derby.client.am.LogWriter netLogWriter,
219:                    String user, String password,
220:                    org.apache.derby.jdbc.ClientBaseDataSource dataSource,
221:                    int rmId, boolean isXAConn) throws SqlException {
222:                return (org.apache.derby.client.am.Connection) (new NetConnection(
223:                        (NetLogWriter) netLogWriter, user, password,
224:                        dataSource, rmId, isXAConn));
225:            }
226:
227:            /**
228:             * returns an instance of org.apache.derby.client.net.NetConnection
229:             */
230:            public org.apache.derby.client.am.Connection newNetConnection(
231:                    org.apache.derby.client.am.LogWriter netLogWriter,
232:                    String ipaddr, int portNumber,
233:                    org.apache.derby.jdbc.ClientBaseDataSource dataSource,
234:                    boolean isXAConn) throws SqlException {
235:                return (org.apache.derby.client.am.Connection) new NetConnection(
236:                        (NetLogWriter) netLogWriter, ipaddr, portNumber,
237:                        dataSource, isXAConn);
238:            }
239:
240:            /**
241:             * Returns an instance of org.apache.derby.client.net.NetConnection.
242:             * @param netLogWriter Placeholder for NetLogWriter object associated
243:             *                     with this connection.
244:             * @param user         user id for this connection.
245:             * @param password     password for this connection.
246:             * @param dataSource   The DataSource object passed from the PooledConnection
247:             *                     object from which this constructor was called.
248:             * @param rmId         The Resource Manager ID for XA Connections
249:             * @param isXAConn     true if this is a XA connection
250:             * @param cpc          The ClientPooledConnection object from which this
251:             *                     NetConnection constructor was called. This is used to
252:             *                     pass StatementEvents back to the pooledConnection
253:             *                     object.
254:             * @return a org.apache.derby.client.am.Connection object
255:             * @throws             SqlException
256:             */
257:            public org.apache.derby.client.am.Connection newNetConnection(
258:                    org.apache.derby.client.am.LogWriter netLogWriter,
259:                    String user, String password,
260:                    org.apache.derby.jdbc.ClientBaseDataSource dataSource,
261:                    int rmId, boolean isXAConn, ClientPooledConnection cpc)
262:                    throws SqlException {
263:                return (org.apache.derby.client.am.Connection) (new NetConnection(
264:                        (NetLogWriter) netLogWriter, user, password,
265:                        dataSource, rmId, isXAConn, cpc));
266:            }
267:
268:            /**
269:             * returns an instance of org.apache.derby.client.net.NetResultSet
270:             */
271:            public org.apache.derby.client.am.ResultSet newNetResultSet(
272:                    Agent netAgent,
273:                    org.apache.derby.client.am.MaterialStatement netStatement,
274:                    Cursor cursor, int qryprctyp, int sqlcsrhld, int qryattscr,
275:                    int qryattsns, int qryattset, long qryinsid,
276:                    int actualResultSetType, int actualResultSetConcurrency,
277:                    int actualResultSetHoldability) throws SqlException {
278:                return new NetResultSet((NetAgent) netAgent,
279:                        (NetStatement) netStatement, cursor, qryprctyp,
280:                        sqlcsrhld, qryattscr, qryattsns, qryattset, qryinsid,
281:                        actualResultSetType, actualResultSetConcurrency,
282:                        actualResultSetHoldability);
283:            }
284:
285:            /**
286:             * returns an instance of org.apache.derby.client.net.NetDatabaseMetaData
287:             */
288:            public org.apache.derby.client.am.DatabaseMetaData newNetDatabaseMetaData(
289:                    Agent netAgent,
290:                    org.apache.derby.client.am.Connection netConnection) {
291:                return new NetDatabaseMetaData((NetAgent) netAgent,
292:                        (NetConnection) netConnection);
293:            }
294:
295:            /**
296:             * This method provides an instance of Statement 
297:             * @param  agent      Agent
298:             * @param  connection Connection
299:             * @return a java.sql.Statement implementation 
300:             * @throws SqlException
301:             *
302:             */
303:            public Statement newStatement(Agent agent,
304:                    org.apache.derby.client.am.Connection connection)
305:                    throws SqlException {
306:                return new Statement(agent, connection);
307:            }
308:
309:            /**
310:             * This method provides an instance of Statement 
311:             * @param  agent            Agent
312:             * @param  connection       Connection
313:             * @param  type             int
314:             * @param  concurrency      int
315:             * @param  holdability      int
316:             * @param autoGeneratedKeys int
317:             * @param columnNames       String[]
318:             * @return a java.sql.Statement implementation 
319:             * @throws SqlException
320:             *
321:             */
322:            public Statement newStatement(Agent agent,
323:                    org.apache.derby.client.am.Connection connection, int type,
324:                    int concurrency, int holdability, int autoGeneratedKeys,
325:                    String[] columnNames) throws SqlException {
326:                return new Statement(agent, connection, type, concurrency,
327:                        holdability, autoGeneratedKeys, columnNames);
328:            }
329:
330:            /**
331:             * Returns an instanceof ColumnMetaData 
332:             *
333:             * @param logWriter LogWriter
334:             * @return a ColumnMetaData implementation
335:             *
336:             */
337:            public ColumnMetaData newColumnMetaData(LogWriter logWriter) {
338:                return new ColumnMetaData(logWriter);
339:            }
340:
341:            /**
342:             * Returns an instanceof ColumnMetaData or ColumnMetaData40 depending 
343:             * on the jdk version under use
344:             *
345:             * @param logWriter  LogWriter
346:             * @param upperBound int
347:             * @return a ColumnMetaData implementation
348:             *
349:             */
350:            public ColumnMetaData newColumnMetaData(LogWriter logWriter,
351:                    int upperBound) {
352:                return new ColumnMetaData(logWriter, upperBound);
353:            }
354:
355:            /**
356:             * 
357:             * returns an instance of ParameterMetaData 
358:             *
359:             * @param columnMetaData ColumnMetaData
360:             * @return a ParameterMetaData implementation
361:             *
362:             */
363:            public ParameterMetaData newParameterMetaData(
364:                    ColumnMetaData columnMetaData) {
365:                return new ParameterMetaData(columnMetaData);
366:            }
367:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.