1 /* 2 (c) Copyright 2003, 2004, 2005 Hewlett-Packard Development Company, LP 3 [See end of file] 4 $Id: TransactionHandler.java,v 1.4 2005/02/21 11:51:56 andy_seaborne Exp $ 5 */ 6 7 package com.hp.hpl.jena.graph; 8 9 import com.hp.hpl.jena.shared.*; 10 11 /** 12 Preliminary interface for graphs supporting transactions. 13 14 @author kers 15 */ 16 public interface TransactionHandler 17 { 18 /** 19 Does this handler support transactions at all? 20 21 @return true iff begin/abort/commit are implemented and make sense. 22 */ 23 boolean transactionsSupported(); 24 25 /** 26 If transactions are supported, begin a new transaction. If tranactions are 27 not supported, or they are but this tranaction is nested and nested transactions 28 are not supported, throw an UnsupportedOperationException. 29 */ 30 void begin(); 31 32 /** 33 If transactions are supported and there is a tranaction in progress, abort 34 it. If transactions are not supported, or there is no transaction in progress, 35 throw an UnsupportedOperationException. 36 */ 37 void abort(); 38 39 /** 40 If transactions are supported and there is a tranaction in progress, commit 41 it. If transactions are not supported, , or there is no transaction in progress, 42 throw an UnsupportedOperationException. 43 */ 44 void commit(); 45 46 /** 47 If transactions are supported, execute the command c within a transaction 48 and return its result. If not, throw an UnsupportedOperationException. 49 */ 50 Object executeInTransaction( Command c ); 51 } 52 53 54 /* 55 (c) Copyright 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP 56 All rights reserved. 57 58 Redistribution and use in source and binary forms, with or without 59 modification, are permitted provided that the following conditions 60 are met: 61 62 1. Redistributions of source code must retain the above copyright 63 notice, this list of conditions and the following disclaimer. 64 65 2. Redistributions in binary form must reproduce the above copyright 66 notice, this list of conditions and the following disclaimer in the 67 documentation and/or other materials provided with the distribution. 68 69 3. The name of the author may not be used to endorse or promote products 70 derived from this software without specific prior written permission. 71 72 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 73 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 74 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 75 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 76 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 77 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 78 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 79 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 80 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 81 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 82 */