1 4 package org.objectweb.jotm; 5 6 import java.io.Serializable ; 7 import java.rmi.Remote ; 8 import java.rmi.RemoteException ; 9 import javax.rmi.CORBA.Tie ; 10 import javax.rmi.CORBA.Util ; 11 import javax.rmi.PortableRemoteObject ; 12 import org.omg.CORBA.BAD_OPERATION ; 13 import org.omg.CORBA.ORB ; 14 import org.omg.CORBA.SystemException ; 15 import org.omg.CORBA.portable.InputStream ; 16 import org.omg.CORBA.portable.OutputStream ; 17 import org.omg.CORBA.portable.ResponseHandler ; 18 import org.omg.CORBA.portable.UnknownException ; 19 import org.omg.CORBA_2_3.portable.ObjectImpl ; 20 21 22 public class _ControlImpl_Tie extends ObjectImpl implements Tie { 23 24 private ControlImpl target = null; 25 26 private static final String [] _type_ids = { 27 "RMI:org.objectweb.jotm.ControlImpl:0000000000000000", 28 "RMI:org.objectweb.jotm.Control:0000000000000000", 29 "RMI:org.objectweb.jotm.Resource:0000000000000000", 30 "RMI:org.objectweb.jotm.Coordinator:0000000000000000", 31 "RMI:org.objectweb.jotm.Terminator:0000000000000000", 32 "RMI:org.objectweb.jotm.RecoveryCoordinator:0000000000000000" 33 }; 34 35 public void setTarget(Remote target) { 36 this.target = (ControlImpl) target; 37 } 38 39 public Remote getTarget() { 40 return target; 41 } 42 43 public org.omg.CORBA.Object thisObject() { 44 return this; 45 } 46 47 public void deactivate() { 48 _orb().disconnect(this); 49 _set_delegate(null); 50 target = null; 51 } 52 53 public ORB orb() { 54 return _orb(); 55 } 56 57 public void orb(ORB orb) { 58 orb.connect(this); 59 } 60 61 public String [] _ids() { 62 return _type_ids; 63 } 64 65 public OutputStream _invoke(String method, InputStream _in, ResponseHandler reply) throws SystemException { 66 try { 67 org.omg.CORBA_2_3.portable.InputStream in = 68 (org.omg.CORBA_2_3.portable.InputStream ) _in; 69 switch (method.length()) { 70 case 6: 71 if (method.equals("forget")) { 72 target.forget(); 73 OutputStream out = reply.createReply(); 74 return out; 75 } 76 case 7: 77 if (method.equals("prepare")) { 78 int result = target.prepare(); 79 OutputStream out = reply.createReply(); 80 out.write_long(result); 81 return out; 82 } 83 case 8: 84 if (method.equals("rollback")) { 85 target.rollback(); 86 OutputStream out = reply.createReply(); 87 return out; 88 } else if (method.equals("commit__")) { 89 target.commit(); 90 OutputStream out = reply.createReply(); 91 return out; 92 } 93 case 13: 94 if (method.equals("_get_J_status")) { 95 int result = target.get_status(); 96 OutputStream out = reply.createReply(); 97 out.write_long(result); 98 return out; 99 } else if (method.equals("rollback_only")) { 100 target.rollback_only(); 101 OutputStream out = reply.createReply(); 102 return out; 103 } 104 case 15: 105 if (method.equals("commit__boolean")) { 106 boolean arg0 = in.read_boolean(); 107 target.commit(arg0); 108 OutputStream out = reply.createReply(); 109 return out; 110 } 111 case 16: 112 if (method.equals("commit_one_phase")) { 113 target.commit_one_phase(); 114 OutputStream out = reply.createReply(); 115 return out; 116 } 117 case 17: 118 if (method.equals("register_resource")) { 119 Resource arg0 = (Resource) PortableRemoteObject.narrow(in.read_Object(), Resource.class); 120 RecoveryCoordinator result = target.register_resource(arg0); 121 OutputStream out = reply.createReply(); 122 Util.writeRemoteObject(out,result); 123 return out; 124 } else if (method.equals("replay_completion")) { 125 Resource arg0 = (Resource) PortableRemoteObject.narrow(in.read_Object(), Resource.class); 126 int result = target.replay_completion(arg0); 127 OutputStream out = reply.createReply(); 128 out.write_long(result); 129 return out; 130 } else if (method.equals("_get_J_terminator")) { 131 Terminator result = target.get_terminator(); 132 OutputStream out = reply.createReply(); 133 Util.writeRemoteObject(out,result); 134 return out; 135 } 136 case 18: 137 if (method.equals("_get_J_coordinator")) { 138 Coordinator result = target.get_coordinator(); 139 OutputStream out = reply.createReply(); 140 Util.writeRemoteObject(out,result); 141 return out; 142 } 143 case 19: 144 if (method.equals("is_same_transaction")) { 145 Coordinator arg0 = (Coordinator) PortableRemoteObject.narrow(in.read_Object(), Coordinator.class); 146 boolean result = target.is_same_transaction(arg0); 147 OutputStream out = reply.createReply(); 148 out.write_boolean(result); 149 return out; 150 } 151 case 23: 152 if (method.equals("_get_J_transaction_name")) { 153 String result = target.get_transaction_name(); 154 org.omg.CORBA_2_3.portable.OutputStream out = 155 (org.omg.CORBA_2_3.portable.OutputStream ) reply.createReply(); 156 out.write_value(result,String .class); 157 return out; 158 } 159 case 24: 160 if (method.equals("register_synchronization")) { 161 RemoteSynchro arg0 = (RemoteSynchro) PortableRemoteObject.narrow(in.read_Object(), RemoteSynchro.class); 162 target.register_synchronization(arg0); 163 OutputStream out = reply.createReply(); 164 return out; 165 } 166 } 167 throw new BAD_OPERATION (); 168 } catch (SystemException ex) { 169 throw ex; 170 } catch (Throwable ex) { 171 throw new UnknownException (ex); 172 } 173 } 174 } 175 | Popular Tags |