You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by db...@apache.org on 2011/07/21 03:35:18 UTC
svn commit: r1149003 -
/geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
Author: dblevins
Date: Thu Jul 21 01:35:17 2011
New Revision: 1149003
URL: http://svn.apache.org/viewvc?rev=1149003&view=rev
Log:
GERONIMO-6089: Support for CDI beans in ear lib directory
Modified:
geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
Modified: geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java?rev=1149003&r1=1149002&r2=1149003&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java Thu Jul 21 01:35:17 2011
@@ -1026,6 +1026,8 @@ public class EARConfigBuilder implements
applicationInfo.getModules().add(module);
}
}
+
+ discoverWebBeans(earFile, application,environment, applicationInfo, idBuilder, altVendorDDs);
}
//all the modules in the geronimo plan should have been found by now.
@@ -1144,6 +1146,42 @@ public class EARConfigBuilder implements
}
}
+ private void discoverWebBeans(JarFile earFile, Application application, Environment environment, Module applicationInfo, ModuleIDBuilder idBuilder, Map<String, Object> altVendorDDs) throws DeploymentException {
+ Enumeration<JarEntry> entries = earFile.entries();
+ while (entries.hasMoreElements()) {
+ ZipEntry entry = entries.nextElement();
+ if (entry.getName().endsWith(".jar") && isLibraryEntry(application, entry)) {
+ try {
+ NestedJarFile moduleFile = new NestedJarFile(earFile, entry.getName());
+
+ if (moduleFile.getEntry("META-INF/beans.xml") == null) continue;
+
+ //ask the ejb builder if its an ejb module
+ ModuleBuilder builder = getEjbConfigBuilder();
+ if (builder == null) {
+ continue;
+ }
+
+ Module module = builder.createModule(altVendorDDs.get(entry.getName()),
+ moduleFile,
+ entry.getName(),
+ null,
+ environment,
+ null,
+ applicationInfo,
+ naming, idBuilder);
+
+ if (module != null) {
+ applicationInfo.getModuleLocations().add(entry.getName());
+ applicationInfo.getModules().add(module);
+ }
+ } catch (IOException e) {
+ throw new DeploymentException("Invalid moduleFile: " + entry.getName(), e);
+ }
+ }
+ }
+ }
+
private ArtifactResolver getArtifactResolver() throws DeploymentException {
if (artifactResolvers == null || artifactResolvers.isEmpty()) {
throw new DeploymentException("No artifact resolver supplied to resolve external module");