Examples of EjbObjectProxyHandler


Examples of org.apache.openejb.core.ivm.EjbObjectProxyHandler

            if (di.getRemoteInterface() == null) {
                throw new IllegalStateException("EJB " + di.getDeploymentID() + " does not have a remote interface");
            }

            EjbObjectProxyHandler handler = new EntityEjbObjectHandler(((RpcContainer) di.getContainer()).getDeploymentInfo(di.getDeploymentID()), threadContext.getPrimaryKey(), InterfaceType.EJB_OBJECT, new ArrayList<Class>());
            try {
                Class[] interfaces = new Class[]{di.getRemoteInterface(), IntraVmProxy.class};
                return (EJBObject) ProxyManager.newProxyInstance(interfaces, handler);
            } catch (IllegalAccessException iae) {
                throw new InternalErrorException("Could not create IVM proxy for " + di.getRemoteInterface() + " interface", iae);
View Full Code Here

Examples of org.apache.openejb.core.ivm.EjbObjectProxyHandler

            if (!interfaceType.isBusiness()) {
                throw new IllegalStateException("Interface is not a business interface for this bean: " + interfce.getName());
            }

            try {
                EjbObjectProxyHandler handler;
                switch(di.getComponentType()){
                    case STATEFUL: {
                        handler = new StatefulEjbObjectHandler(di, threadContext.getPrimaryKey(), interfaceType, new ArrayList<Class>());
                        break;
                    }
View Full Code Here

Examples of org.apache.openejb.core.ivm.EjbObjectProxyHandler

        super(deploymentInfo, interfaceType, interfaces);
    }

    public Object createProxy(Object primaryKey) {
        Object proxy = super.createProxy(primaryKey);
        EjbObjectProxyHandler handler = (EjbObjectProxyHandler) ProxyManager.getInvocationHandler(proxy);

        /*
        * Register the handle with the BaseEjbProxyHandler.liveHandleRegistry
        * If the bean is removed by its home or by an identical proxy, then the
        * this proxy will be automatically invalidated because its properly registered
        * with the liveHandleRegistry.
        */
        registerHandler(handler.getRegistryId(), handler);

        return proxy;

    }
View Full Code Here

Examples of org.apache.openejb.core.ivm.EjbObjectProxyHandler

    }

    @Override
    protected Object isIdentical(final Method method, final Object[] args, final Object proxy) throws Throwable {
        try {
            final EjbObjectProxyHandler handler = (EjbObjectProxyHandler) ProxyManager.getInvocationHandler(args[0]);
            return deploymentID.equals(handler.deploymentID);
        } catch (final Throwable t) {
            return Boolean.FALSE;

        }
View Full Code Here

Examples of org.apache.openejb.core.ivm.EjbObjectProxyHandler

    public static <Bean extends EntityBean> Bean getEntityBean(final EJBLocalObject proxy) {
        if (proxy == null) {
            return null;
        }

        final EjbObjectProxyHandler handler = (EjbObjectProxyHandler) ProxyManager.getInvocationHandler(proxy);
        if (handler.container == null) {
            return null;
        }
        if (!(handler.container instanceof CmpContainer)) {
            throw new IllegalArgumentException("Proxy is not connected to a CMP container but is conect to " + handler.container.getClass().getName());
        }
        final CmpContainer container = (CmpContainer) handler.container;
        final Bean entity = (Bean) container.getEjbInstance(handler.getBeanContext(), handler.primaryKey);
        return entity;
    }
View Full Code Here

Examples of org.apache.openejb.core.ivm.EjbObjectProxyHandler

    public static <Bean extends EntityBean> Bean getEntityBean(final EJBObject proxy) {
        if (proxy == null) {
            return null;
        }

        final EjbObjectProxyHandler handler = (EjbObjectProxyHandler) ProxyManager.getInvocationHandler(proxy);
        if (handler.container == null) {
            return null;
        }
        if (!(handler.container instanceof CmpContainer)) {
            throw new IllegalArgumentException("Proxy is not connected to a CMP container but is conect to " + handler.container.getClass().getName());
        }
        final CmpContainer container = (CmpContainer) handler.container;
        final Bean entity = (Bean) container.getEjbInstance(handler.getBeanContext(), handler.primaryKey);
        return entity;
    }
View Full Code Here

Examples of org.apache.openejb.core.ivm.EjbObjectProxyHandler

        if (di.getLocalInterface() == null) {
            throw new IllegalStateException("EJB " + di.getDeploymentID() + " does not have a local interface");
        }

        final EjbObjectProxyHandler handler = new EntityEjbObjectHandler(di, threadContext.getPrimaryKey(), InterfaceType.EJB_LOCAL, new ArrayList<Class>(), di.getLocalInterface());

        try {
            final Class[] interfaces = new Class[]{di.getLocalInterface(), IntraVmProxy.class};
            return (EJBLocalObject) ProxyManager.newProxyInstance(interfaces, handler);
        } catch (final IllegalAccessException iae) {
View Full Code Here

Examples of org.apache.openejb.core.ivm.EjbObjectProxyHandler

        if (di.getRemoteInterface() == null) {
            throw new IllegalStateException("EJB " + di.getDeploymentID() + " does not have a remote interface");
        }

        final EjbObjectProxyHandler handler = new EntityEjbObjectHandler(di.getContainer().getBeanContext(di.getDeploymentID()), threadContext.getPrimaryKey(), InterfaceType.EJB_OBJECT, new ArrayList<Class>(), di.getRemoteInterface());
        try {
            final Class[] interfaces = new Class[]{di.getRemoteInterface(), IntraVmProxy.class};
            return (EJBObject) ProxyManager.newProxyInstance(interfaces, handler);
        } catch (final IllegalAccessException iae) {
            throw new InternalErrorException("Could not create IVM proxy for " + di.getRemoteInterface() + " interface", iae);
View Full Code Here

Examples of org.apache.openejb.core.ivm.EjbObjectProxyHandler

        throw new RemoteException("Session objects are private resources and do not have primary keys");
    }

    protected Object isIdentical(final Method method, final Object[] args, final Object proxy) throws Throwable {
        try {
            final EjbObjectProxyHandler handler = (EjbObjectProxyHandler) ProxyManager.getInvocationHandler(args[0]);
            return new Boolean(deploymentID.equals(handler.deploymentID)); //NOPMD
        } catch (final Throwable t) {
            return Boolean.FALSE;
        }
    }
View Full Code Here

Examples of org.apache.openejb.core.ivm.EjbObjectProxyHandler

        super(beanContext, interfaceType, interfaces, mainInterface);
    }

    public Object createProxy(final Object primaryKey, final Class mainInterface) {
        final Object proxy = super.createProxy(primaryKey, mainInterface);
        final EjbObjectProxyHandler handler = (EjbObjectProxyHandler) ProxyManager.getInvocationHandler(proxy);

        /*
        * Register the handle with the BaseEjbProxyHandler.liveHandleRegistry
        * If the bean is removed by its home or by an identical proxy, then the
        * this proxy will be automatically invalidated because its properly registered
        * with the liveHandleRegistry.
        */
        registerHandler(handler.getRegistryId(), handler);

        return proxy;

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.