| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| ConnectionManagerIF |
|
| 1.0;1 |
| 1 | package org.apache.ojb.broker.accesslayer; | |
| 2 | ||
| 3 | /* Copyright 2002-2005 The Apache Software Foundation | |
| 4 | * | |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 6 | * you may not use this file except in compliance with the License. | |
| 7 | * You may obtain a copy of the License at | |
| 8 | * | |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 10 | * | |
| 11 | * Unless required by applicable law or agreed to in writing, software | |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 14 | * See the License for the specific language governing permissions and | |
| 15 | * limitations under the License. | |
| 16 | */ | |
| 17 | ||
| 18 | import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor; | |
| 19 | import org.apache.ojb.broker.platforms.Platform; | |
| 20 | ||
| 21 | import java.sql.Connection; | |
| 22 | ||
| 23 | /** | |
| 24 | * The connection manager handles the life cycle of a connection. | |
| 25 | * Each {@link org.apache.ojb.broker.PersistenceBroker} instance | |
| 26 | * use it's own connection manager. | |
| 27 | */ | |
| 28 | public interface ConnectionManagerIF | |
| 29 | { | |
| 30 | ||
| 31 | /** | |
| 32 | * Return the associated {@link org.apache.ojb.broker.metadata.JdbcConnectionDescriptor}. | |
| 33 | */ | |
| 34 | JdbcConnectionDescriptor getConnectionDescriptor(); | |
| 35 | ||
| 36 | /** | |
| 37 | * Returns the supported {@link org.apache.ojb.broker.platforms.Platform} | |
| 38 | * determined by the {@link org.apache.ojb.broker.metadata.JdbcConnectionDescriptor}. | |
| 39 | * @see #getConnectionDescriptor | |
| 40 | */ | |
| 41 | Platform getSupportedPlatform(); | |
| 42 | ||
| 43 | /** | |
| 44 | * checks if Connection conn is still open. | |
| 45 | * returns true, if connection is open, else false. | |
| 46 | */ | |
| 47 | boolean isAlive(Connection conn); | |
| 48 | ||
| 49 | /** | |
| 50 | * Return a connection. | |
| 51 | */ | |
| 52 | Connection getConnection() throws LookupException; | |
| 53 | ||
| 54 | /** | |
| 55 | * Hold connection is in local transaction. | |
| 56 | */ | |
| 57 | boolean isInLocalTransaction(); | |
| 58 | ||
| 59 | /** | |
| 60 | * Begin local transaction on the hold connection | |
| 61 | * and set autocommit to false. | |
| 62 | */ | |
| 63 | void localBegin(); | |
| 64 | ||
| 65 | /** | |
| 66 | * Commit the local transaction on the hold connection. | |
| 67 | */ | |
| 68 | void localCommit(); | |
| 69 | ||
| 70 | /** | |
| 71 | * Rollback a changes on the hold connection. | |
| 72 | */ | |
| 73 | void localRollback(); | |
| 74 | ||
| 75 | /** | |
| 76 | * Release the hold connection. | |
| 77 | */ | |
| 78 | void releaseConnection(); | |
| 79 | ||
| 80 | /** | |
| 81 | * Sets the batch mode on (<code>true</code>) or | |
| 82 | * off (<code>false</code>). | |
| 83 | */ | |
| 84 | void setBatchMode(boolean mode); | |
| 85 | ||
| 86 | /** | |
| 87 | * @return the batch mode. | |
| 88 | */ | |
| 89 | boolean isBatchMode(); | |
| 90 | ||
| 91 | /** | |
| 92 | * Execute batch (if the batch mode where used). | |
| 93 | */ | |
| 94 | void executeBatch(); | |
| 95 | ||
| 96 | /** | |
| 97 | * Execute batch if the number of statements in it | |
| 98 | * exceeded the limit (if the batch mode where used). | |
| 99 | */ | |
| 100 | void executeBatchIfNecessary(); | |
| 101 | ||
| 102 | /** | |
| 103 | * Clear batch (if the batch mode where used). | |
| 104 | */ | |
| 105 | void clearBatch(); | |
| 106 | ||
| 107 | } |