Package org.apache.openejb.jee

Examples of org.apache.openejb.jee.SessionBean


        private void processAsynchronous(EnterpriseBean bean, AnnotationFinder annotationFinder) {
            if (!(bean instanceof SessionBean)) {
                return;
            }

            SessionBean sessionBean = (SessionBean) bean;

            for (Annotated<Method> method : annotationFinder.findMetaAnnotatedMethods(Asynchronous.class)) {
                sessionBean.getAsyncMethod().add(new AsyncMethod(method.get()));
            }

            //Spec 4.5.1 @Asynchronous could be used at the class level of a bean-class ( or superclass ).
            //Seems that it should not be used on the any interface view

            for (Annotated<Class<?>> clazz : annotationFinder.findMetaAnnotatedClasses(Asynchronous.class)) {
                if (!clazz.get().isInterface()) {
                    sessionBean.getAsynchronousClasses().add(clazz.get().getName());
                }
            }
        }
View Full Code Here


public class CheckPersistenceRefs extends ValidationBase {
    public void validate(EjbModule ejbModule) {

        for (EnterpriseBean bean : ejbModule.getEjbJar().getEnterpriseBeans()) {
            if (bean instanceof SessionBean) {
                SessionBean sessionBean = (SessionBean) bean;
                if (sessionBean.getSessionType() == null) {
                    continue; // skipping since we don't know here what is the type
                }
            }

            String beanType = getType(bean);
View Full Code Here

        return type != null && type.equals(PersistenceContextType.EXTENDED);
    }

    private String getType(EnterpriseBean bean) {
        if (bean instanceof SessionBean) {
            SessionBean sessionBean = (SessionBean) bean;
            switch(sessionBean.getSessionType()){
                case STATEFUL: return "Stateful";
                case STATELESS: return "Stateless";
                case SINGLETON: return "Singleton";
                case MANAGED: return "Managed";
                default: throw new IllegalArgumentException("Uknown SessionBean type "+bean.getClass());
View Full Code Here

        for (Bean bean : app.values()) {
            EnterpriseBean enterpriseBean = bean.bean;

            if (!(enterpriseBean instanceof SessionBean)) continue;

            SessionBean sessionBean = (SessionBean) enterpriseBean;

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

            for (String ejbName : sessionBean.getDependsOn()) {
                Bean referee = bean.resolveLink(ejbName);
                if (referee == null) {
                    bean.module.getValidation().fail(enterpriseBean.getEjbName(), "dependsOn.noSuchEjb", ejbName);
                    missingBeans = true;
                } else {
View Full Code Here

        // 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

        Map<String, EnterpriseBean> beansMap = ejbJar.getEnterpriseBeansByEjbName();
        for (Map.Entry<String, EnterpriseBean> entry : beansMap.entrySet()) {
            EnterpriseBean bean = entry.getValue();
            EjbInfo ejbInfo = null;
            if (bean instanceof SessionBean) {
                SessionBean sbean = (SessionBean)bean;
                ejbInfo = createEjbInfo(sbean, classLoader);
            } else if (bean instanceof MessageDrivenBean) {
                MessageDrivenBean mdbean = (MessageDrivenBean)bean;
                ejbInfo = createEjbInfo(mdbean, classLoader);
            } else {
View Full Code Here

                if (!(bean instanceof SessionBean)) {
                    continue;
                }

                SessionBean sessionBean = (SessionBean) bean;

                if (sessionBean.getServiceEndpoint() == null) continue;

                sessionBean.setServiceEndpoint(null);

                // Now check if the bean has no other interfaces
                // if not, then we should just delete it
                if (sessionBean.getHome() != null) continue;
                if (sessionBean.getLocalHome() != null) continue;
                if (sessionBean.getBusinessLocal().size() > 0) continue;
                if (sessionBean.getBusinessRemote().size() > 0) continue;

                // Ok, delete away...
                ejbJar.removeEnterpriseBean(ejbName);
                openejbJar.removeEjbDeployment(ejbDeployment);
View Full Code Here

      for (EnterpriseBean enterpriseBean : enterpriseBeans) {
        if (!(enterpriseBean instanceof SessionBean)) {
          continue;
        }

        SessionBean sessionBean = (SessionBean) enterpriseBean;
        addRemoteAndRemoteHomeAnnotations(sessionBean);
      }
    }

  }
View Full Code Here

      if (enterpriseBean instanceof EntityBean) {
        continue;
      }
     
      try {
        SessionBean sessionBean = (SessionBean) enterpriseBean;
        String remoteClass = sessionBean.getRemote();
        String localClass = sessionBean.getLocal();
        if (remoteClass != null && remoteClass.length() > 0) {
          facade.addAnnotationToFieldsOfType(remoteClass, EJB.class, null);
        }
        if (localClass != null && localClass.length() > 0) {
          facade.addAnnotationToFieldsOfType(localClass, EJB.class, null);
View Full Code Here

      for (EnterpriseBean enterpriseBean : enterpriseBeans) {
        if (!(enterpriseBean instanceof SessionBean)) {
          continue;
        }

        SessionBean sessionBean = (SessionBean) enterpriseBean;
        String ejbClass = sessionBean.getEjbClass();

                if (ejbClass == null || ejbClass.length() == 0) continue;

                facade.removeInterface(ejbClass, "javax.ejb.SessionBean"); //$NON-NLS-1$

                if (! useHome) {
          String remoteInterface = sessionBean.getRemote();
          if (remoteInterface != null && remoteInterface.length() > 0) {
            facade.addInterface(ejbClass, remoteInterface);
            facade.removeInterface(remoteInterface, "javax.ejb.EJBObject"); //$NON-NLS-1$
          }

          String localInterface = sessionBean.getLocal();
          if (localInterface != null && localInterface.length() > 0) {
            facade.addInterface(ejbClass, localInterface);
            facade.removeInterface(localInterface, "javax.ejb.EJBLocalObject"); //$NON-NLS-1$
          }
        }
View Full Code Here

TOP

Related Classes of org.apache.openejb.jee.SessionBean

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.