FileDocCategorySizeDatePackage
LocalSerialContextProviderImpl.javaAPI DocGlassfish v2 API5071Fri May 04 22:35:08 BST 2007com.sun.enterprise.naming

LocalSerialContextProviderImpl

public class LocalSerialContextProviderImpl extends SerialContextProviderImpl
This class is the implementation of the local SerialContextProvider
author
Sheetal Vartak

Fields Summary
private static LocalStringManagerImpl
localStrings
static Logger
_logger
Constructors Summary
LocalSerialContextProviderImpl(TransientContext rootContext)


        
	super(rootContext);
    
Methods Summary
public voidbind(java.lang.String name, java.lang.Object obj)
overriding the super.bind() since we need to make a copy of the object before it gets put into the rootContext Remote Provider already does that since when a method is called on a remote object (in our case the remote provider), the copies of the method arguments get passed and not the real objects.


	Object copyOfObj = NamingUtils.makeCopyOfObject(obj);
        super.bind(name, copyOfObj);
    
static com.sun.enterprise.naming.LocalSerialContextProviderImplgetProvider(TransientContext rootContext)

	try {
	    return new LocalSerialContextProviderImpl(rootContext);
	} catch (RemoteException re) {
	    _logger.log(Level.SEVERE,
			localStrings.getLocalString("local.provider.null",
						    "Exception occurred. Returning null provider : {0}" , 
						    new Object[] {re.getMessage()}));
	    return null;
	}
    
public java.lang.Objectlookup(java.lang.String name)

	Object obj = super.lookup(name);
	// If CORBA object, resolve here in server to prevent a 
	// another round-trip to CosNaming.
	try {
	    if( obj instanceof Reference ) {
		Reference ref = (Reference) obj;
		if( ref.getFactoryClassName().equals
		    (NamingManagerImpl.IIOPOBJECT_FACTORY)) {
		    
		    Hashtable env = new Hashtable();
		    org.omg.CORBA.ORB orb = ORBManager.getORB();
		    env.put("java.naming.corba.orb", orb);
		    obj = javax.naming.spi.NamingManager.getObjectInstance
			(obj, new CompositeName(name), null, env);		 
		    return obj;
		}
	    } 
	    return NamingUtils.makeCopyOfObject(obj);
	} catch(RemoteException re) {
	    throw re;
	} catch(Exception e) {
	    RemoteException re = new RemoteException("", e);
            throw re;

        }
    
public voidrebind(java.lang.String name, java.lang.Object obj)
overriding the super.rebind() since we need to make a copy of the object before it gets put into the rootContext. Remote Provider already does that since when a method is called on a remote object (in our case the remote provider), the copies of the method arguments get passed and not the real objects.


	Object copyOfObj = NamingUtils.makeCopyOfObject(obj);
        super.rebind(name, copyOfObj);