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);
}
}
}
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);
}
Aggregations