Examples of SessionBean


Examples of org.apache.openejb.jee.SessionBean

            for (LifecycleCallback callback : bean.getPreDestroy()) {
                checkCallback(ejbClass, "PreDestroy", callback, bean);
            }

            if (bean instanceof Session ) {
                SessionBean session = (SessionBean) bean;

                if (session.getSessionType() == SessionType.STATEFUL ) {

                    for (LifecycleCallback callback : session.getPrePassivate()) {
                        checkCallback(ejbClass, "PrePassivate", callback, bean);
                    }

                    for (LifecycleCallback callback : session.getPostActivate()) {
                        checkCallback(ejbClass, "PostActivate", callback, bean);
                    }
                } else {
                    for (LifecycleCallback callback : session.getPrePassivate()) {
                        ignoredStatefulAnnotation("PrePassivate", bean, callback.getMethodName(), session.getSessionType().getName());
                    }

                    for (LifecycleCallback callback : session.getPostActivate()) {
                        ignoredStatefulAnnotation("PostActivate", bean, callback.getMethodName(), session.getSessionType().getName());
                    }

                    for (RemoveMethod method : session.getRemoveMethod()) {
                        ignoredStatefulAnnotation("Remove", bean, method.getBeanMethod().getMethodName(), session.getSessionType().getName());
                    }

                    for (InitMethod method : session.getInitMethod()) {
                        ignoredStatefulAnnotation("Init", bean, method.getBeanMethod().getMethodName(), session.getSessionType().getName());
                    }
                }
            } else {
                ClassFinder finder = new ClassFinder(ejbClass);
View Full Code Here

Examples of org.apache.openejb.jee.SessionBean

    }

    public void buildDependsOnRefs(EjbModule module, EnterpriseBean enterpriseBean, EnterpriseBeanInfo beanInfo, String moduleId) throws OpenEJBException {
        if (!(enterpriseBean instanceof SessionBean)) return;

        SessionBean sessionBean = (SessionBean) enterpriseBean;

        if (sessionBean.getSessionType() != SessionType.SINGLETON) return;

        URI moduleUri = null;
        if (moduleId != null) {
            try {
                moduleUri = new URI(moduleId);
            } catch (URISyntaxException e) {
                throw new OpenEJBException("Illegal moduleId " + moduleId, e);
            }
        }

        EjbResolver ejbResolver = getEjbResolver(moduleId);

        for (String ejbName : sessionBean.getDependsOn()) {
            String deploymentId = ejbResolver.resolve(new SimpleRef(ejbName), moduleUri);
            if (deploymentId != null) {
                beanInfo.dependsOn.add(deploymentId);
            }
        }
View Full Code Here

Examples of org.apache.openejb.jee.SessionBean

    public void initContext() throws DeploymentException {
        for (EnterpriseBean enterpriseBean : ejbModule.getEjbJar().getEnterpriseBeans()) {
            AbstractName abstractName = createEjbName(enterpriseBean);
            GBeanData gbean = null;
            if (enterpriseBean instanceof SessionBean) {
                SessionBean sessionBean = (SessionBean) enterpriseBean;
                switch (sessionBean.getSessionType()) {
                    case STATELESS:
                        gbean = new GBeanData(abstractName, StatelessDeploymentGBean.GBEAN_INFO);
                        break;
                    case STATEFUL:
                        gbean = new GBeanData(abstractName, StatefulDeploymentGBean.GBEAN_INFO);
                        break;
                }
            } else if (enterpriseBean instanceof EntityBean) {
                gbean = new GBeanData(abstractName, EntityDeploymentGBean.GBEAN_INFO);
            } else if (enterpriseBean instanceof MessageDrivenBean) {
                gbean = new GBeanData(abstractName, MessageDrivenDeploymentGBean.GBEAN_INFO);
            }
            if (gbean == null) {
                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;

                // Remote
                if (remoteBean.getRemote() != null) {
                    String remoteInterfaceName = remoteBean.getRemote();
                    assureEJBObjectInterface(remoteInterfaceName, ejbModule.getClassLoader());
                    gbean.setAttribute(EjbInterface.REMOTE.getAttributeName(), remoteInterfaceName);

                    String homeInterfaceName = remoteBean.getHome();
                    assureEJBHomeInterface(homeInterfaceName, ejbModule.getClassLoader());
                    gbean.setAttribute(EjbInterface.HOME.getAttributeName(), homeInterfaceName);
                }

                // Local
                if (remoteBean.getLocal() != null) {
                    String localInterfaceName = remoteBean.getLocal();
                    assureEJBLocalObjectInterface(localInterfaceName, ejbModule.getClassLoader());
                    gbean.setAttribute(EjbInterface.LOCAL.getAttributeName(), localInterfaceName);

                    String localHomeInterfaceName = remoteBean.getLocalHome();
                    assureEJBLocalHomeInterface(localHomeInterfaceName, ejbModule.getClassLoader());
                    gbean.setAttribute(EjbInterface.LOCAL_HOME.getAttributeName(), localHomeInterfaceName);
                }

                if (enterpriseBean instanceof SessionBean && ((SessionBean)enterpriseBean).getSessionType() == SessionType.STATELESS ) {
                    SessionBean statelessBean = (SessionBean) enterpriseBean;
                    gbean.setAttribute(EjbInterface.SERVICE_ENDPOINT.getAttributeName(), statelessBean.getServiceEndpoint());
                }
            }

            // set reference patterns
            gbean.setReferencePattern("TrackedConnectionAssociator", new AbstractNameQuery(null, Collections.EMPTY_MAP, TrackedConnectionAssociator.class.getName()));
View Full Code Here

Examples of org.apache.openejb.jee.SessionBean

    private AbstractName createEjbName(EnterpriseBean enterpriseBean) {
        String ejbName = enterpriseBean.getEjbName();
        String type = null;
        if (enterpriseBean instanceof SessionBean) {
            SessionBean sessionBean = (SessionBean) enterpriseBean;
            switch (sessionBean.getSessionType()) {
                case STATELESS:
                    type = NameFactory.STATELESS_SESSION_BEAN;
                    break;
                case STATEFUL:
                    type = NameFactory.STATEFUL_SESSION_BEAN;
View Full Code Here

Examples of org.apache.openejb.jee.SessionBean

        // map the refs declared in the vendor plan, so we can match them to the spec references
        Map<String, GerEjbRefType> refMap = mapEjbRefs(plan);
        Map<String, GerEjbLocalRefType> localRefMap = mapEjbLocalRefs(plan);

        // JndiConsumer holds the ref objects that OpenEJB needs
        JndiConsumer consumer = new SessionBean();

        // Add the refs declaraed the the spec deployment descriptor (e.g., ejb-jar.xml or web.xml)
        List<EjbRefType> ejbRefs = convert(specDD.selectChildren(ejbRefQNameSet), JEE_CONVERTER, EjbRefType.class, EjbRefType.type);
        List<EjbLocalRefType> ejbLocalRefs = convert(specDD.selectChildren(ejbLocalRefQNameSet), JEE_CONVERTER, EjbLocalRefType.class, EjbLocalRefType.type);
        addRefs(consumer, ejbRefs, refMap, ejbLocalRefs, localRefMap, componentContext);
View Full Code Here

Examples of org.apache.openejb.jee.SessionBean

        for (org.apache.openejb.config.EjbModule ejbModule : appModule.getEjbModules()) {
            OpenejbJar openejbJar = ejbModule.getOpenejbJar();
            EjbJar ejbJar = ejbModule.getEjbJar();
            for (EnterpriseBean enterpriseBean : ejbJar.getEnterpriseBeans()) {
                if (enterpriseBean instanceof SessionBean) {
                    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

Examples of org.apache.openejb.jee.SessionBean

            addNetworkConnectorMonitor(earContext, sessionManagerName);

            EjbJar ejbJar = ejbModule.getEjbJar();
            for (EnterpriseBean enterpriseBean : ejbJar.getEnterpriseBeans()) {
                if (enterpriseBean instanceof SessionBean) {
                    SessionBean sessionBean = (SessionBean) enterpriseBean;
                    switch (sessionBean.getSessionType()) {
                        case STATEFUL:
                            replaceByClusteredDeploymentGBean(earContext,
                                ejbModule,
                                sessionManagerName,
                                enterpriseBean);
View Full Code Here

Examples of org.apache.openejb.jee.SessionBean

    public AbstractName createEjbName(EARContext earContext, EjbModule ejbModule, EnterpriseBean enterpriseBean) {
        String ejbName = enterpriseBean.getEjbName();
        String type = null;
        if (enterpriseBean instanceof SessionBean) {
            SessionBean sessionBean = (SessionBean) enterpriseBean;
            switch (sessionBean.getSessionType()) {
                case STATELESS:
                    type = NameFactory.STATELESS_SESSION_BEAN;
                    break;
                case STATEFUL:
                    type = NameFactory.STATEFUL_SESSION_BEAN;
View Full Code Here

Examples of org.apache.openejb.jee.SessionBean

    public void initContext() throws DeploymentException {
        for (EnterpriseBean enterpriseBean : ejbModule.getEjbJar().getEnterpriseBeans()) {
            AbstractName abstractName = beanNameBuilder.createEjbName(earContext, ejbModule, enterpriseBean);
            GBeanData gbean = null;
            if (enterpriseBean instanceof SessionBean) {
                SessionBean sessionBean = (SessionBean) enterpriseBean;
                switch (sessionBean.getSessionType()) {
                    case STATELESS:
                        gbean = new GBeanData(abstractName, StatelessDeploymentGBean.GBEAN_INFO);
                        break;
                    case STATEFUL:
                        gbean = new GBeanData(abstractName, StatefulDeploymentGBean.GBEAN_INFO);
                        break;
                    case SINGLETON:
                        gbean = new GBeanData(abstractName, SingletonDeploymentGBean.GBEAN_INFO);
                        break;
                    case MANAGED:
                        gbean = new GBeanData(abstractName, ManagedDeploymentGBean.GBEAN_INFO);
                        break;
                }
            } else if (enterpriseBean instanceof EntityBean) {
                gbean = new GBeanData(abstractName, EntityDeploymentGBean.GBEAN_INFO);
            } else if (enterpriseBean instanceof MessageDrivenBean) {
                gbean = new GBeanData(abstractName, MessageDrivenDeploymentGBean.GBEAN_INFO);
            }
            if (gbean == null) {
                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;

                // Remote
                if (remoteBean.getRemote() != null) {
                    String remoteInterfaceName = remoteBean.getRemote();
                    assureEJBObjectInterface(remoteInterfaceName, earContext.getDeploymentBundle());
                    gbean.setAttribute(EjbInterface.REMOTE.getAttributeName(), remoteInterfaceName);

                    String homeInterfaceName = remoteBean.getHome();
                    assureEJBHomeInterface(homeInterfaceName, earContext.getDeploymentBundle());
                    gbean.setAttribute(EjbInterface.HOME.getAttributeName(), homeInterfaceName);
                }

                // Local
                if (remoteBean.getLocal() != null) {
                    String localInterfaceName = remoteBean.getLocal();
                    assureEJBLocalObjectInterface(localInterfaceName, earContext.getDeploymentBundle());
                    gbean.setAttribute(EjbInterface.LOCAL.getAttributeName(), localInterfaceName);

                    String localHomeInterfaceName = remoteBean.getLocalHome();
                    assureEJBLocalHomeInterface(localHomeInterfaceName, earContext.getDeploymentBundle());
                    gbean.setAttribute(EjbInterface.LOCAL_HOME.getAttributeName(), localHomeInterfaceName);
                }

                if (enterpriseBean instanceof SessionBean && ((SessionBean) enterpriseBean).getSessionType() == SessionType.STATELESS) {
                    SessionBean statelessBean = (SessionBean) enterpriseBean;
                    gbean.setAttribute(EjbInterface.SERVICE_ENDPOINT.getAttributeName(), statelessBean.getServiceEndpoint());
                }
            }

            // set reference patterns
            gbean.setReferencePattern("TrackedConnectionAssociator", new AbstractNameQuery(null, Collections.EMPTY_MAP, TrackedConnectionAssociator.class.getName()));
View Full Code Here

Examples of org.apache.openejb.jee.SessionBean

    protected JndiConsumer createJndiConsumer(XmlObject specDD) throws DeploymentException {
        List<EjbRefType> ejbRefs = convert(specDD.selectChildren(ejbRefQNameSet), J2EE_CONVERTER, EjbRefType.class, EjbRefType.type);
        List<EjbLocalRefType> ejbLocalRefs = convert(specDD.selectChildren(ejbLocalRefQNameSet), J2EE_CONVERTER, EjbLocalRefType.class, EjbLocalRefType.type);

        // build jndi consumer
        JndiConsumer jndiConsumer = new SessionBean();
        for (EjbRefType xmlbeansRef : ejbRefs) {
            // create the ejb-ref
            EjbRef ref = new EjbRef();
            jndiConsumer.getEjbRef().add(ref);

            // ejb-ref-name
            ref.setEjbRefName(getStringValue(xmlbeansRef.getEjbRefName()));

            // ejb-ref-type
            String refType = getStringValue(xmlbeansRef.getEjbRefType());
            if ("SESSION".equalsIgnoreCase(refType)) {
                ref.setEjbRefType(org.apache.openejb.jee.EjbRefType.SESSION);
            } else if ("ENTITY".equalsIgnoreCase(refType)) {
                ref.setEjbRefType(org.apache.openejb.jee.EjbRefType.ENTITY);
            }

            // home
            ref.setHome(getStringValue(xmlbeansRef.getHome()));

            // remote
            ref.setRemote(getStringValue(xmlbeansRef.getRemote()));

            // ejb-link
            ref.setEjbLink(getStringValue(xmlbeansRef.getEjbLink()));

            // mapped-name
            ref.setMappedName(getStringValue(xmlbeansRef.getMappedName()));

            // injection-targets
            if (xmlbeansRef.getInjectionTargetArray() != null) {
                for (InjectionTargetType injectionTargetType : xmlbeansRef.getInjectionTargetArray()) {
                    InjectionTarget injectionTarget = new InjectionTarget();
                    injectionTarget.setInjectionTargetClass(getStringValue(injectionTargetType.getInjectionTargetClass()));
                    injectionTarget.setInjectionTargetName(getStringValue(injectionTargetType.getInjectionTargetName()));
                    ref.getInjectionTarget().add(injectionTarget);
                }
            }
        }

        for (EjbLocalRefType xmlbeansRef : ejbLocalRefs) {
            // create the ejb-ref
            EjbLocalRef ref = new EjbLocalRef();
            jndiConsumer.getEjbLocalRef().add(ref);

            // ejb-ref-name
            ref.setEjbRefName(getStringValue(xmlbeansRef.getEjbRefName()));

            // ejb-ref-type
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.