Package org.apache.openejb

Examples of org.apache.openejb.BeanContext$Cmp


            // get all of the ejb deployments
            List<BeanContext> deployments = new ArrayList<BeanContext>();
            for (final EjbJarInfo ejbJarInfo : appInfo.ejbJars) {
                for (final EnterpriseBeanInfo beanInfo : ejbJarInfo.enterpriseBeans) {
                    final String deploymentId = beanInfo.ejbDeploymentId;
                    final BeanContext beanContext = containerSystem.getBeanContext(deploymentId);
                    if (beanContext == null) {
                        undeployException.getCauses().add(new Exception("deployment not found: " + deploymentId));
                    } else {
                        deployments.add(beanContext);
                    }
View Full Code Here


        Proxy proxy = (Proxy) EjbObjectProxyHandler.createProxy(beanContext, primaryKey, InterfaceType.EJB_LOCAL_HOME, beanContext.getLocalInterface());
        return proxy;
    }

    public static BeanContext getBeanContext(Class type) {
        BeanContext beanContext;
        try {
            Field deploymentInfoField = type.getField("deploymentInfo");
            beanContext = (BeanContext) deploymentInfoField.get(null);
        } catch (Exception e) {
            throw new IllegalArgumentException("EntityBean class " + type.getName() +
View Full Code Here

        assertEquals(Everything.class.getName(), beanInfo.serviceEndpoint);

        assembler.createApplication(ejbJarInfo);

        ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
        BeanContext deployment = containerSystem.getBeanContext(beanInfo.ejbDeploymentId);

        assertEquals(asList(Everything.class), deployment.getBusinessLocalInterfaces());
        assertEquals(asList(Everything.class), deployment.getBusinessRemoteInterfaces());
        assertEquals(Everything.class, deployment.getServiceEndpointInterface());

        { // remote invoke
            Properties props = new Properties();
            props.put("java.naming.factory.initial", "org.apache.openejb.client.RemoteInitialContextFactory");
            props.put("java.naming.provider.url", "ejbd://127.0.0.1:" + port);
View Full Code Here

                final AppContext appContext = assembler.createApplication(appInfo);

                try {
                    final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
                    final BeanContext context = containerSystem.getBeanContext(javaClass.getName());

                    ThreadContext callContext = new ThreadContext(context, null, Operation.INJECTION);
                    ThreadContext oldContext = ThreadContext.enter(callContext);
                    try {
                        final InjectionProcessor processor = new InjectionProcessor(testInstance, context.getInjections(), context.getJndiContext());

                        processor.createInstance();

                        try {
                            OWBInjector beanInjector = new OWBInjector(appContext.getWebBeansContext());
View Full Code Here

        entered = true;
        final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);

        if (containerSystem == null) return;

        BeanContext context = null;
        for (BeanContext beanContext : containerSystem.deployments()) {
            BeanType beanType = BeanType.MANAGED;
            if (beanContext.getComponentType() == beanType) {
                context = beanContext;
                break;
            }
        }

        if (context == null) return;

        final WebBeansContext webBeansContext = context.getModuleContext().getAppContext().getWebBeansContext();
        contextsService = webBeansContext.getContextsService();

        contextsService.startContext(RequestScoped.class, null);
    }
View Full Code Here

            } 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

            } 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

        }
    }

    public BeanContext getDeployment(EJBRequest req) throws RemoteException {

        BeanContext info = null;

        int deploymentCode = req.getDeploymentCode();
        if (deploymentCode > 0 && deploymentCode < deployments.length) {
            info = deployments[deploymentCode];
            req.setDeploymentId((String) info.getDeploymentID());
            return info;
        }

        if (req.getDeploymentId() == null) {
            throw new RemoteException(messages.format("invalidDeploymentIdAndCode", req.getDeploymentId(), req.getDeploymentCode()));
View Full Code Here


    @Override
    public void contextEntered(ThreadContext oldContext, ThreadContext newContext) {

        final BeanContext beanContext = newContext.getBeanContext();

        final WebBeansContext webBeansContext = beanContext.getModuleContext().getAppContext().getWebBeansContext();
        final ContextsService contextsService = webBeansContext.getContextsService();

        final Context requestContext = contextsService.getCurrentContext(RequestScoped.class);

        if (requestContext == null) {
View Full Code Here

        assertAttribute(1, TimeUnit.DAYS, Scarlet.class.getMethod("scarlet", String.class));
    }

    private void loadAttributes(EjbJarInfo ejbJarInfo, String deploymentId) {
        ContainerSystem system = SystemInstance.get().getComponent(ContainerSystem.class);
        BeanContext beanContext = system.getBeanContext(deploymentId);
        List<MethodConcurrencyInfo> lockInfos = new ArrayList<MethodConcurrencyInfo>();
        List<MethodConcurrencyInfo> accessTimeoutInfos = new ArrayList<MethodConcurrencyInfo>();
        MethodConcurrencyBuilder.normalize(ejbJarInfo.methodConcurrency, lockInfos, accessTimeoutInfos);
        attributes = MethodInfoUtil.resolveAttributes(accessTimeoutInfos, beanContext);
    }
View Full Code Here

TOP

Related Classes of org.apache.openejb.BeanContext$Cmp

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.