// valid class
return true;
}
private void processSessionBeanMetaData(final DeploymentUnit deploymentUnit, final SessionBeanMetaData sessionBean) throws DeploymentUnitProcessingException {
final EjbJarDescription ejbJarDescription = getEjbJarDescription(deploymentUnit);
final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
final List<ComponentDescription> additionalComponents = deploymentUnit.getAttachmentList(Attachments.ADDITIONAL_RESOLVABLE_COMPONENTS);
final String beanName = sessionBean.getName();
// the important bit is to skip already processed EJBs via annotations
if (ejbJarDescription.hasComponent(beanName)) {
final ComponentDescription description = eeModuleDescription.getComponentByName(beanName);
if (description instanceof SessionBeanComponentDescription) {
((SessionBeanComponentDescription) description).setDescriptorData(sessionBean);
} else {
throw new DeploymentUnitProcessingException("Session bean with name " + beanName + " referenced in ejb-jar.xml could not be created, as existing non session bean component with same name already exists: " + description);
}
return;
}
if (appclient) {
for (final ComponentDescription component : additionalComponents) {
if (component.getComponentName().equals(beanName)) {
if (component instanceof SessionBeanComponentDescription) {
((SessionBeanComponentDescription) component).setDescriptorData(sessionBean);
} else {
throw new DeploymentUnitProcessingException("Session bean with name " + beanName + " referenced in ejb-jar.xml could not be created, as existing non session bean component with same name already exists: " + component);
}
return;
}
}
}
final SessionType sessionType = sessionBean.getSessionType();
if(sessionType == null) {
}
if(sessionType == null && sessionBean instanceof GenericBeanMetaData) {
//TODO: this is a hack
return;
}
final String beanClassName = sessionBean.getEjbClass();
final SessionBeanComponentDescription sessionBeanDescription;
switch (sessionType) {
case Stateless:
sessionBeanDescription = new StatelessComponentDescription(beanName, beanClassName, ejbJarDescription, deploymentUnit.getServiceName());
break;
case Stateful:
sessionBeanDescription = new StatefulComponentDescription(beanName, beanClassName, ejbJarDescription, deploymentUnit.getServiceName());
break;
case Singleton:
sessionBeanDescription = new SingletonComponentDescription(beanName, beanClassName, ejbJarDescription, deploymentUnit.getServiceName());
break;
default:
throw new IllegalArgumentException("Unknown session bean type: " + sessionType);
}
if (appclient) {
deploymentUnit.addToAttachmentList(Attachments.ADDITIONAL_RESOLVABLE_COMPONENTS, sessionBeanDescription);
} else {
// Add this component description to module description
ejbJarDescription.getEEModuleDescription().addComponent(sessionBeanDescription);
}
sessionBeanDescription.setDescriptorData(sessionBean);
}