// classes annotated with ejb annotations, it is not an ejb module
if (ejbJarXml == null && !isEjbAnnotatedModule(moduleFile)) {
return null;
}
EjbJar ejbJar = XmlUtil.unmarshal(EjbJar.class, ejbJarXml);
if (ejbJar == null){
ejbJar = new EjbJar();
}
// load the geronimo-openejb.xml
boolean standAlone = earEnvironment == null;
OpenejbGeronimoEjbJarType geronimoOpenejb = XmlUtil.loadGeronimOpenejbJar(plan, moduleFile, standAlone, targetPath, ejbJar);
if (geronimoOpenejb == null) {
// Avoid NPE GERONIMO-1220; todo: remove this if we can work around the requirement for a plan
throw new DeploymentException("Currently a Geronimo deployment plan is required for an EJB module. Please provide a plan as a deployer argument or packaged in the EJB JAR at META-INF/openejb-jar.xml");
}
// load the openejb-jar.xml
XmlObject object = null;
if (geronimoOpenejb.isSetOpenejbJar()) {
XmlCursor xmlCursor = geronimoOpenejb.getOpenejbJar().newCursor();
xmlCursor.toFirstChild();
object = xmlCursor.getObject();
}
String openejbJarXml = XmlUtil.loadOpenejbJarXml(object, moduleFile);
OpenejbJar openejbJar = XmlUtil.unmarshal(OpenejbJar.class, openejbJarXml);
if (openejbJar == null){
openejbJar = new OpenejbJar();
}
// initialize the geronimo environment
EnvironmentType environmentType = geronimoOpenejb.getEnvironment();
Environment environment = EnvironmentBuilder.buildEnvironment(environmentType, defaultEnvironment);
if (earEnvironment != null) {
EnvironmentBuilder.mergeEnvironments(earEnvironment, environment);
environment = earEnvironment;
if (!environment.getConfigId().isResolved()) {
throw new IllegalStateException("EJB module ID should be fully resolved (not " + environment.getConfigId() + ")");
}
} else {
idBuilder.resolve(environment, new File(moduleFile.getName()).getName(), "jar");
}
// todo THIS WILL NOT WORK WITH ANNOTATIONS... move this to initContext when naming is fixed
// since assembly descriptor will only be valid once metadata complete
// which is only available once a class loader has been constructed in the init phase
EjbJarType ejbJarType = XmlUtil.convertToXmlbeans(ejbJar);
if (ejbJar.getAssemblyDescriptor() != null) {
AssemblyDescriptorType assemblyDescriptor = ejbJarType.getAssemblyDescriptor();
namingBuilder.buildEnvironment(assemblyDescriptor, geronimoOpenejb, environment);
}
//overridden web service locations