}
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
final Module module = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.MODULE);
final DeploymentReflectionIndex deploymentReflectionIndex = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.REFLECTION_INDEX);
final EJBComponentDescription ejbComponentDescription = (EJBComponentDescription) moduleDescription.getComponentByName(ejbName);
final Class<?> ejbClass;
try {
ejbClass = module.getClassLoader().loadClass(beanMetaData.getEjbClass());
} catch (ClassNotFoundException e) {
throw new DeploymentUnitProcessingException("Could not load EJB class " + beanMetaData.getEjbClass());
}
final ClassReflectionIndex classReflectionIndex = deploymentReflectionIndex.getClassIndex(ejbClass);
for (final MethodPermissionMetaData methodPermission : methodPermissions) {
final MethodsMetaData methods = methodPermission.getMethods();
if (methods == null || methods.isEmpty()) {
continue;
}
// if "unchecked" then it means all roles are allowed access
if (methodPermission.isNotChecked()) {
continue;
}
final Set<String> securityRoles = methodPermission.getRoles();
for (final MethodMetaData method : methods) {
final String methodName = method.getMethodName();
final MethodIntf methodIntf = this.getMethodIntf(method);
// style 1
// <method>
// <ejb-name>EJBNAME</ejb-name>
// <method-name>*</method-name>
// </method>
if (methodName.equals("*")) {
// if method name is * then it means all methods, which actually implies a class level @RolesAllowed
// now check if it specifies the optional method-inf. If it doesn't then it applies to all views
if (methodIntf == null) {
ejbComponentDescription.setRolesAllowedForAllMethodsOfAllViews(securityRoles);
} else {
ejbComponentDescription.setRolesAllowedForAllMethodsOnViewType(methodIntf, securityRoles);
}
} else {
final MethodParametersMetaData methodParams = method.getMethodParams();
// style 2
// <method>