/***************************************
* *
* JBoss: The OpenSource J2EE WebOS *
* *
* Distributable under LGPL license. *
* See terms of license at gnu.org. *
* *
***************************************/
package org.jboss.proxy.ejb;
import java.rmi.RemoteException;
import java.util.Properties;
import javax.ejb.EJBHome;
import javax.ejb.HomeHandle;
import javax.rmi.PortableRemoteObject;
import org.jboss.iiop.CorbaORB;
/**
* A CORBA-based EJB home handle implementation.
*
* @author Rickard Öberg.
* @author Jason Dillon
* @author Francisco Reverbel
* @version $Revision: 1.1.2.1 $
*/
public class HomeHandleImplIIOP
implements HomeHandle
{
/**
* This handle encapsulates an stringfied CORBA reference for an
* EJBHome.
*/
private String ior;
/**
* Constructs a HomeHandleImplIIOP.
*
* @param ior An stringfied CORBA reference for an EJBHome.
*/
public HomeHandleImplIIOP(String ior)
{
this.ior = ior;
}
/**
* Constructs a HomeHandleImplIIOP.
*
* @param home An EJBHome.
*/
public HomeHandleImplIIOP(EJBHome home)
{
this((org.omg.CORBA.Object)home);
}
/**
* Constructs a HomeHandleImplIIOP.
*
* @param home A CORBA reference for an EJBHome.
*/
public HomeHandleImplIIOP(org.omg.CORBA.Object home)
{
this.ior = CorbaORB.getInstance().object_to_string(home);
}
// Public --------------------------------------------------------
// Handle implementation -----------------------------------------
/**
* Obtains the EJBHome represented by this home handle.
*
* @return a reference to an EJBHome.
*
* @throws RemoteException
*/
public EJBHome getEJBHome()
throws RemoteException
{
try
{
return (EJBHome)PortableRemoteObject.narrow(
CorbaORB.getInstance().string_to_object(ior),
EJBHome.class);
}
catch (Exception e)
{
throw new RemoteException("Could not get EJBHome from HomeHandle");
}
}
}