} else {
openejbJar = new OpenejbJar();
ejbModule.setOpenejbJar(openejbJar);
}
StringTemplate deploymentIdTemplate = this.deploymentIdTemplate;
if (openejbJar.getProperties().containsKey(DEPLOYMENT_ID_FORMAT)) {
String format = openejbJar.getProperties().getProperty(DEPLOYMENT_ID_FORMAT);
logger.info("Using " + DEPLOYMENT_ID_FORMAT + " '" + format + "'");
deploymentIdTemplate = new StringTemplate(format);
}
for (EnterpriseBean bean : ejbModule.getEjbJar().getEnterpriseBeans()) {
StringTemplate template = deploymentIdTemplate;
org.apache.openejb.api.EjbDeployment annotation = getEjbDeploymentAnnotation(ejbModule, bean);
EjbDeployment ejbDeployment = openejbJar.getDeploymentsByEjbName().get(bean.getEjbName());
if (ejbDeployment == null) {
ejbDeployment = new EjbDeployment();
ejbDeployment.setEjbName(bean.getEjbName());
if (annotation != null && isDefined(annotation.id())) {
template = new StringTemplate(annotation.id());
ejbDeployment.setDeploymentId(formatDeploymentId(bean, contextData, template));
} else {
ejbDeployment.setDeploymentId(formatDeploymentId(bean, contextData, template));
if (!(bean instanceof ManagedBean) || !((ManagedBean) bean).isHidden()) {
logger.info("Auto-deploying ejb " + bean.getEjbName() + ": EjbDeployment(deployment-id=" + ejbDeployment.getDeploymentId() + ")");
}
}
openejbJar.getEjbDeployment().add(ejbDeployment);
} else if (ejbDeployment.getDeploymentId() == null) {
if (annotation != null && isDefined(annotation.id())) {
template = new StringTemplate(annotation.id());
ejbDeployment.setDeploymentId(formatDeploymentId(bean, contextData, template));
} else {
ejbDeployment.setDeploymentId(formatDeploymentId(bean, contextData, template));
logger.info("Auto-assigning deployment-id for ejb " + bean.getEjbName() + ": EjbDeployment(deployment-id=" + ejbDeployment.getDeploymentId() + ")");
}