private Properties getActivationConfigProperties(
     final ActivationConfigMetaData activationConfig) {
   final Properties activationConfigProps = new Properties();
   if (activationConfig == null || activationConfig.getActivationConfigProperties() == null) {
     return activationConfigProps;
   }
   final ActivationConfigPropertiesMetaData activationConfigPropertiesMetaData =
       activationConfig.getActivationConfigProperties();
   for (ActivationConfigPropertyMetaData activationConfigProp :
       activationConfigPropertiesMetaData) {
     if (activationConfigProp == null) {
       continue;
     }
     final String propName = activationConfigProp.getActivationConfigPropertyName();
     final String propValue = activationConfigProp.getValue();
     if (propName != null) {
       activationConfigProps.put(propName, propValue);
     }
   }
   return activationConfigProps;
 }
  private void processMessageBeans(
      final DeploymentUnit deploymentUnit,
      final Collection<AnnotationInstance> messageBeanAnnotations,
      final CompositeIndex compositeIndex)
      throws DeploymentUnitProcessingException {
    if (messageBeanAnnotations.isEmpty()) return;

    final EjbJarDescription ejbJarDescription = getEjbJarDescription(deploymentUnit);
    final ServiceName deploymentUnitServiceName = deploymentUnit.getServiceName();
    DeploymentDescriptorEnvironment deploymentDescriptorEnvironment = null;

    for (final AnnotationInstance messageBeanAnnotation : messageBeanAnnotations) {
      final AnnotationTarget target = messageBeanAnnotation.target();
      final ClassInfo beanClassInfo = (ClassInfo) target;
      if (!assertMDBClassValidity(beanClassInfo)) {
        continue;
      }
      final String ejbName = beanClassInfo.name().local();
      final AnnotationValue nameValue = messageBeanAnnotation.value("name");
      final String beanName =
          nameValue == null || nameValue.asString().isEmpty() ? ejbName : nameValue.asString();
      final MessageDrivenBeanMetaData beanMetaData =
          getEnterpriseBeanMetaData(deploymentUnit, beanName, MessageDrivenBeanMetaData.class);
      final String beanClassName;
      final String messageListenerInterfaceName;
      boolean replacement =
          deploymentUnit.getAttachment(Attachments.EJB_ANNOTATION_PROPERTY_REPLACEMENT);
      final Properties activationConfigProperties =
          getActivationConfigProperties(messageBeanAnnotation, replacement);
      final String messagingType;
      if (beanMetaData != null) {
        beanClassName = override(beanClassInfo.name().toString(), beanMetaData.getEjbClass());
        deploymentDescriptorEnvironment =
            new DeploymentDescriptorEnvironment("java:comp/env/", beanMetaData);

        if (beanMetaData instanceof MessageDrivenBeanMetaData) {
          // It may actually be GenericBeanMetadata instance
          final MessageDrivenBeanMetaData mdb = (MessageDrivenBeanMetaData) beanMetaData;
          messagingType = mdb.getMessagingType();
          final ActivationConfigMetaData activationConfigMetaData = mdb.getActivationConfig();
          if (activationConfigMetaData != null) {
            final ActivationConfigPropertiesMetaData propertiesMetaData =
                activationConfigMetaData.getActivationConfigProperties();
            if (propertiesMetaData != null) {
              for (final ActivationConfigPropertyMetaData propertyMetaData : propertiesMetaData) {
                activationConfigProperties.put(
                    propertyMetaData.getKey(), propertyMetaData.getValue());
              }
            }
          }
        } else if (beanMetaData instanceof JBossGenericBeanMetaData) {
          // TODO: fix the hierarchy so this is not needed
          final JBossGenericBeanMetaData mdb = (JBossGenericBeanMetaData) beanMetaData;
          messagingType = mdb.getMessagingType();
          final ActivationConfigMetaData activationConfigMetaData = mdb.getActivationConfig();
          if (activationConfigMetaData != null) {
            final ActivationConfigPropertiesMetaData propertiesMetaData =
                activationConfigMetaData.getActivationConfigProperties();
            if (propertiesMetaData != null) {
              for (final ActivationConfigPropertyMetaData propertyMetaData : propertiesMetaData) {
                activationConfigProperties.put(
                    propertyMetaData.getKey(), propertyMetaData.getValue());
              }
            }
          }
        } else {
          messagingType = null;
        }
        messageListenerInterfaceName =
            messagingType != null
                ? messagingType
                : getMessageListenerInterface(compositeIndex, messageBeanAnnotation);

      } else {
        beanClassName = beanClassInfo.name().toString();
        messageListenerInterfaceName =
            getMessageListenerInterface(compositeIndex, messageBeanAnnotation);
      }
      final String defaultResourceAdapterName =
          this.getDefaultResourceAdapterName(deploymentUnit.getServiceRegistry());
      final MessageDrivenComponentDescription beanDescription =
          new MessageDrivenComponentDescription(
              beanName,
              beanClassName,
              ejbJarDescription,
              deploymentUnitServiceName,
              messageListenerInterfaceName,
              activationConfigProperties,
              defaultResourceAdapterName,
              beanMetaData);
      beanDescription.setDeploymentDescriptorEnvironment(deploymentDescriptorEnvironment);

      addComponent(deploymentUnit, beanDescription);
    }

    EjbDeploymentMarker.mark(deploymentUnit);
  }