private void processMessageDrivenBeanMetaData( final DeploymentUnit deploymentUnit, final MessageDrivenBeanMetaData mdb) throws DeploymentUnitProcessingException { final EjbJarDescription ejbJarDescription = getEjbJarDescription(deploymentUnit); final String beanName = mdb.getName(); final String beanClassName = mdb.getEjbClass(); String messageListenerInterface = mdb.getMessagingType(); if (messageListenerInterface == null || messageListenerInterface.trim().isEmpty()) { // TODO: This isn't really correct to default to MessageListener messageListenerInterface = MessageListener.class.getName(); } final Properties activationConfigProps = getActivationConfigProperties(mdb.getActivationConfig()); final String defaultResourceAdapterName = this.getDefaultResourceAdapterName(deploymentUnit.getServiceRegistry()); final MessageDrivenComponentDescription mdbComponentDescription = new MessageDrivenComponentDescription( beanName, beanClassName, ejbJarDescription, deploymentUnit.getServiceName(), messageListenerInterface, activationConfigProps, defaultResourceAdapterName, mdb); mdbComponentDescription.setDeploymentDescriptorEnvironment( new DeploymentDescriptorEnvironment("java:comp/env/", mdb)); addComponent(deploymentUnit, mdbComponentDescription); }
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); }