Package org.apache.openejb.jee.oejb3

Examples of org.apache.openejb.jee.oejb3.PropertiesAdapter


            Map<String, EjbDeployment> ejbDeployments = ejbModule.getOpenejbJar().getDeploymentsByEjbName();

            for (EnterpriseBean enterpriseBean : ejbModule.getEjbJar().getEnterpriseBeans()) {

                // Get the OpenEJB deployment from openejb-jar.xml
                EjbDeployment ejbDeployment = ejbDeployments.get(enterpriseBean.getEjbName());

                enterpriseBean.setId(ejbDeployment.getDeploymentId());

                // Copy all links over to mappedName

                for (ResourceRef ref : enterpriseBean.getResourceRef()) {
                    ResourceLink resourceLink = ejbDeployment.getResourceLink(ref.getName());
                    if (resourceLink != null && resourceLink.getResId() != null /* don't overwrite with null */) {
                        ref.setMappedName(resourceLink.getResId());
                    }
                }

                for (ResourceEnvRef ref : enterpriseBean.getResourceEnvRef()) {
                    ResourceLink resourceLink = ejbDeployment.getResourceLink(ref.getName());
                    if (resourceLink != null && resourceLink.getResId() != null /* don't overwrite with null */) {
                        ref.setMappedName(resourceLink.getResId());
                    }
                }

                for (MessageDestinationRef ref : enterpriseBean.getMessageDestinationRef()) {
                    ResourceLink resourceLink = ejbDeployment.getResourceLink(ref.getName());
                    if (resourceLink != null && resourceLink.getResId() != null /* don't overwrite with null */) {
                        ref.setMappedName(resourceLink.getResId());
                    }
                }

                for (EjbRef ref : enterpriseBean.getEjbRef()) {
                    EjbLink ejbLink = ejbDeployment.getEjbLink(ref.getName());
                    if (ejbLink != null && ejbLink.getDeployentId() != null /* don't overwrite with null */) {
                        ref.setMappedName(ejbLink.getDeployentId());
                    }
                }

                for (EjbLocalRef ref : enterpriseBean.getEjbLocalRef()) {
                    EjbLink ejbLink = ejbDeployment.getEjbLink(ref.getName());
                    if (ejbLink != null && ejbLink.getDeployentId() != null /* don't overwrite with null */) {
                        ref.setMappedName(ejbLink.getDeployentId());
                    }
                }
            }
View Full Code Here


                throw new DeploymentException("Unknown enterprise bean type " + enterpriseBean.getClass().getName());
            }

            String ejbName = enterpriseBean.getEjbName();

            EjbDeployment ejbDeployment = ejbModule.getOpenejbJar().getDeploymentsByEjbName().get(ejbName);
            if (ejbDeployment == null) {
                throw new DeploymentException("OpenEJB configuration not found for ejb " + ejbName);
            }
            gbean.setAttribute("deploymentId", ejbDeployment.getDeploymentId());
            gbean.setAttribute("ejbName", ejbName);

            // set interface class names
            if (enterpriseBean instanceof RemoteBean) {
                RemoteBean remoteBean = (RemoteBean) enterpriseBean;
View Full Code Here

                    SessionBean sessionBean = (SessionBean) enterpriseBean;
                    switch (sessionBean.getSessionType()) {
                    case STATEFUL:
                        if (this.containerSessionType == SessionType.STATEFUL) {
                            String ejbName = sessionBean.getEjbName();
                            EjbDeployment ejbDeployment = openejbJar.getDeploymentsByEjbName().get(ejbName);
                            if (null == ejbDeployment) {
                                throw new OpenEJBException("No ejbDeployment for ejbName [" + ejbName + "]");
                            }
                            ejbDeployment.setContainerId(containerId);
                        }
                    case STATELESS:
                        if (this.containerSessionType == SessionType.STATELESS) {
                            String ejbName = sessionBean.getEjbName();
                            EjbDeployment ejbDeployment = openejbJar.getDeploymentsByEjbName().get(ejbName);
                            if (null == ejbDeployment) {
                                throw new OpenEJBException("No ejbDeployment for ejbName [" + ejbName + "]");
                            }
                            ejbDeployment.setContainerId(containerId);
                        }       
                    }
                }
            }
        }
View Full Code Here

        ejbJar.addEnterpriseBean(mdb);
       
        EjbModule ejbModule = new EjbModule(ejbJar);

        OpenejbJar openejbJar = new OpenejbJar();
        EjbDeployment sfsbDeployment = new EjbDeployment();
        sfsbDeployment.setEjbName(sfsbName);
        openejbJar.addEjbDeployment(sfsbDeployment);
       
        ejbModule.setOpenejbJar(openejbJar);

        ejbModules.add(ejbModule);
       
        String targetContainerId = "targetContainerId";
        MapSessionBeanToContainerIDDeployer deployer = new MapSessionBeanToContainerIDDeployer(targetContainerId,SessionType.STATEFUL);
        deployer.deploy(appModule);
       
        assertEquals(targetContainerId, sfsbDeployment.getContainerId());
    }
View Full Code Here

                throw new DeploymentException("Unknown enterprise bean type " + enterpriseBean.getClass().getName());
            }

            String ejbName = enterpriseBean.getEjbName();

            EjbDeployment ejbDeployment = ejbModule.getOpenejbJar().getDeploymentsByEjbName().get(ejbName);
            if (ejbDeployment == null) {
                throw new DeploymentException("OpenEJB configuration not found for ejb " + ejbName);
            }
            gbean.setAttribute("deploymentId", ejbDeployment.getDeploymentId());
            gbean.setAttribute("ejbName", ejbName);

            // set interface class names
            if (enterpriseBean instanceof RemoteBean) {
                RemoteBean remoteBean = (RemoteBean) enterpriseBean;
View Full Code Here

                throw new DeploymentException("Unknown enterprise bean type " + enterpriseBean.getClass().getName());
            }

            String ejbName = enterpriseBean.getEjbName();

            EjbDeployment ejbDeployment = ejbModule.getOpenejbJar().getDeploymentsByEjbName().get(ejbName);
            if (ejbDeployment == null) {
                throw new DeploymentException("OpenEJB configuration not found for ejb " + ejbName);
            }
            gbean.setAttribute("deploymentId", ejbDeployment.getDeploymentId());
            gbean.setAttribute("ejbName", ejbName);

            // set interface class names
            if (enterpriseBean instanceof RemoteBean) {
                RemoteBean remoteBean = (RemoteBean) enterpriseBean;
View Full Code Here

        for (EnterpriseBean bean : ejbModule.getEjbJar().getEnterpriseBeans()) {
            StringTemplate template = deploymentIdTemplate;

            org.apache.openejb.api.EjbDeployment annotation = getEjbDeploymentAnnotation(ejbModule, bean);

            EjbDeployment ejbDeployment = openejbJar.getDeploymentsByEjbName().get(bean.getEjbName());
            if (ejbDeployment == null) {

                ejbDeployment = new EjbDeployment();

                ejbDeployment.setEjbName(bean.getEjbName());

                if (annotation != null && isDefined(annotation.id())) {
                    template = new StringTemplate(annotation.id());
                    ejbDeployment.setDeploymentId(formatDeploymentId(bean, contextData, template));
                } else {
                    ejbDeployment.setDeploymentId(formatDeploymentId(bean, contextData, template));
                    logger.info("Auto-deploying ejb " + bean.getEjbName() + ": EjbDeployment(deployment-id=" + ejbDeployment.getDeploymentId() + ")");
                }

                openejbJar.getEjbDeployment().add(ejbDeployment);
            } else if (ejbDeployment.getDeploymentId() == null) {
                if (annotation != null && isDefined(annotation.id())) {
                    template = new StringTemplate(annotation.id());
                    ejbDeployment.setDeploymentId(formatDeploymentId(bean, contextData, template));
                } else {
                    ejbDeployment.setDeploymentId(formatDeploymentId(bean, contextData, template));
                    logger.info("Auto-assigning deployment-id for ejb " + bean.getEjbName() + ": EjbDeployment(deployment-id=" + ejbDeployment.getDeploymentId() + ")");
                }
            }

            if (ejbDeployment.getContainerId() == null && annotation != null && isDefined(annotation.container())) {
                ejbDeployment.setContainerId(annotation.container());
            }

            if (isCmpEntity(bean)) {
                EntityBean entity = (EntityBean) bean;
                if (entity.getAbstractSchemaName() == null) {
View Full Code Here

    }

    private MethodInfo getMethodInfo(Method method, Map ejbds) {
        MethodInfo methodInfo = new MethodInfo();

        EjbDeployment d = (EjbDeployment) ejbds.get(method.getEjbName());

        methodInfo.description = method.getDescription();
        methodInfo.ejbDeploymentId = d.getDeploymentId();
        methodInfo.ejbName = method.getEjbName();
        methodInfo.methodIntf = (method.getMethodIntf() == null) ? null : method.getMethodIntf().toString();
        methodInfo.methodName = method.getMethodName();

        MethodParams mp = method.getMethodParams();
View Full Code Here

        copyCallbacks(s.getAroundInvoke(), bean.aroundInvoke);
        copyCallbacks(s.getPostConstruct(), bean.postConstruct);
        copyCallbacks(s.getPreDestroy(), bean.preDestroy);

        EjbDeployment d = (EjbDeployment) m.get(s.getEjbName());
        if (d == null) {
            throw new OpenEJBException("No deployment information in openejb-jar.xml for bean "
                    + s.getEjbName()
                    + ". Please redeploy the jar");
        }
        bean.ejbDeploymentId = d.getDeploymentId();
        bean.containerId = d.getContainerId();

        Icon icon = s.getIcon();
        bean.largeIcon = (icon == null) ? null : icon.getLargeIcon();
        bean.smallIcon = (icon == null) ? null : icon.getSmallIcon();
        bean.description = s.getDescription();
View Full Code Here

        copyCallbacks(mdb.getAroundInvoke(), bean.aroundInvoke);
        copyCallbacks(mdb.getPostConstruct(), bean.postConstruct);
        copyCallbacks(mdb.getPreDestroy(), bean.preDestroy);

        EjbDeployment d = (EjbDeployment) m.get(mdb.getEjbName());
        if (d == null) {
            throw new OpenEJBException("No deployment information in openejb-jar.xml for bean "
                    + mdb.getEjbName()
                    + ". Please redeploy the jar");
        }
        bean.ejbDeploymentId = d.getDeploymentId();
        bean.containerId = d.getContainerId();

        Icon icon = mdb.getIcon();
        bean.largeIcon = (icon == null) ? null : icon.getLargeIcon();
        bean.smallIcon = (icon == null) ? null : icon.getSmallIcon();
        bean.description = mdb.getDescription();
        bean.displayName = mdb.getDisplayName();
        bean.ejbClass = mdb.getEjbClass();
        bean.ejbName = mdb.getEjbName();
        TransactionType txType = mdb.getTransactionType();
        bean.transactionType = (txType != null)?txType.toString(): TransactionType.CONTAINER.toString();

        if (mdb.getMessagingType() != null) {
            bean.mdbInterface = mdb.getMessagingType();
        } else {
            bean.mdbInterface = "javax.jms.MessageListener";
        }

        ResourceLink resourceLink = d.getResourceLink("openejb/destination");
        if (resourceLink != null) {
            bean.destinationId = resourceLink.getResId();
        }

        if (mdb.getMessageDestinationType() != null) {
View Full Code Here

TOP

Related Classes of org.apache.openejb.jee.oejb3.PropertiesAdapter

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.