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

RemoteBusinessIntfInvocationHandler

public final class RemoteBusinessIntfInvocationHandler extends Object implements Serializable, InvocationHandler
This is an invocation handler for a remote EJB 3.x business interface. It is used to convert invocations made on the EJB 3.0 business interface to its corresponding RMI-IIOP object.
@@
Need to handle serialization/deserialization
author
Kenneth Saks

Fields Summary
private Class
businessInterface
private Remote
delegate
Constructors Summary
public RemoteBusinessIntfInvocationHandler(Class businessIntf, Remote stub)

        businessInterface = businessIntf;
        delegate = stub;
    
Methods Summary
public java.lang.Objectinvoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)


        // NOTE : be careful with "args" parameter.  It is null
        //        if method signature has 0 arguments.

        Class methodClass = method.getDeclaringClass();
        if( methodClass == java.lang.Object.class )  {
            return InvocationHandlerUtil.
                invokeJavaObjectMethod(this, method, args);    
        }

        Object returnValue = null;
        Throwable t = null;
        try {
            Method m = delegate.getClass().getMethod
                (method.getName(), method.getParameterTypes());
                                                     
            returnValue = m.invoke(delegate, args);
        } catch(NoSuchMethodException nsme) {
            t = nsme;
        } catch(InvocationTargetException ite) {
            t = ite.getCause();
        } catch(Throwable c) {
            t = c;
        }

        if( t != null ) {
            if( t instanceof java.rmi.RemoteException ) {
                EJBException ejbEx = new EJBException();
                ejbEx.initCause(t);
                throw ejbEx;
            } else {
                throw t;
            }
        }

        return returnValue;