1 17 18 package org.objectweb.jac.core.dist.rmi; 19 20 import java.io.Serializable ; 21 import java.rmi.RemoteException ; 22 import org.apache.log4j.Logger; 23 import org.objectweb.jac.core.dist.RemoteContainer; 24 import org.objectweb.jac.core.dist.RemoteRef; 25 26 48 49 public class RMIRemoteContainerStub 50 extends RemoteContainer implements Serializable 51 { 52 static Logger logger = Logger.getLogger("dist.rmi"); 53 54 57 58 protected RMIRemoteContainerInterf delegate; 59 60 61 67 68 public RMIRemoteContainerStub(RMIRemoteContainerInterf delegate, 69 String name) 70 { 71 this.delegate = delegate; 72 this.name = name; 73 } 74 75 76 88 89 public int instantiates(String name, String className, Object [] args, 90 String [] fields, byte[] state, 91 byte[] collaboration) 92 { 93 logger.debug(this.name+".instantiates("+name+")"); 94 try { 95 return delegate.instantiates(name, className, args, fields, state, 96 collaboration); 97 } catch (RemoteException e) { 98 e.printStackTrace(); 99 } 100 101 return 0; 102 } 103 104 105 113 114 public void copy(String name, int index, String [] fields, byte[] state, 115 byte[] collaboration) { 116 117 try { 118 delegate.copy( name, index, fields, state, collaboration ); 119 } catch(RemoteException e) { 120 e.printStackTrace(); 121 } 122 } 123 124 125 136 137 public byte[] invoke(int index, String methodName, 138 byte[] methodArgs, byte[] collaboration) { 139 140 try { 141 return delegate.invoke(index, methodName, methodArgs, collaboration); 142 } catch(RemoteException e) { 143 e.printStackTrace(); 144 } 145 146 return null; 147 } 148 149 public byte[] invokeRoleMethod(int index, 150 String methodName, 151 byte[] methodArgs, 152 byte[] collaboration) 153 { 154 try { 155 return delegate.invokeRoleMethod(index,methodName, 156 methodArgs,collaboration); 157 } catch(RemoteException e) { 158 e.printStackTrace(); 159 } 160 return null; 161 } 162 163 public byte[] getByteCodeFor(String className) { 164 try { 165 return delegate.getByteCodeFor(className); 166 } catch(RemoteException e) { 167 e.printStackTrace(); 168 } 169 return null; 170 } 171 172 175 176 public RemoteRef bindTo(String name) { 177 RemoteRef result=null; 178 try { 179 logger.debug("binding to "+name+" (delegate="+delegate+")"); 180 result=delegate.bindTo( name ); 181 logger.debug("result is "+result); 182 } catch(RemoteException e) { 183 e.printStackTrace(); 184 } 185 return result; 186 } 187 188 189 211 } 212 | Popular Tags |