Source Code Cross Referenced for I18nConnection.java in  » Database-JDBC-Connection-Pool » octopus » org » webdocwf » util » i18njdbc » 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 JDBC Connection Pool » octopus » org.webdocwf.util.i18njdbc 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:            Copyright (C) 2002-2003  Together
003:
004:            This library is free software; you can redistribute it and/or
005:            modify it under the terms of the GNU Lesser General Public
006:            License as published by the Free Software Foundation; either
007:            version 2.1 of the License, or (at your option) any later version.
008:
009:            This library is distributed in the hope that it will be useful,
010:            but WITHOUT ANY WARRANTY; without even the implied warranty of
011:            MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
012:            Lesser General Public License for more details.
013:
014:            You should have received a copy of the GNU Lesser General Public
015:            License along with this library; if not, write to the Free Software
016:            Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
017:
018:         */package org.webdocwf.util.i18njdbc;
019:
020:        import java.io.File;
021:        import java.sql.Array;
022:        import java.sql.Blob;
023:        import java.sql.CallableStatement;
024:        import java.sql.Clob;
025:        import java.sql.Connection;
026:        import java.sql.DatabaseMetaData;
027:        import java.sql.NClob;
028:        import java.sql.PreparedStatement;
029:        import java.sql.SQLClientInfoException;
030:        import java.sql.SQLException;
031:        import java.sql.SQLWarning;
032:        import java.sql.SQLXML;
033:        import java.sql.Savepoint;
034:        import java.sql.Statement;
035:        import java.sql.Struct;
036:        import java.util.Enumeration;
037:        import java.util.Map;
038:        import java.util.Properties;
039:        import java.util.StringTokenizer;
040:        import java.util.Vector;
041:
042:        import org.webdocwf.util.i18njdbc.I18nDriver;
043:
044:        /**
045:         * This class implements the Connection interface for the I18nJdbc driver.
046:         *
047:         * @author     Zoran Milakovic
048:         * @author		 Zeljko Kovacevic
049:         */
050:        public class I18nConnection implements  Connection {
051:
052:            /** Directory where the i18n files to use are located */
053:            private String path;
054:
055:            /** File extension to use */
056:            //  private String charset = I18nDriver.DEFAULT_CHARSET;
057:            private String nameColumn = I18nDriver.DEFAULT_NAMECOLUMN;
058:            private String valueColumn = I18nDriver.DEFAULT_VALUECOLUMN;
059:            private boolean create = I18nDriver.DEFAULT_CREATE;
060:            private String extension = I18nDriver.DEFAULT_EXTENSION;
061:            private I18nProperties prop;
062:            private String currentTableName = null;
063:
064:            /** Collection of all created Statements */
065:            private Vector statements = new Vector();
066:
067:            /** Charset that should be used to read the files */
068:            //private String charset = null;
069:            /** Stores whether this Connection is closed or not */
070:            private boolean closed;
071:
072:            /** If value is true I18n file will be saved after each query.Default value is true in JDBC compliant drivers.*/
073:            private boolean autoCommit = true;
074:
075:            /**
076:             * Creates a new I18nConnection that takes the supplied path
077:             * @param path directory where the i18n files are located
078:             */
079:            protected I18nConnection(String path) throws SQLException {
080:                init(path);
081:                this .prop = new I18nProperties();
082:            }
083:
084:            /**
085:             * Creates a new I18nConnection that takes the supplied path and properties
086:             * @param path directory where the i18n files are located
087:             * @param info set of properties containing custom options
088:             */
089:            protected I18nConnection(String path, Properties info)
090:                    throws SQLException {
091:
092:                // check for properties
093:                if (info != null) {
094:                    // set the file extension to be used
095:                    if (info.getProperty(I18nDriver.FILE_EXTENSION) != null) {
096:                        extension = info.getProperty(I18nDriver.FILE_EXTENSION);
097:                        if (!extension.startsWith("."))
098:                            this .extension = "." + extension;
099:                    }
100:                    //set the nameColumn
101:                    if (info.getProperty(I18nDriver.NAMECOLUMN) != null) {
102:                        this .nameColumn = info
103:                                .getProperty(I18nDriver.NAMECOLUMN);
104:                    }
105:                    // set the valueColumn
106:                    if (info.getProperty(I18nDriver.VALUECOLUMN) != null) {
107:                        this .valueColumn = info
108:                                .getProperty(I18nDriver.VALUECOLUMN);
109:                    }
110:                    // default charset
111:                    //      if (info.getProperty(I18nDriver.CHARSET) != null) {
112:                    //        this.charset = info.getProperty(I18nDriver.CHARSET);
113:                    //      }
114:                    // set create
115:                    if (info.getProperty(I18nDriver.CREATE) != null) {
116:                        this .create = Boolean.valueOf(
117:                                info.getProperty(I18nDriver.CREATE))
118:                                .booleanValue();
119:                    }
120:                }
121:                init(path);
122:                this .prop = new I18nProperties();
123:            }
124:
125:            /**
126:             * This method set init parameters
127:             * @param path
128:             * @throws SQLException
129:             */
130:            protected void init(String path) throws SQLException {
131:                if (path == null || path.length() == 0) {
132:                    throw new IllegalArgumentException(
133:                            "'path' argument may not be empty or null");
134:                }
135:                //check for properties
136:                StringTokenizer st = new StringTokenizer(path, ";");
137:                this .path = st.nextToken();
138:                if (!this .path.endsWith(File.separator)) {
139:                    this .path += File.separator;
140:                }
141:                while (st.hasMoreTokens()) {
142:                    String next = st.nextToken();
143:                    if (!this .setProperty(next)) {
144:                        throw new IllegalArgumentException("unknown property "
145:                                + next);
146:                    }
147:                }
148:                File filePath = new File(this .path);
149:
150:                if (!this .create && !filePath.exists()) {
151:                    throw new SQLException("Specified path '"
152:                            + filePath.getAbsolutePath() + "' does not exist !");
153:                }
154:
155:                if (this .create && !filePath.exists())
156:                    filePath.mkdirs();
157:            }
158:
159:            /**
160:             * This method set parameters from property string
161:             * @param propString
162:             * @return
163:             */
164:            private boolean setProperty(String propString) {
165:                boolean retVal = true;
166:                StringTokenizer st = new StringTokenizer(propString, "=");
167:                String name = st.nextToken();
168:                String value = st.nextToken();
169:
170:                if (name.equals(I18nDriver.FILE_EXTENSION)) {
171:                    if (!value.startsWith("."))
172:                        value = "." + value;
173:                    this .extension = value;
174:                }
175:                //    else if (name.equals(I18nDriver.CHARSET)) {
176:                //      this.charset = value;
177:                //    }
178:                else if (name.equals(I18nDriver.CREATE)) {
179:                    this .create = Boolean.valueOf(value).booleanValue();
180:                } else if (name.equals(I18nDriver.NAMECOLUMN)) {
181:                    this .nameColumn = value;
182:                } else if (name.equals(I18nDriver.VALUECOLUMN)) {
183:                    this .valueColumn = value;
184:                } else
185:                    retVal = false;
186:                return retVal;
187:            }
188:
189:            /**
190:             * Creates a <code>Statement</code> object for sending
191:             * SQL statements to the database.
192:             * SQL statements without parameters are normally
193:             * executed using <code>Statement</code> objects. If the same SQL statement
194:             * is executed many times, it may be more efficient to use a
195:             * <code>PreparedStatement</code> object.
196:             * <P>
197:             * Result sets created using the returned <code>Statement</code>
198:             * object will by default be type <code>TYPE_FORWARD_ONLY</code>
199:             * and have a concurrency level of <code>CONCUR_READ_ONLY</code>.
200:             *
201:             * @return a new default <code>Statement</code> object
202:             * @exception SQLException if a database access error occurs
203:             */
204:            public Statement createStatement() throws SQLException {
205:                I18nStatement statement = new I18nStatement(this );
206:                statements.add(statement);
207:                return statement;
208:            }
209:
210:            /**
211:             * Creates a <code>PreparedStatement</code> object for sending
212:             * parameterized SQL statements to the database.
213:             * <P>
214:             * A SQL statement with or without IN parameters can be
215:             * pre-compiled and stored in a <code>PreparedStatement</code> object. This
216:             * object can then be used to efficiently execute this statement
217:             * multiple times.
218:             *
219:             * <P><B>Note:</B> This method is optimized for handling
220:             * parametric SQL statements that benefit from precompilation. If
221:             * the driver supports precompilation,
222:             * the method <code>prepareStatement</code> will send
223:             * the statement to the database for precompilation. Some drivers
224:             * may not support precompilation. In this case, the statement may
225:             * not be sent to the database until the <code>PreparedStatement</code>
226:             * object is executed.  This has no direct effect on users; however, it does
227:             * affect which methods throw certain <code>SQLException</code> objects.
228:             * <P>
229:             * Result sets created using the returned <code>PreparedStatement</code>
230:             * object will by default be type <code>TYPE_FORWARD_ONLY</code>
231:             * and have a concurrency level of <code>CONCUR_READ_ONLY</code>.
232:             *
233:             * @param sql an SQL statement that may contain one or more '?' IN
234:             * parameter placeholders
235:             * @return a new default <code>PreparedStatement</code> object containing the
236:             * pre-compiled SQL statement
237:             * @exception SQLException if a database access error occurs
238:             */
239:            public PreparedStatement prepareStatement(String sql)
240:                    throws SQLException {
241:                int index = sql.indexOf("?");
242:                while (index != -1) {
243:                    sql = sql.substring(0, index)
244:                            + I18nPreparedStatement.PREPARE_SEPARATOR
245:                            + sql.substring(index + 1);
246:                    index = sql.indexOf("?");
247:                }
248:                I18nPreparedStatement statement = new I18nPreparedStatement(
249:                        this , sql);
250:                statements.add(statement);
251:                return statement;
252:
253:            }
254:
255:            /**
256:             * Creates a <code>CallableStatement</code> object for calling
257:             * database stored procedures.
258:             * The <code>CallableStatement</code> object provides
259:             * methods for setting up its IN and OUT parameters, and
260:             * methods for executing the call to a stored procedure.
261:             *
262:             * <P><B>Note:</B> This method is optimized for handling stored
263:             * procedure call statements. Some drivers may send the call
264:             * statement to the database when the method <code>prepareCall</code>
265:             * is done; others
266:             * may wait until the <code>CallableStatement</code> object
267:             * is executed. This has no
268:             * direct effect on users; however, it does affect which method
269:             * throws certain SQLExceptions.
270:             * <P>
271:             * Result sets created using the returned <code>CallableStatement</code>
272:             * object will by default be type <code>TYPE_FORWARD_ONLY</code>
273:             * and have a concurrency level of <code>CONCUR_READ_ONLY</code>.
274:             *
275:             * @param sql an SQL statement that may contain one or more '?'
276:             * parameter placeholders. Typically this  statement is a JDBC
277:             * function call escape string.
278:             * @return a new default <code>CallableStatement</code> object containing the
279:             * pre-compiled SQL statement
280:             * @exception SQLException if a database access error occurs
281:             */
282:            public CallableStatement prepareCall(String sql)
283:                    throws SQLException {
284:                throw new UnsupportedOperationException(
285:                        "Connection.prepareCall(String) unsupported");
286:            }
287:
288:            /**
289:             * Converts the given SQL statement into the system's native SQL grammar.
290:             * A driver may convert the JDBC SQL grammar into its system's
291:             * native SQL grammar prior to sending it. This method returns the
292:             * native form of the statement that the driver would have sent.
293:             *
294:             * @param sql an SQL statement that may contain one or more '?'
295:             * parameter placeholders
296:             * @return the native form of this statement
297:             * @exception SQLException if a database access error occurs
298:             */
299:            public String nativeSQL(String sql) throws SQLException {
300:                throw new UnsupportedOperationException(
301:                        "Connection.nativeSQL(String) unsupported");
302:            }
303:
304:            /**
305:             * Sets this connection's auto-commit mode to the given state.
306:             * If a connection is in auto-commit mode, then all its SQL
307:             * statements will be executed and committed as individual
308:             * transactions.  Otherwise, its SQL statements are grouped into
309:             * transactions that are terminated by a call to either
310:             * the method <code>commit</code> or the method <code>rollback</code>.
311:             * By default, new connections are in auto-commit
312:             * mode.
313:             * <P>
314:             * The commit occurs when the statement completes or the next
315:             * execute occurs, whichever comes first. In the case of
316:             * statements returning a <code>ResultSet</code> object,
317:             * the statement completes when the last row of the
318:             * <code>ResultSet</code> object has been retrieved or the
319:             * <code>ResultSet</code> object has been closed. In advanced cases, a
320:             * single statement may return multiple results as well as output
321:             * parameter values. In these cases, the commit occurs when all results and
322:             * output parameter values have been retrieved.
323:             * <P>
324:             * <B>NOTE:</B>  If this method is called during a transaction, the
325:             * transaction is committed.
326:             *
327:             * @param autoCommit <code>true</code> to enable auto-commit mode;
328:             *         <code>false</code> to disable it
329:             * @exception SQLException if a database access error occurs
330:             * @see #getAutoCommit
331:             */
332:            public void setAutoCommit(boolean autoCommit) throws SQLException {
333:                this .autoCommit = autoCommit;
334:            }
335:
336:            /**
337:             * Retrieves the current auto-commit mode for this <code>Connection</code>
338:             * object.
339:             *
340:             * @return the current state of this <code>Connection</code> object's
341:             *         auto-commit mode
342:             * @exception SQLException if a database access error occurs
343:             * @see #setAutoCommit
344:             */
345:            public boolean getAutoCommit() throws SQLException {
346:                return this .autoCommit;
347:            }
348:
349:            /**
350:             * Makes all changes made since the previous
351:             * commit/rollback permanent and releases any database locks
352:             * currently held by this <code>Connection</code> object.
353:             * This method should be
354:             * used only when auto-commit mode has been disabled.
355:             *
356:             * @exception SQLException if a database access error occurs or this
357:             *            <code>Connection</code> object is in auto-commit mode
358:             * @see #setAutoCommit
359:             */
360:            public void commit() throws SQLException {
361:                for (int i = 0; i < this .statements.size(); i++) {
362:                    ((Statement) statements.get(i)).close();
363:                }
364:                try {
365:                    if (getCurrentTableName() != null) {
366:                        this .prop.store(new File(getPath()
367:                                + getCurrentTableName() + getExtension()));
368:                        this .prop = new I18nProperties();
369:                        this .currentTableName = null;
370:                    }
371:                } catch (Exception e) {
372:                    e.printStackTrace();
373:                    throw new SQLException(e.getMessage());
374:                }
375:            }
376:
377:            /**
378:             * Undoes all changes made in the current transaction
379:             * and releases any database locks currently held
380:             * by this <code>Connection</code> object. This method should be
381:             * used only when auto-commit mode has been disabled.
382:             *
383:             * @exception SQLException if a database access error occurs or this
384:             *            <code>Connection</code> object is in auto-commit mode
385:             * @see #setAutoCommit
386:             */
387:            public void rollback() throws SQLException {
388:                throw new UnsupportedOperationException(
389:                        "Connection.rollback() unsupported");
390:            }
391:
392:            /**
393:             * Releases this <code>Connection</code> object's database and JDBC
394:             * resources immediately instead of waiting for them to be automatically
395:             * released.
396:             * <P>
397:             * Calling the method <code>close</code> on a <code>Connection</code>
398:             * object that is already closed is a no-op.
399:             * <P>
400:             * <B>Note:</B> A <code>Connection</code> object is automatically
401:             * closed when it is garbage collected. Certain fatal errors also
402:             * close a <code>Connection</code> object.
403:             *
404:             * @exception SQLException if a database access error occurs
405:             */
406:            public void close() throws SQLException {
407:                // close all created statements
408:                for (Enumeration i = statements.elements(); i.hasMoreElements();) {
409:                    Statement statement = (Statement) i.nextElement();
410:                    statement.close();
411:                }
412:                // set this Connection as closed
413:                closed = true;
414:            }
415:
416:            /**
417:             * Retrieves whether this <code>Connection</code> object has been
418:             * closed.  A connection is closed if the method <code>close</code>
419:             * has been called on it or if certain fatal errors have occurred.
420:             * This method is guaranteed to return <code>true</code> only when
421:             * it is called after the method <code>Connection.close</code> has
422:             * been called.
423:             * <P>
424:             * This method generally cannot be called to determine whether a
425:             * connection to a database is valid or invalid.  A typical client
426:             * can determine that a connection is invalid by catching any
427:             * exceptions that might be thrown when an operation is attempted.
428:             *
429:             * @return <code>true</code> if this <code>Connection</code> object
430:             *         is closed; <code>false</code> if it is still open
431:             * @exception SQLException if a database access error occurs
432:             */
433:            public boolean isClosed() throws SQLException {
434:                return closed;
435:            }
436:
437:            /**
438:             * Retrieves a <code>DatabaseMetaData</code> object that contains
439:             * metadata about the database to which this
440:             * <code>Connection</code> object represents a connection.
441:             * The metadata includes information about the database's
442:             * tables, its supported SQL grammar, its stored
443:             * procedures, the capabilities of this connection, and so on.
444:             *
445:             * @return a <code>DatabaseMetaData</code> object for this
446:             *         <code>Connection</code> object
447:             * @exception SQLException if a database access error occurs
448:             */
449:            public DatabaseMetaData getMetaData() throws SQLException {
450:                throw new UnsupportedOperationException(
451:                        "Connection.getMetaData() unsupported");
452:            }
453:
454:            /**
455:             * Puts this connection in read-only mode as a hint to the driver to enable
456:             * database optimizations.
457:             *
458:             * <P><B>Note:</B> This method cannot be called during a transaction.
459:             *
460:             * @param readOnly <code>true</code> enables read-only mode;
461:             *        <code>false</code> disables it
462:             * @exception SQLException if a database access error occurs or this
463:             *            method is called during a transaction
464:             */
465:            public void setReadOnly(boolean readOnly) throws SQLException {
466:                throw new UnsupportedOperationException(
467:                        "Connection.setReadOnly(boolean) unsupported");
468:            }
469:
470:            /**
471:             * Retrieves whether this <code>Connection</code>
472:             * object is in read-only mode.
473:             *
474:             * @return <code>true</code> if this <code>Connection</code> object
475:             *         is read-only; <code>false</code> otherwise
476:             * @exception SQLException if a database access error occurs
477:             */
478:            public boolean isReadOnly() throws SQLException {
479:                return true;
480:            }
481:
482:            /**
483:             * Sets the given catalog name in order to select
484:             * a subspace of this <code>Connection</code> object's database
485:             * in which to work.
486:             * <P>
487:             * If the driver does not support catalogs, it will
488:             * silently ignore this request.
489:             *
490:             * @param catalog the name of a catalog (subspace in this
491:             *        <code>Connection</code> object's database) in which to work
492:             * @exception SQLException if a database access error occurs
493:             * @see #getCatalog
494:             */
495:            public void setCatalog(String catalog) throws SQLException {
496:                // silently ignore this request
497:            }
498:
499:            /**
500:             * Retrieves this <code>Connection</code> object's current catalog name.
501:             *
502:             * @return the current catalog name or <code>null</code> if there is none
503:             * @exception SQLException if a database access error occurs
504:             * @see #setCatalog
505:             */
506:            public String getCatalog() throws SQLException {
507:                return null;
508:            }
509:
510:            /**
511:             * Attempts to change the transaction isolation level for this
512:             * <code>Connection</code> object to the one given.
513:             * The constants defined in the interface <code>Connection</code>
514:             * are the possible transaction isolation levels.
515:             * <P>
516:             * <B>Note:</B> If this method is called during a transaction, the result
517:             * is implementation-defined.
518:             *
519:             * @param level one of the following <code>Connection</code> constants:
520:             *        <code>Connection.TRANSACTION_READ_UNCOMMITTED</code>,
521:             *        <code>Connection.TRANSACTION_READ_COMMITTED</code>,
522:             *        <code>Connection.TRANSACTION_REPEATABLE_READ</code>, or
523:             *        <code>Connection.TRANSACTION_SERIALIZABLE</code>.
524:             *        (Note that <code>Connection.TRANSACTION_NONE</code> cannot be used
525:             *        because it specifies that transactions are not supported.)
526:             * @exception SQLException if a database access error occurs
527:             *            or the given parameter is not one of the <code>Connection</code>
528:             *            constants
529:             * @see DatabaseMetaData#supportsTransactionIsolationLevel
530:             * @see #getTransactionIsolation
531:             */
532:            public void setTransactionIsolation(int level) throws SQLException {
533:                throw new UnsupportedOperationException(
534:                        "Connection.setTransactionIsolation(int) unsupported");
535:            }
536:
537:            /**
538:             * Retrieves this <code>Connection</code> object's current
539:             * transaction isolation level.
540:             *
541:             * @return the current transaction isolation level, which will be one
542:             *         of the following constants:
543:             *        <code>Connection.TRANSACTION_READ_UNCOMMITTED</code>,
544:             *        <code>Connection.TRANSACTION_READ_COMMITTED</code>,
545:             *        <code>Connection.TRANSACTION_REPEATABLE_READ</code>,
546:             *        <code>Connection.TRANSACTION_SERIALIZABLE</code>, or
547:             *        <code>Connection.TRANSACTION_NONE</code>.
548:             * @exception SQLException if a database access error occurs
549:             * @see #setTransactionIsolation
550:             */
551:            public int getTransactionIsolation() throws SQLException {
552:                return Connection.TRANSACTION_NONE;
553:            }
554:
555:            /**
556:             * Retrieves the first warning reported by calls on this
557:             * <code>Connection</code> object.  If there is more than one
558:             * warning, subsequent warnings will be chained to the first one
559:             * and can be retrieved by calling the method
560:             * <code>SQLWarning.getNextWarning</code> on the warning
561:             * that was retrieved previously.
562:             * <P>
563:             * This method may not be
564:             * called on a closed connection; doing so will cause an
565:             * <code>SQLException</code> to be thrown.
566:             *
567:             * <P><B>Note:</B> Subsequent warnings will be chained to this
568:             * SQLWarning.
569:             *
570:             * @return the first <code>SQLWarning</code> object or <code>null</code>
571:             *         if there are none
572:             * @exception SQLException if a database access error occurs or
573:             *            this method is called on a closed connection
574:             * @see SQLWarning
575:             */
576:            public SQLWarning getWarnings() throws SQLException {
577:                throw new UnsupportedOperationException(
578:                        "Connection.getWarnings() unsupported");
579:            }
580:
581:            /**
582:             * Clears all warnings reported for this <code>Connection</code> object.
583:             * After a call to this method, the method <code>getWarnings</code>
584:             * returns <code>null</code> until a new warning is
585:             * reported for this <code>Connection</code> object.
586:             *
587:             * @exception SQLException if a database access error occurs
588:             */
589:            public void clearWarnings() throws SQLException {
590:                throw new UnsupportedOperationException(
591:                        "Connection.getWarnings() unsupported");
592:            }
593:
594:            //--------------------------JDBC 2.0-----------------------------
595:
596:            /**
597:             * Creates a <code>Statement</code> object that will generate
598:             * <code>ResultSet</code> objects with the given type and concurrency.
599:             * This method is the same as the <code>createStatement</code> method
600:             * above, but it allows the default result set
601:             * type and concurrency to be overridden.
602:             *
603:             * @param resultSetType a result set type; one of
604:             *        <code>ResultSet.TYPE_FORWARD_ONLY</code>,
605:             *        <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
606:             *        <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
607:             * @param resultSetConcurrency a concurrency type; one of
608:             *        <code>ResultSet.CONCUR_READ_ONLY</code> or
609:             *        <code>ResultSet.CONCUR_UPDATABLE</code>
610:             * @return a new <code>Statement</code> object that will generate
611:             *         <code>ResultSet</code> objects with the given type and
612:             *         concurrency
613:             * @exception SQLException if a database access error occurs
614:             *         or the given parameters are not <code>ResultSet</code>
615:             *         constants indicating type and concurrency
616:             */
617:            public Statement createStatement(int resultSetType,
618:                    int resultSetConcurrency) throws SQLException {
619:                throw new UnsupportedOperationException(
620:                        "Connection.createStatement(int, int) unsupported");
621:            }
622:
623:            /**
624:             * Creates a <code>PreparedStatement</code> object that will generate
625:             * <code>ResultSet</code> objects with the given type and concurrency.
626:             * This method is the same as the <code>prepareStatement</code> method
627:             * above, but it allows the default result set
628:             * type and concurrency to be overridden.
629:             *
630:             * @param sql a <code>String</code> object that is the SQL statement to
631:             *            be sent to the database; may contain one or more ? IN
632:             *            parameters
633:             * @param resultSetType a result set type; one of
634:             *         <code>ResultSet.TYPE_FORWARD_ONLY</code>,
635:             *         <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
636:             *         <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
637:             * @param resultSetConcurrency a concurrency type; one of
638:             *         <code>ResultSet.CONCUR_READ_ONLY</code> or
639:             *         <code>ResultSet.CONCUR_UPDATABLE</code>
640:             * @return a new PreparedStatement object containing the
641:             * pre-compiled SQL statement that will produce <code>ResultSet</code>
642:             * objects with the given type and concurrency
643:             * @exception SQLException if a database access error occurs
644:             *         or the given parameters are not <code>ResultSet</code>
645:             *         constants indicating type and concurrency
646:             */
647:            public PreparedStatement prepareStatement(String sql,
648:                    int resultSetType, int resultSetConcurrency)
649:                    throws SQLException {
650:                throw new UnsupportedOperationException(
651:                        "Connection.prepareStatement(String, int, int) unsupported");
652:            }
653:
654:            /**
655:             * Creates a <code>CallableStatement</code> object that will generate
656:             * <code>ResultSet</code> objects with the given type and concurrency.
657:             * This method is the same as the <code>prepareCall</code> method
658:             * above, but it allows the default result set
659:             * type and concurrency to be overridden.
660:             *
661:             * @param sql a <code>String</code> object that is the SQL statement to
662:             *            be sent to the database; may contain on or more ? parameters
663:             * @param resultSetType a result set type; one of
664:             *         <code>ResultSet.TYPE_FORWARD_ONLY</code>,
665:             *         <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
666:             *         <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
667:             * @param resultSetConcurrency a concurrency type; one of
668:             *         <code>ResultSet.CONCUR_READ_ONLY</code> or
669:             *         <code>ResultSet.CONCUR_UPDATABLE</code>
670:             * @return a new <code>CallableStatement</code> object containing the
671:             * pre-compiled SQL statement that will produce <code>ResultSet</code>
672:             * objects with the given type and concurrency
673:             * @exception SQLException if a database access error occurs
674:             *         or the given parameters are not <code>ResultSet</code>
675:             *         constants indicating type and concurrency
676:             */
677:            public CallableStatement prepareCall(String sql, int resultSetType,
678:                    int resultSetConcurrency) throws SQLException {
679:                throw new UnsupportedOperationException(
680:                        "Connection.prepareCall(String, int, int) unsupported");
681:            }
682:
683:            /**
684:             * Retrieves the <code>Map</code> object associated with this
685:             * <code>Connection</code> object.
686:             * Unless the application has added an entry, the type map returned
687:             * will be empty.
688:             *
689:             * @return the <code>java.util.Map</code> object associated
690:             *         with this <code>Connection</code> object
691:             * @exception SQLException if a database access error occurs
692:             * @see #setTypeMap
693:             */
694:            public Map getTypeMap() throws SQLException {
695:                throw new UnsupportedOperationException(
696:                        "Connection.getTypeMap() unsupported");
697:            }
698:
699:            /**
700:             * Installs the given <code>TypeMap</code> object as the type map for
701:             * this <code>Connection</code> object.  The type map will be used for the
702:             * custom mapping of SQL structured types and distinct types.
703:             *
704:             * @param map the <code>java.util.Map</code> object to install
705:             *        as the replacement for this <code>Connection</code>
706:             *        object's default type map
707:             * @exception SQLException if a database access error occurs or
708:             *        the given parameter is not a <code>java.util.Map</code>
709:             *        object
710:             * @see #getTypeMap
711:             */
712:            public void setTypeMap(Map map) throws SQLException {
713:                throw new UnsupportedOperationException(
714:                        "Connection.setTypeMap(Map) unsupported");
715:            }
716:
717:            //--------------------------JDBC 3.0-----------------------------
718:            /**
719:             * Changes the holdability of <code>ResultSet</code> objects
720:             * created using this <code>Connection</code> object to the given
721:             * holdability.
722:             *
723:             * @param holdability a <code>ResultSet</code> holdability constant; one of
724:             *        <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
725:             *        <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
726:             * @throws SQLException if a database access occurs, the given parameter
727:             *         is not a <code>ResultSet</code> constant indicating holdability,
728:             *         or the given holdability is not supported
729:             * @since 1.4
730:             * @see #getHoldability
731:             * @see java.sql.ResultSet
732:             */
733:            public void setHoldability(int holdability) throws SQLException {
734:                throw new UnsupportedOperationException(
735:                        "Connection.setHoldability(int) unsupported");
736:            }
737:
738:            /**
739:             * Retrieves the current holdability of ResultSet objects created
740:             * using this Connection object.
741:             *
742:             * @return the holdability, one of <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
743:             * <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
744:             * @throws SQLException if a database access occurs
745:             * @since 1.4
746:             * @see #setHoldability
747:             * @see java.sql.ResultSet
748:             */
749:            public int getHoldability() throws SQLException {
750:                throw new UnsupportedOperationException(
751:                        "Connection.getHoldability() unsupported");
752:            }
753:
754:            //     Removed since this only builds under JDK 1.4
755:            public Savepoint setSavepoint() throws SQLException {
756:                throw new UnsupportedOperationException(
757:                        "Connection.setSavepoint() unsupported");
758:            }
759:
760:            public Savepoint setSavepoint(String name) throws SQLException {
761:                throw new UnsupportedOperationException(
762:                        "Connection.setSavepoint(String) unsupported");
763:            }
764:
765:            public void rollback(Savepoint savepoint) throws SQLException {
766:                throw new UnsupportedOperationException(
767:                        "Connection.rollback(Savepoint) unsupported");
768:            }
769:
770:            public void releaseSavepoint(Savepoint savepoint)
771:                    throws SQLException {
772:                throw new UnsupportedOperationException(
773:                        "Connection.releaseSavepoint(Savepoint) unsupported");
774:            }
775:
776:            public Statement createStatement(int resultSetType,
777:                    int resultSetConcurrency, int resultSetHoldability)
778:                    throws SQLException {
779:                throw new UnsupportedOperationException(
780:                        "Connection.createStatement(int,int,int) unsupported");
781:            }
782:
783:            public PreparedStatement prepareStatement(String sql,
784:                    int resultSetType, int resultSetConcurrency,
785:                    int resultSetHoldability) throws SQLException {
786:                throw new UnsupportedOperationException(
787:                        "Connection.prepareStatement(String,int,int,int) unsupported");
788:            }
789:
790:            public CallableStatement prepareCall(String sql, int resultSetType,
791:                    int resultSetConcurrency, int resultSetHoldability)
792:                    throws SQLException {
793:                throw new UnsupportedOperationException(
794:                        "Connection.prepareCall(String,int,int,int) unsupported");
795:            }
796:
797:            public PreparedStatement prepareStatement(String sql,
798:                    int autoGeneratedKeys) throws SQLException {
799:                throw new UnsupportedOperationException(
800:                        "Connection.prepareStatement(String,int) unsupported");
801:            }
802:
803:            public PreparedStatement prepareStatement(String sql,
804:                    int[] columnIndexes) throws SQLException {
805:                throw new UnsupportedOperationException(
806:                        "Connection.prepareStatement(String,int[]) unsupported");
807:            }
808:
809:            public PreparedStatement prepareStatement(String sql,
810:                    String[] columnNames) throws SQLException {
811:                throw new UnsupportedOperationException(
812:                        "Connection.prepareStatement(String,String[]) unsupported");
813:            }
814:
815:            //---------------------------------------------------------------------
816:            // Properties
817:            //---------------------------------------------------------------------
818:
819:            /**
820:             * Accessor method for the path property
821:             * @return current value for the path property
822:             */
823:            protected String getPath() {
824:                return path;
825:            }
826:
827:            /**
828:             * Accessor method for the extension property
829:             * @return current value for the extension property
830:             */
831:            protected String getExtension() {
832:                return extension;
833:            }
834:
835:            /**
836:             * Accessor method for the charset property
837:             * @return current value for the suppressHeaders property
838:             */
839:            //  protected String getCharset() {
840:            //    return charset;
841:            //  }
842:            //  protected long getMaxFileSize() {
843:            //    return maxFileSize;
844:            //  }
845:            //
846:            //  protected String getLineBreakEscape() {
847:            //    return lineBrakesEscape;
848:            //  }
849:            //
850:            //  protected String getCarriageReturnEscape() {
851:            //      return carriageReturnEscape;
852:            //  }
853:            //  protected String getDoubleQuotesEscape() {
854:            //    return doubleQuotesEscape;
855:            //  }
856:            /**
857:             * @return String which represents nameColumn
858:             */
859:            protected String getNameColumn() {
860:                return this .nameColumn;
861:            }
862:
863:            /**
864:             * @return String which represents valueColumn
865:             */
866:            protected String getValueColumn() {
867:                return this .valueColumn;
868:            }
869:
870:            /**
871:             * @return String[] which represents valueColumn
872:             */
873:            protected String[] getColumnNames() {
874:                String[] retString = new String[2];
875:                retString[0] = this .nameColumn;
876:                retString[1] = this .valueColumn;
877:                return retString;
878:            }
879:
880:            public I18nProperties getProperties() {
881:                return prop;
882:            }
883:
884:            public void setProperties(I18nProperties prop) {
885:                this .prop = prop;
886:            }
887:
888:            public String getCurrentTableName() {
889:                return currentTableName;
890:            }
891:
892:            public void setCurrentTableName(String currentFileName)
893:                    throws SQLException {
894:                if (!this .getAutoCommit() && (this .currentTableName != null)
895:                        && !this .currentTableName.equals(currentFileName)) {
896:                    this .commit();
897:                }
898:                this .currentTableName = currentFileName;
899:            }
900:
901:            public Array createArrayOf(String typeName, Object[] elements)
902:                    throws SQLException {
903:                // TODO Auto-generated method stub
904:                return null;
905:            }
906:
907:            public Blob createBlob() throws SQLException {
908:                // TODO Auto-generated method stub
909:                return null;
910:            }
911:
912:            public Clob createClob() throws SQLException {
913:                // TODO Auto-generated method stub
914:                return null;
915:            }
916:
917:            public NClob createNClob() throws SQLException {
918:                // TODO Auto-generated method stub
919:                return null;
920:            }
921:
922:            public SQLXML createSQLXML() throws SQLException {
923:                // TODO Auto-generated method stub
924:                return null;
925:            }
926:
927:            public Struct createStruct(String typeName, Object[] attributes)
928:                    throws SQLException {
929:                // TODO Auto-generated method stub
930:                return null;
931:            }
932:
933:            public Properties getClientInfo() throws SQLException {
934:                // TODO Auto-generated method stub
935:                return null;
936:            }
937:
938:            public String getClientInfo(String name) throws SQLException {
939:                // TODO Auto-generated method stub
940:                return null;
941:            }
942:
943:            public boolean isValid(int timeout) throws SQLException {
944:                // TODO Auto-generated method stub
945:                return false;
946:            }
947:
948:            public void setClientInfo(Properties properties)
949:                    throws SQLClientInfoException {
950:                // TODO Auto-generated method stub
951:                throw new UnsupportedOperationException(
952:                        "I18nConnection.setClientInfo(Properties) unsupported");
953:            }
954:
955:            public void setClientInfo(String name, String value)
956:                    throws SQLClientInfoException {
957:                // TODO Auto-generated method stub
958:                throw new UnsupportedOperationException(
959:                        "I18nConnection.setClientInfo(String,String) unsupported");
960:            }
961:
962:            //   public void setTypeMap(Map<String, Class<?>> arg0) throws SQLException {
963:            //      // TODO Auto-generated method stub
964:            //      
965:            //   }
966:
967:            public boolean isWrapperFor(Class<?> iface) throws SQLException {
968:                // TODO Auto-generated method stub
969:                return false;
970:            }
971:
972:            public <T> T unwrap(Class<T> iface) throws SQLException {
973:                // TODO Auto-generated method stub
974:                return null;
975:            }
976:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.