Package javax.ejb

Examples of javax.ejb.Stateful


      if (getEJBName() == null && !"".equals(stateless.name()))
        setEJBName(stateless.name());

      _sessionType = Stateless.class;
    } else if (ejbClass.isAnnotationPresent(Stateful.class)) {
      Stateful stateful = ejbClass.getAnnotation(Stateful.class);

      if (getEJBName() == null && !"".equals(stateful.name()))
        setEJBName(stateful.name());

      _sessionType = Stateful.class;
    }

    if (getEJBName() == null)
View Full Code Here


      else if (annType.isAnnotationPresent(Stateful.class)) {
        EjbStatefulBean<X> bean
          = new EjbStatefulBean<X>(this, rawAnnType, annType, moduleName);
        bean.setInjectionTarget(injectTarget);
       
        Stateful stateful = annType.getAnnotation(Stateful.class);

        if (! "".equals(stateful.name()) && stateful.name() != null)
          bean.setEJBName(stateful.name());

        setBeanConfig(bean.getEJBName(), bean);
      }
      else if (annType.isAnnotationPresent(Singleton.class)) {
        EjbSingletonBean<X> bean
View Full Code Here

    if (getInstanceClass() == null)
      throw new ConfigException(L.l("ejb-stateful-bean requires a 'class' attribute"));

    final String name = getName();

    Annotation statefulAnn = new Stateful() {
        public Class annotationType() { return Stateful.class; }
        public String name() { return name; }
        public String mappedName() { return name; }
        public String description() { return ""; }
    };
View Full Code Here

      annType.addAnnotation(stateless);
     
      return new EjbStatelessBean<T>(getConfig(), rawAnnType, annType, moduleName);
    }
    else if ("Stateful".equals(_sessionType)) {
      Stateful stateful = new StatefulLiteral(name, mappedName, description);
      annType.addAnnotation(stateful);
     
      return new EjbStatefulBean<T>(getConfig(), rawAnnType, annType, moduleName);
    }
    else if ("Singleton".equals(_sessionType)) {
View Full Code Here

                    sessionBean.setSessionType(SessionType.STATELESS);
                }
            }

            for (Class<?> beanClass : finder.findAnnotatedClasses(Stateful.class)) {
                Stateful stateful = beanClass.getAnnotation(Stateful.class);
                String ejbName = getEjbName(stateful, beanClass);

                if (!isValidAnnotationUsage(Stateful.class, beanClass, ejbName, ejbModule)) continue;

                EnterpriseBean enterpriseBean = ejbJar.getEnterpriseBean(ejbName);
View Full Code Here

                    managedClasses.remove(beanClass.get().getName());
                    specializingClasses.add(beanClass.get());
                    continue;
                }

                Stateful stateful = beanClass.getAnnotation(Stateful.class);
                String ejbName = getEjbName(stateful, beanClass.get());

                if (!isValidEjbAnnotationUsage(Stateful.class, beanClass, ejbName, ejbModule)) continue;

                EnterpriseBean enterpriseBean = ejbJar.getEnterpriseBean(ejbName);
                if (enterpriseBean == null) {
                    enterpriseBean = new StatefulBean(ejbName, beanClass.get());
                    ejbJar.addEnterpriseBean(enterpriseBean);
                }
                if (enterpriseBean.getEjbClass() == null) {
                    enterpriseBean.setEjbClass(beanClass.get());
                }
                if (enterpriseBean instanceof SessionBean) {
                    SessionBean sessionBean = (SessionBean) enterpriseBean;
                    // TODO: We might be stepping on an xml override here
                    sessionBean.setSessionType(SessionType.STATEFUL);
                    if (stateful.mappedName() != null) {
                        sessionBean.setMappedName(stateful.mappedName());
                    }
                }
                LegacyProcessor.process(beanClass.get(), enterpriseBean);
            }
View Full Code Here

            if (bean instanceof SessionBean) {
                SessionBean sessionBean = (SessionBean) bean;
                switch (sessionBean.getSessionType()) {
                    case STATEFUL: {
                        final Stateful annotation = clazz.getAnnotation(Stateful.class);
                        if (annotation != null && specified(annotation.name())) {
                            return annotation.name();
                        }
                    }
                    case STATELESS: {
                        final Stateless annotation = clazz.getAnnotation(Stateless.class);
                        if (annotation != null && specified(annotation.name())) {
                            return annotation.name();
                        }
                    }
                    case SINGLETON: {
                        final Singleton annotation = clazz.getAnnotation(Singleton.class);
                        if (annotation != null && specified(annotation.name())) {
                            return annotation.name();
                        }
                    }
                }
            }

            if (bean instanceof MessageDrivenBean) {
                final MessageDriven annotation = clazz.getAnnotation(MessageDriven.class);
                if (annotation != null && specified(annotation.name())) {
                    return annotation.name();
                }
            }

            return clazz.getSimpleName();
        }
View Full Code Here

      MockEjb3Deployment deployment = new MockEjb3Deployment(new MockDeploymentUnit());
      Ejb3DescriptorHandler handler = new Ejb3DescriptorHandler(deployment, metaData);
      List<Container> containers = handler.getContainers(deployment, new HashMap<String, Container>());
     
      EJBContainer container = (EJBContainer) containers.get(0);
      Stateful annotation = ((EJBContainer) containers.get(0)).getAnnotation(Stateful.class);
      assertNotNull("Can't find annotation @Stateful on the container", annotation);
     
      //ApplicationException ex = container.getAnnotation(ApplicationException.class, DummyException.class);
      ApplicationException ex = ExtendedAdvisorHelper.getExtendedAdvisor(container.getAdvisor()).resolveAnnotation(DummyException.class, ApplicationException.class);
      assertNotNull("Can't find annotation @ApplicationException in the meta data", ex);
View Full Code Here

      MockEjb3Deployment deployment = new MockEjb3Deployment(new MockDeploymentUnit());
      Ejb3DescriptorHandler handler = new Ejb3DescriptorHandler(deployment, metaData);
      List<Container> containers = handler.getContainers(deployment, new HashMap<String, Container>());
     
      EJBContainer container = (EJBContainer) containers.get(0);
      Stateful annotation = ((EJBContainer) containers.get(0)).getAnnotation(Stateful.class);
      assertNotNull("Can't find annotation @Stateful on the container", annotation);
     
      assertFalse("Stateful bean incorrectly has been marked with " + SerializedConcurrentAccess.class.getName()
            + " annotation", container.getAdvisor().hasAnnotation(SerializedConcurrentAccess.class.getName()));
   }
View Full Code Here

     
      MockEjb3Deployment deployment = new MockEjb3Deployment(new MockDeploymentUnit());
      Ejb3DescriptorHandler handler = new Ejb3DescriptorHandler(deployment, metaData);
      List<Container> containers = handler.getContainers(deployment, new HashMap<String, Container>());
     
      Stateful annotation = ((EJBContainer) containers.get(0)).getAnnotation(Stateful.class);
      assertNotNull("Can't find annotation @Stateful on the container", annotation);
   }
View Full Code Here

TOP

Related Classes of javax.ejb.Stateful

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.