FileDocCategorySizeDatePackage
IIOPHandleDelegate.javaAPI DocGlassfish v2 API5518Fri May 04 22:34:54 BST 2007com.sun.enterprise.iiop

IIOPHandleDelegate

public final class IIOPHandleDelegate extends Object implements javax.ejb.spi.HandleDelegate
An implementation of HandleDelegate for the IIOP Protocol.

Fields Summary
Constructors Summary
Methods Summary
public static javax.ejb.spi.HandleDelegategetHandleDelegate()

        HandleDelegate handleDelegate =
            (HandleDelegate) java.security.AccessController.doPrivileged(
                new java.security.PrivilegedAction() {
                    public Object run()  {
                        try {
                            ClassLoader cl = new HandleDelegateClassLoader();
                            Class c = cl.loadClass(
                                "com.sun.enterprise.iiop.IIOPHandleDelegate");
                            return c.newInstance();
                        } catch ( Exception ex ) {
                            ex.printStackTrace();
                            return null;
                        }
                    }
                }
            );
        return handleDelegate;
    
private java.lang.ObjectgetStub(java.io.ObjectInputStream istream, java.lang.Class stubClass)

        // deserialize obj
        Object obj = istream.readObject();

        if( StubAdapter.isStub(obj) ) {

            try {

                // Check if it is already connected to the ORB by getting
                // the delegate.  If BAD_OPERATION is not thrown, then the 
                // stub is connected.  This will happen if istream is an 
                // IIOP input stream.
                Delegate delegate = StubAdapter.getDelegate(obj);

            } catch(org.omg.CORBA.BAD_OPERATION bo) {
                

                // Stub is not connected. This can happen if istream is
		// not an IIOP input stream (e.g. it's a File stream).
                StubAdapter.connect
                    (obj, (com.sun.corba.ee.spi.orb.ORB) ORBManager.getORB());
            }

        } else {
            throw new IOException("Unable to create stub for class " + 
                stubClass.getName() + 
                ", object deserialized is not a CORBA object, it's type is " +
                obj.getClass().getName());
        }

        // narrow it
        Object stub = PortableRemoteObject.narrow(obj, stubClass);
     
        return stub;
    
public javax.ejb.EJBHomereadEJBHome(java.io.ObjectInputStream istream)

        return (EJBHome)getStub(istream, EJBHome.class);
    
public javax.ejb.EJBObjectreadEJBObject(java.io.ObjectInputStream istream)

        return (EJBObject)getStub(istream, EJBObject.class);
    
public voidwriteEJBHome(javax.ejb.EJBHome ejbHome, java.io.ObjectOutputStream ostream)

        ostream.writeObject(ejbHome); // IIOP stubs are Serializable
    
public voidwriteEJBObject(javax.ejb.EJBObject ejbObject, java.io.ObjectOutputStream ostream)

        ostream.writeObject(ejbObject); // IIOP stubs are Serializable