1 26 27 package org.objectweb.openccm.plugins.transaction.controller; 28 29 import org.objectweb.openccm.corba.TheORB; 30 31 39 public abstract class WithCurrentController 40 extends org.omg.CORBA.LocalObject 41 implements org.objectweb.openccm.Containers.CallController 42 { 43 49 53 protected org.omg.CosTransactions.Current current_; 54 55 59 protected boolean private_transaction_; 60 61 67 71 public 72 WithCurrentController() 73 { 74 current_ = null; 75 private_transaction_ = false; 76 try 77 { 78 org.omg.CORBA.Object _obj = TheORB.getORB().resolve_initial_references("TransactionCurrent"); 79 current_ = org.omg.CosTransactions.CurrentHelper.narrow( _obj ); 80 } 81 catch (org.omg.CORBA.ORBPackage.InvalidName ex) 82 { 83 } 84 } 85 86 92 97 protected boolean 98 no_transaction(org.objectweb.openccm.Containers.CallContext ctx) 99 { 100 return current_.get_status() == org.omg.CosTransactions.Status.StatusNoTransaction; 101 } 102 103 107 protected void 108 begin(org.objectweb.openccm.Containers.CallContext ctx) 109 { 110 try 111 { 112 current_.begin(); 113 private_transaction_ = true; 114 } 115 catch (org.omg.CosTransactions.SubtransactionsUnavailable ex) 116 { 117 } 118 } 122 123 128 protected void 129 commit(org.objectweb.openccm.Containers.CallContext ctx) 130 { 131 if (private_transaction_) 132 { 133 try 134 { 135 current_.commit(false); 136 private_transaction_ = false; 137 } catch(org.omg.CosTransactions.NoTransaction ex) { 138 } catch(org.omg.CosTransactions.HeuristicMixed ex) { 139 } catch(org.omg.CosTransactions.HeuristicHazard ex) { 140 } 141 } 142 } 146 147 153 159 165 public abstract void 166 preinvoke(org.objectweb.openccm.Containers.CallContext ctx); 167 168 174 public abstract void 175 postinvoke(org.objectweb.openccm.Containers.CallContext ctx); 176 177 183 189 195 public abstract void 196 configure(org.objectweb.openccm.Containers.PropertySet config) 197 throws org.objectweb.openccm.Containers.ConfigurationFailed; 198 } 199 | Popular Tags |