Package org.apache.openejb

Examples of org.apache.openejb.Container


    @RemoteMethod
    public Tree getEjbInformation() {

        ClassLoader oldcl = Thread.currentThread().getContextClassLoader();
        ClassLoader newcl = null;
        Container container = null;
        ContainerSystemInfo systemInfo = configuration.containerSystem;
        Map<ContainerType, TreeEntry> containerMap = new TreeMap<ContainerType, TreeEntry>();
        List<ContainerInfo> containerInfos = systemInfo.containers;
        ContainerInfo containerInfo = null;
        TreeEntry containerTypesEntry, containersEntry, deploymentsEntry = null;
        Tree tree = new Tree("name", "name");
        List<TreeEntry> entries = new ArrayList<TreeEntry>();
        for (int i = 0; i < containerInfos.size(); i++) {

            containerInfo = containerInfos.get(i);
            container = containerSystem.getContainer(containerInfo.id);
            List<TreeEntry> containers = null;
            if (containerMap.get(container.getContainerType()) != null) {
                containerTypesEntry = containerMap.get(container.getContainerType());
                containers = containerTypesEntry.getChildren();
            } else {
                containerTypesEntry = new TreeEntry();
                containerTypesEntry.setName(resolveContainerTypes(container.getContainerType()));
                containerTypesEntry.setValues(new String[]{containerTypesEntry.getName()});
                containers = new ArrayList<TreeEntry>();
                containerTypesEntry.setChildren(containers);
                containerMap.put(container.getContainerType(),containerTypesEntry);
                entries.add(containerTypesEntry);
            }
            containersEntry = new TreeEntry();
            containersEntry.setName(containerInfo.id);
            containersEntry.setValues(new String[]{containerInfo.id});

            BeanContext[] deployments = container.getBeanContexts();
            containersEntry.setChildren(getDeployments(deployments));
            containers.add(containersEntry);
        }
        tree.setItems(entries);
        return tree;
View Full Code Here


    }

    @RemoteMethod
    public List<EjbInformation> getContainerInfo(String containerId, HttpServletRequest request) {
      containerId = replaceEscapes(containerId);
        Container container = containerSystem.getContainer(containerId);
        if (container == null)
            return null;
        ContainerSystemInfo systemInfo = configuration.containerSystem;
        List<ContainerInfo> containerInfos = systemInfo.containers;
        List<EjbInformation> infos = new ArrayList<EjbInformation>();
        EjbInformation information = null;
        GBeanData data = null;
        if (container.getContainerType() == ContainerType.MESSAGE_DRIVEN) {
            data = getOpenEJBPropertiesGBean(containerId, OpenEjbSystem.class);
        } else {
            data = getOpenEJBPropertiesGBean(containerId, EjbContainer.class);
        }
        Properties props = null;
View Full Code Here

        propertyKey = propertyKey.trim();
        propertyValue = propertyValue.trim();

        containerId = replaceEscapes(containerId);

        Container container = containerSystem.getContainer(containerId);

        String query = null;

        if (container.getContainerType() == ContainerType.MESSAGE_DRIVEN) {
            query = OpenEjbSystem.class.getName();
        } else {
            query = EjbContainer.class.getName();
        }
View Full Code Here

        }
    }
    @RemoteMethod
    public List<EjbInformation> getDeploymentInfo(String containerId,
            String deploymentId, HttpServletRequest request) {
        Container container = containerSystem.getContainer(containerId);
        BeanContext beanContext = container
                .getBeanContext(deploymentId);
        List<EjbInformation> informations = new ArrayList<EjbInformation>();
        EjbInformation information = new EjbInformation();
        information.setName(getLocalizedString(request, BUNDLE_NAME, BEANCLASSNAME_KEY));
        information.setValue(beanContext.getBeanClass().getName());
        informations.add(information);

        if (beanContext.getBusinessLocalInterface() != null) {
            information = new EjbInformation();
            information.setName(getLocalizedString(request, BUNDLE_NAME, BLI_KEY));
            information.setValue(appendMultipleInterfaces(beanContext
                    .getBusinessLocalInterfaces()));
            informations.add(information);
        }
        if (beanContext.getBusinessRemoteInterface() != null) {
            information = new EjbInformation();
            information.setName(getLocalizedString(request, BUNDLE_NAME, BRI_KEY));
            information.setValue(appendMultipleInterfaces(beanContext
                    .getBusinessRemoteInterfaces()));
            informations.add(information);
        }
        information = new EjbInformation();
        information.setName(getLocalizedString(request, BUNDLE_NAME, DEPLOYMENTID_KEY));
        information.setValue(deploymentId);
        informations.add(information);
        information = new EjbInformation();
        information.setName(getLocalizedString(request, BUNDLE_NAME, EJBNAME_KEY));
        information.setValue(beanContext.getEjbName());
        informations.add(information);
        if (beanContext.getHomeInterface() != null) {
            information = new EjbInformation();
            information.setValue(beanContext.getHomeInterface().getName());
            information.setName(getLocalizedString(request, BUNDLE_NAME, EJBHOMEI_KEY));
            informations.add(information);
        }
        if (!container.getContainerType().equals(ContainerType.MESSAGE_DRIVEN)) {
            information = new EjbInformation();
            Class cls = null;
            try {
                cls = Class.forName("org.apache.openejb.assembler.classic.JndiBuilder$Bindings");
                Method method = cls.getMethod("getBindings");
View Full Code Here

    @Override
    protected EjbDeployment initialize(BeanContext deploymentInfo) {
        super.initialize(deploymentInfo);

        Container container = deploymentInfo.getContainer();
        if (null == container) {
            throw new IllegalStateException("Container not assigned to deployment " + deploymentId);
        }
        if (!(container instanceof SessionManagerTracker)) {
            throw new IllegalStateException("Container for deployment [" + deploymentId + "] is not a ["
                    + SessionManagerTracker.class.getName() + "]. It is a [" + container.getClass().getName() + "]");
        }
        SessionManagerTracker sessionManagerTracker = (SessionManagerTracker) container;
        sessionManagerTracker.addSessionManager(deploymentId, sessionManager);

        return this;
View Full Code Here

    @Override
    protected void destroy() {
        BeanContext info = deploymentInfo.get();
        if (null != info) {
            Container container = info.getContainer();
            if (null != container) {
                SessionManagerTracker sessionManagerTracker = (SessionManagerTracker) container;
                sessionManagerTracker.removeSessionManager(deploymentId, sessionManager);
            }
        }
View Full Code Here

            // now that everything is configured, deploy to the container
            if (start) {
                for (DeploymentInfo deployment : allDeployments) {
                    try {
                        Container container = deployment.getContainer();
                        container.deploy(deployment);
                        logger.info("createApplication.createdEjb", deployment.getDeploymentID(), deployment.getEjbName(), container.getContainerID());
                    } catch (Throwable t) {
                        throw new OpenEJBException("Error deploying '"+deployment.getEjbName()+"'.  Exception: "+t.getClass()+": "+t.getMessage(), t);
                    }
                }
            }
View Full Code Here

        Collections.reverse(deployments);

        for (DeploymentInfo deployment : deployments) {
            String deploymentID = deployment.getDeploymentID() + "";
            try {
                Container container = deployment.getContainer();
                container.undeploy(deployment);
                deployment.setContainer(null);
            } catch (Throwable t) {
                undeployException.getCauses().add(new Exception("bean: " + deploymentID + ": " + t.getMessage(), t));
            } finally {
                ((CoreDeploymentInfo)deployment).setDestroyed(true);
View Full Code Here

                interceptorBindingBuilder.build(deployment, ejbInfo);

                deployment.setJarPath(ejbJar.jarPath);
                deployments.put(ejbInfo.ejbDeploymentId, deployment);

                Container container = (Container) props.get(ejbInfo.containerId);
                if (container == null) throw new IllegalStateException("Container does not exist: " + ejbInfo.containerId + ".  Referenced by deployment: " + deployment.getDeploymentID());
                // Don't deploy to the container, yet. That will be done by deploy() once Assembler as finished configuring the DeploymentInfo
                deployment.setContainer(container);
            } catch (Throwable e) {
                throw new OpenEJBException("Error building bean '" + ejbInfo.ejbName + "'.  Exception: " + e.getClass() + ": " + e.getMessage(), e);
View Full Code Here

            final Collection<BeanContext> toStart = new ArrayList<BeanContext>();

            // deploy
            for (final BeanContext deployment : allDeployments) {
                try {
                    final Container container = deployment.getContainer();
                    if (container.getBeanContext(deployment.getDeploymentID()) == null) {
                        container.deploy(deployment);
                        if (!((String) deployment.getDeploymentID()).endsWith(".Comp")
                            && !deployment.isHidden()) {
                            logger.info("createApplication.createdEjb", deployment.getDeploymentID(), deployment.getEjbName(), container.getContainerID());
                        }
                        if (logger.isDebugEnabled()) {
                            for (final Map.Entry<Object, Object> entry : deployment.getProperties().entrySet()) {
                                logger.info("createApplication.createdEjb.property", deployment.getEjbName(), entry.getKey(), entry.getValue());
                            }
                        }
                        toStart.add(deployment);
                    }
                } catch (final Throwable t) {
                    throw new OpenEJBException("Error deploying '" + deployment.getEjbName() + "'.  Exception: " + t.getClass() + ": " + t.getMessage(), t);
                }
            }

            // start
            for (final BeanContext deployment : toStart) {
                try {
                    final Container container = deployment.getContainer();
                    container.start(deployment);
                    if (!((String) deployment.getDeploymentID()).endsWith(".Comp")
                        && !deployment.isHidden()) {
                        logger.info("createApplication.startedEjb", deployment.getDeploymentID(), deployment.getEjbName(), container.getContainerID());
                    }
                } catch (final Throwable t) {
                    throw new OpenEJBException("Error starting '" + deployment.getEjbName() + "'.  Exception: " + t.getClass() + ": " + t.getMessage(), t);
                }
            }
View Full Code Here

TOP

Related Classes of org.apache.openejb.Container

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.