1 22 package org.jboss.proxy.ejb; 23 24 import java.io.IOException ; 25 import java.io.ObjectInputStream ; 26 import java.io.ObjectOutputStream ; 27 import java.rmi.RemoteException ; 28 29 import javax.ejb.EJBHome ; 30 import javax.ejb.HomeHandle ; 31 import javax.ejb.spi.HandleDelegate ; 32 import javax.rmi.PortableRemoteObject ; 33 34 import org.jboss.iiop.CorbaORB; 35 import org.jboss.proxy.ejb.handle.HandleDelegateImpl; 36 37 45 public class HomeHandleImplIIOP 46 implements HomeHandle 47 { 48 52 private String ior; 53 54 59 public HomeHandleImplIIOP(String ior) 60 { 61 this.ior = ior; 62 } 63 64 69 public HomeHandleImplIIOP(EJBHome home) 70 { 71 this((org.omg.CORBA.Object )home); 72 } 73 74 79 public HomeHandleImplIIOP(org.omg.CORBA.Object home) 80 { 81 this.ior = CorbaORB.getInstance().object_to_string(home); 82 } 83 84 86 88 95 public EJBHome getEJBHome() 96 throws RemoteException 97 { 98 try 99 { 100 return (EJBHome )PortableRemoteObject.narrow( 101 CorbaORB.getInstance().string_to_object(ior), 102 EJBHome .class); 103 } 104 catch (Exception e) 105 { 106 throw new RemoteException ("Could not get EJBHome from HomeHandle"); 107 } 108 } 109 110 111 public void writeObject(ObjectOutputStream oostream) throws IOException 112 { 113 HandleDelegate delegate = HandleDelegateImpl.getDelegate(); 114 delegate.writeEJBHome(getEJBHome(), oostream); 115 } 116 117 public void readObject(ObjectInputStream oistream) throws IOException , ClassNotFoundException 118 { 119 HandleDelegate delegate = HandleDelegateImpl.getDelegate(); 120 EJBHome obj = delegate.readEJBHome(oistream); 121 this.ior = CorbaORB.getInstance().object_to_string((org.omg.CORBA.Object ) obj); 122 } 123 } 124 | Popular Tags |