1 22 package org.jboss.tm.iiop.wrapper; 23 24 import java.rmi.RemoteException ; 25 26 import org.jboss.iiop.CorbaORB; 27 import org.jboss.tm.remoting.interfaces.RecoveryCoordinator; 28 import org.jboss.tm.remoting.interfaces.Resource; 29 import org.jboss.tm.remoting.interfaces.Status; 30 import org.jboss.tm.remoting.interfaces.TransactionNotPreparedException; 31 32 40 public class OTSRecoveryCoordinatorWrapper implements RecoveryCoordinator 41 { 42 44 47 private org.omg.CosTransactions.RecoveryCoordinator otsRecoveryCoordinator; 48 49 51 56 public OTSRecoveryCoordinatorWrapper( 57 org.omg.CosTransactions.RecoveryCoordinator otsRecoveryCoordinator) 58 { 59 this.otsRecoveryCoordinator = otsRecoveryCoordinator; 60 } 61 62 64 public org.omg.CosTransactions.RecoveryCoordinator getWrappedRecoveryCoordinator() 65 { 66 return otsRecoveryCoordinator; 67 } 68 69 71 public String toString() 72 { 73 return CorbaORB.getInstance().object_to_string(otsRecoveryCoordinator); 74 } 75 76 78 public static OTSRecoveryCoordinatorWrapper fromString(String s) 79 { 80 org.omg.CORBA.Object obj = CorbaORB.getInstance().string_to_object(s); 81 org.omg.CosTransactions.RecoveryCoordinator otsRecCoord = 82 org.omg.CosTransactions.RecoveryCoordinatorHelper.narrow(obj); 83 return new OTSRecoveryCoordinatorWrapper(otsRecCoord); 84 } 85 86 88 92 public Status replayCompletion(Resource r) throws RemoteException , 93 TransactionNotPreparedException 94 { 95 try 96 { 97 org.omg.CosTransactions.Resource otsResource = 98 ((OTSResourceWrapper) r).getWrappedResource(); 99 return Util.cosTransactionsToJBoss( 100 otsRecoveryCoordinator.replay_completion(otsResource)); 101 } 102 catch (org.omg.CosTransactions.NotPrepared np) 103 { 104 throw new TransactionNotPreparedException(); 105 } 106 catch (org.omg.CORBA.SystemException se) 107 { 108 throw javax.rmi.CORBA.Util.mapSystemException(se); 109 } 110 111 } 112 113 } 114 | Popular Tags |