if (sessionType == null) {
throw new DeploymentUnitProcessingException("Unknown session-type for session bean: " + sessionBean.getName() + " in deployment unit: " + deploymentUnit);
}
String beanName = sessionBean.getName();
String beanClassName = sessionBean.getEjbClass();
SessionBeanComponentDescription sessionBeanDescription = null;
switch (sessionType) {
case Stateless:
sessionBeanDescription = new StatelessComponentDescription(beanName, beanClassName, moduleDescription);
break;
case Stateful:
sessionBeanDescription = new StatefulComponentDescription(beanName, beanClassName, moduleDescription);
break;
case Singleton:
sessionBeanDescription = new SingletonComponentDescription(beanName, beanClassName, moduleDescription);
break;
default:
throw new IllegalArgumentException("Unknown session bean type: " + sessionType);
}
// mapped-name
sessionBeanDescription.setMappedName(sessionBean.getMappedName());
// local business interface views
BusinessLocalsMetaData businessLocals = sessionBean.getBusinessLocals();
if (businessLocals != null && !businessLocals.isEmpty()) {
sessionBeanDescription.addLocalBusinessInterfaceViews(businessLocals);
}
// remote business interface views
BusinessRemotesMetaData businessRemotes = sessionBean.getBusinessRemotes();
if (businessRemotes != null && !businessRemotes.isEmpty()) {
sessionBeanDescription.addRemoteBusinessInterfaceViews(businessRemotes);
}
// tx management type
if (sessionBean.getTransactionType() != null) {
sessionBeanDescription.setTransactionManagementType(sessionBean.getTransactionType());
}
// CMT Tx attributes
if (sessionBean.getTransactionType() != TransactionManagementType.BEAN) {
ContainerTransactionsMetaData containerTransactions = sessionBean.getContainerTransactions();
if (containerTransactions != null && !containerTransactions.isEmpty()) {
for (ContainerTransactionMetaData containerTx : containerTransactions) {
TransactionAttributeType txAttr = containerTx.getTransAttribute();
MethodsMetaData methods = containerTx.getMethods();
for (MethodMetaData method : methods) {
String methodName = method.getMethodName();
MethodIntf methodIntf = this.getMethodIntf(method.getMethodIntf());
if (methodName.equals("*")) {
sessionBeanDescription.setTransactionAttribute(methodIntf, txAttr);
} else {
MethodParametersMetaData methodParams = method.getMethodParams();
// update the session bean description with the tx attribute info
sessionBeanDescription.setTransactionAttribute(methodIntf, txAttr, methodName, this.getMethodParams(methodParams));
}
}
}
}
}