1 /** 2 * Copyright (C) 2001-2002 3 * - France Telecom R&D 4 * - Laboratoire Logiciels, Systemes, Reseaux - UMR 5526, CNRS-INPG-UJF 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2 of the License, or (at your option) any later version. 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with this library; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * 20 * Release: 1.0 21 * 22 * Authors: 23 * 24 */ 25 26 package org.objectweb.perseus.persistence.api; 27 28 /** 29 * It defines a persistence manager able to manage context transactional or not. 30 * 31 * @author Luciano Garcia-Banuelos (Luciano.Garcia@imag.fr) 32 */ 33 public interface TransactionalPersistenceManager extends PersistenceManager { 34 35 /** 36 * converts a context to a transaction 37 * @param context becomes transactional 38 * @throws PersistenceException if the context is already transactional. 39 */ 40 void begin(TransactionalWorkingSet context) throws PersistenceException; 41 42 /** 43 * Prepare the transactinal context. 44 * @param context the 45 * @return true if the transaction can be commit or false is the transaction 46 * must be rolled back. 47 * @throws PersistenceException if an error raised during the prepare 48 * operation, or if the context is not a transactional context. 49 */ 50 boolean prepare(TransactionalWorkingSet context) throws PersistenceException; 51 52 /** 53 * commits a transactional context. The call to the prepare method is 54 * required. 55 * @param context 56 * @throws PersistenceException if an error raised during the commit 57 * operation, or if the context is not a transactional context. 58 */ 59 void commit(TransactionalWorkingSet context) throws PersistenceException; 60 61 /** 62 * rollbacks a transactional context. The call to the prepare method is 63 * required. 64 * @param context 65 * @throws PersistenceException if an error raised during the rollback 66 * operation, or if the context is not a transactional context. 67 */ 68 void rollback(TransactionalWorkingSet context) throws PersistenceException; 69 } 70