Search in sources :

Example 1 with ActivationConfigPropertiesMetaData

use of org.jboss.metadata.ejb.spec.ActivationConfigPropertiesMetaData in project wildfly by wildfly.

the class MessageDrivenComponentDescriptionFactory method processMessageBeans.

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 PropertyReplacer propertyReplacer = EJBAnnotationPropertyReplacement.propertyReplacer(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 (!EjbValidationsUtil.assertEjbClassValidity(beanClassInfo).isEmpty()) {
            continue;
        }
        final String ejbName = beanClassInfo.name().local();
        final AnnotationValue nameValue = messageBeanAnnotation.value("name");
        final String beanName = (nameValue == null || nameValue.asString().isEmpty()) ? ejbName : propertyReplacer.replaceProperties(nameValue.asString());
        final MessageDrivenBeanMetaData beanMetaData = getEnterpriseBeanMetaData(deploymentUnit, beanName, MessageDrivenBeanMetaData.class);
        final String beanClassName;
        final String messageListenerInterfaceName;
        final Properties activationConfigProperties = getActivationConfigProperties(messageBeanAnnotation, propertyReplacer);
        final String messagingType;
        if (beanMetaData != null) {
            beanClassName = override(beanClassInfo.name().toString(), beanMetaData.getEjbClass());
            deploymentDescriptorEnvironment = new DeploymentDescriptorEnvironment("java:comp/env/", beanMetaData);
            messagingType = beanMetaData.getMessagingType();
            final ActivationConfigMetaData activationConfigMetaData = beanMetaData.getActivationConfig();
            if (activationConfigMetaData != null) {
                final ActivationConfigPropertiesMetaData propertiesMetaData = activationConfigMetaData.getActivationConfigProperties();
                if (propertiesMetaData != null) {
                    for (final ActivationConfigPropertyMetaData propertyMetaData : propertiesMetaData) {
                        activationConfigProperties.put(propertyMetaData.getKey(), propertyMetaData.getValue());
                    }
                }
            }
            messageListenerInterfaceName = messagingType != null ? messagingType : getMessageListenerInterface(compositeIndex, messageBeanAnnotation, deploymentUnit);
        } else {
            beanClassName = beanClassInfo.name().toString();
            messageListenerInterfaceName = getMessageListenerInterface(compositeIndex, messageBeanAnnotation, deploymentUnit);
        }
        final String defaultResourceAdapterName = this.getDefaultResourceAdapterName(deploymentUnit.getServiceRegistry());
        final MessageDrivenComponentDescription beanDescription = new MessageDrivenComponentDescription(beanName, beanClassName, ejbJarDescription, deploymentUnit, messageListenerInterfaceName, activationConfigProperties, defaultResourceAdapterName, beanMetaData, defaultMdbPoolAvailable);
        beanDescription.setDeploymentDescriptorEnvironment(deploymentDescriptorEnvironment);
        addComponent(deploymentUnit, beanDescription);
        final AnnotationValue mappedNameValue = messageBeanAnnotation.value("mappedName");
        if (mappedNameValue != null && !mappedNameValue.asString().isEmpty()) {
            EjbLogger.ROOT_LOGGER.mappedNameNotSupported(mappedNameValue != null ? mappedNameValue.asString() : "", ejbName);
        }
    }
    EjbDeploymentMarker.mark(deploymentUnit);
}
Also used : AnnotationTarget(org.jboss.jandex.AnnotationTarget) MessageDrivenBeanMetaData(org.jboss.metadata.ejb.spec.MessageDrivenBeanMetaData) ActivationConfigPropertyMetaData(org.jboss.metadata.ejb.spec.ActivationConfigPropertyMetaData) ActivationConfigMetaData(org.jboss.metadata.ejb.spec.ActivationConfigMetaData) Properties(java.util.Properties) ActivationConfigPropertiesMetaData(org.jboss.metadata.ejb.spec.ActivationConfigPropertiesMetaData) ServiceName(org.jboss.msc.service.ServiceName) MessageDrivenComponentDescription(org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponentDescription) DeploymentDescriptorEnvironment(org.jboss.as.ee.component.DeploymentDescriptorEnvironment) AnnotatedEJBComponentDescriptionDeploymentUnitProcessor.getEjbJarDescription(org.jboss.as.ejb3.deployment.processors.AnnotatedEJBComponentDescriptionDeploymentUnitProcessor.getEjbJarDescription) EjbJarDescription(org.jboss.as.ejb3.deployment.EjbJarDescription) AnnotationValue(org.jboss.jandex.AnnotationValue) PropertyReplacer(org.jboss.metadata.property.PropertyReplacer) AnnotationInstance(org.jboss.jandex.AnnotationInstance) ClassInfo(org.jboss.jandex.ClassInfo)

Example 2 with ActivationConfigPropertiesMetaData

use of org.jboss.metadata.ejb.spec.ActivationConfigPropertiesMetaData in project wildfly by wildfly.

the class MessageDrivenComponentDescriptionFactory method getActivationConfigProperties.

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;
}
Also used : ActivationConfigPropertyMetaData(org.jboss.metadata.ejb.spec.ActivationConfigPropertyMetaData) Properties(java.util.Properties) ActivationConfigPropertiesMetaData(org.jboss.metadata.ejb.spec.ActivationConfigPropertiesMetaData)

Aggregations

Properties (java.util.Properties)2 ActivationConfigPropertiesMetaData (org.jboss.metadata.ejb.spec.ActivationConfigPropertiesMetaData)2 ActivationConfigPropertyMetaData (org.jboss.metadata.ejb.spec.ActivationConfigPropertyMetaData)2 DeploymentDescriptorEnvironment (org.jboss.as.ee.component.DeploymentDescriptorEnvironment)1 MessageDrivenComponentDescription (org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponentDescription)1 EjbJarDescription (org.jboss.as.ejb3.deployment.EjbJarDescription)1 AnnotatedEJBComponentDescriptionDeploymentUnitProcessor.getEjbJarDescription (org.jboss.as.ejb3.deployment.processors.AnnotatedEJBComponentDescriptionDeploymentUnitProcessor.getEjbJarDescription)1 AnnotationInstance (org.jboss.jandex.AnnotationInstance)1 AnnotationTarget (org.jboss.jandex.AnnotationTarget)1 AnnotationValue (org.jboss.jandex.AnnotationValue)1 ClassInfo (org.jboss.jandex.ClassInfo)1 ActivationConfigMetaData (org.jboss.metadata.ejb.spec.ActivationConfigMetaData)1 MessageDrivenBeanMetaData (org.jboss.metadata.ejb.spec.MessageDrivenBeanMetaData)1 PropertyReplacer (org.jboss.metadata.property.PropertyReplacer)1 ServiceName (org.jboss.msc.service.ServiceName)1