1 4 package org.objectweb.jotm; 5 6 import java.io.Serializable ; 7 import java.rmi.Remote ; 8 import java.rmi.RemoteException ; 9 import java.rmi.UnexpectedException ; 10 import javax.rmi.CORBA.Stub ; 11 import javax.rmi.CORBA.Util ; 12 import org.omg.CORBA.ORB ; 13 import org.omg.CORBA.SystemException ; 14 import org.omg.CORBA.portable.ApplicationException ; 15 import org.omg.CORBA.portable.InputStream ; 16 import org.omg.CORBA.portable.OutputStream ; 17 import org.omg.CORBA.portable.RemarshalException ; 18 import org.omg.CORBA.portable.ResponseHandler ; 19 import org.omg.CORBA.portable.ServantObject ; 20 21 22 public class _Resource_Stub extends Stub implements Resource { 23 24 private static final String [] _type_ids = { 25 "RMI:org.objectweb.jotm.Resource:0000000000000000" 26 }; 27 28 public String [] _ids() { 29 return _type_ids; 30 } 31 32 public int prepare() throws RemoteException { 33 if (!Util.isLocal(this)) { 34 try { 35 org.omg.CORBA.portable.InputStream in = null; 36 try { 37 OutputStream out = _request("prepare", true); 38 in = _invoke(out); 39 return in.read_long(); 40 } catch (ApplicationException ex) { 41 in = ex.getInputStream(); 42 String id = in.read_string(); 43 throw new UnexpectedException (id); 44 } catch (RemarshalException ex) { 45 return prepare(); 46 } finally { 47 _releaseReply(in); 48 } 49 } catch (SystemException ex) { 50 throw Util.mapSystemException(ex); 51 } 52 } else { 53 ServantObject so = _servant_preinvoke("prepare",Resource.class); 54 if (so == null) { 55 return prepare(); 56 } 57 try { 58 return ((Resource)so.servant).prepare(); 59 } catch (Throwable ex) { 60 Throwable exCopy = (Throwable )Util.copyObject(ex,_orb()); 61 throw Util.wrapException(exCopy); 62 } finally { 63 _servant_postinvoke(so); 64 } 65 } 66 } 67 68 public void rollback() throws RemoteException { 69 if (!Util.isLocal(this)) { 70 try { 71 org.omg.CORBA.portable.InputStream in = null; 72 try { 73 OutputStream out = _request("rollback", true); 74 _invoke(out); 75 } catch (ApplicationException ex) { 76 in = ex.getInputStream(); 77 String id = in.read_string(); 78 throw new UnexpectedException (id); 79 } catch (RemarshalException ex) { 80 rollback(); 81 } finally { 82 _releaseReply(in); 83 } 84 } catch (SystemException ex) { 85 throw Util.mapSystemException(ex); 86 } 87 } else { 88 ServantObject so = _servant_preinvoke("rollback",Resource.class); 89 if (so == null) { 90 rollback(); 91 return ; 92 } 93 try { 94 ((Resource)so.servant).rollback(); 95 } catch (Throwable ex) { 96 Throwable exCopy = (Throwable )Util.copyObject(ex,_orb()); 97 throw Util.wrapException(exCopy); 98 } finally { 99 _servant_postinvoke(so); 100 } 101 } 102 } 103 104 public void commit() throws RemoteException { 105 if (!Util.isLocal(this)) { 106 try { 107 org.omg.CORBA.portable.InputStream in = null; 108 try { 109 OutputStream out = _request("commit", true); 110 _invoke(out); 111 } catch (ApplicationException ex) { 112 in = ex.getInputStream(); 113 String id = in.read_string(); 114 throw new UnexpectedException (id); 115 } catch (RemarshalException ex) { 116 commit(); 117 } finally { 118 _releaseReply(in); 119 } 120 } catch (SystemException ex) { 121 throw Util.mapSystemException(ex); 122 } 123 } else { 124 ServantObject so = _servant_preinvoke("commit",Resource.class); 125 if (so == null) { 126 commit(); 127 return ; 128 } 129 try { 130 ((Resource)so.servant).commit(); 131 } catch (Throwable ex) { 132 Throwable exCopy = (Throwable )Util.copyObject(ex,_orb()); 133 throw Util.wrapException(exCopy); 134 } finally { 135 _servant_postinvoke(so); 136 } 137 } 138 } 139 140 public void commit_one_phase() throws RemoteException { 141 if (!Util.isLocal(this)) { 142 try { 143 org.omg.CORBA.portable.InputStream in = null; 144 try { 145 OutputStream out = _request("commit_one_phase", true); 146 _invoke(out); 147 } catch (ApplicationException ex) { 148 in = ex.getInputStream(); 149 String id = in.read_string(); 150 throw new UnexpectedException (id); 151 } catch (RemarshalException ex) { 152 commit_one_phase(); 153 } finally { 154 _releaseReply(in); 155 } 156 } catch (SystemException ex) { 157 throw Util.mapSystemException(ex); 158 } 159 } else { 160 ServantObject so = _servant_preinvoke("commit_one_phase",Resource.class); 161 if (so == null) { 162 commit_one_phase(); 163 return ; 164 } 165 try { 166 ((Resource)so.servant).commit_one_phase(); 167 } catch (Throwable ex) { 168 Throwable exCopy = (Throwable )Util.copyObject(ex,_orb()); 169 throw Util.wrapException(exCopy); 170 } finally { 171 _servant_postinvoke(so); 172 } 173 } 174 } 175 176 public void forget() throws RemoteException { 177 if (!Util.isLocal(this)) { 178 try { 179 org.omg.CORBA.portable.InputStream in = null; 180 try { 181 OutputStream out = _request("forget", true); 182 _invoke(out); 183 } catch (ApplicationException ex) { 184 in = ex.getInputStream(); 185 String id = in.read_string(); 186 throw new UnexpectedException (id); 187 } catch (RemarshalException ex) { 188 forget(); 189 } finally { 190 _releaseReply(in); 191 } 192 } catch (SystemException ex) { 193 throw Util.mapSystemException(ex); 194 } 195 } else { 196 ServantObject so = _servant_preinvoke("forget",Resource.class); 197 if (so == null) { 198 forget(); 199 return ; 200 } 201 try { 202 ((Resource)so.servant).forget(); 203 } catch (Throwable ex) { 204 Throwable exCopy = (Throwable )Util.copyObject(ex,_orb()); 205 throw Util.wrapException(exCopy); 206 } finally { 207 _servant_postinvoke(so); 208 } 209 } 210 } 211 } 212 | Popular Tags |