1 26 27 package org.objectweb.openccm.plugins.transaction.deployment; 28 29 30 38 public class TransactionManagerImpl 39 implements TransactionManagerLocal 40 { 41 50 protected org.objectweb.ccm.util.Vector transactions_; 51 52 61 public 62 TransactionManagerImpl() 63 { 64 transactions_ = new org.objectweb.ccm.util.Vector (); 65 } 66 67 68 76 protected ResourceManagerLocal 77 create_manager (org.omg.CosTransactions.Coordinator coordinator) 78 { 79 try { 80 ResourceManagerImpl _resource = new ResourceManagerImpl (coordinator, this); 81 transactions_.add (_resource); 82 ResourceManager _res_ref = _resource._this (org.objectweb.openccm.corba.TheORB.getORB()); 83 coordinator.register_resource( _res_ref ); 84 85 return _resource; 86 } catch (org.omg.CosTransactions.Inactive ex) { } 87 return null; 88 } 89 90 96 109 public ResourceManagerLocal 110 getCurrent() 111 { 112 try { 113 org.omg.CORBA.Object _obj = org.objectweb.openccm.corba.TheORB.getORB() 114 .resolve_initial_references("TransactionCurrent"); 115 org.omg.CosTransactions.Current _current = 116 org.omg.CosTransactions.CurrentHelper.narrow( _obj ); 117 org.omg.CosTransactions.Control _control = 118 _current.get_control(); 119 org.omg.CosTransactions.Coordinator _coordinator = 120 _control.get_coordinator(); 121 122 java.util.Iterator _iterator = transactions_.iterator(); 123 124 while (_iterator.hasNext()) { 125 ResourceManagerLocal _resource = (ResourceManagerLocal) _iterator.next (); 126 if ( _coordinator.is_same_transaction( _resource.coordinator() ) ) 127 return _resource; 128 } 129 return create_manager (_coordinator); 130 } catch (org.omg.CORBA.ORBPackage.InvalidName ex) { 131 } catch (org.omg.CosTransactions.Unavailable ex) { 132 } 133 return null; 134 } 135 136 146 public void 147 remove_manager(ResourceManagerLocal ref) 148 throws org.omg.Components.RemoveFailure 149 { 150 transactions_.remove (ref); 151 } 152 } 153 154 155 156 157 158 159 | Popular Tags |