Package javax.ejb

Examples of javax.ejb.MessageDriven


    * @param jbossEjbMD jboss EJB meta data
    * @return webservices EJB meta data
    */
   private EJBMetaData newEjbMetaData(final WebServiceDeclaration jbossEjbMD)
   {
      final MessageDriven mdbAnnotation = jbossEjbMD.getAnnotation(MessageDriven.class);

      if (mdbAnnotation == null)
      {
         this.log.debug("Creating JBoss agnostic EJB3 meta data for session bean: "
               + jbossEjbMD.getComponentClassName());
         return new SLSBMetaData();
      }
      else
      {
         this.log.debug("Creating JBoss agnostic EJB3 meta data for message driven bean: "
               + jbossEjbMD.getComponentClassName());
         final MDBMetaData mdbMD = new MDBMetaData();

         final String destinationName = this.getActivationProperty("destination", mdbAnnotation.activationConfig());
         mdbMD.setDestinationJndiName(destinationName);

         return mdbMD;
      }
   }
View Full Code Here


  @Override
  protected void introspect()
  {
    super.introspect();

    MessageDriven messageDriven
      = getAnnotatedType().getAnnotation(MessageDriven.class);

    if (messageDriven != null) {
      ActivationConfigProperty []activationConfig
        = messageDriven.activationConfig();

      if (activationConfig != null) {
        for (ActivationConfigProperty prop : activationConfig) {
          addActivationConfigProperty(prop.propertyName(),
                                      prop.propertyValue());
        }
      }

      Class<?> type = messageDriven.messageListenerInterface();
      if (type != null && ! Object.class.equals(type))
        _messagingType = type;
    }
   
    validate();
View Full Code Here

                    }
                }

                if (bean instanceof MessageDrivenBean) {
                    MessageDrivenBean mdb = (MessageDrivenBean) bean;
                    MessageDriven messageDriven = clazz.getAnnotation(MessageDriven.class);
                    if (messageDriven != null) {
                        javax.ejb.ActivationConfigProperty[] configProperties = messageDriven.activationConfig();
                        if (configProperties != null) {
                            ActivationConfig activationConfig = mdb.getActivationConfig();
                            if (activationConfig == null) {
                                activationConfig = new ActivationConfig();
                                mdb.setActivationConfig(activationConfig);
                            }
                            Properties properties = activationConfig.toProperties();
                            for (javax.ejb.ActivationConfigProperty property : configProperties) {
                                if (!properties.containsKey(property.propertyName())) {
                                    activationConfig.addProperty(property.propertyName(), property.propertyValue());
                                }
                            }
                        }

                        if (mdb.getMessagingType() == null) {
                            Class<?> interfce = messageDriven.messageListenerInterface();
                            if (interfce != null && !interfce.equals(Object.class)) {
                                if (!interfce.isInterface()) {
                                    // TODO: Move this check to o.a.o.c.rules.CheckClasses and do it for all MDBs, annotated or not
                                    throw new OpenEJBException("MessageListenerInterface property of @MessageDriven is not an interface");
                                }
View Full Code Here

                }
            }

            List<Class> classes = finder.findAnnotatedClasses(MessageDriven.class);
            for (Class<?> beanClass : classes) {
                MessageDriven mdb = beanClass.getAnnotation(MessageDriven.class);
                String ejbName = getEjbName(mdb, beanClass);

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

                MessageDrivenBean messageBean = (MessageDrivenBean) ejbJar.getEnterpriseBean(ejbName);
View Full Code Here

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

                MessageDriven mdb = beanClass.getAnnotation(MessageDriven.class);
                String ejbName = getEjbName(mdb, beanClass.get());

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

                MessageDrivenBean messageBean = (MessageDrivenBean) ejbJar.getEnterpriseBean(ejbName);
View Full Code Here

                    }
                }
            }

            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

                if (bean instanceof MessageDrivenBean) {
                    /*
                     * @ActivationConfigProperty
                     */
                    MessageDrivenBean mdb = (MessageDrivenBean) bean;
                    MessageDriven messageDriven = clazz.getAnnotation(MessageDriven.class);
                    if (messageDriven != null) {
                        ActivationConfig activationConfig = mdb.getActivationConfig();
                        if (activationConfig == null) {
                            activationConfig = new ActivationConfig();
                        }

                        if (!messageDriven.mappedName().isEmpty()) {
                            if (mdb.getActivationConfig() == null) {
                                mdb.setActivationConfig(activationConfig);
                            }
                            activationConfig.addProperty("destinationType", Queue.class.getName());
                            activationConfig.addProperty("destination", messageDriven.mappedName());
                        }

                        javax.ejb.ActivationConfigProperty[] configProperties = messageDriven.activationConfig();
                        if (configProperties != null) {
                            if (mdb.getActivationConfig() == null) {
                                mdb.setActivationConfig(activationConfig);
                            }

                            Properties properties = activationConfig.toProperties();
                            for (javax.ejb.ActivationConfigProperty property : configProperties) {
                                if (!properties.containsKey(property.propertyName())) {
                                    activationConfig.addProperty(property.propertyName(), property.propertyValue());
                                }
                            }
                        }

                        if (mdb.getMessagingType() == null) {
                            Class<?> interfce = messageDriven.messageListenerInterface();
                            if (interfce != null && !interfce.equals(Object.class)) {
                                if (!interfce.isInterface()) {
                                    // TODO: Move this check to o.a.o.c.rules.CheckClasses and do it for all MDBs, annotated or not
                                    throw new OpenEJBException("MessageListenerInterface property of @MessageDriven is not an interface");
                                }
View Full Code Here

   }

   @Override
   protected MessageDrivenBeanMetaData create(Class<?> beanClass)
   {
      MessageDriven annotation = finder.getAnnotation(beanClass, MessageDriven.class);
      if(annotation == null)
         return null;

      MessageDrivenBeanMetaData metaData = new MessageDrivenBeanMetaData();
      metaData.setEjbClass(beanClass.getName());
      if(annotation.name().length() > 0)
         metaData.setEjbName(annotation.name());
      else
         metaData.setEjbName(beanClass.getSimpleName());
      if(annotation.description().length() > 0)
      {
         DescriptionGroupMetaData dg = ProcessorUtils.getDescriptionGroup(annotation.description());
         metaData.setDescriptionGroup(dg);
      }
      if(annotation.mappedName().length() > 0)
         metaData.setMappedName(annotation.mappedName());
      if(annotation.messageListenerInterface() != Object.class)
         metaData.setMessagingType(annotation.messageListenerInterface().getName());
      ActivationConfigProperty[] props = annotation.activationConfig();
      ActivationConfigMetaData config = new ActivationConfigMetaData();
      ActivationConfigPropertiesMetaData configProps = new ActivationConfigPropertiesMetaData();
      config.setActivationConfigProperties(configProps);
      for(ActivationConfigProperty prop : props)
      {
View Full Code Here

   }

   @Override
   protected JBossMessageDrivenBeanMetaData create(Class<?> beanClass)
   {
      MessageDriven annotation = finder.getAnnotation(beanClass, MessageDriven.class);
      if(annotation == null)
         return null;

      JBossMessageDrivenBeanMetaData metaData = new JBossMessageDrivenBeanMetaData();
      metaData.setEjbClass(beanClass.getName());
      if(annotation.name().length() > 0)
         metaData.setEjbName(annotation.name());
      else
         metaData.setEjbName(beanClass.getSimpleName());
      if(annotation.description().length() > 0)
      {
         DescriptionGroupMetaData dg = ProcessorUtils.getDescriptionGroup(annotation.description());
         metaData.setDescriptionGroup(dg);
      }
      if(annotation.mappedName().length() > 0)
         metaData.setMappedName(annotation.mappedName());
      if(annotation.messageListenerInterface() != Object.class)
         metaData.setMessagingType(annotation.messageListenerInterface().getName());
      ActivationConfigProperty[] props = annotation.activationConfig();
      ActivationConfigMetaData config = new ActivationConfigMetaData();
      ActivationConfigPropertiesMetaData configProps = new ActivationConfigPropertiesMetaData();
      config.setActivationConfigProperties(configProps);
      for(ActivationConfigProperty prop : props)
      {
View Full Code Here

   }

   @Override
   protected MessageDrivenBeanMetaData create(Class<?> beanClass)
   {
      MessageDriven annotation = finder.getAnnotation(beanClass, MessageDriven.class);
      if(annotation == null)
         return null;

      MessageDrivenBeanMetaData metaData = new MessageDrivenBeanMetaData();
      metaData.setEjbClass(beanClass.getName());
      if(annotation.name().length() > 0)
         metaData.setEjbName(annotation.name());
      else
         metaData.setEjbName(beanClass.getSimpleName());
      if(annotation.description().length() > 0)
      {
         DescriptionGroupMetaData dg = ProcessorUtils.getDescriptionGroup(annotation.description());
         metaData.setDescriptionGroup(dg);
      }
      if(annotation.mappedName().length() > 0)
         metaData.setMappedName(annotation.mappedName());
      if(annotation.messageListenerInterface() != Object.class)
         metaData.setMessagingType(annotation.messageListenerInterface().getName());
      ActivationConfigProperty[] props = annotation.activationConfig();
      ActivationConfigMetaData config = new ActivationConfigMetaData();
      ActivationConfigPropertiesMetaData configProps = new ActivationConfigPropertiesMetaData();
      config.setActivationConfigProperties(configProps);
      for(ActivationConfigProperty prop : props)
      {
View Full Code Here

TOP

Related Classes of javax.ejb.MessageDriven

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.