Examples of Stateless


Examples of javax.ejb.Stateless

                        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

Examples of javax.ejb.Stateless

            }
        } else {

          
            //TODO BM handle stateless
            Stateless stateless = null;
            try {
                stateless = annElem.getAnnotation(javax.ejb.Stateless.class);
            } catch (Exception e) {
                if (logger.isLoggable(Level.FINE)) {
                    //This can happen in the web.zip installation where there is no ejb
                    //Just logging the error
                    conLogger.log(Level.FINE, LogUtils.EXCEPTION_THROWN, e);
                }
            }
            Singleton singleton = null;
            try {
                singleton = annElem.getAnnotation(javax.ejb.Singleton.class);
            } catch (Exception e) {
                if (logger.isLoggable(Level.FINE)) {
                    //This can happen in the web.zip installation where there is no ejb
                    //Just logging the error
                    conLogger.log(Level.FINE, LogUtils.EXCEPTION_THROWN, e);
                }
            }
            String name;


            if ((stateless != null) &&((stateless).name()==null || stateless.name().length()>0)) {
                name = stateless.name();
            } else if ((singleton != null) &&((singleton).name()==null || singleton.name().length()>0)) {
                name = singleton.name();

            }else {
                name = ((Class) annElem).getSimpleName();
View Full Code Here

Examples of javax.ejb.Stateless

     * Return the name attribute of given annotation.
     * @param annotation
     * @return name
     */
    protected String getAnnotatedName(Annotation annotation) {
        Stateless slAn = (Stateless)annotation;
        return slAn.name();
    }
View Full Code Here

Examples of javax.ejb.Stateless

         // set session bean type in case it wasn't set in a sparse ejb-jar.xml.
        if( !ejbSessionDesc.isSessionTypeSet() ) {
            ejbSessionDesc.setSessionType(EjbSessionDescriptor.STATELESS);
        }

        Stateless sless = (Stateless) ainfo.getAnnotation();

        doDescriptionProcessing(sless.description(), ejbDesc);
        doMappedNameProcessing(sless.mappedName(), ejbDesc);

        return setBusinessAndHomeInterfaces(ejbDesc, ainfo);
    }
View Full Code Here

Examples of javax.ejb.Stateless

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

                Stateless stateless = beanClass.getAnnotation(Stateless.class);
                String ejbName = getEjbName(stateless, beanClass.get());

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

                EnterpriseBean enterpriseBean = ejbJar.getEnterpriseBean(ejbName);
                if (enterpriseBean == null) {
                    enterpriseBean = new StatelessBean(ejbName, beanClass.get());
                    ejbJar.addEnterpriseBean(enterpriseBean);
                }
                if (enterpriseBean.getEjbClass() == null) {
                    enterpriseBean.setEjbClass(beanClass.get());
                }
                if (enterpriseBean instanceof SessionBean) {
                    SessionBean sessionBean = (SessionBean) enterpriseBean;
                    sessionBean.setSessionType(SessionType.STATELESS);

                    if (stateless.mappedName() != null) {
                        sessionBean.setMappedName(stateless.mappedName());
                    }
                }
                LegacyProcessor.process(beanClass.get(), enterpriseBean);
            }
View Full Code Here

Examples of javax.ejb.Stateless

                        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

Examples of javax.ejb.Stateless

/* 42 */     super(finder);
/*    */   }
/*    */
/*    */   public SessionBeanMetaData create(Class<?> beanClass)
/*    */   {
/* 47 */     Stateless annotation = (Stateless)this.finder.getAnnotation(beanClass, Stateless.class);
/* 48 */     if (annotation == null) {
/* 49 */       return null;
/*    */     }
/* 51 */     SessionBeanMetaData beanMetaData = create(beanClass, annotation);
/* 52 */     beanMetaData.setSessionType(SessionType.Stateless);
View Full Code Here

Examples of org.jboss.as.test.clustering.cluster.ejb3.stateless.bean.Stateless

        this.deploy(0);

        final ContextSelector<EJBClientContext> selector = EJBClientContextSelector.setup(CLIENT_PROPERTIES);
       
        try {
            Stateless bean = context.lookupStateless(StatelessBean.class, Stateless.class);
           
            assertEquals(NODES[0], bean.getNodeName());

            this.start(1);
            this.deploy(1);

            // Allow ample time for topology change to propagate to client
            Thread.sleep(GRACE_TIME_TO_MEMBERSHIP_CHANGE);
           
            this.stop(0);
           
            assertEquals(NODES[1], bean.getNodeName());
        } finally {
            // reset the selector
            if (selector != null) {
                EJBClientContext.setSelector(selector);
            }
View Full Code Here

Examples of org.jboss.as.test.clustering.cluster.ejb3.stateless.bean.Stateless

        this.deploy(0);

        final ContextSelector<EJBClientContext> selector = EJBClientContextSelector.setup(CLIENT_PROPERTIES);
       
        try {
            Stateless bean = context.lookupStateless(StatelessBean.class, Stateless.class);
           
            assertEquals(NODES[0], bean.getNodeName());

            this.start(1);
            this.deploy(1);
           
            // Allow ample time for topology change to propagate to client
            Thread.sleep(GRACE_TIME_TO_MEMBERSHIP_CHANGE);
           
            this.undeploy(0);
           
            assertEquals(NODES[1], bean.getNodeName());
        } finally {
            // reset the selector
            if (selector != null) {
                EJBClientContext.setSelector(selector);
            }
View Full Code Here

Examples of org.jboss.test.cluster.ejb3.stateful.Stateless

      SecurityClient client = SecurityClientFactory.getSecurityClient();
      client.setSimple("somebody", "password");
      client.login();
     
      System.out.println("testPassivation");
      Stateless stateless = (Stateless)getInitialContext().lookup("Stateless");
      stateless.testInjection();
     
      ServiceRemote service = (ServiceRemote) getInitialContext().lookup("ServiceBean/remote");
      service.testInjection();
     
      Stateful stateful = (Stateful)getInitialContext().lookup("Stateful");
      assertNotNull(stateful);
      stateful.setState("state");
      assertEquals("state", stateful.getState());
      stateful.testSerializedState("state");
      assertEquals(null, stateful.getInterceptorState());
      stateful.setInterceptorState("hello world");
      assertFalse(stateful.testSessionContext());
      Thread.sleep(10 * 1000);
      assertTrue(stateful.wasPassivated());
     
      assertEquals("state", stateful.getState());
      assertEquals("hello world", stateful.getInterceptorState());

      Stateful another = (Stateful)getInitialContext().lookup("Stateful");
      assertEquals(null, another.getInterceptorState());
      another.setInterceptorState("foo");
      assertEquals("foo", another.getInterceptorState());
      assertEquals("hello world", stateful.getInterceptorState());
     
      assertFalse(stateful.testSessionContext());
     
      stateful.testResources();
     
      stateless.testInjection();
     
      service.testInjection();
   }
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.