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 org.omg.CORBA.BAD_OPERATION ; 12 import org.omg.CORBA.ORB ; 13 import org.omg.CORBA.SystemException ; 14 import org.omg.CORBA.portable.InputStream ; 15 import org.omg.CORBA.portable.OutputStream ; 16 import org.omg.CORBA.portable.ResponseHandler ; 17 import org.omg.CORBA.portable.UnknownException ; 18 import org.omg.CORBA_2_3.portable.ObjectImpl ; 19 20 21 public class _SubCoordinator_Tie extends ObjectImpl implements Tie { 22 23 private SubCoordinator target = null; 24 25 private static final String [] _type_ids = { 26 "RMI:org.objectweb.jotm.Resource:0000000000000000" 27 }; 28 29 public void setTarget(Remote target) { 30 this.target = (SubCoordinator) target; 31 } 32 33 public Remote getTarget() { 34 return target; 35 } 36 37 public org.omg.CORBA.Object thisObject() { 38 return this; 39 } 40 41 public void deactivate() { 42 _orb().disconnect(this); 43 _set_delegate(null); 44 target = null; 45 } 46 47 public ORB orb() { 48 return _orb(); 49 } 50 51 public void orb(ORB orb) { 52 orb.connect(this); 53 } 54 55 public String [] _ids() { 56 return _type_ids; 57 } 58 59 public OutputStream _invoke(String method, InputStream _in, ResponseHandler reply) throws SystemException { 60 try { 61 org.omg.CORBA_2_3.portable.InputStream in = 62 (org.omg.CORBA_2_3.portable.InputStream ) _in; 63 switch (method.length()) { 64 case 6: 65 if (method.equals("commit")) { 66 target.commit(); 67 OutputStream out = reply.createReply(); 68 return out; 69 } else if (method.equals("forget")) { 70 target.forget(); 71 OutputStream out = reply.createReply(); 72 return out; 73 } 74 case 7: 75 if (method.equals("prepare")) { 76 int result = target.prepare(); 77 OutputStream out = reply.createReply(); 78 out.write_long(result); 79 return out; 80 } 81 case 8: 82 if (method.equals("rollback")) { 83 target.rollback(); 84 OutputStream out = reply.createReply(); 85 return out; 86 } 87 case 16: 88 if (method.equals("commit_one_phase")) { 89 target.commit_one_phase(); 90 OutputStream out = reply.createReply(); 91 return out; 92 } 93 } 94 throw new BAD_OPERATION (); 95 } catch (SystemException ex) { 96 throw ex; 97 } catch (Throwable ex) { 98 throw new UnknownException (ex); 99 } 100 } 101 } 102 | Popular Tags |