1 28 package org.objectweb.carol.jtests.conform.basic.server; 29 30 import java.rmi.RemoteException ; 31 32 import javax.naming.InitialContext ; 33 import javax.rmi.PortableRemoteObject ; 34 35 40 public class BasicMultiObject extends PortableRemoteObject implements BasicMultiObjectItf { 41 42 46 public BasicMultiObject() throws RemoteException { 47 super(); 48 } 49 50 56 public String getMultiString() throws RemoteException { 57 try { 58 String basicName = "basicname"; 60 InitialContext ic = new InitialContext (); 61 BasicObjectItf ob = (BasicObjectItf) PortableRemoteObject 62 .narrow(ic.lookup(basicName), BasicObjectItf.class); 63 64 return "multi string call: " + ob.getString(); 65 } catch (Exception e) { 66 e.printStackTrace(); 67 throw new RemoteException ("" + e); 68 } 69 } 70 71 76 public BasicObjectItf getBasicObject() throws RemoteException { 77 try { 78 String basicName = "basicname"; 80 InitialContext ic = new InitialContext (); 81 return (BasicObjectItf) PortableRemoteObject.narrow(ic.lookup(basicName), BasicObjectItf.class); 82 83 } catch (Exception e) { 84 e.printStackTrace(); 85 throw new RemoteException ("" + e); 86 } 87 } 88 89 94 public String getBasicRefString() throws RemoteException { 95 try { 96 String basicRefName = "basicrefname"; 98 InitialContext ic = new InitialContext (); 99 return ((BasicObjectRef) PortableRemoteObject.narrow(ic.lookup(basicRefName), BasicObjectRef.class)) 100 .toString(); 101 } catch (Exception e) { 102 throw new RemoteException ("" + e); 103 } 104 } 105 106 } | Popular Tags |