Source Code Cross Referenced for DatabasePersistence.java in  » Science » Cougaar12_4 » org » cougaar » core » persist » 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 » Science » Cougaar12_4 » org.cougaar.core.persist 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * <copyright>
0003:         *  
0004:         *  Copyright 1997-2004 BBNT Solutions, LLC
0005:         *  under sponsorship of the Defense Advanced Research Projects
0006:         *  Agency (DARPA).
0007:         * 
0008:         *  You can redistribute this software and/or modify it under the
0009:         *  terms of the Cougaar Open Source License as published on the
0010:         *  Cougaar Open Source Website (www.cougaar.org).
0011:         * 
0012:         *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0013:         *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0014:         *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0015:         *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0016:         *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0017:         *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0018:         *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0019:         *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0020:         *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0021:         *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0022:         *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0023:         *  
0024:         * </copyright>
0025:         */
0026:
0027:        package org.cougaar.core.persist;
0028:
0029:        import java.io.ByteArrayInputStream;
0030:        import java.io.ByteArrayOutputStream;
0031:        import java.io.IOException;
0032:        import java.io.InputStream;
0033:        import java.io.OutputStream;
0034:        import java.io.Reader;
0035:        import java.math.BigDecimal;
0036:        import java.net.URL;
0037:        import java.sql.Array;
0038:        import java.sql.Blob;
0039:        import java.sql.CallableStatement;
0040:        import java.sql.Clob;
0041:        import java.sql.Connection;
0042:        import java.sql.DatabaseMetaData;
0043:        import java.sql.Date;
0044:        import java.sql.DriverManager;
0045:        import java.sql.ParameterMetaData;
0046:        import java.sql.PreparedStatement;
0047:        import java.sql.Ref;
0048:        import java.sql.ResultSet;
0049:        import java.sql.ResultSetMetaData;
0050:        import java.sql.SQLException;
0051:        import java.sql.SQLWarning;
0052:        import java.sql.Savepoint;
0053:        import java.sql.Statement;
0054:        import java.sql.Time;
0055:        import java.sql.Timestamp;
0056:        import java.util.ArrayList;
0057:        import java.util.Calendar;
0058:        import java.util.Collections;
0059:        import java.util.Enumeration;
0060:        import java.util.HashMap;
0061:        import java.util.List;
0062:        import java.util.Map;
0063:        import java.util.Vector;
0064:
0065:        import org.cougaar.bootstrap.SystemProperties;
0066:        import org.cougaar.core.service.DataProtectionKey;
0067:        import org.cougaar.util.log.Logger;
0068:
0069:        /**
0070:         * This {@link PersistencePlugin} saves blackboard objects in a
0071:         * database. It saves and restores persistence deltas in RDB tables.
0072:         * <p>
0073:         * We store the deltas for each agent in a separate table named
0074:         * after the agent: delta_&lt;agentName&gt;. The table has three columns:
0075:         * <pre> 
0076:         * seqno  -- has an INTEGER delta sequence number
0077:         * active -- has a CHAR indicating the kind of delta stored
0078:         *           x -- full delta (all data)
0079:         *           t -- incremental delta
0080:         *           a -- archive delta (full but not active)
0081:         *           f -- inactive incremental
0082:         *   The above codes were selected for backward compatibility with the
0083:         *   former t/f meaning active was true/false
0084:         * data   -- has a LONG RAW with the serialized data
0085:         * </pre> 
0086:         *
0087:         * @property org.cougaar.core.persistence.database.url
0088:         * Specify the database to use for DatabasePersistence.
0089:         *
0090:         * @property org.cougaar.core.persistence.database.user
0091:         * Specify the database user to use for DatabasePersistence.
0092:         *
0093:         * @property org.cougaar.core.persistence.database.password
0094:         * Specify the database password to use for DatabasePersistence.
0095:         *
0096:         * @property org.cougaar.core.persistence.database.driver
0097:         * Specify the database driver to use for DatabasePersistence.
0098:         */
0099:        public class DatabasePersistence extends PersistencePluginAdapter
0100:                implements  PersistencePlugin {
0101:            // Codes used in the active column. Chosen for backward compatibility
0102:            private static final String INCREMENTAL = "'t'";
0103:            private static final String FULL = "'x'";
0104:            private static final String INACTIVE = "'f'";
0105:            private static final String ARCHIVE = "'a'";
0106:
0107:            String databaseURL = SystemProperties
0108:                    .getProperty("org.cougaar.core.persistence.database.url");
0109:            String databaseUser = SystemProperties
0110:                    .getProperty("org.cougaar.core.persistence.database.user");
0111:            String databasePassword = SystemProperties
0112:                    .getProperty("org.cougaar.core.persistence.database.password");
0113:            String databaseDriver = SystemProperties
0114:                    .getProperty("org.cougaar.core.persistence.database.driver");
0115:            String intDef = "NUMBER";
0116:            String longBinaryDef = "LONG RAW";
0117:            String timestampDef = "BIGINT";
0118:
0119:            private Connection theConnection;
0120:            private DatabaseMetaData theMetaData;
0121:            private PreparedStatement getSequenceNumbers;
0122:            private PreparedStatement getArchiveSequenceNumbers;
0123:            private PreparedStatement putSequenceNumbers1;
0124:            private PreparedStatement putSequenceNumbers2;
0125:            private PreparedStatement storeDelta;
0126:            private PreparedStatement getDelta;
0127:            private PreparedStatement checkDelta;
0128:            private PreparedStatement cleanDeltas;
0129:            private String deltaTable;
0130:
0131:            protected void handleParameter(String param) {
0132:                String value;
0133:                if ((value = parseParamValue(param,
0134:                        PERSISTENCE_DB_DRIVER_PREFIX)) != null) {
0135:                    databaseDriver = value;
0136:                    return;
0137:                }
0138:                if ((value = parseParamValue(param, PERSISTENCE_DB_URL_PREFIX)) != null) {
0139:                    databaseURL = value;
0140:                    return;
0141:                }
0142:                if ((value = parseParamValue(param, PERSISTENCE_DB_USER_PREFIX)) != null) {
0143:                    databaseUser = value;
0144:                    return;
0145:                }
0146:                if ((value = parseParamValue(param,
0147:                        PERSISTENCE_DB_PASSWORD_PREFIX)) != null) {
0148:                    databasePassword = value;
0149:                    return;
0150:                }
0151:                if ((value = parseParamValue(param,
0152:                        PERSISTENCE_DB_INTDEF_PREFIX)) != null) {
0153:                    intDef = value;
0154:                    return;
0155:                }
0156:                if ((value = parseParamValue(param,
0157:                        PERSISTENCE_DB_LONGBINARYDEF_PREFIX)) != null) {
0158:                    longBinaryDef = value;
0159:                    return;
0160:                }
0161:                if (pps.getLogger().isWarnEnabled()) {
0162:                    pps.getLogger().warn(
0163:                            name + ": Unrecognized parameter " + param);
0164:                }
0165:            }
0166:
0167:            public void init(PersistencePluginSupport pps, String name,
0168:                    String[] params, boolean deleteOldPersistence)
0169:                    throws PersistenceException {
0170:                init(pps, name, params);
0171:                String agentName = pps.getMessageAddress().getAddress()
0172:                        .replace('-', '_');
0173:                Logger ls = pps.getLogger();
0174:                if (ls.isInfoEnabled()) {
0175:                    StringBuffer buf = new StringBuffer();
0176:                    buf.append("DatabasePersistence;").append(name);
0177:                    for (int i = 0; i < params.length; i++) {
0178:                        buf.append(";").append(params[i]);
0179:                    }
0180:                    ls.info(buf.toString());
0181:                }
0182:                deltaTable = name + "_" + agentName;
0183:                if (databaseDriver != null) {
0184:                    try {
0185:                        Class.forName(databaseDriver);
0186:                    } catch (Exception e) {
0187:                        fatalException(e);
0188:                    }
0189:                }
0190:                try {
0191:                    theConnection = DriverManager.getConnection(databaseURL,
0192:                            databaseUser, databasePassword);
0193:                    theMetaData = theConnection.getMetaData();
0194:                    if (theMetaData.supportsTransactions()) {
0195:                        theConnection.setAutoCommit(false);
0196:                    } else {
0197:                        ls
0198:                                .error("Warning!!!! Persistence Database does not support transactions");
0199:                    }
0200:                    ls.debug("Database transaction isolation is "
0201:                            + theConnection.getTransactionIsolation());
0202:                    getSequenceNumbers = theConnection
0203:                            .prepareStatement("select count(seqno), min(seqno), max(seqno)+1, max(timestamp) from "
0204:                                    + deltaTable
0205:                                    + " where active ="
0206:                                    + FULL
0207:                                    + " or active = " + INCREMENTAL);
0208:                    getArchiveSequenceNumbers = theConnection
0209:                            .prepareStatement("select seqno, timestamp from "
0210:                                    + deltaTable + " where active =" + ARCHIVE);
0211:                    putSequenceNumbers1 = theConnection
0212:                            .prepareStatement("update " + deltaTable
0213:                                    + " set active = " + INACTIVE
0214:                                    + " where active = " + INCREMENTAL
0215:                                    + " and (seqno < ? or seqno >= ?)");
0216:                    putSequenceNumbers2 = theConnection
0217:                            .prepareStatement("update " + deltaTable
0218:                                    + " set active = " + ARCHIVE
0219:                                    + " where active = " + FULL
0220:                                    + " and (seqno < ? or seqno >= ?)");
0221:                    storeDelta = theConnection
0222:                            .prepareStatement("insert into "
0223:                                    + deltaTable
0224:                                    + "(seqno, active, timestamp, data) values (?, ?, ?, ?)");
0225:                    getDelta = theConnection
0226:                            .prepareStatement("select data from " + deltaTable
0227:                                    + " where seqno = ?");
0228:                    checkDelta = theConnection
0229:                            .prepareStatement("select timestamp from "
0230:                                    + deltaTable
0231:                                    + " where seqno = ? and (active = " + FULL
0232:                                    + ") or (active = " + ARCHIVE + ")");
0233:                    cleanDeltas = theConnection.prepareStatement("delete from "
0234:                            + deltaTable + " where seqno >= ? and seqno < ?");
0235:                    try {
0236:                        ResultSet rs = getSequenceNumbers.executeQuery();
0237:                        rs.close();
0238:                    } catch (SQLException e) {
0239:                        createTable(deltaTable);
0240:                    }
0241:                    if (deleteOldPersistence)
0242:                        deleteOldPersistence();
0243:                } catch (SQLException e) {
0244:                    ls.error("Persistence connection error");
0245:                    ls.error("     URL: " + databaseURL);
0246:                    ls.error("    User: " + databaseUser);
0247:                    ls.error("Password: " + databasePassword);
0248:                    ls.error(" Drivers:");
0249:                    for (Enumeration drivers = DriverManager.getDrivers(); drivers
0250:                            .hasMoreElements();) {
0251:                        ls.error("     "
0252:                                + drivers.nextElement().getClass().getName());
0253:                    }
0254:                    fatalException(e);
0255:                }
0256:            }
0257:
0258:            private void createTable(String tableName) throws SQLException {
0259:                String qry = "create table " + tableName + "(seqno " + intDef
0260:                        + " primary key" + ", active char(1)" + ", timestamp "
0261:                        + timestampDef + ", data " + longBinaryDef + ")";
0262:                pps.getLogger().info("Creating table: " + qry);
0263:                Statement stmt = theConnection.createStatement();
0264:                stmt.executeUpdate(qry);
0265:            }
0266:
0267:            public SequenceNumbers[] readSequenceNumbers(String suffix) {
0268:                if (!suffix.equals("")) {
0269:                    if (suffix.startsWith("_"))
0270:                        suffix = suffix.substring(1);
0271:                    try {
0272:                        int deltaNumber = Integer.parseInt(suffix);
0273:                        checkDelta.setInt(1, deltaNumber);
0274:                        ResultSet rs = checkDelta.executeQuery();
0275:                        if (!rs.next())
0276:                            throw new IllegalArgumentException("Delta "
0277:                                    + deltaNumber + " does not exist");
0278:                        long timestamp = rs.getLong(1);
0279:                        return new SequenceNumbers[] { new SequenceNumbers(
0280:                                deltaNumber, deltaNumber + 1, timestamp) };
0281:                    } catch (Exception e) {
0282:                        fatalException(e);
0283:                    }
0284:                }
0285:                try {
0286:                    List results = new ArrayList();
0287:                    ResultSet rs = getSequenceNumbers.executeQuery();
0288:                    try {
0289:                        if (rs.next()) {
0290:                            int count = rs.getInt(1);
0291:                            if (count > 0) {
0292:                                int first = rs.getInt(2);
0293:                                int last = rs.getInt(3);
0294:                                long timestamp = rs.getLong(4);
0295:                                results.add(new SequenceNumbers(first, last,
0296:                                        timestamp));
0297:                            }
0298:                        }
0299:                    } finally {
0300:                        rs.close();
0301:                    }
0302:                    rs = getArchiveSequenceNumbers.executeQuery();
0303:                    try {
0304:                        while (rs.next()) {
0305:                            int seqno = rs.getInt(1);
0306:                            long timestamp = rs.getLong(2);
0307:                            results.add(new SequenceNumbers(seqno, seqno + 1,
0308:                                    timestamp));
0309:                        }
0310:                    } finally {
0311:                        rs.close();
0312:                    }
0313:                    return (SequenceNumbers[]) results
0314:                            .toArray(new SequenceNumbers[results.size()]);
0315:                } catch (SQLException e) {
0316:                    fatalException(e);
0317:                    return new SequenceNumbers[0];
0318:                }
0319:            }
0320:
0321:            private void writeSequenceNumbers(SequenceNumbers sequenceNumbers) {
0322:                try {
0323:                    putSequenceNumbers1.setInt(1, sequenceNumbers.first);
0324:                    putSequenceNumbers1.setInt(2, sequenceNumbers.current);
0325:                    putSequenceNumbers1.executeUpdate();
0326:                    putSequenceNumbers2.setInt(1, sequenceNumbers.first);
0327:                    putSequenceNumbers2.setInt(2, sequenceNumbers.current);
0328:                    putSequenceNumbers2.executeUpdate();
0329:                } catch (SQLException e) {
0330:                    fatalException(e);
0331:                }
0332:            }
0333:
0334:            public void cleanupOldDeltas(SequenceNumbers cleanupNumbers) {
0335:                try {
0336:                    cleanDeltas.setInt(1, cleanupNumbers.first);
0337:                    cleanDeltas.setInt(2, cleanupNumbers.current);
0338:                    cleanDeltas.executeUpdate();
0339:                } catch (SQLException e) {
0340:                    fatalException(e);
0341:                }
0342:            }
0343:
0344:            public void cleanupArchive() {
0345:                Logger ls = pps.getLogger();
0346:                if (archiveCount < Integer.MAX_VALUE) {
0347:                    List sns = new ArrayList();
0348:                    try {
0349:                        ResultSet rs = getArchiveSequenceNumbers.executeQuery();
0350:                        try {
0351:                            while (rs.next()) {
0352:                                int seqno = rs.getInt(1);
0353:                                long timestamp = rs.getLong(2);
0354:                                sns.add(new SequenceNumbers(seqno, seqno + 1,
0355:                                        timestamp));
0356:                            }
0357:                        } finally {
0358:                            rs.close();
0359:                        }
0360:                    } catch (SQLException sqle) {
0361:                        fatalException(sqle);
0362:                    }
0363:                    int excess = sns.size() - archiveCount;
0364:                    ls.info(excess + " excess archives to delete");
0365:                    if (excess > 0) {
0366:                        Collections.sort(sns);
0367:                        for (int i = 0; i < excess; i++) {
0368:                            SequenceNumbers sn = (SequenceNumbers) sns.get(i);
0369:                            if (ls.isInfoEnabled())
0370:                                ls.info("Deleting " + sn);
0371:                            cleanupOldDeltas(sn);
0372:                        }
0373:                    }
0374:                } else {
0375:                    ls.info("Keeping all archives");
0376:                }
0377:            }
0378:
0379:            private void writeDelta(int seqno, InputStream is, int length,
0380:                    boolean full) {
0381:                try {
0382:                    storeDelta.setInt(1, seqno);
0383:                    storeDelta.setString(2, full ? "x" : "t");
0384:                    storeDelta.setLong(3, System.currentTimeMillis());
0385:                    storeDelta.setBinaryStream(4, is, length);
0386:                    storeDelta.executeUpdate();
0387:                } catch (SQLException e) {
0388:                    fatalException(e);
0389:                }
0390:            }
0391:
0392:            // consider replacing superclass with 
0393:            //   org.cougaar.util.LinkedByteOutputStream
0394:            private class MyOutputStream extends ByteArrayOutputStream {
0395:                private int deltaNumber;
0396:                private boolean full;
0397:
0398:                public MyOutputStream(int deltaNumber, boolean full) {
0399:                    super (8192);
0400:                    this .deltaNumber = deltaNumber;
0401:                    this .full = full;
0402:                }
0403:
0404:                public void close() throws IOException {
0405:                    final int cnt = count;
0406:                    final byte[] bfr = buf;
0407:                    InputStream is = new InputStream() {
0408:                        int n = 0;
0409:
0410:                        public int read() {
0411:                            if (n >= cnt)
0412:                                return -1;
0413:                            return bfr[n++];
0414:                        }
0415:
0416:                        public int read(byte[] rbuf) {
0417:                            return read(rbuf, 0, rbuf.length);
0418:                        }
0419:
0420:                        public int read(byte[] rbuf, int offset, int len) {
0421:                            len = Math.min(len, cnt - n);
0422:                            if (len == 0)
0423:                                return -1;
0424:                            System.arraycopy(bfr, n, rbuf, offset, len);
0425:                            n += len;
0426:                            return len;
0427:                        }
0428:                    };
0429:                    writeDelta(deltaNumber, is, cnt, full);
0430:                    super .close();
0431:                    try {
0432:                        theConnection.commit();
0433:                    } catch (SQLException e) {
0434:                        fatalException(e);
0435:                    }
0436:                    releaseDatabaseConnection(DatabasePersistence.this );
0437:                }
0438:            }
0439:
0440:            public OutputStream openOutputStream(final int deltaNumber,
0441:                    final boolean full) throws IOException {
0442:                getDatabaseConnection(this );
0443:                return new MyOutputStream(deltaNumber, full);
0444:            }
0445:
0446:            public void finishOutputStream(SequenceNumbers retainNumbers,
0447:                    boolean full) {
0448:                writeSequenceNumbers(retainNumbers);
0449:            }
0450:
0451:            public void abortOutputStream(SequenceNumbers retainNumbers) {
0452:                // Nothing to do since we haven't written to the db yet
0453:                // We just abandon the streams.
0454:            }
0455:
0456:            public InputStream openInputStream(int deltaNumber)
0457:                    throws IOException {
0458:                try {
0459:                    getDelta.setInt(1, deltaNumber);
0460:                    final ResultSet rs = getDelta.executeQuery();
0461:                    try {
0462:                        if (rs.next()) {
0463:                            return new ByteArrayInputStream(rs.getBytes(1));
0464:                        } else {
0465:                            throw new SQLException("Delta not found");
0466:                        }
0467:                    } finally {
0468:                        rs.close();
0469:                    }
0470:                } catch (SQLException e) {
0471:                    fatalException(e);
0472:                    return null;
0473:                }
0474:            }
0475:
0476:            public void finishInputStream(int deltaNumber) {
0477:                // Nothing to do, just quietly abandon the input stream
0478:            }
0479:
0480:            private void deleteOldPersistence() {
0481:                try {
0482:                    Statement stmt = theConnection.createStatement();
0483:                    stmt.executeUpdate("delete from " + deltaTable);
0484:                } catch (SQLException se) {
0485:                    fatalException(se);
0486:                }
0487:            }
0488:
0489:            public void storeDataProtectionKey(int deltaNumber,
0490:                    DataProtectionKey key) throws IOException {
0491:                throw new IOException(
0492:                        "storeDataProtectionKey unimplemented for database persistence");
0493:            }
0494:
0495:            public DataProtectionKey retrieveDataProtectionKey(int deltaNumber)
0496:                    throws IOException {
0497:                throw new IOException(
0498:                        "retrieveDataProtectionKey unimplemented for database persistence");
0499:            }
0500:
0501:            private void fatalException(Exception e) {
0502:                pps.getLogger()
0503:                        .fatal("Fatal database persistence exception", e);
0504:                System.exit(13);
0505:            }
0506:
0507:            private static class EqWrapper {
0508:                Object theObject;
0509:                int theHashCode;
0510:
0511:                public EqWrapper(Object anObject) {
0512:                    theObject = anObject;
0513:                    theHashCode = System.identityHashCode(theObject);
0514:                }
0515:
0516:                public int hashCode() {
0517:                    return theHashCode;
0518:                }
0519:
0520:                public boolean equals(Object o) {
0521:                    return ((EqWrapper) o).theObject == theObject;
0522:                }
0523:            }
0524:
0525:            private Object connectionLock = new Object();
0526:            private EqWrapper connectionLocker = null;
0527:            private WrappedConnection activeConnection;
0528:            private HashMap wrappedConnections = new HashMap();
0529:
0530:            /**
0531:             * Override adapter version since we actually have a database
0532:             * connection we can return instead of throwing an exception.
0533:             */
0534:            public Connection getDatabaseConnection(Object locker) {
0535:                if (locker == null)
0536:                    throw new IllegalArgumentException("locker is null");
0537:                synchronized (connectionLock) {
0538:                    if (connectionLocker != null) {
0539:                        if (locker == connectionLocker.theObject)
0540:                            throw new IllegalArgumentException(
0541:                                    "reentrant locker");
0542:                        while (connectionLocker != null) {
0543:                            try {
0544:                                connectionLock.wait(10000);
0545:                            } catch (InterruptedException ie) {
0546:                            }
0547:                        }
0548:                    }
0549:                    connectionLocker = new EqWrapper(locker);
0550:                    activeConnection = (WrappedConnection) wrappedConnections
0551:                            .get(connectionLocker);
0552:                    if (activeConnection == null) {
0553:                        activeConnection = new WrappedConnection(theConnection);
0554:                        wrappedConnections.put(connectionLocker,
0555:                                activeConnection);
0556:                    }
0557:                    activeConnection.setActive(true);
0558:                    return activeConnection;
0559:                }
0560:            }
0561:
0562:            public void releaseDatabaseConnection(Object locker) {
0563:                synchronized (connectionLock) {
0564:                    if (locker != connectionLocker.theObject) {
0565:                        throw new IllegalArgumentException("locker mismatch "
0566:                                + connectionLocker.theObject);
0567:                    }
0568:                    activeConnection.setActive(false);
0569:                    connectionLocker = null;
0570:                    connectionLock.notify();
0571:                }
0572:            }
0573:
0574:            /**
0575:             * This is a wrapper for a Connection object that delegates most
0576:             * functions to the wrapped object, but interposes some processing
0577:             * of its own to keep track of operations that have been done to the
0578:             * connection. Mainly, we disallow closing, committing, or rolling
0579:             * back the connection. Additionally, we can keep track of open
0580:             * statements to guard against an unreasonable accumulation of them
0581:             * (indicating a failure to close the statement.
0582:             */
0583:            class WrappedConnection implements  Connection {
0584:                Connection c;
0585:                boolean active = false;
0586:                Vector statements = new Vector();
0587:
0588:                WrappedConnection(Connection realConnection) {
0589:                    c = realConnection;
0590:                }
0591:
0592:                void closeStatement(WrappedStatement statement)
0593:                        throws SQLException {
0594:                    synchronized (statements) {
0595:                        statement.theStatement.close();
0596:                        statements.removeElement(statement);
0597:                    }
0598:                }
0599:
0600:                void addStatement(Statement statement) throws SQLException {
0601:                    if (statements.size() > 20)
0602:                        throw new SQLException("Too many statements");
0603:                    statements.add(statement);
0604:                }
0605:
0606:                void setActive(boolean newActive) {
0607:                    active = newActive;
0608:                }
0609:
0610:                public Statement createStatement() throws SQLException {
0611:                    if (!active)
0612:                        throw new SQLException(
0613:                                "getDatabaseConnection not called");
0614:                    Statement statement = new WrappedStatement(c
0615:                            .createStatement());
0616:                    addStatement(statement);
0617:                    return statement;
0618:                }
0619:
0620:                public Statement createStatement(int a, int b)
0621:                        throws SQLException {
0622:                    if (!active)
0623:                        throw new SQLException(
0624:                                "getDatabaseConnection not called");
0625:                    Statement statement = new WrappedStatement(c
0626:                            .createStatement(a, b));
0627:                    addStatement(statement);
0628:                    return statement;
0629:                }
0630:
0631:                public PreparedStatement prepareStatement(String sql)
0632:                        throws SQLException {
0633:                    if (!active)
0634:                        throw new SQLException(
0635:                                "getDatabaseConnection not called");
0636:                    PreparedStatement statement = (PreparedStatement) new WrappedPreparedStatement(
0637:                            c.prepareStatement(sql));
0638:                    addStatement(statement);
0639:                    return statement;
0640:                }
0641:
0642:                public PreparedStatement prepareStatement(String sql, int a,
0643:                        int b) throws SQLException {
0644:                    if (!active)
0645:                        throw new SQLException(
0646:                                "getDatabaseConnection not called");
0647:                    PreparedStatement statement = (PreparedStatement) new WrappedPreparedStatement(
0648:                            c.prepareStatement(sql, a, b));
0649:                    addStatement(statement);
0650:                    return statement;
0651:                }
0652:
0653:                public CallableStatement prepareCall(String sql)
0654:                        throws SQLException {
0655:                    if (!active)
0656:                        throw new SQLException(
0657:                                "getDatabaseConnection not called");
0658:                    CallableStatement statement = new WrappedCallableStatement(
0659:                            c.prepareCall(sql));
0660:                    addStatement(statement);
0661:                    return statement;
0662:                }
0663:
0664:                public CallableStatement prepareCall(String sql, int a, int b)
0665:                        throws SQLException {
0666:                    if (!active)
0667:                        throw new SQLException(
0668:                                "getDatabaseConnection not called");
0669:                    CallableStatement statement = new WrappedCallableStatement(
0670:                            c.prepareCall(sql, a, b));
0671:                    addStatement(statement);
0672:                    return statement;
0673:                }
0674:
0675:                public String nativeSQL(String sql) throws SQLException {
0676:                    if (!active)
0677:                        throw new SQLException(
0678:                                "getDatabaseConnection not called");
0679:                    return c.nativeSQL(sql);
0680:                }
0681:
0682:                public void setAutoCommit(boolean autoCommit)
0683:                        throws SQLException {
0684:                    throw new SQLException("setAutoCommit disallowed");
0685:                }
0686:
0687:                public boolean getAutoCommit() throws SQLException {
0688:                    if (!active)
0689:                        throw new SQLException(
0690:                                "getDatabaseConnection not called");
0691:                    return c.getAutoCommit();
0692:                }
0693:
0694:                public void commit() throws SQLException {
0695:                    throw new SQLException("commit disallowed");
0696:                }
0697:
0698:                public void rollback() throws SQLException {
0699:                    throw new SQLException("rollback disallowed");
0700:                }
0701:
0702:                public void close() throws SQLException {
0703:                    throw new SQLException("close disallowed");
0704:                }
0705:
0706:                public boolean isClosed() throws SQLException {
0707:                    if (!active)
0708:                        throw new SQLException(
0709:                                "getDatabaseConnection not called");
0710:                    return false;
0711:                }
0712:
0713:                public DatabaseMetaData getMetaData() throws SQLException {
0714:                    if (!active)
0715:                        throw new SQLException(
0716:                                "getDatabaseConnection not called");
0717:                    return c.getMetaData();
0718:                }
0719:
0720:                public void setReadOnly(boolean readOnly) throws SQLException {
0721:                    throw new SQLException("setReadOnly disallowed");
0722:                }
0723:
0724:                public boolean isReadOnly() throws SQLException {
0725:                    if (!active)
0726:                        throw new SQLException(
0727:                                "getDatabaseConnection not called");
0728:                    return c.isReadOnly();
0729:                }
0730:
0731:                public void setCatalog(String catalog) throws SQLException {
0732:                    throw new SQLException("setCatalog disallowed");
0733:                }
0734:
0735:                public String getCatalog() throws SQLException {
0736:                    if (!active)
0737:                        throw new SQLException(
0738:                                "getDatabaseConnection not called");
0739:                    return getCatalog();
0740:                }
0741:
0742:                public void setTransactionIsolation(int level)
0743:                        throws SQLException {
0744:                    throw new SQLException("setTransactionIsolation disallowed");
0745:                }
0746:
0747:                public int getTransactionIsolation() throws SQLException {
0748:                    if (!active)
0749:                        throw new SQLException(
0750:                                "getDatabaseConnection not called");
0751:                    return c.getTransactionIsolation();
0752:                }
0753:
0754:                public SQLWarning getWarnings() throws SQLException {
0755:                    if (!active)
0756:                        throw new SQLException(
0757:                                "getDatabaseConnection not called");
0758:                    return c.getWarnings();
0759:                }
0760:
0761:                public void clearWarnings() throws SQLException {
0762:                    if (!active)
0763:                        throw new SQLException(
0764:                                "getDatabaseConnection not called");
0765:                    c.clearWarnings();
0766:                }
0767:
0768:                public java.util.Map getTypeMap() throws SQLException {
0769:                    if (!active)
0770:                        throw new SQLException(
0771:                                "getDatabaseConnection not called");
0772:                    return c.getTypeMap();
0773:                }
0774:
0775:                public void setTypeMap(java.util.Map map) throws SQLException {
0776:                    throw new SQLException("setTypeMap disallowed");
0777:                }
0778:
0779:                // begin jdk1.4 compatability
0780:                public void setHoldability(int holdability) throws SQLException {
0781:                    throw new SQLException("setHoldability disallowed");
0782:                }
0783:
0784:                public int getHoldability() throws SQLException {
0785:                    throw new SQLException("setHoldability disallowed");
0786:                }
0787:
0788:                public Savepoint setSavepoint() throws SQLException {
0789:                    throw new SQLException("setSavepoint disallowed");
0790:                }
0791:
0792:                public Savepoint setSavepoint(String s) throws SQLException {
0793:                    throw new SQLException("setSavepoint(String) disallowed");
0794:                }
0795:
0796:                public void rollback(Savepoint savepoint) throws SQLException {
0797:                    throw new SQLException("rollback disallowed");
0798:                }
0799:
0800:                public void releaseSavepoint(Savepoint savepoint)
0801:                        throws SQLException {
0802:                    throw new SQLException("releaseSavepoint disallowed");
0803:                }
0804:
0805:                public Statement createStatement(int resultSetType,
0806:                        int resultSetConcurrency, int resultSetHoldability)
0807:                        throws SQLException {
0808:                    throw new SQLException(
0809:                            "createStatement(int,int,int) disallowed");
0810:                }
0811:
0812:                public PreparedStatement prepareStatement(String sql,
0813:                        int resultSetType, int resultSetConcurrency,
0814:                        int resultSetHoldability) throws SQLException {
0815:                    throw new SQLException(
0816:                            "prepareStatement(String,int,int,int) disallowed");
0817:                }
0818:
0819:                public CallableStatement prepareCall(String sql,
0820:                        int resultSetType, int resultSetConcurrency,
0821:                        int resultSetHoldability) throws SQLException {
0822:                    throw new SQLException(
0823:                            "prepareCall(String,int,int,int) disallowed");
0824:                }
0825:
0826:                public PreparedStatement prepareStatement(String sql,
0827:                        int autoGenerateKeys) throws SQLException {
0828:                    throw new SQLException(
0829:                            "prepareStatement(String,int) disallowed");
0830:                }
0831:
0832:                public PreparedStatement prepareStatement(String sql, int ci[])
0833:                        throws SQLException {
0834:                    throw new SQLException(
0835:                            "prepareStatement(String,int[]) disallowed");
0836:                }
0837:
0838:                public PreparedStatement prepareStatement(String sql,
0839:                        String cn[]) throws SQLException {
0840:                    throw new SQLException(
0841:                            "prepareStatement(String,String[]) disallowed");
0842:                }
0843:
0844:                // end jdk1.4 compatability
0845:
0846:                /**
0847:                 * A wrapper for a Statement object. Most operations are
0848:                 * delegated to the wrapped object. The close operation goes
0849:                 * through the WrappedConnection wrapper to keep track of which
0850:                 * statements have been closed and which haven't.
0851:                 */
0852:                class WrappedStatement implements  java.sql.Statement {
0853:                    java.sql.Statement theStatement;
0854:
0855:                    public WrappedStatement(java.sql.Statement theStatement) {
0856:                        this .theStatement = theStatement;
0857:                    }
0858:
0859:                    public void addBatch(String sql)
0860:                            throws java.sql.SQLException {
0861:                        theStatement.addBatch(sql);
0862:                    }
0863:
0864:                    public void clearBatch() throws java.sql.SQLException {
0865:                        if (!active)
0866:                            throw new SQLException(
0867:                                    "getDatabaseConnection not called");
0868:                        theStatement.clearBatch();
0869:                    }
0870:
0871:                    public int[] executeBatch() throws java.sql.SQLException {
0872:                        if (!active)
0873:                            throw new SQLException(
0874:                                    "getDatabaseConnection not called");
0875:                        return theStatement.executeBatch();
0876:                    }
0877:
0878:                    public Connection getConnection()
0879:                            throws java.sql.SQLException {
0880:                        if (!active)
0881:                            throw new SQLException(
0882:                                    "getDatabaseConnection not called");
0883:                        return WrappedConnection.this ;
0884:                    }
0885:
0886:                    public int getFetchDirection() throws java.sql.SQLException {
0887:                        if (!active)
0888:                            throw new SQLException(
0889:                                    "getDatabaseConnection not called");
0890:                        return theStatement.getFetchDirection();
0891:                    }
0892:
0893:                    public int getFetchSize() throws java.sql.SQLException {
0894:                        if (!active)
0895:                            throw new SQLException(
0896:                                    "getDatabaseConnection not called");
0897:                        return theStatement.getFetchSize();
0898:                    }
0899:
0900:                    public int getResultSetConcurrency()
0901:                            throws java.sql.SQLException {
0902:                        if (!active)
0903:                            throw new SQLException(
0904:                                    "getDatabaseConnection not called");
0905:                        return theStatement.getResultSetConcurrency();
0906:                    }
0907:
0908:                    public int getResultSetType() throws java.sql.SQLException {
0909:                        if (!active)
0910:                            throw new SQLException(
0911:                                    "getDatabaseConnection not called");
0912:                        return theStatement.getResultSetType();
0913:                    }
0914:
0915:                    public void setFetchDirection(int direction)
0916:                            throws java.sql.SQLException {
0917:                        if (!active)
0918:                            throw new SQLException(
0919:                                    "getDatabaseConnection not called");
0920:                        theStatement.setFetchDirection(direction);
0921:                    }
0922:
0923:                    public void setFetchSize(int rows)
0924:                            throws java.sql.SQLException {
0925:                        if (!active)
0926:                            throw new SQLException(
0927:                                    "getDatabaseConnection not called");
0928:                        theStatement.setFetchSize(rows);
0929:                    }
0930:
0931:                    public java.sql.ResultSet executeQuery(java.lang.String arg0)
0932:                            throws java.sql.SQLException {
0933:                        if (!active)
0934:                            throw new SQLException(
0935:                                    "getDatabaseConnection not called");
0936:                        return theStatement.executeQuery(arg0);
0937:                    }
0938:
0939:                    public int executeUpdate(java.lang.String arg0)
0940:                            throws java.sql.SQLException {
0941:                        if (!active)
0942:                            throw new SQLException(
0943:                                    "getDatabaseConnection not called");
0944:                        return theStatement.executeUpdate(arg0);
0945:                    }
0946:
0947:                    public void close() throws java.sql.SQLException {
0948:                        if (!active)
0949:                            throw new SQLException(
0950:                                    "getDatabaseConnection not called");
0951:                        closeStatement(this );
0952:                    }
0953:
0954:                    public int getMaxFieldSize() throws java.sql.SQLException {
0955:                        if (!active)
0956:                            throw new SQLException(
0957:                                    "getDatabaseConnection not called");
0958:                        return theStatement.getMaxFieldSize();
0959:                    }
0960:
0961:                    public void setMaxFieldSize(int arg0)
0962:                            throws java.sql.SQLException {
0963:                        if (!active)
0964:                            throw new SQLException(
0965:                                    "getDatabaseConnection not called");
0966:                        theStatement.setMaxFieldSize(arg0);
0967:                    }
0968:
0969:                    public int getMaxRows() throws java.sql.SQLException {
0970:                        if (!active)
0971:                            throw new SQLException(
0972:                                    "getDatabaseConnection not called");
0973:                        return theStatement.getMaxRows();
0974:                    }
0975:
0976:                    public void setMaxRows(int arg0)
0977:                            throws java.sql.SQLException {
0978:                        if (!active)
0979:                            throw new SQLException(
0980:                                    "getDatabaseConnection not called");
0981:                        theStatement.setMaxRows(arg0);
0982:                    }
0983:
0984:                    public void setEscapeProcessing(boolean arg0)
0985:                            throws java.sql.SQLException {
0986:                        if (!active)
0987:                            throw new SQLException(
0988:                                    "getDatabaseConnection not called");
0989:                        theStatement.setEscapeProcessing(arg0);
0990:                    }
0991:
0992:                    public int getQueryTimeout() throws java.sql.SQLException {
0993:                        if (!active)
0994:                            throw new SQLException(
0995:                                    "getDatabaseConnection not called");
0996:                        return theStatement.getQueryTimeout();
0997:                    }
0998:
0999:                    public void setQueryTimeout(int arg0)
1000:                            throws java.sql.SQLException {
1001:                        if (!active)
1002:                            throw new SQLException(
1003:                                    "getDatabaseConnection not called");
1004:                        theStatement.setQueryTimeout(arg0);
1005:                    }
1006:
1007:                    public void cancel() throws java.sql.SQLException {
1008:                        if (!active)
1009:                            throw new SQLException(
1010:                                    "getDatabaseConnection not called");
1011:                        theStatement.cancel();
1012:                    }
1013:
1014:                    public java.sql.SQLWarning getWarnings()
1015:                            throws java.sql.SQLException {
1016:                        if (!active)
1017:                            throw new SQLException(
1018:                                    "getDatabaseConnection not called");
1019:                        return theStatement.getWarnings();
1020:                    }
1021:
1022:                    public void clearWarnings() throws java.sql.SQLException {
1023:                        if (!active)
1024:                            throw new SQLException(
1025:                                    "getDatabaseConnection not called");
1026:                        theStatement.clearWarnings();
1027:                    }
1028:
1029:                    public void setCursorName(java.lang.String arg0)
1030:                            throws java.sql.SQLException {
1031:                        if (!active)
1032:                            throw new SQLException(
1033:                                    "getDatabaseConnection not called");
1034:                        theStatement.setCursorName(arg0);
1035:                    }
1036:
1037:                    public boolean execute(java.lang.String arg0)
1038:                            throws java.sql.SQLException {
1039:                        if (!active)
1040:                            throw new SQLException(
1041:                                    "getDatabaseConnection not called");
1042:                        return theStatement.execute(arg0);
1043:                    }
1044:
1045:                    public java.sql.ResultSet getResultSet()
1046:                            throws java.sql.SQLException {
1047:                        if (!active)
1048:                            throw new SQLException(
1049:                                    "getDatabaseConnection not called");
1050:                        return theStatement.getResultSet();
1051:                    }
1052:
1053:                    public int getUpdateCount() throws java.sql.SQLException {
1054:                        if (!active)
1055:                            throw new SQLException(
1056:                                    "getDatabaseConnection not called");
1057:                        return theStatement.getUpdateCount();
1058:                    }
1059:
1060:                    public boolean getMoreResults()
1061:                            throws java.sql.SQLException {
1062:                        if (!active)
1063:                            throw new SQLException(
1064:                                    "getDatabaseConnection not called");
1065:                        return theStatement.getMoreResults();
1066:                    }
1067:
1068:                    // begin jdk 1.4 compatability
1069:                    public boolean getMoreResults(int current)
1070:                            throws java.sql.SQLException {
1071:                        throw new SQLException("getMoreResults(int) disallowed");
1072:                    }
1073:
1074:                    public ResultSet getGeneratedKeys()
1075:                            throws java.sql.SQLException {
1076:                        throw new SQLException("getGeneratedKeys() disallowed");
1077:                    }
1078:
1079:                    public int executeUpdate(String sql, int agk)
1080:                            throws java.sql.SQLException {
1081:                        throw new SQLException(
1082:                                "executeUpdate(String,int) disallowed");
1083:                    }
1084:
1085:                    public int executeUpdate(String sql, int ci[])
1086:                            throws java.sql.SQLException {
1087:                        throw new SQLException(
1088:                                "executeUpdate(String,int[]) disallowed");
1089:                    }
1090:
1091:                    public int executeUpdate(String sql, String cn[])
1092:                            throws java.sql.SQLException {
1093:                        throw new SQLException(
1094:                                "executeUpdate(String,String[]) disallowed");
1095:                    }
1096:
1097:                    public boolean execute(String sql, int agk)
1098:                            throws java.sql.SQLException {
1099:                        throw new SQLException("execute(String,int) disallowed");
1100:                    }
1101:
1102:                    public boolean execute(String sql, int ci[])
1103:                            throws java.sql.SQLException {
1104:                        throw new SQLException(
1105:                                "execute(String,int[]) disallowed");
1106:                    }
1107:
1108:                    public boolean execute(String sql, String cn[])
1109:                            throws java.sql.SQLException {
1110:                        throw new SQLException(
1111:                                "execute(String,String[]) disallowed");
1112:                    }
1113:
1114:                    public int getResultSetHoldability()
1115:                            throws java.sql.SQLException {
1116:                        throw new SQLException(
1117:                                "getResultSetHoldability() disallowed");
1118:                    }
1119:                    // end jdk 1.4 compatability
1120:
1121:                }
1122:
1123:                /**
1124:                 * A wrapper for a PreparedStatement object. All operations are
1125:                 * delegated to the wrapped object. The close operation in the
1126:                 * base class goes through the WrappedConnection wrapper to keep
1127:                 * track of which statements have been closed and which haven't.
1128:                 */
1129:                class WrappedPreparedStatement extends WrappedStatement
1130:                        implements  java.sql.PreparedStatement {
1131:                    private java.sql.PreparedStatement thePreparedStatement;
1132:
1133:                    public WrappedPreparedStatement(
1134:                            java.sql.PreparedStatement thePreparedStatement) {
1135:                        super (thePreparedStatement);
1136:                        this .thePreparedStatement = thePreparedStatement;
1137:                    }
1138:
1139:                    public void addBatch() throws java.sql.SQLException {
1140:                        if (!active)
1141:                            throw new SQLException(
1142:                                    "getDatabaseConnection not called");
1143:                        thePreparedStatement.addBatch();
1144:                    }
1145:
1146:                    public ResultSetMetaData getMetaData()
1147:                            throws java.sql.SQLException {
1148:                        if (!active)
1149:                            throw new SQLException(
1150:                                    "getDatabaseConnection not called");
1151:                        return (thePreparedStatement.getMetaData());
1152:                    }
1153:
1154:                    public void setArray(int i, Array x)
1155:                            throws java.sql.SQLException {
1156:                        if (!active)
1157:                            throw new SQLException(
1158:                                    "getDatabaseConnection not called");
1159:                        thePreparedStatement.setArray(i, x);
1160:                    }
1161:
1162:                    public void setBlob(int i, Blob x)
1163:                            throws java.sql.SQLException {
1164:                        if (!active)
1165:                            throw new SQLException(
1166:                                    "getDatabaseConnection not called");
1167:                        thePreparedStatement.setBlob(i, x);
1168:                    }
1169:
1170:                    public void setCharacterStream(int paramIndex,
1171:                            java.io.Reader reader, int length)
1172:                            throws java.sql.SQLException {
1173:                        if (!active)
1174:                            throw new SQLException(
1175:                                    "getDatabaseConnection not called");
1176:                        thePreparedStatement.setCharacterStream(paramIndex,
1177:                                reader, length);
1178:                    }
1179:
1180:                    public void setClob(int i, Clob x)
1181:                            throws java.sql.SQLException {
1182:                        if (!active)
1183:                            throw new SQLException(
1184:                                    "getDatabaseConnection not called");
1185:                        thePreparedStatement.setClob(i, x);
1186:                    }
1187:
1188:                    public void setRef(int i, Ref x)
1189:                            throws java.sql.SQLException {
1190:                        if (!active)
1191:                            throw new SQLException(
1192:                                    "getDatabaseConnection not called");
1193:                        thePreparedStatement.setRef(i, x);
1194:                    }
1195:
1196:                    public void setDate(int i, Date myDate, Calendar cal)
1197:                            throws java.sql.SQLException {
1198:                        if (!active)
1199:                            throw new SQLException(
1200:                                    "getDatabaseConnection not called");
1201:                        thePreparedStatement.setDate(i, myDate, cal);
1202:                    }
1203:
1204:                    public void setTime(int paramIndex, Time x, Calendar cal)
1205:                            throws java.sql.SQLException {
1206:                        if (!active)
1207:                            throw new SQLException(
1208:                                    "getDatabaseConnection not called");
1209:                        thePreparedStatement.setTime(paramIndex, x, cal);
1210:                    }
1211:
1212:                    public void setTimestamp(int paramIndex,
1213:                            java.sql.Timestamp x, Calendar cal)
1214:                            throws java.sql.SQLException {
1215:                        if (!active)
1216:                            throw new SQLException(
1217:                                    "getDatabaseConnection not called");
1218:                        thePreparedStatement.setTimestamp(paramIndex, x, cal);
1219:                    }
1220:
1221:                    public java.sql.ResultSet executeQuery()
1222:                            throws java.sql.SQLException {
1223:                        if (!active)
1224:                            throw new SQLException(
1225:                                    "getDatabaseConnection not called");
1226:                        return thePreparedStatement.executeQuery();
1227:                    }
1228:
1229:                    public int executeUpdate() throws java.sql.SQLException {
1230:                        if (!active)
1231:                            throw new SQLException(
1232:                                    "getDatabaseConnection not called");
1233:                        return thePreparedStatement.executeUpdate();
1234:                    }
1235:
1236:                    public void setNull(int arg0, int arg1)
1237:                            throws java.sql.SQLException {
1238:                        if (!active)
1239:                            throw new SQLException(
1240:                                    "getDatabaseConnection not called");
1241:                        thePreparedStatement.setNull(arg0, arg1);
1242:                    }
1243:
1244:                    public void setNull(int arg0, int arg1, String typeName)
1245:                            throws java.sql.SQLException {
1246:                        if (!active)
1247:                            throw new SQLException(
1248:                                    "getDatabaseConnection not called");
1249:                        thePreparedStatement.setNull(arg0, arg1, typeName);
1250:                    }
1251:
1252:                    public void setBoolean(int arg0, boolean arg1)
1253:                            throws java.sql.SQLException {
1254:                        if (!active)
1255:                            throw new SQLException(
1256:                                    "getDatabaseConnection not called");
1257:                        thePreparedStatement.setBoolean(arg0, arg1);
1258:                    }
1259:
1260:                    public void setByte(int arg0, byte arg1)
1261:                            throws java.sql.SQLException {
1262:                        if (!active)
1263:                            throw new SQLException(
1264:                                    "getDatabaseConnection not called");
1265:                        thePreparedStatement.setByte(arg0, arg1);
1266:                    }
1267:
1268:                    public void setShort(int arg0, short arg1)
1269:                            throws java.sql.SQLException {
1270:                        if (!active)
1271:                            throw new SQLException(
1272:                                    "getDatabaseConnection not called");
1273:                        thePreparedStatement.setShort(arg0, arg1);
1274:                    }
1275:
1276:                    public void setInt(int arg0, int arg1)
1277:                            throws java.sql.SQLException {
1278:                        if (!active)
1279:                            throw new SQLException(
1280:                                    "getDatabaseConnection not called");
1281:                        thePreparedStatement.setInt(arg0, arg1);
1282:                    }
1283:
1284:                    public void setLong(int arg0, long arg1)
1285:                            throws java.sql.SQLException {
1286:                        if (!active)
1287:                            throw new SQLException(
1288:                                    "getDatabaseConnection not called");
1289:                        thePreparedStatement.setLong(arg0, arg1);
1290:                    }
1291:
1292:                    public void setFloat(int arg0, float arg1)
1293:                            throws java.sql.SQLException {
1294:                        if (!active)
1295:                            throw new SQLException(
1296:                                    "getDatabaseConnection not called");
1297:                        thePreparedStatement.setFloat(arg0, arg1);
1298:                    }
1299:
1300:                    public void setDouble(int arg0, double arg1)
1301:                            throws java.sql.SQLException {
1302:                        if (!active)
1303:                            throw new SQLException(
1304:                                    "getDatabaseConnection not called");
1305:                        thePreparedStatement.setDouble(arg0, arg1);
1306:                    }
1307:
1308:                    public void setBigDecimal(int arg0,
1309:                            java.math.BigDecimal arg1)
1310:                            throws java.sql.SQLException {
1311:                        if (!active)
1312:                            throw new SQLException(
1313:                                    "getDatabaseConnection not called");
1314:                        thePreparedStatement.setBigDecimal(arg0, arg1);
1315:                    }
1316:
1317:                    public void setString(int arg0, java.lang.String arg1)
1318:                            throws java.sql.SQLException {
1319:                        if (!active)
1320:                            throw new SQLException(
1321:                                    "getDatabaseConnection not called");
1322:                        thePreparedStatement.setString(arg0, arg1);
1323:                    }
1324:
1325:                    public void setBytes(int arg0, byte[] arg1)
1326:                            throws java.sql.SQLException {
1327:                        if (!active)
1328:                            throw new SQLException(
1329:                                    "getDatabaseConnection not called");
1330:                        thePreparedStatement.setBytes(arg0, arg1);
1331:                    }
1332:
1333:                    public void setDate(int arg0, java.sql.Date arg1)
1334:                            throws java.sql.SQLException {
1335:                        if (!active)
1336:                            throw new SQLException(
1337:                                    "getDatabaseConnection not called");
1338:                        thePreparedStatement.setDate(arg0, arg1);
1339:                    }
1340:
1341:                    public void setTime(int arg0, java.sql.Time arg1)
1342:                            throws java.sql.SQLException {
1343:                        if (!active)
1344:                            throw new SQLException(
1345:                                    "getDatabaseConnection not called");
1346:                        thePreparedStatement.setTime(arg0, arg1);
1347:                    }
1348:
1349:                    public void setTimestamp(int arg0, java.sql.Timestamp arg1)
1350:                            throws java.sql.SQLException {
1351:                        if (!active)
1352:                            throw new SQLException(
1353:                                    "getDatabaseConnection not called");
1354:                        thePreparedStatement.setTimestamp(arg0, arg1);
1355:                    }
1356:
1357:                    public void setAsciiStream(int arg0,
1358:                            java.io.InputStream arg1, int arg2)
1359:                            throws java.sql.SQLException {
1360:                        if (!active)
1361:                            throw new SQLException(
1362:                                    "getDatabaseConnection not called");
1363:                        thePreparedStatement.setAsciiStream(arg0, arg1, arg2);
1364:                    }
1365:
1366:                    /**
1367:                     * @deprecated in the original
1368:                     */
1369:                    public void setUnicodeStream(int arg0,
1370:                            java.io.InputStream arg1, int arg2)
1371:                            throws java.sql.SQLException {
1372:                        if (!active)
1373:                            throw new SQLException(
1374:                                    "getDatabaseConnection not called");
1375:                        throw new java.sql.SQLException("Method not supported");
1376:                        //	  thePreparedStatement.setUnicodeStream(arg0, arg1, arg2);
1377:                    }
1378:
1379:                    public void setBinaryStream(int arg0,
1380:                            java.io.InputStream arg1, int arg2)
1381:                            throws java.sql.SQLException {
1382:                        if (!active)
1383:                            throw new SQLException(
1384:                                    "getDatabaseConnection not called");
1385:                        thePreparedStatement.setBinaryStream(arg0, arg1, arg2);
1386:                    }
1387:
1388:                    public void clearParameters() throws java.sql.SQLException {
1389:                        if (!active)
1390:                            throw new SQLException(
1391:                                    "getDatabaseConnection not called");
1392:                        thePreparedStatement.clearParameters();
1393:                    }
1394:
1395:                    public void setObject(int arg0, java.lang.Object arg1,
1396:                            int arg2, int arg3) throws java.sql.SQLException {
1397:                        if (!active)
1398:                            throw new SQLException(
1399:                                    "getDatabaseConnection not called");
1400:                        thePreparedStatement.setObject(arg0, arg1, arg2, arg3);
1401:                    }
1402:
1403:                    public void setObject(int arg0, java.lang.Object arg1,
1404:                            int arg2) throws java.sql.SQLException {
1405:                        if (!active)
1406:                            throw new SQLException(
1407:                                    "getDatabaseConnection not called");
1408:                        thePreparedStatement.setObject(arg0, arg1, arg2);
1409:                    }
1410:
1411:                    public void setObject(int arg0, java.lang.Object arg1)
1412:                            throws java.sql.SQLException {
1413:                        if (!active)
1414:                            throw new SQLException(
1415:                                    "getDatabaseConnection not called");
1416:                        thePreparedStatement.setObject(arg0, arg1);
1417:                    }
1418:
1419:                    public boolean execute() throws java.sql.SQLException {
1420:                        if (!active)
1421:                            throw new SQLException(
1422:                                    "getDatabaseConnection not called");
1423:                        return thePreparedStatement.execute();
1424:                    }
1425:
1426:                    // begin jdk 1.4 compatability
1427:                    public void setURL(int param, URL x)
1428:                            throws java.sql.SQLException {
1429:                        throw new SQLException("setURL(int,URL) disallowed");
1430:                    }
1431:
1432:                    public ParameterMetaData getParameterMetaData()
1433:                            throws java.sql.SQLException {
1434:                        throw new SQLException(
1435:                                "getParameterMetaData() disallowed");
1436:                    }
1437:                    // end jdk 1.4 compatability
1438:                }
1439:
1440:                /**
1441:                 * A wrapper for a CallableStatement object. All operations are
1442:                 * delegated to the wrapped object. The close operation in the
1443:                 * base class goes through the WrappedConnection wrapper to keep
1444:                 * track of which statements have been closed and which haven't.
1445:                 */
1446:                class WrappedCallableStatement extends WrappedPreparedStatement
1447:                        implements  java.sql.CallableStatement {
1448:                    private java.sql.CallableStatement theCallableStatement;
1449:
1450:                    public WrappedCallableStatement(
1451:                            java.sql.CallableStatement theCallableStatement) {
1452:                        super (theCallableStatement);
1453:                        this .theCallableStatement = theCallableStatement;
1454:                    }
1455:
1456:                    public Array getArray(int i) throws java.sql.SQLException {
1457:                        if (!active)
1458:                            throw new SQLException(
1459:                                    "getDatabaseConnection not called");
1460:                        return (theCallableStatement.getArray(i));
1461:                    }
1462:
1463:                    /**
1464:                     * @deprecated in the original
1465:                     */
1466:                    public java.math.BigDecimal getBigDecimal(int paramIndex)
1467:                            throws java.sql.SQLException {
1468:                        if (!active)
1469:                            throw new SQLException(
1470:                                    "getDatabaseConnection not called");
1471:                        return (theCallableStatement.getBigDecimal(paramIndex));
1472:                    }
1473:
1474:                    public Blob getBlob(int i) throws java.sql.SQLException {
1475:                        if (!active)
1476:                            throw new SQLException(
1477:                                    "getDatabaseConnection not called");
1478:                        return (theCallableStatement.getBlob(i));
1479:                    }
1480:
1481:                    public Clob getClob(int i) throws java.sql.SQLException {
1482:                        if (!active)
1483:                            throw new SQLException(
1484:                                    "getDatabaseConnection not called");
1485:                        return (theCallableStatement.getClob(i));
1486:                    }
1487:
1488:                    public Date getDate(int paramIndex, Calendar cal)
1489:                            throws java.sql.SQLException {
1490:                        if (!active)
1491:                            throw new SQLException(
1492:                                    "getDatabaseConnection not called");
1493:                        return (theCallableStatement.getDate(paramIndex, cal));
1494:                    }
1495:
1496:                    public Object getObject(int i, Map map)
1497:                            throws java.sql.SQLException {
1498:                        if (!active)
1499:                            throw new SQLException(
1500:                                    "getDatabaseConnection not called");
1501:                        return (theCallableStatement.getObject(i, map));
1502:                    }
1503:
1504:                    public Ref getRef(int i) throws java.sql.SQLException {
1505:                        if (!active)
1506:                            throw new SQLException(
1507:                                    "getDatabaseConnection not called");
1508:                        return (theCallableStatement.getRef(i));
1509:                    }
1510:
1511:                    public Time getTime(int paramIndex, Calendar cal)
1512:                            throws java.sql.SQLException {
1513:                        if (!active)
1514:                            throw new SQLException(
1515:                                    "getDatabaseConnection not called");
1516:                        return (theCallableStatement.getTime(paramIndex, cal));
1517:                    }
1518:
1519:                    public Timestamp getTimestamp(int paramIndex, Calendar cal)
1520:                            throws java.sql.SQLException {
1521:                        if (!active)
1522:                            throw new SQLException(
1523:                                    "getDatabaseConnection not called");
1524:                        return (theCallableStatement.getTimestamp(paramIndex,
1525:                                cal));
1526:                    }
1527:
1528:                    public void registerOutParameter(int paramIndex,
1529:                            int sqlType, String typeName)
1530:                            throws java.sql.SQLException {
1531:                        if (!active)
1532:                            throw new SQLException(
1533:                                    "getDatabaseConnection not called");
1534:                        theCallableStatement.registerOutParameter(paramIndex,
1535:                                sqlType, typeName);
1536:                    }
1537:
1538:                    public void registerOutParameter(int arg0, int arg1)
1539:                            throws java.sql.SQLException {
1540:                        if (!active)
1541:                            throw new SQLException(
1542:                                    "getDatabaseConnection not called");
1543:                        theCallableStatement.registerOutParameter(arg0, arg1);
1544:                    }
1545:
1546:                    public void registerOutParameter(int arg0, int arg1,
1547:                            int arg2) throws java.sql.SQLException {
1548:                        if (!active)
1549:                            throw new SQLException(
1550:                                    "getDatabaseConnection not called");
1551:                        theCallableStatement.registerOutParameter(arg0, arg1,
1552:                                arg2);
1553:                    }
1554:
1555:                    public boolean wasNull() throws java.sql.SQLException {
1556:                        if (!active)
1557:                            throw new SQLException(
1558:                                    "getDatabaseConnection not called");
1559:                        return theCallableStatement.wasNull();
1560:                    }
1561:
1562:                    public java.lang.String getString(int arg0)
1563:                            throws java.sql.SQLException {
1564:                        if (!active)
1565:                            throw new SQLException(
1566:                                    "getDatabaseConnection not called");
1567:                        return theCallableStatement.getString(arg0);
1568:                    }
1569:
1570:                    public boolean getBoolean(int arg0)
1571:                            throws java.sql.SQLException {
1572:                        if (!active)
1573:                            throw new SQLException(
1574:                                    "getDatabaseConnection not called");
1575:                        return theCallableStatement.getBoolean(arg0);
1576:                    }
1577:
1578:                    public byte getByte(int arg0) throws java.sql.SQLException {
1579:                        if (!active)
1580:                            throw new SQLException(
1581:                                    "getDatabaseConnection not called");
1582:                        return theCallableStatement.getByte(arg0);
1583:                    }
1584:
1585:                    public short getShort(int arg0)
1586:                            throws java.sql.SQLException {
1587:                        if (!active)
1588:                            throw new SQLException(
1589:                                    "getDatabaseConnection not called");
1590:                        return theCallableStatement.getShort(arg0);
1591:                    }
1592:
1593:                    public int getInt(int arg0) throws java.sql.SQLException {
1594:                        if (!active)
1595:                            throw new SQLException(
1596:                                    "getDatabaseConnection not called");
1597:                        return theCallableStatement.getInt(arg0);
1598:                    }
1599:
1600:                    public long getLong(int arg0) throws java.sql.SQLException {
1601:                        if (!active)
1602:                            throw new SQLException(
1603:                                    "getDatabaseConnection not called");
1604:                        return theCallableStatement.getLong(arg0);
1605:                    }
1606:
1607:                    public float getFloat(int arg0)
1608:                            throws java.sql.SQLException {
1609:                        if (!active)
1610:                            throw new SQLException(
1611:                                    "getDatabaseConnection not called");
1612:                        return theCallableStatement.getFloat(arg0);
1613:                    }
1614:
1615:                    public double getDouble(int arg0)
1616:                            throws java.sql.SQLException {
1617:                        if (!active)
1618:                            throw new SQLException(
1619:                                    "getDatabaseConnection not called");
1620:                        return theCallableStatement.getDouble(arg0);
1621:                    }
1622:
1623:                    /** @deprecated in the original */
1624:                    public java.math.BigDecimal getBigDecimal(int arg0, int arg1)
1625:                            throws java.sql.SQLException {
1626:                        if (!active)
1627:                            throw new SQLException(
1628:                                    "getDatabaseConnection not called");
1629:                        throw new java.sql.SQLException("Method not supported");
1630:                        //	  return theCallableStatement.getBigDecimal(arg0, arg1);
1631:                    }
1632:
1633:                    public byte[] getBytes(int arg0)
1634:                            throws java.sql.SQLException {
1635:                        if (!active)
1636:                            throw new SQLException(
1637:                                    "getDatabaseConnection not called");
1638:                        return theCallableStatement.getBytes(arg0);
1639:                    }
1640:
1641:                    public java.sql.Date getDate(int arg0)
1642:                            throws java.sql.SQLException {
1643:                        if (!active)
1644:                            throw new SQLException(
1645:                                    "getDatabaseConnection not called");
1646:                        return theCallableStatement.getDate(arg0);
1647:                    }
1648:
1649:                    public java.sql.Time getTime(int arg0)
1650:                            throws java.sql.SQLException {
1651:                        if (!active)
1652:                            throw new SQLException(
1653:                                    "getDatabaseConnection not called");
1654:                        return theCallableStatement.getTime(arg0);
1655:                    }
1656:
1657:                    public java.sql.Timestamp getTimestamp(int arg0)
1658:                            throws java.sql.SQLException {
1659:                        if (!active)
1660:                            throw new SQLException(
1661:                                    "getDatabaseConnection not called");
1662:                        return theCallableStatement.getTimestamp(arg0);
1663:                    }
1664:
1665:                    public java.lang.Object getObject(int arg0)
1666:                            throws java.sql.SQLException {
1667:                        if (!active)
1668:                            throw new SQLException(
1669:                                    "getDatabaseConnection not called");
1670:                        return theCallableStatement.getObject(arg0);
1671:                    }
1672:
1673:                    // begin jdk 1.4 compatability
1674:                    public void registerOutParameter(String pn, int sqltype)
1675:                            throws java.sql.SQLException {
1676:                        if (!active)
1677:                            throw new SQLException(
1678:                                    "getDatabaseConnection not called");
1679:                        theCallableStatement.registerOutParameter(pn, sqltype);
1680:                    }
1681:
1682:                    public void registerOutParameter(String pn, int sqltype,
1683:                            int scale) throws java.sql.SQLException {
1684:                        if (!active)
1685:                            throw new SQLException(
1686:                                    "getDatabaseConnection not called");
1687:                        theCallableStatement.registerOutParameter(pn, sqltype,
1688:                                scale);
1689:                    }
1690:
1691:                    public void registerOutParameter(String pn, int sqltype,
1692:                            String tn) throws java.sql.SQLException {
1693:                        if (!active)
1694:                            throw new SQLException(
1695:                                    "getDatabaseConnection not called");
1696:                        theCallableStatement.registerOutParameter(pn, sqltype,
1697:                                tn);
1698:                    }
1699:
1700:                    public URL getURL(int pi) throws java.sql.SQLException {
1701:                        if (!active)
1702:                            throw new SQLException(
1703:                                    "getDatabaseConnection not called");
1704:                        return theCallableStatement.getURL(pi);
1705:                    }
1706:
1707:                    public void setURL(String pn, URL v)
1708:                            throws java.sql.SQLException {
1709:                        if (!active)
1710:                            throw new SQLException(
1711:                                    "getDatabaseConnection not called");
1712:                        theCallableStatement.setURL(pn, v);
1713:                    }
1714:
1715:                    public void setNull(String pn, int sqlt)
1716:                            throws java.sql.SQLException {
1717:                        if (!active)
1718:                            throw new SQLException(
1719:                                    "getDatabaseConnection not called");
1720:                        theCallableStatement.setNull(pn, sqlt);
1721:                    }
1722:
1723:                    public void setBoolean(String pn, boolean x)
1724:                            throws java.sql.SQLException {
1725:                        if (!active)
1726:                            throw new SQLException(
1727:                                    "getDatabaseConnection not called");
1728:                        theCallableStatement.setBoolean(pn, x);
1729:                    }
1730:
1731:                    public void setByte(String pn, byte x)
1732:                            throws java.sql.SQLException {
1733:                        if (!active)
1734:                            throw new SQLException(
1735:                                    "getDatabaseConnection not called");
1736:                        theCallableStatement.setByte(pn, x);
1737:                    }
1738:
1739:                    public void setShort(String pn, short x)
1740:                            throws java.sql.SQLException {
1741:                        if (!active)
1742:                            throw new SQLException(
1743:                                    "getDatabaseConnection not called");
1744:                        theCallableStatement.setShort(pn, x);
1745:                    }
1746:
1747:                    public void setInt(String pn, int x)
1748:                            throws java.sql.SQLException {
1749:                        if (!active)
1750:                            throw new SQLException(
1751:                                    "getDatabaseConnection not called");
1752:                        theCallableStatement.setInt(pn, x);
1753:                    }
1754:
1755:                    public void setLong(String pn, long x)
1756:                            throws java.sql.SQLException {
1757:                        if (!active)
1758:                            throw new SQLException(
1759:                                    "getDatabaseConnection not called");
1760:                        theCallableStatement.setLong(pn, x);
1761:                    }
1762:
1763:                    public void setFloat(String pn, float x)
1764:                            throws java.sql.SQLException {
1765:                        if (!active)
1766:                            throw new SQLException(
1767:                                    "getDatabaseConnection not called");
1768:                        theCallableStatement.setFloat(pn, x);
1769:                    }
1770:
1771:                    public void setDouble(String pn, double x)
1772:                            throws java.sql.SQLException {
1773:                        if (!active)
1774:                            throw new SQLException(
1775:                                    "getDatabaseConnection not called");
1776:                        theCallableStatement.setDouble(pn, x);
1777:                    }
1778:
1779:                    public void setBigDecimal(String pn, BigDecimal x)
1780:                            throws java.sql.SQLException {
1781:                        if (!active)
1782:                            throw new SQLException(
1783:                                    "getDatabaseConnection not called");
1784:                        theCallableStatement.setBigDecimal(pn, x);
1785:                    }
1786:
1787:                    public void setString(String pn, String x)
1788:                            throws java.sql.SQLException {
1789:                        if (!active)
1790:                            throw new SQLException(
1791:                                    "getDatabaseConnection not called");
1792:                        theCallableStatement.setString(pn, x);
1793:                    }
1794:
1795:                    public void setBytes(String pn, byte[] x)
1796:                            throws java.sql.SQLException {
1797:                        if (!active)
1798:                            throw new SQLException(
1799:                                    "getDatabaseConnection not called");
1800:                        theCallableStatement.setBytes(pn, x);
1801:                    }
1802:
1803:                    public void setDate(String pn, Date x)
1804:                            throws java.sql.SQLException {
1805:                        if (!active)
1806:                            throw new SQLException(
1807:                                    "getDatabaseConnection not called");
1808:                        theCallableStatement.setDate(pn, x);
1809:                    }
1810:
1811:                    public void setTime(String pn, Time x)
1812:                            throws java.sql.SQLException {
1813:                        if (!active)
1814:                            throw new SQLException(
1815:                                    "getDatabaseConnection not called");
1816:                        theCallableStatement.setTime(pn, x);
1817:                    }
1818:
1819:                    public void setTimestamp(String pn, Timestamp x)
1820:                            throws java.sql.SQLException {
1821:                        if (!active)
1822:                            throw new SQLException(
1823:                                    "getDatabaseConnection not called");
1824:                        theCallableStatement.setTimestamp(pn, x);
1825:                    }
1826:
1827:                    public void setAsciiStream(String pn, InputStream x, int l)
1828:                            throws java.sql.SQLException {
1829:                        if (!active)
1830:                            throw new SQLException(
1831:                                    "getDatabaseConnection not called");
1832:                        theCallableStatement.setAsciiStream(pn, x, l);
1833:                    }
1834:
1835:                    public void setBinaryStream(String pn, InputStream x, int l)
1836:                            throws java.sql.SQLException {
1837:                        if (!active)
1838:                            throw new SQLException(
1839:                                    "getDatabaseConnection not called");
1840:                        theCallableStatement.setBinaryStream(pn, x, l);
1841:                    }
1842:
1843:                    public void setObject(String pn, Object x, int tt, int s)
1844:                            throws java.sql.SQLException {
1845:                        if (!active)
1846:                            throw new SQLException(
1847:                                    "getDatabaseConnection not called");
1848:                        theCallableStatement.setObject(pn, x, tt, s);
1849:                    }
1850:
1851:                    public void setObject(String pn, Object x, int tt)
1852:                            throws java.sql.SQLException {
1853:                        if (!active)
1854:                            throw new SQLException(
1855:                                    "getDatabaseConnection not called");
1856:                        theCallableStatement.setObject(pn, x, tt);
1857:                    }
1858:
1859:                    public void setObject(String pn, Object x)
1860:                            throws java.sql.SQLException {
1861:                        if (!active)
1862:                            throw new SQLException(
1863:                                    "getDatabaseConnection not called");
1864:                        theCallableStatement.setObject(pn, x);
1865:                    }
1866:
1867:                    public void setCharacterStream(String pn, Reader x, int l)
1868:                            throws java.sql.SQLException {
1869:                        if (!active)
1870:                            throw new SQLException(
1871:                                    "getDatabaseConnection not called");
1872:                        theCallableStatement.setCharacterStream(pn, x, l);
1873:                    }
1874:
1875:                    public void setDate(String pn, Date x, Calendar cal)
1876:                            throws java.sql.SQLException {
1877:                        if (!active)
1878:                            throw new SQLException(
1879:                                    "getDatabaseConnection not called");
1880:                        theCallableStatement.setDate(pn, x, cal);
1881:                    }
1882:
1883:                    public void setTime(String pn, Time x, Calendar cal)
1884:                            throws java.sql.SQLException {
1885:                        if (!active)
1886:                            throw new SQLException(
1887:                                    "getDatabaseConnection not called");
1888:                        theCallableStatement.setTime(pn, x, cal);
1889:                    }
1890:
1891:                    public void setTimestamp(String pn, Timestamp x,
1892:                            Calendar cal) throws java.sql.SQLException {
1893:                        if (!active)
1894:                            throw new SQLException(
1895:                                    "getDatabaseConnection not called");
1896:                        theCallableStatement.setTimestamp(pn, x, cal);
1897:                    }
1898:
1899:                    public void setNull(String pn, int st, String tn)
1900:                            throws java.sql.SQLException {
1901:                        if (!active)
1902:                            throw new SQLException(
1903:                                    "getDatabaseConnection not called");
1904:                        theCallableStatement.setNull(pn, st, tn);
1905:                    }
1906:
1907:                    public String getString(String pn)
1908:                            throws java.sql.SQLException {
1909:                        if (!active)
1910:                            throw new SQLException(
1911:                                    "getDatabaseConnection not called");
1912:                        return theCallableStatement.getString(pn);
1913:                    }
1914:
1915:                    public boolean getBoolean(String pn)
1916:                            throws java.sql.SQLException {
1917:                        if (!active)
1918:                            throw new SQLException(
1919:                                    "getDatabaseConnection not called");
1920:                        return theCallableStatement.getBoolean(pn);
1921:                    }
1922:
1923:                    public byte getByte(String pn) throws java.sql.SQLException {
1924:                        if (!active)
1925:                            throw new SQLException(
1926:                                    "getDatabaseConnection not called");
1927:                        return theCallableStatement.getByte(pn);
1928:                    }
1929:
1930:                    public short getShort(String pn)
1931:                            throws java.sql.SQLException {
1932:                        if (!active)
1933:                            throw new SQLException(
1934:                                    "getDatabaseConnection not called");
1935:                        return theCallableStatement.getShort(pn);
1936:                    }
1937:
1938:                    public int getInt(String pn) throws java.sql.SQLException {
1939:                        if (!active)
1940:                            throw new SQLException(
1941:                                    "getDatabaseConnection not called");
1942:                        return theCallableStatement.getInt(pn);
1943:                    }
1944:
1945:                    public long getLong(String pn) throws java.sql.SQLException {
1946:                        if (!active)
1947:                            throw new SQLException(
1948:                                    "getDatabaseConnection not called");
1949:                        return theCallableStatement.getLong(pn);
1950:                    }
1951:
1952:                    public float getFloat(String pn)
1953:                            throws java.sql.SQLException {
1954:                        if (!active)
1955:                            throw new SQLException(
1956:                                    "getDatabaseConnection not called");
1957:                        return theCallableStatement.getFloat(pn);
1958:                    }
1959:
1960:                    public double getDouble(String pn)
1961:                            throws java.sql.SQLException {
1962:                        if (!active)
1963:                            throw new SQLException(
1964:                                    "getDatabaseConnection not called");
1965:                        return theCallableStatement.getDouble(pn);
1966:                    }
1967:
1968:                    public byte[] getBytes(String pn)
1969:                            throws java.sql.SQLException {
1970:                        if (!active)
1971:                            throw new SQLException(
1972:                                    "getDatabaseConnection not called");
1973:                        return theCallableStatement.getBytes(pn);
1974:                    }
1975:
1976:                    public Date getDate(String pn) throws java.sql.SQLException {
1977:                        if (!active)
1978:                            throw new SQLException(
1979:                                    "getDatabaseConnection not called");
1980:                        return theCallableStatement.getDate(pn);
1981:                    }
1982:
1983:                    public Time getTime(String pn) throws java.sql.SQLException {
1984:                        if (!active)
1985:                            throw new SQLException(
1986:                                    "getDatabaseConnection not called");
1987:                        return theCallableStatement.getTime(pn);
1988:                    }
1989:
1990:                    public Timestamp getTimestamp(String pn)
1991:                            throws java.sql.SQLException {
1992:                        if (!active)
1993:                            throw new SQLException(
1994:                                    "getDatabaseConnection not called");
1995:                        return theCallableStatement.getTimestamp(pn);
1996:                    }
1997:
1998:                    public Object getObject(String pn)
1999:                            throws java.sql.SQLException {
2000:                        if (!active)
2001:                            throw new SQLException(
2002:                                    "getDatabaseConnection not called");
2003:                        return theCallableStatement.getObject(pn);
2004:                    }
2005:
2006:                    public BigDecimal getBigDecimal(String pn)
2007:                            throws java.sql.SQLException {
2008:                        if (!active)
2009:                            throw new SQLException(
2010:                                    "getDatabaseConnection not called");
2011:                        return theCallableStatement.getBigDecimal(pn);
2012:                    }
2013:
2014:                    public Object getObject(String pn, Map m)
2015:                            throws java.sql.SQLException {
2016:                        if (!active)
2017:                            throw new SQLException(
2018:                                    "getDatabaseConnection not called");
2019:                        return theCallableStatement.getObject(pn, m);
2020:                    }
2021:
2022:                    public Ref getRef(String pn) throws java.sql.SQLException {
2023:                        if (!active)
2024:                            throw new SQLException(
2025:                                    "getDatabaseConnection not called");
2026:                        return theCallableStatement.getRef(pn);
2027:                    }
2028:
2029:                    public Blob getBlob(String pn) throws java.sql.SQLException {
2030:                        if (!active)
2031:                            throw new SQLException(
2032:                                    "getDatabaseConnection not called");
2033:                        return theCallableStatement.getBlob(pn);
2034:                    }
2035:
2036:                    public Clob getClob(String pn) throws java.sql.SQLException {
2037:                        if (!active)
2038:                            throw new SQLException(
2039:                                    "getDatabaseConnection not called");
2040:                        return theCallableStatement.getClob(pn);
2041:                    }
2042:
2043:                    public Array getArray(String pn)
2044:                            throws java.sql.SQLException {
2045:                        if (!active)
2046:                            throw new SQLException(
2047:                                    "getDatabaseConnection not called");
2048:                        return theCallableStatement.getArray(pn);
2049:                    }
2050:
2051:                    public Date getDate(String pn, Calendar c)
2052:                            throws java.sql.SQLException {
2053:                        if (!active)
2054:                            throw new SQLException(
2055:                                    "getDatabaseConnection not called");
2056:                        return theCallableStatement.getDate(pn, c);
2057:                    }
2058:
2059:                    public Time getTime(String pn, Calendar c)
2060:                            throws java.sql.SQLException {
2061:                        if (!active)
2062:                            throw new SQLException(
2063:                                    "getDatabaseConnection not called");
2064:                        return theCallableStatement.getTime(pn, c);
2065:                    }
2066:
2067:                    public Timestamp getTimestamp(String pn, Calendar c)
2068:                            throws java.sql.SQLException {
2069:                        if (!active)
2070:                            throw new SQLException(
2071:                                    "getDatabaseConnection not called");
2072:                        return theCallableStatement.getTimestamp(pn, c);
2073:                    }
2074:
2075:                    public URL getURL(String pn) throws java.sql.SQLException {
2076:                        if (!active)
2077:                            throw new SQLException(
2078:                                    "getDatabaseConnection not called");
2079:                        return theCallableStatement.getURL(pn);
2080:                    }
2081:                    // end jdk 1.4 compatability
2082:                }
2083:            }
2084:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.