01: // You can redistribute this software and/or modify it under the terms of
02: // the Ozone Library License version 1 published by ozone-db.org.
03: //
04: // The original code and portions created by SMB are
05: // Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.
06: //
07: // $Id: OzoneUserTransaction.java,v 1.1 2001/12/18 10:31:31 per_nyfelt Exp $
08:
09: package org.ozoneDB.xa;
10:
11: import java.rmi.*;
12: import org.ozoneDB.*;
13: import javax.transaction.*;
14: import javax.naming.*;
15:
16: /**
17: * The UserTransaction interface defines the methods that allow an application
18: * to explicitly manage transaction boundaries.
19: *
20: *
21: * @author <a href="http://www.softwarebuero.de/">SMB</a>
22: * @version $Revision: 1.1 $Date: 2001/12/18 10:31:31 $
23: */
24: public final class OzoneUserTransaction implements UserTransaction {
25:
26: /**
27: * Holds a reference to the underlying transaction manager.
28: */
29: private static TransactionManager txManager;
30:
31: public void setTransactionManager(TransactionManager _txManager) {
32: txManager = _txManager;
33: }
34:
35: public OzoneUserTransaction() {
36: }
37:
38: public void begin() throws NotSupportedException, SystemException {
39: // The logic for user transaction is to never support nested
40: // transactions, regardless of what the transaction server
41: // can do.
42: if (txManager.getTransaction() != null) {
43: throw new NotSupportedException(
44: "Nested transactions not supported in beans");
45: }
46: txManager.begin();
47: }
48:
49: public void commit() throws RollbackException,
50: HeuristicMixedException, HeuristicRollbackException,
51: SecurityException, IllegalStateException, SystemException {
52: txManager.commit();
53: }
54:
55: public void rollback() throws IllegalStateException,
56: SecurityException, SystemException {
57: txManager.rollback();
58: }
59:
60: public int getStatus() throws SystemException {
61: return txManager.getStatus();
62: }
63:
64: public void setRollbackOnly() throws SystemException {
65: txManager.setRollbackOnly();
66: }
67:
68: public void setTransactionTimeout(int seconds)
69: throws SystemException {
70: txManager.setTransactionTimeout(seconds);
71: }
72:
73: }
|