1 package com.daffodilwoods.rmi; 2 3 import com.daffodilwoods.rmi.interfaces._RmiDXAResource; 4 import com.daffodilwoods.daffodildb.server.serversystem._Connection; 5 import javax.transaction.xa.Xid ; 6 import java.util.Properties ; 7 import javax.transaction.xa.XAException ; 8 import com.daffodilwoods.daffodildb.server.serversystem._DXAResource; 9 import java.rmi.RemoteException ; 10 import com.daffodilwoods.database.utility.P; 11 import com.daffodilwoods.rmi.interfaces._RmiConnection; 12 13 14 public class RmiDXAResource implements _DXAResource { 15 _RmiDXAResource dxaResource_Interface; 16 17 public RmiDXAResource(_RmiDXAResource dxaResource0){ 18 dxaResource_Interface = dxaResource0; 19 } 20 21 public _Connection start(Xid xid, int flags, Properties prop) throws XAException { 22 try { 23 xid = getServerXID(xid); 24 return new RmiConnection(dxaResource_Interface.start(xid,flags,prop)); 25 } 26 catch (RemoteException re) { 27 throw new RuntimeException (re.getMessage()); 28 } 29 } 30 public void end(Xid xid, int flags) throws XAException { 31 try { 32 xid = getServerXID(xid); 33 dxaResource_Interface.end(xid,flags); 34 } 35 catch (RemoteException re) { 36 throw new RuntimeException (re.getMessage()); 37 } 38 } 39 public void forget(Xid xid) throws XAException { 40 try { 41 xid = getServerXID(xid); 42 dxaResource_Interface.forget(xid); 43 } 44 catch (RemoteException re) { 45 throw new RuntimeException (re.getMessage()); 46 } 47 } 48 public void commit(Xid xid) throws XAException { 49 try { 50 xid = getServerXID(xid); 51 dxaResource_Interface.commit(xid); 52 } 53 catch (RemoteException re) { 54 throw new RuntimeException (re.getMessage()); 55 } 56 } 57 public int prepare(Xid xid) throws XAException { 58 try { 59 xid = getServerXID(xid); 60 return dxaResource_Interface.prepare(xid); 61 } 62 catch (RemoteException re) { 63 throw new RuntimeException (re.getMessage()); 64 } 65 } 66 public int makePersistent(Xid xid) throws XAException { 67 try { 68 xid = getServerXID(xid); 69 return dxaResource_Interface.makePersistent(xid); 70 } 71 catch (RemoteException re) { 72 throw new RuntimeException (re.getMessage()); 73 } 74 } 75 public void rollback(Xid xid) throws XAException { 76 try { 77 xid = getServerXID(xid); 78 dxaResource_Interface.rollback(xid); 79 } 80 catch (RemoteException re) { 81 throw new RuntimeException (re.getMessage()); 82 } 83 } 84 85 private Xid getServerXID(Xid xid){ 86 return xid; } 88 public boolean inGlobalTransaction() { 89 try { 90 return dxaResource_Interface.inGlobalTransaction(); 91 } 92 catch (RemoteException ex) { 93 return false; 94 } 95 } 96 public void close() { 97 try { 98 dxaResource_Interface.close(); 99 } 100 catch (RemoteException ex) { 101 } 102 } 103 } 104 105 168 | Popular Tags |