Package org.apache.openejb

Examples of org.apache.openejb.ModuleContext


    protected void setUp() throws Exception {
        requestHandler = new BasicClusterableRequestHandler();
        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), BasicClusterableRequestHandlerTest.class, null, null, null, null, null, null, null, null, null, null, false);
    }
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()), testClass, null, null, null, null, null, null, null, null, null, BeanType.MANAGED, false);
        } catch (SystemException e) {
            throw new IllegalStateException(e);
        }
    }
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

    @Override
    public void contextEntered(ThreadContext oldContext, ThreadContext newContext) {
        BeanContext beanContext = newContext.getBeanContext();
        if (beanContext == null) return;
        ModuleContext moduleContext = beanContext.getModuleContext();
        //TODO its not clear what the scope for one of these context should be: ejb, module, or app
        //For now, go with the attachment of the BeanManager to AppContext
        AppContext appContext = moduleContext.getAppContext();
        WebBeansContext owbContext = appContext.getWebBeansContext();
        if (owbContext == null) {
//            throw new IllegalStateException("WebBeansContext not initialized in appContext " + appContext);
            return;
        }
View Full Code Here

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

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

        ModuleContext moduleContext = new ModuleContext(ejbJar.moduleName, ejbJar.moduleUri, ejbJar.uniqueId, context, moduleJndiContext);
        InterceptorBindingBuilder interceptorBindingBuilder = new InterceptorBindingBuilder(context.getClassLoader(), ejbJar);

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

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

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

        ModuleContext moduleContext = new ModuleContext(ejbJar.moduleName, ejbJar.moduleUri, ejbJar.uniqueId, context, moduleJndiContext);
        InterceptorBindingBuilder interceptorBindingBuilder = new InterceptorBindingBuilder(context.getClassLoader(), 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 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

    public void contextEntered(final ThreadContext oldContext, final ThreadContext newContext) {
        final BeanContext beanContext = newContext.getBeanContext();
        if (beanContext == null) { // OWBContextHolder will be null so calling contextExited will throw a NPE
            return;
        }
        final ModuleContext moduleContext = beanContext.getModuleContext();
        //TODO its not clear what the scope for one of these context should be: ejb, module, or app
        //For now, go with the attachment of the BeanManager to AppContext
        final AppContext appContext = moduleContext.getAppContext();
        final WebBeansContext owbContext = appContext.getWebBeansContext();
        final Object oldOWBContext;
        if (owbContext != null) {
            oldOWBContext = singletonService.contextEntered(owbContext);
        } else {
View Full Code Here

        }
    }

    private BeanContext createDeployment(final 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 (final 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.