*
*/
@Override
protected void processBeanMetaData(SessionBeanMetaData sessionBean, DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final EjbJarDescription ejbJarDescription = deploymentUnit.getAttachment(EjbDeploymentAttachmentKeys.EJB_JAR_DESCRIPTION);
SessionType sessionType = sessionBean.getSessionType();
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, ejbJarDescription);
break;
case Stateful:
sessionBeanDescription = new StatefulComponentDescription(beanName, beanClassName, ejbJarDescription);
break;
case Singleton:
sessionBeanDescription = new SingletonComponentDescription(beanName, beanClassName, ejbJarDescription);
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));
}
}
}
}
}
// interceptors
this.processInterceptors(sessionBean, sessionBeanDescription);
// process EJB3.1 specific session bean description
if (sessionBean instanceof SessionBean31MetaData) {
this.processSessionBean31((SessionBean31MetaData) sessionBean, sessionBeanDescription);
}
// Add this component description to the module description
ejbJarDescription.getEEModuleDescription().addComponent(sessionBeanDescription);
}