Search in sources :

Example 1 with Tie

use of javax.rmi.CORBA.Tie in project Payara by payara.

the class POAProtocolMgr method validateTargetObjectInterfaces.

@Override
public void validateTargetObjectInterfaces(Remote targetObj) {
    if (targetObj != null) {
        // All Remote interfaces implemented by targetObj will be
        // validated as a side-effect of calling setTarget().
        // A runtime exception will be propagated if validation fails.
        Tie tie = presentationMgr.getTie();
        tie.setTarget(targetObj);
    } else {
        throw new IllegalArgumentException("null passed to validateTargetObjectInterfaces");
    }
}
Also used : Tie(javax.rmi.CORBA.Tie)

Example 2 with Tie

use of javax.rmi.CORBA.Tie in project Payara by payara.

the class RemoteObject method exportObject.

protected void exportObject(java.rmi.Remote remote) throws java.rmi.RemoteException {
    // create servant and tie
    PortableRemoteObject.exportObject(remote);
    Tie servantsTie = javax.rmi.CORBA.Util.getTie(remote);
    // Note: at this point the Tie doesnt have a delegate inside it,
    // so it is not really "exported".
    // The following call does orb.connect() which is the real exporting
    servantsTie.orb(orb);
}
Also used : Tie(javax.rmi.CORBA.Tie)

Example 3 with Tie

use of javax.rmi.CORBA.Tie in project tomee by apache.

the class Corbas method toStub.

public static Object toStub(final Object obj) throws IOException {
    final Tie tie = javax.rmi.CORBA.Util.getTie((Remote) obj);
    if (tie == null) {
        throw new IOException("Unable to serialize PortableRemoteObject; object has not been exported: " + obj);
    }
    final ORB orb = getORB();
    tie.orb(orb);
    return PortableRemoteObject.toStub((Remote) obj);
}
Also used : Tie(javax.rmi.CORBA.Tie) IOException(java.io.IOException) ORB(org.omg.CORBA.ORB)

Example 4 with Tie

use of javax.rmi.CORBA.Tie in project Payara by payara.

the class POARemoteReferenceFactory method preinvoke.

/**
 * This is the implementation of ServantLocator.preinvoke()
 * It is called from the POA before every remote invocation.
 * Return a POA Servant (which is the RMI/IIOP Tie for EJBObject/EJBHome).
 * @param ejbKey
 * @param cookieHolder
 */
@Override
public Servant preinvoke(byte[] ejbKey, POA adapter, String operation, CookieHolder cookieHolder) throws org.omg.PortableServer.ForwardRequest {
    if (logger.isLoggable(Level.FINE)) {
        logger.log(Level.FINE, "In preinvoke for operation:{0}", operation);
    }
    // get instance key
    int keyLen = Utility.bytesToInt(ejbKey, INSTANCEKEYLEN_OFFSET);
    byte[] instanceKey = new byte[keyLen];
    System.arraycopy(ejbKey, INSTANCEKEY_OFFSET, instanceKey, 0, keyLen);
    Servant servant = null;
    try {
        while (servant == null) {
            // get the EJBObject / EJBHome
            Remote targetObj = container.getTargetObject(instanceKey, (isRemoteHomeView ? null : remoteBusinessIntf));
            // the looping logic the same as it has always been.
            if (targetObj != null) {
                // get the Tie which is the POA Servant
                // fix for bug 6484935
                @SuppressWarnings("unchecked") Tie tie = (Tie) AccessController.doPrivileged(new PrivilegedAction() {

                    @Override
                    public Tie run() {
                        return presentationMgr.getTie();
                    }
                });
                tie.setTarget(targetObj);
                servant = (Servant) tie;
            }
        }
    } catch (NoSuchObjectLocalException e) {
        logger.log(Level.SEVERE, "iiop.gettie_exception", e);
        throw new OBJECT_NOT_EXIST(GET_TIE_EXCEPTION_CODE, CompletionStatus.COMPLETED_NO);
    } catch (RuntimeException e) {
        logger.log(Level.SEVERE, "iiop.runtime_exception", e);
        throw e;
    }
    return servant;
}
Also used : NoSuchObjectLocalException(javax.ejb.NoSuchObjectLocalException) Tie(javax.rmi.CORBA.Tie) OBJECT_NOT_EXIST(org.omg.CORBA.OBJECT_NOT_EXIST) PrivilegedAction(java.security.PrivilegedAction) Remote(java.rmi.Remote) Servant(org.omg.PortableServer.Servant)

Example 5 with Tie

use of javax.rmi.CORBA.Tie in project Payara by payara.

the class RemoteObject method exportObject.

protected void exportObject(Remote remote) throws RemoteException {
    // create servant and tie
    PortableRemoteObject.exportObject(remote);
    Tie servantsTie = javax.rmi.CORBA.Util.getTie(remote);
    // Note: at this point the Tie doesnt have a delegate inside it,
    // so it is not really "exported".
    // The following call does orb.connect() which is the real exporting
    servantsTie.orb(orb);
}
Also used : Tie(javax.rmi.CORBA.Tie)

Aggregations

Tie (javax.rmi.CORBA.Tie)5 IOException (java.io.IOException)1 Remote (java.rmi.Remote)1 PrivilegedAction (java.security.PrivilegedAction)1 NoSuchObjectLocalException (javax.ejb.NoSuchObjectLocalException)1 OBJECT_NOT_EXIST (org.omg.CORBA.OBJECT_NOT_EXIST)1 ORB (org.omg.CORBA.ORB)1 Servant (org.omg.PortableServer.Servant)1