use of org.apache.openejb.config.AppModule in project aries by apache.
the class OpenEJBLocator method findEJBs.
public void findEJBs(BundleManifest manifest, IDirectory bundle, EJBRegistry registry) throws ModellerException {
logger.debug("Scanning " + manifest.getSymbolicName() + "_" + manifest.getManifestVersion() + " for EJBs");
String ejbJarLocation = (manifest.getRawAttributes().getValue("Web-ContextPath") == null) ? "META-INF/ejb-jar.xml" : "WEB-INF/ejb-jar.xml";
try {
//If we have an ejb-jar.xml then parse it
IFile file = bundle.getFile(ejbJarLocation);
EjbJar ejbJar = (file == null) ? new EjbJar() : ReadDescriptors.readEjbJar(file.toURL());
EjbModule module = new EjbModule(ejbJar);
//We build our own because we can't trust anyone to get the classpath right otherwise!
module.setFinder(new IDirectoryFinder(AnnotationDeployer.class.getClassLoader(), getClassPathLocations(manifest, bundle)));
//Scan our app for annotated EJBs
AppModule app = new AppModule(module);
new AnnotationDeployer().deploy(app);
//Register our session beans
for (EnterpriseBean eb : ejbJar.getEnterpriseBeans()) {
if (!!!(eb instanceof SessionBean))
continue;
else
registerSessionBean(registry, (SessionBean) eb);
}
} catch (Exception e) {
throw new ModellerException(e);
}
}
Aggregations