Package org.apache.openejb

Examples of org.apache.openejb.Container


    }

    public Container createContainer(Class<? extends ContainerInfo> type, String serviceId, Properties declaredProperties, String providerId) throws OpenEJBException {
        ContainerInfo containerInfo = configurationFactory.configureService(type, serviceId, declaredProperties, providerId, "Container");
        assembler.createContainer(containerInfo);
        Container container = assembler.getContainerSystem().getContainer(serviceId);
        return container;
    }
View Full Code Here


    @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});

            DeploymentInfo[] deployments = container.deployments();
            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

                return new JSCommonMessage(CommonMessage.Type.Error, getLocalizedString(request, BUNDLE_NAME, "portlet.openejb.view.invalid", propertyKey), null);
            }
        }

        Properties props = null;
        Container container = containerSystem.getContainer(containerId);
        if (container.getContainerType() == ContainerType.MESSAGE_DRIVEN) {
            OpenEjbSystem openEjbSystem = null;
            AbstractNameQuery absQuery = new AbstractNameQuery(
                    OpenEjbSystem.class.getName());
            Set<AbstractName> systemGBeans = kernel.listGBeans(absQuery);
            for (AbstractName absName : systemGBeans) {
View Full Code Here

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

        if (deploymentInfo.getBusinessLocalInterface() != null) {
            information = new EjbInformation();
            information.setName(getLocalizedString(request, BUNDLE_NAME, BLI_KEY));
            information.setValue(appendMultipleInterfaces(deploymentInfo
                    .getBusinessLocalInterfaces()));
            informations.add(information);
        }
        if (deploymentInfo.getBusinessRemoteInterface() != null) {
            information = new EjbInformation();
            information.setName(getLocalizedString(request, BUNDLE_NAME, BRI_KEY));
            information.setValue(appendMultipleInterfaces(deploymentInfo
                    .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(deploymentInfo.getEjbName());
        informations.add(information);
        if (deploymentInfo.getHomeInterface() != null) {
            information = new EjbInformation();
            information.setValue(deploymentInfo.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

    }

    public Container createContainer(Class<? extends ContainerInfo> type, String serviceId, Properties declaredProperties, String providerId) throws OpenEJBException {
        ContainerInfo containerInfo = configurationFactory.configureService(type, serviceId, declaredProperties, providerId, "Container");
        assembler.createContainer(containerInfo);
        Container container = assembler.getContainerSystem().getContainer(serviceId);
        return container;
    }
View Full Code Here

    @Override
    protected EjbDeployment initialize(CoreDeploymentInfo 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() {
        CoreDeploymentInfo 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

        ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(classLoader);
        try {
            ContainerInfo containerInfo = configurationFactory.configureService(type, serviceId, declaredProperties, providerId, "Container");
            assembler.createContainer(containerInfo);
            Container container = assembler.getContainerSystem().getContainer(serviceId);
            return container;
        } finally {
            Thread.currentThread().setContextClassLoader(oldClassLoader);
        }
    }
View Full Code Here

        //start code from openejb assembler

                // deploy
                for (BeanContext deployment : allDeployments) {
                    try {
                        Container container = deployment.getContainer();
                        container.deploy(deployment);
                        log.info("createApplication.createdEjb" + deployment.getDeploymentID() + deployment.getEjbName() + container.getContainerID());
                        if (log.isDebugEnabled()) {
                            for (Map.Entry<Object, Object> entry : deployment.getProperties().entrySet()) {
                                log.info("createApplication.createdEjb.property" + deployment.getEjbName() + entry.getKey() + entry.getValue());
                            }
                        }
                    } catch (OpenEJBException e) {
                        log.warn("Apparent double start of ejb?? ", e);
                    } catch (Throwable t) {
                        throw new OpenEJBException("Error deploying '"+deployment.getEjbName()+"'.  Exception: "+t.getClass()+": "+t.getMessage(), t);
                    }
                }

                // start
                for (BeanContext deployment : allDeployments) {
                    try {
                        Container container = deployment.getContainer();
                        container.start(deployment);
                        log.info("createApplication.startedEjb" + deployment.getDeploymentID() + deployment.getEjbName() + container.getContainerID());
                    } catch (Throwable t) {
                        throw new OpenEJBException("Error starting '"+deployment.getEjbName()+"'.  Exception: "+t.getClass()+": "+t.getMessage(), t);
                    }
                }
        EjbResolver globalEjbResolver = SystemInstance.get().getComponent(EjbResolver.class);
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.