Package org.apache.openejb

Examples of org.apache.openejb.ModuleContext


        request = (ClusterableRequest) mock(ClusterableRequest.class);
        response = (ClusterableResponse) mock(ClusterableResponse.class);
        clusteredContainer = (ClusteredRPCContainer) mock(ClusteredRPCContainer.class);
        beanContext = new BeanContext("aDeploymentId",
            null,
            new ModuleContext("", null, "", new AppContext("", SystemInstance.get(), null, null, null, false), null, null),
            BasicClusterableRequestHandlerTest.class,
            null,
            null,
            null,
            null,
View Full Code Here


            if (!it.hasNext()) {
                return;
            }

            // TODO we should just pass in the ModuleContext
            final ModuleContext moduleContext = it.next().getModuleContext();

            appContext = new HashMap<String, String>();
            putAll(appContext, SystemInstance.get().getProperties());
            putAll(appContext, moduleContext.getAppContext().getProperties());
            putAll(appContext, moduleContext.getProperties());

            appContext.put("appName", moduleContext.getAppContext().getId());
            appContext.put("appId", moduleContext.getAppContext().getId());

            appContext.put("moduleName", moduleContext.getId());
            appContext.put("moduleId", moduleContext.getId());
        }
View Full Code Here

    }

    //ee6 specified ejb bindings in module, app, and global contexts

    private String computeGlobalName(final BeanContext cdi, final Class<?> intrface) {
        final ModuleContext module = cdi.getModuleContext();
        final AppContext application = module.getAppContext();

        final String appName = application.isStandaloneModule() ? "" : application.getId() + "/";
        final String moduleName = cdi.getModuleName() + "/";
        String beanName = cdi.getEjbName();
        if (intrface != null) {
View Full Code Here

        return "global/" + appName + moduleName + beanName;
    }

    private void bindJava(final BeanContext cdi, final Class intrface, final Reference ref, final Bindings bindings, final EnterpriseBeanInfo beanInfo) throws NamingException {
        final ModuleContext module = cdi.getModuleContext();
        final AppContext application = module.getAppContext();

        final Context moduleContext = module.getModuleJndiContext();
        final Context appContext = application.getAppJndiContext();
        final Context globalContext = application.getGlobalJndiContext();

        final String appName = application.isStandaloneModule() ? "" : application.getId() + "/";
        final String moduleName = cdi.getModuleName() + "/";
View Full Code Here

        Context moduleJndiContext = new JndiEncBuilder(ejbJar.moduleJndiEnc, moduleInjections, null, ejbJar.moduleName, ejbJar.moduleUri, ejbJar.uniqueId, classLoader)
            .build(JndiEncBuilder.JndiScope.module);

        HashMap<String, BeanContext> deployments = new HashMap<String, BeanContext>();

        ModuleContext moduleContext = new ModuleContext(ejbJar.moduleName, ejbJar.moduleUri, ejbJar.uniqueId, context, moduleJndiContext, classLoader);
        moduleContext.getProperties().putAll(ejbJar.properties);
        InterceptorBindingBuilder interceptorBindingBuilder = new InterceptorBindingBuilder(classLoader, ejbJar);

        MethodScheduleBuilder methodScheduleBuilder = new MethodScheduleBuilder();
       
        for (EnterpriseBeanInfo ejbInfo : ejbJar.enterpriseBeans) {
View Full Code Here

    }

    //ee6 specified ejb bindings in module, app, and global contexts

    private String computeGlobalName(final BeanContext cdi, final Class<?> intrface) {
        final ModuleContext module = cdi.getModuleContext();
        final AppContext application = module.getAppContext();

        final String appName = application.isStandaloneModule() ? "" : application.getId() + "/";
        final String moduleName = cdi.getModuleName() + "/";
        String beanName = cdi.getEjbName();
        if (intrface != null) {
View Full Code Here

        return "global/" + appName + moduleName + beanName;
    }

    private void bindJava(BeanContext cdi, Class intrface, Reference ref, Bindings bindings, EnterpriseBeanInfo beanInfo) throws NamingException {
        final ModuleContext module = cdi.getModuleContext();
        final AppContext application = module.getAppContext();

        Context moduleContext = module.getModuleJndiContext();
        Context appContext = application.getAppJndiContext();
        Context globalContext = application.getGlobalJndiContext();

        String appName = application.isStandaloneModule() ? "" : application.getId() + "/";
        String moduleName = cdi.getModuleName() + "/";
View Full Code Here

            final Iterator<BeanContext> it = deployments.values().iterator();
            if (!it.hasNext()) return;

            // TODO we should just pass in the ModuleContext
            final ModuleContext moduleContext = it.next().getModuleContext();

            appContext = new HashMap<String, String>();
            putAll(appContext, SystemInstance.get().getProperties());
            putAll(appContext, moduleContext.getAppContext().getProperties());
            putAll(appContext, moduleContext.getProperties());

            appContext.put("appName", moduleContext.getAppContext().getId());
            appContext.put("appId", moduleContext.getAppContext().getId());

            appContext.put("moduleName", moduleContext.getId());
            appContext.put("moduleId", moduleContext.getId());
        }
View Full Code Here

        SystemInstance.get().getProperties().put("openejb.fooApp.color", "blue");
    }

    private void assertContexts(ContainerSystem containerSystem) {
        final BeanContext beanContext = containerSystem.getBeanContext("WidgetBean");
        final ModuleContext moduleContext = beanContext.getModuleContext();
        final AppContext appContext = moduleContext.getAppContext();

        { // Assert as Properties

            // AppContext should have color property
            assertProperty(appContext.getProperties(), "color", "orange");

            // BeanContext and ModuleContext should not
            assertNoProperty(beanContext.getProperties(), "color");
            assertNoProperty(moduleContext.getProperties(), "color");

            // Try all the above again with mixed case
            assertProperty(appContext.getProperties(), "coLOr", "orange");
            assertNoProperty(beanContext.getProperties(), "coLOr");
            assertNoProperty(moduleContext.getProperties(), "coLOr");
        }

        { // Assert as Options

            // AppContext should have color option
            assertOption(appContext.getOptions(), "color", "orange");

            // BeanContext and ModuleContext should inherit AppContext color
            assertOption(beanContext.getOptions(), "color", "orange");
            assertOption(moduleContext.getOptions(), "color", "orange");

            // Try all the above again using mixed case
            assertOption(appContext.getOptions(), "coLoR", "orange");
            assertOption(moduleContext.getOptions(), "coLoR", "orange");
            assertOption(beanContext.getOptions(), "coLoR", "orange");
        }
    }
View Full Code Here

        }
    }

    private BeanContext createDeployment(Class<?> testClass) {
        try {
            return new BeanContext(null, new IvmContext(), new ModuleContext("", null, "", new AppContext("", SystemInstance.get(), testClass.getClassLoader(), new IvmContext(), new IvmContext(), false), new IvmContext(), null), testClass, null, null, null, null, null, null, null, null, null, BeanType.MANAGED, false);
        } catch (SystemException e) {
            throw new IllegalStateException(e);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.openejb.ModuleContext

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.