Package org.apache.openejb.spi

Examples of org.apache.openejb.spi.ContainerSystem


        }
    }

    private void initializeDependencies(BeanContext beanContext) throws OpenEJBException {
        SystemInstance systemInstance = SystemInstance.get();
        ContainerSystem containerSystem = systemInstance.getComponent(ContainerSystem.class);
        for (String dependencyId : beanContext.getDependsOn()) {
            BeanContext dependencyContext = containerSystem.getBeanContext(dependencyId);
            if (dependencyContext == null) {
                throw new OpenEJBException("Deployment does not exist. Deployment(id='"+dependencyContext+"')");
            }

            final Object containerData = dependencyContext.getContainerData();
View Full Code Here


        assertEquals(asList(Everything.class.getName()), beanInfo.businessRemote);
        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());
View Full Code Here

            }
        }

        if (optionsMap.containsKey(Option.DATABASE_POOL_NAME)) {
            String dataSourceName = optionsMap.get(Option.DATABASE_POOL_NAME);
            ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
            try {
                dataSource = (DataSource) containerSystem.getJNDIContext().lookup("openejb/Resource/" + dataSourceName);
            } catch (NamingException e) {
                initError(e, "Data source %s not found.", dataSourceName);
            }
        } else if (optionsMap.containsKey(Option.CONNECTION_URL)) {
            connectionURL = optionsMap.get(Option.CONNECTION_URL);
View Full Code Here

            application.deployApplication();
        }
    }

    public void printContainerSystem() {
        ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
        if (logger.isDebugEnabled()) {
            //
            // Log Containers
            //
            logger.debug("startup.debugContainers", containerSystem.containers().length);
            if (containerSystem.containers().length > 0) {
                logger.debug("startup.debugContainersType");
                for (Container container : containerSystem.containers()) {
                    String entry = "   ";
                    switch (container.getContainerType()) {
                        case BMP_ENTITY:
                            entry += "BMP ENTITY  ";
                            break;
                        case CMP_ENTITY:
                            entry += "CMP ENTITY  ";
                            break;
                        case STATEFUL:
                            entry += "STATEFUL    ";
                            break;
                        case STATELESS:
                            entry += "STATELESS   ";
                            break;
                        case SINGLETON:
                            entry += "SINGLETON   ";
                            break;
                        case MESSAGE_DRIVEN:
                            entry += "MESSAGE     ";
                            break;
                    }
                    entry += container.getContainerID();
                    logger.debug("startup.debugEntry", entry);
                }
            }

            //
            // Log Deployments
            //
            logger.debug("startup.debugDeployments", containerSystem.deployments().length);
            if (containerSystem.deployments().length > 0) {
                logger.debug("startup.debugDeploymentsType");
                for (BeanContext deployment : containerSystem.deployments()) {
                    String entry = "   ";
                    switch (deployment.getComponentType()) {
                        case BMP_ENTITY:
                            entry += "BMP_ENTITY  ";
                            break;
View Full Code Here

         * lookup datasource in openejb resources
         */
        private void init() {
            dataSources = new ConcurrentHashMap<String, DataSource>();
            for (String ds : dataSourceNames.split(" ")) {
                ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);

                Object o = null;
                Context ctx = containerSystem.getJNDIContext();
                try {
                    o = ctx.lookup("openejb:Resource/" + ds);
                    if (o instanceof DataSource) {
                        dataSources.put(ds, (DataSource) o);
                    }
View Full Code Here

        EjbJarInfo ejbJar = config.configureApplication(buildTestApp());

        assembler.createApplication(ejbJar);

        ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);

        BeanContext beanContext = containerSystem.getBeanContext("EchoBean");

        assertNotNull(beanContext);

        assertEquals("ServiceEndpointInterface", EchoServiceEndpoint.class, beanContext.getServiceEndpointInterface());
View Full Code Here

            }
            String message = messages.format(key, info.getName(), info.getEjbLink(), info.getHome(), info.getInterface());
            throw new NameNotFoundException(message);
        }

        ContainerSystem containerSystem = systemInstance.getComponent(ContainerSystem.class);

        BeanContext beanContext = containerSystem.getBeanContext(deploymentId);

        if (beanContext == null) {
            String message = messages.format("deploymentNotFound", info.getName(), deploymentId);
            throw new NameNotFoundException(message);
        }
View Full Code Here

    public BeanContext getBeanContext() {
        if (beanContext != null) {
            return beanContext;
        } else if (deploymentId != null) {
            ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
            BeanContext beanContext = containerSystem.getBeanContext(deploymentId);
            return beanContext;
        }
        return null;
    }
View Full Code Here

        // this is the pattern for the internal jndi name
        String jndiName = "java:openejb/Deployment/" + JndiBuilder.format(beanContext.getDeploymentID(), getInterface().getName());

        // perform the lookup against the jndi context in the container system
        ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
        Object proxy = containerSystem.getJNDIContext().lookup(jndiName);
        if (!intf.isInstance(proxy)) {
            throw new IllegalArgumentException("EJB at " + jndiName + " is not an instance of " + intf.getName() + ", but is " + proxy.getClass().getName());
        }
        return intf.cast(proxy);
    }
View Full Code Here

        assertTrue(org.apache.openejb.OpenEJB.isInitialized());

        //
        // ContainerSystem
        //
        ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
        assertNotNull("containerSystem is null", containerSystem);
        Context initialContext = containerSystem.getJNDIContext();
        assertNotNull(initialContext);

        //
        // TransactionManager
        //
        Object tm = context.getBean("tm");
        TransactionManager springTM = (TransactionManager) tm;
        assertNotNull("springTM is null", springTM);
        assertTrue("springTM should be an instance of MockTransactionManager", springTM instanceof MockTransactionManager);

        TransactionManager systemTM = SystemInstance.get().getComponent(TransactionManager.class);
        assertNotNull("systemTM is null", systemTM);
        assertSame(springTM, systemTM);

        assertSame(springTM, initialContext.lookup("openejb/TransactionManager"));

        //
        // SecurityService
        //
        SecurityService springSecurityService = (SecurityService) context.getBean("sec");
        assertNotNull("springSecurityService is null", springSecurityService);
        assertTrue("springSecurityService should be an instance of MockSecurityService", springSecurityService instanceof MockSecurityService);

        SecurityService systemSecurityService = SystemInstance.get().getComponent(SecurityService.class);
        assertNotNull("systemSecurityService is null", systemSecurityService);
        assertSame(springSecurityService, systemSecurityService);

        assertSame(springSecurityService, initialContext.lookup("openejb/SecurityService"));

        //
        // DataSource
        //
        DataSource springDataSource = (DataSource) context.getBean("ds");
        assertNotNull("springDataSource is null", springDataSource);
        assertTrue("springDataSource should be an instance of BasicDataSource", springDataSource instanceof BasicDataSource);

        DataSource jndiDataSource = (DataSource) initialContext.lookup("openejb/Resource/ds");
        assertSame(springDataSource, jndiDataSource);

        DataSource exportedDS = (DataSource) context.getBean("openejbDS");
        assertSame(springDataSource, exportedDS);

        //
        // Container
        //
        Container singletonContainer = containerSystem.getContainer("SpringDefinedSingletonContainer");
        assertTrue("singletonContainer should be an instance of SingletonContainer", singletonContainer instanceof org.apache.openejb.core.singleton.SingletonContainer);
        Container statelessContainer = containerSystem.getContainer("SpringDefinedStatelessContainer");
        assertTrue("statelessContainer should be an instance of StatelessContainer", statelessContainer instanceof org.apache.openejb.core.stateless.StatelessContainer);
        Container statefulContainer = containerSystem.getContainer("SpringDefinedStatefulContainer");
        assertTrue("statefulContainer should be an instance of StatefulContainer", statefulContainer instanceof org.apache.openejb.core.stateful.StatefulContainer);
        Container mdbContainer = containerSystem.getContainer("SpringDefinedMdbContainer");
        assertTrue("mdbContainer should be an instance of MdbContainer", mdbContainer instanceof org.apache.openejb.core.mdb.MdbContainer);
        Container bmpContainer = containerSystem.getContainer("SpringDefinedBmpContainer");
        assertTrue("bmpContainer should be an instance of BmpContainer", bmpContainer instanceof EntityContainer);
        Container cmpContainer = containerSystem.getContainer("SpringDefinedCmpContainer");
        assertTrue("cmpContainer should be an instance of CmpContainer", cmpContainer instanceof org.apache.openejb.core.cmp.CmpContainer);

        //
        // JNDI Context
        //
View Full Code Here

TOP

Related Classes of org.apache.openejb.spi.ContainerSystem

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.