protected void processComponentConfig(DeploymentUnit deploymentUnit, DeploymentPhaseContext phaseContext, CompositeIndex index, ComponentDescription componentDescription) throws DeploymentUnitProcessingException {
if (!(componentDescription instanceof SessionBeanComponentDescription)) {
return;
}
SessionBeanComponentDescription sessionBeanComponentDescription = (SessionBeanComponentDescription) componentDescription;
// if it already has a no-interface view, then no need to check for the implicit rules
if (sessionBeanComponentDescription.hasNoInterfaceView()) {
return;
}
// if the bean already exposes some view(s) then it isn't eligible for an implicit no-interface view.
if (!sessionBeanComponentDescription.getViews().isEmpty()) {
return;
}
String ejbClassName = sessionBeanComponentDescription.getComponentClassName();
final Module module = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.MODULE);
if (module == null) {
throw MESSAGES.moduleNotAttachedToDeploymentUnit(deploymentUnit);
}
ClassLoader cl = module.getClassLoader();
Class<?> ejbClass = null;
try {
ejbClass = cl.loadClass(ejbClassName);
} catch (ClassNotFoundException cnfe) {
throw new DeploymentUnitProcessingException(cnfe);
}
// check whether it's eligible for implicit no-interface view
if (this.exposesNoInterfaceView(ejbClass)) {
logger.debug("Bean: " + sessionBeanComponentDescription.getEJBName() + " will be marked for (implicit) no-interface view");
sessionBeanComponentDescription.addNoInterfaceView();
return;
}
// check for default local view
Class<?> defaultLocalView = this.getDefaultLocalView(ejbClass);
if (defaultLocalView != null) {
logger.debug("Bean: " + sessionBeanComponentDescription.getEJBName() + " will be marked for default local view: " + defaultLocalView.getName());
sessionBeanComponentDescription.addLocalBusinessInterfaceViews(Collections.singleton(defaultLocalView.getName()));
return;
}
}