Package org.apache.openejb.client

Examples of org.apache.openejb.client.EJBMetaDataImpl


    private static Logger logger = Logger.getInstance(LogCategory.OPENEJB_SERVER_REMOTE, "org.apache.openejb.server.util.resources");

    public Object resolve(EJBHomeHandler handler) {
        try {
            EJBMetaDataImpl ejb = handler.getEjb();

            InterfaceType interfaceType = (ejb.getRemoteInterfaceClass() == null)? InterfaceType.BUSINESS_REMOTE_HOME : InterfaceType.EJB_HOME;

            ArrayList<Class> interfaces = new ArrayList<Class>();
            if (interfaceType.isBusiness()){
                interfaces.addAll(ejb.getBusinessClasses());
            } else {
                interfaces.add(ejb.getRemoteInterfaceClass());
            }

            ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
            DeploymentInfo deploymentInfo = containerSystem.getDeploymentInfo(ejb.getDeploymentID());

            return EjbHomeProxyHandler.createHomeProxy(deploymentInfo, interfaceType, interfaces);
        } catch (Exception e) {
            logger.error("ServerSideResolver.resolve() failed, falling back to ClientSideResolver: "+e.getClass().getName()+": "+e.getMessage(), e );
            return new EJBHomeProxyHandle.ClientSideResovler().resolve(handler);
View Full Code Here


        }
    }

    public Object resolve(EJBObjectHandler handler) {
        try {
            EJBMetaDataImpl ejb = handler.getEjb();

            InterfaceType interfaceType = (ejb.getRemoteInterfaceClass() == null)? InterfaceType.BUSINESS_REMOTE_HOME : InterfaceType.EJB_HOME;

            ArrayList<Class> interfaces = new ArrayList<Class>();
            if (interfaceType.isBusiness()){
                interfaces.addAll(ejb.getBusinessClasses());
            } else {
                interfaces.add(ejb.getRemoteInterfaceClass());
            }

            ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
            DeploymentInfo deploymentInfo = containerSystem.getDeploymentInfo(ejb.getDeploymentID());

            return EjbObjectProxyHandler.createProxy(deploymentInfo, handler.getPrimaryKey(), interfaceType, interfaces);
        } catch (Exception e) {
            logger.error("ServerSideResolver.resolve() failed, falling back to ClientSideResolver: "+e.getClass().getName()+": "+e.getMessage(), e );
            return new EJBObjectProxyHandle.ClientSideResovler().resolve(handler);
View Full Code Here

    private static Logger logger = Logger.getInstance(LogCategory.OPENEJB_SERVER_REMOTE, "org.apache.openejb.server.util.resources");

    public Object resolve(EJBHomeHandler handler) {
        try {
            EJBMetaDataImpl ejb = handler.getEjb();

            InterfaceType interfaceType = (ejb.getRemoteInterfaceClass() == null)? InterfaceType.BUSINESS_REMOTE_HOME : InterfaceType.EJB_HOME;

            ArrayList<Class> interfaces = new ArrayList<Class>();
            if (interfaceType.isBusiness()){
                interfaces.addAll(ejb.getBusinessClasses());
            } else {
                interfaces.add(ejb.getRemoteInterfaceClass());
            }

            ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
            BeanContext beanContext = containerSystem.getBeanContext(ejb.getDeploymentID());

            return EjbHomeProxyHandler.createHomeProxy(beanContext, interfaceType, interfaces, ejb.getMainInterface());
        } catch (Exception e) {
            logger.error("ServerSideResolver.resolve() failed, falling back to ClientSideResolver: "+e.getClass().getName()+": "+e.getMessage(), e );
            return new EJBHomeProxyHandle.ClientSideResovler().resolve(handler);
        }
    }
View Full Code Here

        }
    }

    public Object resolve(EJBObjectHandler handler) {
        try {
            EJBMetaDataImpl ejb = handler.getEjb();

            InterfaceType interfaceType = (ejb.getRemoteInterfaceClass() == null)? InterfaceType.BUSINESS_REMOTE_HOME : InterfaceType.EJB_HOME;

            ArrayList<Class> interfaces = new ArrayList<Class>();
            if (interfaceType.isBusiness()){
                interfaces.addAll(ejb.getBusinessClasses());
            } else {
                interfaces.add(ejb.getRemoteInterfaceClass());
            }

            ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
            BeanContext beanContext = containerSystem.getBeanContext(ejb.getDeploymentID());

            return EjbObjectProxyHandler.createProxy(beanContext, handler.getPrimaryKey(), interfaceType, interfaces, ejb.getMainInterface());
        } catch (Exception e) {
            logger.error("ServerSideResolver.resolve() failed, falling back to ClientSideResolver: "+e.getClass().getName()+": "+e.getMessage(), e );
            return new EJBObjectProxyHandle.ClientSideResovler().resolve(handler);
        }
    }
View Full Code Here

        deploymentIndex = new DeploymentIndex(new BeanContext[] {beanContext, beanContext});
    }

    @Test
    public void testGetDeploymentEJBRequest() throws RemoteException {
        EJBMetaDataImpl ejbMetadataWithId = new EJBMetaDataImpl(null, null, null, null, null, 1, InterfaceType.BUSINESS_REMOTE, null, null);
        EJBRequest request = new EJBRequest(0, ejbMetadataWithId, method, null, null);
        BeanContext info = deploymentIndex.getDeployment(request);
        assert beanContext.equals(info);
        assert request.getDeploymentId().equals(info.getDeploymentID());
    }
View Full Code Here

    }

    @Test(expected = RemoteException.class)
    public void testGetDeploymentEJBRequestRemoteException() throws RemoteException {
        // 0 causes DeploymentIndex to move further
        EJBMetaDataImpl ejbMetadata = new EJBMetaDataImpl(null, null, null, null, null, 0, InterfaceType.BUSINESS_REMOTE, null, null);
        EJBRequest request = new EJBRequest(0, ejbMetadata, method, null, null);
        deploymentIndex.getDeployment(request);
    }
View Full Code Here

        CallContext call = CallContext.getCallContext();

        BeanContext beanContext = info.getBeanContext();
        int idCode = -1;

        EJBMetaDataImpl metaData = buildEjbMetaData(info, beanContext, idCode);
        return metaData;
    }
View Full Code Here

            securityIdentity = call.getEJBRequest().getClientIdentity();
        } catch (Exception e) {

        }
        ClientMetaData cMetaData = new ClientMetaData(securityIdentity);
        EJBMetaDataImpl eMetaData = buildEjbMetaData(info, beanContext, idCode);
        Object primKey = info.getPrimaryKey();

        EJBObjectHandler hanlder = EJBObjectHandler.createEJBObjectHandler(eMetaData, getServerMetaData(), cMetaData, primKey);

        return new EJBObjectHandle(hanlder.createEJBObjectProxy());
View Full Code Here

            securityIdentity = call.getEJBRequest().getClientIdentity();
        } catch (Exception e) {
            e.printStackTrace();
        }
        ClientMetaData cMetaData = new ClientMetaData(securityIdentity);
        EJBMetaDataImpl eMetaData = buildEjbMetaData(info, beanContext, idCode);

        EJBHomeHandler hanlder = EJBHomeHandler.createEJBHomeHandler(eMetaData, getServerMetaData(), cMetaData);

        return new EJBHomeHandle(hanlder.createEJBHomeProxy());
    }
View Full Code Here

            securityIdentity = call.getEJBRequest().getClientIdentity();
        } catch (Exception e) {
            e.printStackTrace();
        }
        ClientMetaData cMetaData = new ClientMetaData(securityIdentity);
        EJBMetaDataImpl eMetaData = buildEjbMetaData(info, beanContext, idCode);
        Object primKey = info.getPrimaryKey();

        EJBObjectHandler hanlder = EJBObjectHandler.createEJBObjectHandler(eMetaData, getServerMetaData(), cMetaData, primKey);

        return (javax.ejb.EJBObject) hanlder.createEJBObjectProxy();
View Full Code Here

TOP

Related Classes of org.apache.openejb.client.EJBMetaDataImpl

Copyright © 2018 www.massapicom. 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.