geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r941561 - in /geronimo/server/trunk: ./ plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/ plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/
Date Thu, 06 May 2010 01:34:54 GMT
Author: xuhaihong
Date: Thu May  6 01:34:53 2010
New Revision: 941561

URL: http://svn.apache.org/viewvc?rev=941561&view=rev
Log:
Enable ServletContainerInitializer scanning as we have an ASM-based class finder now

Modified:
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeHelper.java
    geronimo/server/trunk/pom.xml

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java?rev=941561&r1=941560&r2=941561&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java
Thu May  6 01:34:53 2010
@@ -451,7 +451,7 @@ public abstract class AbstractWebModuleB
         }
         //TODO From my understanding, whether we scan ServletContainerInitializer has nothing
to do with meta-complete/web.xml schema version
         //Might need double-check !
-        //MergeHelper.processServletContainerInitializer(earContext, webModule, bundle);
+        MergeHelper.processServletContainerInitializer(earContext, webModule, bundle);
 
         //Process Web Service
         Map servletNameToPathMap = buildServletNameToPathMap((WebAppType) webModule.getSpecDD(),
webModule.getContextRoot());

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeHelper.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeHelper.java?rev=941561&r1=941560&r2=941561&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeHelper.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeHelper.java
Thu May  6 01:34:53 2010
@@ -90,6 +90,7 @@ import org.apache.geronimo.xbeans.javaee
 import org.apache.geronimo.xbeans.javaee6.WebFragmentDocument;
 import org.apache.geronimo.xbeans.javaee6.WebFragmentType;
 import org.apache.xbean.finder.BundleAnnotationFinder;
+import org.apache.xbean.finder.BundleAssignableClassFinder;
 import org.apache.xbean.osgi.bundle.util.BundleClassFinder;
 import org.apache.xbean.osgi.bundle.util.BundleResourceFinder;
 import org.apache.xbean.osgi.bundle.util.ClassDiscoveryFilter;
@@ -292,37 +293,14 @@ public class MergeHelper {
                     }
                 }
             });
-            //TODO we might need to change to ASM
-            BundleClassFinder bundleClassFinder = new BundleClassFinder(packageAdmin, bundle,
new ClassDiscoveryFilter() {
-
-                @Override
-                public boolean directoryDiscoveryRequired(String directory) {
-                    return true;
-                }
-
-                @Override
-                public boolean jarFileDiscoveryRequired(String jarUrl) {
-                    return !excludedJarNames.contains(jarUrl);
-                }
-
-                @Override
-                public boolean packageDiscoveryRequired(String packageName) {
-                    return true;
-                }
-
-                @Override
-                public boolean rangeDiscoveryRequired(DiscoveryRange discoveryRange) {
-                    return discoveryRange.equals(DiscoveryRange.BUNDLE_CLASSPATH);
-                }
-            });
             Map<String, Set<String>> servletContainerInitializerClassNamesMap
= new HashMap<String, Set<String>>();
-            List<Class> allAvailbleClasses = bundleClassFinder.loadClasses(bundleClassFinder.find());
             for (String servletContainerInitializer : servletContainerInitializers) {
                 Class<?> servletContainerInitializerClass = null;
                 try {
                     servletContainerInitializerClass = bundle.loadClass(servletContainerInitializer);
                 } catch (Exception e) {
                     logger.warn("Fail to load ServletContainerInitializer class " + servletContainerInitializer,
e);
+                    continue;
                 }
                 if (!ServletContainerInitializer.class.isAssignableFrom(servletContainerInitializerClass))
{
                     logger.warn("Class " + servletContainerInitializer + " does not implement
ServletContainerInitializer interface, ignored");
@@ -333,15 +311,29 @@ public class MergeHelper {
                     servletContainerInitializerClassNamesMap.put(servletContainerInitializer,
null);
                     continue;
                 }
-                Set<String> acceptedClassNames = new HashSet<String>();
-                for (Class candidateClass : allAvailbleClasses) {
-                    for (Class expectedClass : handlesTypes.value()) {
-                        if (expectedClass.isAssignableFrom(candidateClass)) {
-                            acceptedClassNames.add(candidateClass.getName());
-                            break;
-                        }
+                BundleClassFinder bundleClassFinder = new BundleAssignableClassFinder(packageAdmin,
bundle, handlesTypes.value(), new ClassDiscoveryFilter() {
+
+                    @Override
+                    public boolean directoryDiscoveryRequired(String directory) {
+                        return true;
                     }
-                }
+
+                    @Override
+                    public boolean jarFileDiscoveryRequired(String jarUrl) {
+                        return !excludedJarNames.contains(jarUrl);
+                    }
+
+                    @Override
+                    public boolean packageDiscoveryRequired(String packageName) {
+                        return true;
+                    }
+
+                    @Override
+                    public boolean rangeDiscoveryRequired(DiscoveryRange discoveryRange)
{
+                        return discoveryRange.equals(DiscoveryRange.BUNDLE_CLASSPATH);
+                    }
+                });
+                Set<String> acceptedClassNames = bundleClassFinder.find();
                 servletContainerInitializerClassNamesMap.put(servletContainerInitializer,
acceptedClassNames.size() > 0 ? acceptedClassNames : null);
             }
             earContext.getGeneralData().put(AbstractWebModuleBuilder.SERVLET_CONTAINER_INITIALIZERS,
servletContainerInitializerClassNamesMap);
@@ -354,7 +346,8 @@ public class MergeHelper {
 
     public static void processWebFragmentsAndAnnotations(EARContext earContext, Module module,
Bundle bundle, WebAppType webApp) throws DeploymentException {
         final Map<String, WebFragmentDocument> jarUrlWebFragmentDocumentMap = new LinkedHashMap<String,
WebFragmentDocument>();
-        final String validJarNamePrefix = module.isStandAlone() ? "WEB-INF/lib" : module.getName()
+ "/WEB-INF/lib";
+        //TODO Double check the name prefix once we have ear support
+        final String validJarNamePrefix = module.isStandAlone() ? "WEB-INF/lib" : module.getTargetPath()
+ "/WEB-INF/lib";
         WebFragmentEntry[] webFragmentEntries = null;
         Enumeration<String> enumeration = bundle.getEntryPaths(validJarNamePrefix);
         if (enumeration != null) {

Modified: geronimo/server/trunk/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/pom.xml?rev=941561&r1=941560&r2=941561&view=diff
==============================================================================
--- geronimo/server/trunk/pom.xml (original)
+++ geronimo/server/trunk/pom.xml Thu May  6 01:34:53 2010
@@ -498,6 +498,12 @@
                 <groupId>org.apache.xbean</groupId>
                 <artifactId>xbean-finder</artifactId>
                 <version>${xbeanVersion}</version>
+                <exclusions>
+                    <exclusion>
+                        <groupId>org.slf4j</groupId>
+                        <artifactId>slf4j-api</artifactId>
+                    </exclusion>
+                </exclusions>
             </dependency>
 
             <dependency>
@@ -528,6 +534,12 @@
                 <groupId>org.apache.xbean</groupId>
                 <artifactId>xbean-bundleutils</artifactId>
                 <version>${xbeanVersion}</version>
+                <exclusions>
+                    <exclusion>
+                        <groupId>org.slf4j</groupId>
+                        <artifactId>slf4j-api</artifactId>
+                    </exclusion>
+                </exclusions>
             </dependency>
 
             <dependency>



Mime
View raw message