Search in sources :

Example 1 with RemoteBusinessWrapperBase

use of com.sun.ejb.containers.RemoteBusinessWrapperBase in project Payara by payara.

the class EJBUtils method resolveEjbRefObject.

public static Object resolveEjbRefObject(EjbReferenceDescriptor refDesc, Object jndiObj) throws NamingException {
    Object returnObject = jndiObj;
    if (refDesc.isLocal()) {
        EjbDescriptor target = refDesc.getEjbDescriptor();
        BaseContainer container = EjbContainerUtilImpl.getInstance().getContainer(target.getUniqueId());
        if (refDesc.isEJB30ClientView()) {
            GenericEJBLocalHome genericLocalHome = container.getEJBLocalBusinessHome(refDesc.getEjbInterface());
            returnObject = genericLocalHome.create(refDesc.getEjbInterface());
        } else {
            returnObject = container.getEJBLocalHome();
        }
    } else {
        if (refDesc.isEJB30ClientView() && !(jndiObj instanceof RemoteBusinessWrapperBase)) {
            returnObject = EJBUtils.lookupRemote30BusinessObject(jndiObj, refDesc.getEjbInterface());
        }
    }
    return returnObject;
}
Also used : BaseContainer(com.sun.ejb.containers.BaseContainer) GenericEJBLocalHome(com.sun.ejb.containers.GenericEJBLocalHome) RemoteBusinessWrapperBase(com.sun.ejb.containers.RemoteBusinessWrapperBase) PortableRemoteObject(javax.rmi.PortableRemoteObject) EjbDescriptor(com.sun.enterprise.deployment.EjbDescriptor)

Example 2 with RemoteBusinessWrapperBase

use of com.sun.ejb.containers.RemoteBusinessWrapperBase in project Payara by payara.

the class EJBUtils method createRemoteBusinessObject.

public static RemoteBusinessWrapperBase createRemoteBusinessObject(ClassLoader loader, String businessInterface, java.rmi.Remote delegate) throws Exception {
    String wrapperClassName = EJBUtils.getGeneratedRemoteWrapperName(businessInterface);
    Class clientWrapperClass = loader.loadClass(wrapperClassName);
    Constructor[] ctors = clientWrapperClass.getConstructors();
    Constructor ctor = null;
    for (Constructor next : ctors) {
        if (next.getParameterTypes().length > 0) {
            ctor = next;
            break;
        }
    }
    Object obj = ctor.newInstance(new Object[] { delegate, businessInterface });
    return (RemoteBusinessWrapperBase) obj;
}
Also used : RemoteBusinessWrapperBase(com.sun.ejb.containers.RemoteBusinessWrapperBase) PortableRemoteObject(javax.rmi.PortableRemoteObject)

Example 3 with RemoteBusinessWrapperBase

use of com.sun.ejb.containers.RemoteBusinessWrapperBase in project Payara by payara.

the class SerializableS1ASEJBObjectReference method replaceObject.

/**
 * This code is needed to serialize non-Serializable objects that
 * can be part of a bean's state. See EJB2.0 section 7.4.1.
 */
public Object replaceObject(Object obj) throws IOException {
    Object result = obj;
    // Until we've identified a remote object, we can't assume the orb is
    // available in the container.  If the orb is not present, this will be null.
    ProtocolManager protocolMgr = getProtocolManager();
    if (obj instanceof RemoteBusinessWrapperBase) {
        result = getRemoteBusinessObjectFactory((RemoteBusinessWrapperBase) obj);
    } else if ((protocolMgr != null) && protocolMgr.isStub(obj) && protocolMgr.isLocal(obj)) {
        org.omg.CORBA.Object target = (org.omg.CORBA.Object) obj;
        // If we're here, it's always for the 2.x RemoteHome view.
        // There is no remote business wrapper class.
        result = getSerializableEJBReference(target, protocolMgr, null);
    }
    return result;
}
Also used : RemoteBusinessWrapperBase(com.sun.ejb.containers.RemoteBusinessWrapperBase) ProtocolManager(org.glassfish.enterprise.iiop.api.ProtocolManager)

Aggregations

RemoteBusinessWrapperBase (com.sun.ejb.containers.RemoteBusinessWrapperBase)3 PortableRemoteObject (javax.rmi.PortableRemoteObject)2 BaseContainer (com.sun.ejb.containers.BaseContainer)1 GenericEJBLocalHome (com.sun.ejb.containers.GenericEJBLocalHome)1 EjbDescriptor (com.sun.enterprise.deployment.EjbDescriptor)1 ProtocolManager (org.glassfish.enterprise.iiop.api.ProtocolManager)1