Search in sources :

Example 11 with AssemblyDescriptorMetaData

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

the class AssemblyDescriptorProcessor method deploy.

@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    // get the deployment unit
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    // find the EJB jar metadata and start processing it
    final EjbJarMetaData ejbJarMetaData = deploymentUnit.getAttachment(EjbDeploymentAttachmentKeys.EJB_JAR_METADATA);
    if (ejbJarMetaData == null) {
        return;
    }
    // process assembly-descriptor stuff
    final AssemblyDescriptorMetaData assemblyDescriptor = ejbJarMetaData.getAssemblyDescriptor();
    if (assemblyDescriptor != null) {
        // get hold of the ejb jar description (to which we'll be adding this assembly description metadata)
        final EjbJarDescription ejbJarDescription = deploymentUnit.getAttachment(EjbDeploymentAttachmentKeys.EJB_JAR_DESCRIPTION);
        final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
        // process security-role(s)
        this.processSecurityRoles(assemblyDescriptor.getSecurityRoles(), ejbJarDescription);
        final MessageDestinationsMetaData destinations = assemblyDescriptor.getMessageDestinations();
        if (destinations != null) {
            processMessageDestinations(destinations, eeModuleDescription);
        }
    }
}
Also used : EEModuleDescription(org.jboss.as.ee.component.EEModuleDescription) MessageDestinationsMetaData(org.jboss.metadata.javaee.spec.MessageDestinationsMetaData) EjbJarMetaData(org.jboss.metadata.ejb.spec.EjbJarMetaData) EjbJarDescription(org.jboss.as.ejb3.deployment.EjbJarDescription) AssemblyDescriptorMetaData(org.jboss.metadata.ejb.spec.AssemblyDescriptorMetaData) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 12 with AssemblyDescriptorMetaData

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

the class SecurityRolesMergingProcessor method handleDeploymentDescriptor.

@Override
protected void handleDeploymentDescriptor(DeploymentUnit deploymentUnit, DeploymentReflectionIndex deploymentReflectionIndex, Class<?> componentClass, EJBComponentDescription ejbComponentDescription) throws DeploymentUnitProcessingException {
    final SecurityRolesMetaData roleMappings = new SecurityRolesMetaData();
    final EjbJarMetaData ejbJarMetaData = deploymentUnit.getAttachment(EjbDeploymentAttachmentKeys.EJB_JAR_METADATA);
    if (ejbJarMetaData != null) {
        final AssemblyDescriptorMetaData assemblyDescriptorMetaData = ejbJarMetaData.getAssemblyDescriptor();
        if (assemblyDescriptorMetaData != null) {
            // get the mapping between principal to rolename, defined in the assembly descriptor
            final List<SecurityRoleMetaData> securityRoleMetaDatas = assemblyDescriptorMetaData.getAny(SecurityRoleMetaData.class);
            if (securityRoleMetaDatas != null) {
                for (SecurityRoleMetaData securityRoleMetaData : securityRoleMetaDatas) {
                    roleMappings.add(securityRoleMetaData);
                }
            }
        }
    }
    //Let us look at the ear metadata also
    DeploymentUnit parent = deploymentUnit.getParent();
    if (parent != null) {
        final EarMetaData earMetaData = parent.getAttachment(Attachments.EAR_METADATA);
        if (earMetaData != null) {
            SecurityRolesMetaData earSecurityRolesMetaData = earMetaData.getSecurityRoles();
            SecurityRolesMetaDataMerger.merge(roleMappings, roleMappings, earSecurityRolesMetaData);
        }
    }
    // add it to the EJB component description
    ejbComponentDescription.setSecurityRoles(roleMappings);
}
Also used : SecurityRoleMetaData(org.jboss.metadata.javaee.spec.SecurityRoleMetaData) EjbJarMetaData(org.jboss.metadata.ejb.spec.EjbJarMetaData) SecurityRolesMetaData(org.jboss.metadata.javaee.spec.SecurityRolesMetaData) AssemblyDescriptorMetaData(org.jboss.metadata.ejb.spec.AssemblyDescriptorMetaData) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit) EarMetaData(org.jboss.metadata.ear.spec.EarMetaData)

Aggregations

AssemblyDescriptorMetaData (org.jboss.metadata.ejb.spec.AssemblyDescriptorMetaData)12 EjbJarMetaData (org.jboss.metadata.ejb.spec.EjbJarMetaData)12 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)3 EJBBoundSecurityMetaData (org.jboss.as.ejb3.security.metadata.EJBBoundSecurityMetaData)2 Map (java.util.Map)1 TransactionAttributeType (javax.ejb.TransactionAttributeType)1 EEModuleDescription (org.jboss.as.ee.component.EEModuleDescription)1 CacheInfo (org.jboss.as.ejb3.cache.CacheInfo)1 EJBBoundCacheMetaData (org.jboss.as.ejb3.cache.EJBBoundCacheMetaData)1 EJBBoundClusteringMetaData (org.jboss.as.ejb3.clustering.EJBBoundClusteringMetaData)1 MethodIntf (org.jboss.as.ejb3.component.MethodIntf)1 MessageDrivenComponentDescription (org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponentDescription)1 EJBBoundMdbDeliveryMetaData (org.jboss.as.ejb3.deliveryactive.metadata.EJBBoundMdbDeliveryMetaData)1 ApplicationExceptionDescriptions (org.jboss.as.ejb3.deployment.ApplicationExceptionDescriptions)1 ApplicationExceptions (org.jboss.as.ejb3.deployment.ApplicationExceptions)1 EjbJarDescription (org.jboss.as.ejb3.deployment.EjbJarDescription)1 EJBBoundPoolMetaData (org.jboss.as.ejb3.pool.EJBBoundPoolMetaData)1 EJBBoundResourceAdapterBindingMetaData (org.jboss.as.ejb3.resourceadapterbinding.metadata.EJBBoundResourceAdapterBindingMetaData)1 EjbJaccConfigurator (org.jboss.as.ejb3.security.EjbJaccConfigurator)1 ApplicationExceptionDetails (org.jboss.as.ejb3.tx.ApplicationExceptionDetails)1