FileDocCategorySizeDatePackage
EJBLocalObjectInvocationHandlerDelegate.javaAPI DocGlassfish v2 API6442Fri May 04 22:32:58 BST 2007com.sun.ejb.containers

EJBLocalObjectInvocationHandlerDelegate

public class EJBLocalObjectInvocationHandlerDelegate extends Object implements InvocationHandler
This class is used as a "proxy" or adapter between the business interface proxy and the EJBLocalObjectInvocationHandler. An instance of this class is created for each business interface of a bean. All java.lang.Object methods and mthods of IndirectlySerializable are handled by this InvocationHandler itself while the business interface methods are delegated to the delegate (which is the EJBLocalObjectInvocaionHandler).
author
Mahesh Kannan

Fields Summary
private Class
intfClass
private long
containerId
private EJBLocalObjectInvocationHandler
delegate
Constructors Summary
EJBLocalObjectInvocationHandlerDelegate(Class intfClass, long containerId, EJBLocalObjectInvocationHandler delegate)

        this.intfClass = intfClass;
        this.containerId = containerId;
        this.delegate = delegate;
    
Methods Summary
public booleanequals(java.lang.Object other)

        boolean result = false;
        
        if ((other != null)
        && (other instanceof EJBLocalObjectInvocationHandlerDelegate)) {
            EJBLocalObjectInvocationHandlerDelegate otherDelegate
                    = (EJBLocalObjectInvocationHandlerDelegate) other;
            if ((containerId == otherDelegate.containerId)
            && (intfClass == otherDelegate.intfClass)) {
                EJBLocalObjectInvocationHandler otherHandler
                    = otherDelegate.delegate;
                result = (delegate.getKey() != null)
                    ? delegate.getKey().equals(otherHandler.getKey())
                    : (otherHandler.getKey() == null);
            }
        }
        
        return result;
    
public com.sun.ejb.spi.io.SerializableObjectFactorygetSerializableObjectFactory()

        // Note: for stateful SessionBeans, the EJBLocalObjectImpl contains
        // a pointer to the EJBContext. We should not serialize it here.
        
        return new SerializableLocalObjectDelegate(
            containerId, intfClass.getName(), delegate.getKey(),
            delegate.getSfsbClientVersion());
    
public inthashCode()

        return (int) containerId;
    
public java.lang.Objectinvoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)

        
        Class methodClass = method.getDeclaringClass();
        Object result = null;
        if( methodClass == java.lang.Object.class ) {
            result = InvocationHandlerUtil.invokeJavaObjectMethod
                (this, method, args);
        } else if( methodClass == IndirectlySerializable.class ) {
            result = this.getSerializableObjectFactory();
        }else {
            result = delegate.invoke(intfClass, method, args);
        }
        
        return result;
    
public java.lang.StringtoString()

        return intfClass.getName() + "_" + System.identityHashCode(this);