[cvs] expresso commit by yves: Yves Amaizo new changes commit today
JCorporate Ltd
jcorp at jcorporate.com
Tue Oct 18 22:58:00 UTC 2005
Log Message:
-----------
Yves Amaizo new changes commit today 2005/10/19 00:55 french time
Added Files:
-----------
expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/db:
ITransaction.java
Revision Data
-------------
--- /dev/null
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/core/db/ITransaction.java
@@ -0,0 +1,249 @@
+/* ====================================================================
+ * The Jcorporate Apache Style Software License, Version 1.2 05-07-2002
+ *
+ * Copyright (c) 1995-2002 Jcorporate Ltd. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by Jcorporate Ltd.
+ * (http://www.jcorporate.com/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. "Jcorporate" and product names such as "Expresso" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written permission,
+ * please contact info at jcorporate.com.
+ *
+ * 5. Products derived from this software may not be called "Expresso",
+ * or other Jcorporate product names; nor may "Expresso" or other
+ * Jcorporate product names appear in their name, without prior
+ * written permission of Jcorporate Ltd.
+ *
+ * 6. No product derived from this software may compete in the same
+ * market space, i.e. framework, without prior written permission
+ * of Jcorporate Ltd. For written permission, please contact
+ * partners at jcorporate.com.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL JCORPORATE LTD OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Jcorporate Ltd. Contributions back
+ * to the project(s) are encouraged when you make modifications.
+ * Please send them to support at jcorporate.com. For more information
+ * on Jcorporate Ltd. and its products, please see
+ * <http://www.jcorporate.com/>.
+ *
+ * Portions of this software are based upon other open source
+ * products and are subject to their respective licenses.
+ */
+
+package com.jcorporate.expresso.core.db;
+
+import com.jcorporate.expresso.core.misc.StringUtil;
+import org.apache.log4j.Logger;
+
+
+/**
+ * Generic database transaction object - hides the implementation
+ * details of using jdbc and allows for JDBC message and exceptions to be
+ * handled better than by default.
+ * DBTransaction are also designed to be used in conjunction with connection
+ * pooling, and have special methods to support this.
+ *
+ * @author Yves Henri AMAIZO
+ */
+public interface ITransaction {
+
+ /**
+ * Constant name for the 'Default' database context
+ */
+ public static String TRANSACTION_TYPE = "TRANSACTION";
+
+
+ /**
+ * Constant name for the 'Default' database context
+ */
+ public static final String DEFAULT_DB_CONTEXT_NAME = "default";
+
+
+ /**
+ * Sets up the transaction operation on an identitied DBConnectionPool
+ *
+ * @param transactionDataContext The transaction data context name
+ * for more information on what this paramter means.
+ */
+ public void startTransaction() throws DBException;
+
+ /**
+ * Sets up the transaction operation on an identitied DBConnectionPool
+ *
+ * @param transactionDataContext The transaction data context name
+ * for more information on what this paramter means.
+ */
+ public void startTransaction(boolean immortal) throws DBException;
+
+ /**
+ * Clear all result sets and statements associated with this connection
+ */
+ public void clear() throws DBException;
+
+
+ /**
+ * Send a COMMIT to the database, closing the current transaction If the
+ * database driver claims it doesn't support transactions, then we skip
+ * this.
+ *
+ * @throws DBException If the commit does not succeed
+ */
+ public void commit() throws DBException;
+
+
+ /**
+ * <p/>
+ * Low level function that allows you to retrieve the JDBC connection associated
+ * with this DBConnection. This allows you to do several fancy things that would
+ * not normally happen within Expresso itself such as prepared statements, and
+ * other low level entities. </p>
+ * <p/>
+ * <b>NOTE:</b> Once you grab the connection yourself, you are on your own
+ * as far as the framework is concerned. It doesn't help you to get your
+ * connection back in place. So, for example, if you close the connection manually,
+ * it will mess up the connection pool. Or if you fail to free a prepared statement,
+ * it will register as a resource leak. Be sure to restore your connection to
+ * pristine order before releasing this DBConnection back into the pool.
+ * </p>
+ *
+ * @return a java.sql.Connection JDBC connection.
+ */
+ public DBConnection getTransactionConnection();
+
+ /**
+ * Returns the text description of this connection. When the connection
+ * is put in use by a client program a description is set, this method
+ * retrieves the description.
+ *
+ * @return String A text description of this database connection's purpose
+ */
+ public String getDescription();
+ /**
+ * When this connection has lost its connection to the server,
+ * tell whether or not it is available to be re-allocated
+ *
+ * @return boolean True if the connection has been lost,
+ * false if it is still usable
+ */
+ public boolean isClosed() throws DBException;
+
+ /**
+ * When this connection has lost its connection to the server,
+ * tell whether or not it is available to be re-allocated
+ *
+ * @return boolean True if the connection has been lost,
+ * false if it is still usable
+ */
+ public boolean isConnected();
+
+
+ /**
+ * Roll back the current transaction, as if it were never requested. If
+ * the JDBC driver claims it doesn't support transactions, then this
+ * method is a NOOP except for touching the connection
+ *
+ * @throws DBException If the rollback encounters an error
+ */
+ public void rollback() throws DBException;
+
+ /**
+ * Set a description for this database connection. When status is requested
+ * from the connection pool, this is used to describe the connection.
+ * Any client requesting a connection from the pool should set the
+ * description of the connection as soon as it's returned
+ *
+ * @param newDescription Description of this connection
+ */
+ public void setDescription(String newDescription);
+
+ /**
+ * Sets the data context for the connection.
+ *
+ * @param newDBName the datacontext name to use
+ */
+ public void setDataContext(String newDBName);
+
+ /**
+ * Retrieve the data context name we're associated with
+ *
+ * @return java.lang.String of the current data Context
+ */
+ public String getDataContext();
+ /**
+ * <p>Releases the DBConnection back into the parent DBConnectionPool. Allows
+ * for syntax like:</p>
+ * <code>
+ * <p/>
+ * DBConnection connection = DBConnectionPool.getInstance("default").getConnection(); <br/>
+ * [do stuff]<br />
+ * connection.release(); <br />
+ * </code>
+ * </p>
+ */
+ public void release() throws DBException;
+
+ /**
+ * @return
+ */
+ public DBConnectionPool getPool();
+ /**
+ * @param pool
+ */
+ public void setPool(DBConnectionPool pool);
+
+ /**
+ * Get transaction id
+ *
+ * @return int
+ * <p/>
+ * author Yves Henri AMAIZO, Mon Dec 22 10:30:59 2003
+ * @since Expresso 5.3
+ */
+ public int getId();
+
+
+ /**
+ * Get transaction identifier which is myDescription + transactionId
+ *
+ * @return String
+ * <p/>
+ * author Yves Henri AMAIZO, Mon Dec 22 10:30:59 2003
+ * @since Expresso 5.3
+ */
+ public String getTransactionIdentifier();
+
+}
+
+/* DBTransaction */
\ No newline at end of file
More information about the cvs
mailing list