return;
}
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
final StatefulComponentDescription sessionBean = (StatefulComponentDescription) moduleDescription.getComponentByName(beanMetaData.getEjbName());
final DeploymentReflectionIndex reflectionIndex = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.REFLECTION_INDEX);
final Module module = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.MODULE);
if(module == null) {
return;
}
if(sessionBean == null) {
//should not happen
return;
}
final Class<?> componentClass;
try {
componentClass = module.getClassLoader().loadClass(sessionBean.getComponentClassName());
} catch (ClassNotFoundException e) {
throw new DeploymentUnitProcessingException("Could not load EJB class " + sessionBean.getComponentClassName());
}
for(final RemoveMethodMetaData removeMethod : beanMetaData.getRemoveMethods()) {
final NamedMethodMetaData methodData = removeMethod.getBeanMethod();
final Method method = MethodResolutionUtils.resolveMethod(methodData, componentClass, reflectionIndex);
sessionBean.addRemoveMethod(MethodIdentifier.getIdentifierForMethod(method), removeMethod.isRetainIfException());
}
}