Examples of EjbObjectProxyHandler


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

    public EJBLocalObject getEJBLocalObject() {
        ThreadContext threadContext = ThreadContext.getThreadContext();
        org.apache.openejb.DeploymentInfo di = threadContext.getDeploymentInfo();

        EjbObjectProxyHandler handler = newEjbObjectHandler((RpcContainer) di.getContainer(), threadContext.getPrimaryKey(), di.getDeploymentID(), InterfaceType.EJB_LOCAL);

        Object newProxy = null;
        try {
            Class[] interfaces = new Class[]{di.getLocalInterface(), org.apache.openejb.core.ivm.IntraVmProxy.class};
            newProxy = ProxyManager.newProxyInstance(interfaces, handler);
View Full Code Here

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

            throw new IllegalArgumentException("Component has no such interface " + interfce.getName());
        }

        Object newProxy;
        try {
            EjbObjectProxyHandler handler = newEjbObjectHandler((RpcContainer) di.getContainer(), threadContext.getPrimaryKey(), di.getDeploymentID(), interfaceType);
            Class[] interfaces = new Class[]{interfce, IntraVmProxy.class};
            newProxy = ProxyManager.newProxyInstance(interfaces, handler);
        } catch (IllegalAccessException iae) {
            throw new InternalErrorException("Could not create IVM proxy for " + interfce.getName() + " interface", iae);
        }
View Full Code Here

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

    }

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

        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());
        }
        CmpContainer container = (CmpContainer) handler.container;
        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(EJBObject proxy) {
        if (proxy == null) return null;

        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());
        }
        CmpContainer container = (CmpContainer) handler.container;
        Bean entity = (Bean) container.getEjbInstance(handler.getBeanContext(), handler.primaryKey);
        return entity;
    }
View Full Code Here

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

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

    public Object createProxy(Object primaryKey, Class mainInterface) {
        Object proxy = super.createProxy(primaryKey, mainInterface);
        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

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

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

        try {
            handler = (EjbObjectProxyHandler) ProxyManager.getInvocationHandler(proxy);
        } catch (Exception e) {
            // try getting the invocation handler from the localbean
            try {
                Field field = proxy.getClass().getDeclaredField("invocationHandler");
                field.setAccessible(true);
                handler = (EjbObjectProxyHandler) field.get(proxy);
            } catch (Exception e1) {
            }
        }

        registerHandler(handler.getRegistryId(), handler);
        return proxy;
    }
View Full Code Here

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

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

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

        try {
            handler = (EjbObjectProxyHandler) ProxyManager.getInvocationHandler(proxy);
        } catch (Exception e) {
            // try getting the invocation handler from the localbean
            try {
                Field field = proxy.getClass().getDeclaredField("invocationHandler");
                field.setAccessible(true);
                handler = (EjbObjectProxyHandler) field.get(proxy);
            } catch (Exception e1) {
            }
        }

        registerHandler(handler.getRegistryId(), handler);
        return proxy;
    }
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(Method method, Object[] args, Object proxy) throws Throwable {
        try {
            EjbObjectProxyHandler handler = (EjbObjectProxyHandler) ProxyManager.getInvocationHandler(args[0]);
            return new Boolean(deploymentID.equals(handler.deploymentID));
        } catch (Throwable t) {
            return Boolean.FALSE;

        }
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(Method method, Object[] args, Object proxy) throws Throwable {
        try {
            EjbObjectProxyHandler handler = (EjbObjectProxyHandler) ProxyManager.getInvocationHandler(args[0]);
            return new Boolean(deploymentID.equals(handler.deploymentID));
        } catch (Throwable t) {
            return Boolean.FALSE;

        }
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>(), interfce);
                    break;
                }
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.