//----------------------------BEGIN LICENSE----------------------------
/* 
 * Willow : the Open Source WorkFlow Project
 * Distributable under GNU LGPL license by gun.org
 *
 * Copyright (C) 2004-2010 huihoo.org 
 * Copyright (C) 2004-2010  ZosaTapo <dertyang@hotmail.com> 
 * 
 * ====================================================================
 * Project Homepage : http://www.huihoo.org/willow
 * Source Forge     : http://sourceforge.net/projects/huihoo
 * Mailing list     : willow@lists.sourceforge.net 
 */
//----------------------------END  LICENSE-----------------------------
package org.huihoo.workflow;

import java.sql.Connection;



public interface WorkflowTransaction  extends WorkflowComponent
{ 
	/**
	 *  return the database that the transaction belongs to
	 */
	public WorkflowDatabase getDatabase();
  
  /**
   *  Return connection for this transaction 
   */
  public Connection  getConnection();   

  /**
   * Commits user transaction.
   *
   * @exception TransactionException If something unexpected happens.
   */
  public void commit() throws TransactionException;

  /**
   * Rollbacks user transaction. This method is called when commit
   * method fails.
   *
   * @exception TransactionException If something unexpected happens.
   */
  public void rollback() throws TransactionException;
  
  /**
   * Releases user transaction. Method <b>MUST</b> be called for each transaction.
   *
   * @exception TransactionException If something unexpected happens.
   */
  public void release() throws TransactionException;
}
