1 /* 2 * Jalisto - JAva LIght STOrage 3 * Copyright (C) 2000-2005 Xcalia http://www.xcalia.com 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public 7 * License as published by the Free Software Foundation; either 8 * version 2.1 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public 16 * License along with this library; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 18 * 19 * Xcalia 20 * 71, rue Desnouettes 21 * 75014 Paris - France 22 * http://www.xcalia.com 23 */ 24 package org.objectweb.jalisto.se.api; 25 26 /** 27 * The Transaction interface allows operations to be performed against the transaction in the target Transaction object. 28 * A Transaction object is associated to a target Session. 29 */ 30 public interface Transaction { 31 32 /** 33 * Start the transaction represented by this Transaction object. 34 * 35 * @throws org.objectweb.jalisto.se.exception.TransactionException 36 * Thrown if the transaction is already active. 37 */ 38 void begin(); 39 40 /** 41 * Complete the transaction represented by this Transaction object. 42 * 43 * @throws org.objectweb.jalisto.se.exception.TransactionException 44 * Thrown if the transaction is inactive. 45 */ 46 void commit(); 47 48 /** 49 * Rollback the transaction represented by this Transaction object. 50 * 51 * @throws org.objectweb.jalisto.se.exception.TransactionException 52 * Thrown if the transaction is inactive. 53 */ 54 void rollback(); 55 56 /** 57 * Set the transaction represented by this Transaction object to optimistic mode. 58 * 59 * @throws org.objectweb.jalisto.se.exception.TransactionException 60 * Thrown if the transaction is already active. 61 */ 62 void setOptimistic(); 63 64 /** 65 * Set the transaction represented by this Transaction object to pessimistic mode. 66 * 67 * @throws org.objectweb.jalisto.se.exception.TransactionException 68 * Thrown if the transaction is already active. 69 */ 70 void setPessimistic(); 71 72 /** 73 * Tell if we are in an active transaction. 74 * 75 * @return true if the transaction represented by this Transaction object is active; otherwise false. 76 */ 77 boolean isActive(); 78 79 /** 80 * Get the transaction's associated Jalisto ressource. 81 * 82 * @return Session object associated with this Transaction. 83 */ 84 Session getSession(); 85 } 86