geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r931020 [1/6] - in /geronimo/server/trunk: framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/ framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/osgi/ plugins/j2ee/geronimo-web-2.5-bu...
Date Tue, 06 Apr 2010 05:14:12 GMT
Author: xuhaihong
Date: Tue Apr  6 05:14:09 2010
New Revision: 931020

URL: http://svn.apache.org/viewvc?rev=931020&view=rev
Log:
GERONIMO-5037 Support Servlet 3.0 annotation and fragment web file

Added:
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/osgi/DiscoveryFilter.java   (with props)
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/osgi/DiscoveryRange.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/ElementSource.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeContext.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeHelper.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeItem.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/annotation/
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/annotation/AnnotationMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/annotation/WebFilterAnnotationMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/annotation/WebListenerAnnotationMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/annotation/WebServletAnnotationMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/ContextParamMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/DataSourceMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/DistributableMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/EjbLocalRefMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/EjbRefMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/EnvEntryMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/ErrorPageMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/FilterInitParamMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/FilterMappingDispatcherMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/FilterMappingMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/FilterMappingServletNameMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/FilterMappingUrlPatternMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/FilterMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/JspConfigMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/ListenerMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/LocaleEncodingMappingListMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/LoginConfigMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/MessageDestinationMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/MessageDestinationRefMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/MimeMappingMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/PersistenceContextRefMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/PersistenceUnitRefMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/PostConstructMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/PreDestroyMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/ResourceEnvRefMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/ResourceRefMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/SecurityConstraintMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/SecurityRoleMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/ServiceRefMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/ServletInitParamMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/ServletLoadOnStartupMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/ServletMappingMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/ServletMappingUrlPatternMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/ServletMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/SessionConfigMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/SubMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/WebFragmentEntry.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/WebFragmentMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/webfragment/WelcomeFileListMergeHandler.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/utils/
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/utils/WebDeploymentMessageUtils.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/utils/WebDeploymentValidationUtils.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/java/org/apache/geronimo/web25/deployment/WebFragmentTest.java   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/resources/javaee_6schema/web-fragment-1.xml   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/resources/webfragments/
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/resources/webfragments/absolute/
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/resources/webfragments/absolute/web-withothers.xml   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/resources/webfragments/absolute/web-withoutothers.xml   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/resources/webfragments/absolute/webfragmentA.xml   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/resources/webfragments/absolute/webfragmentB.xml   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/resources/webfragments/absolute/webfragmentC.xml   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/resources/webfragments/absolute/webfragmentD.xml   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/resources/webfragments/circus/
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/resources/webfragments/circus/circusA/
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/resources/webfragments/circus/circusA/web.xml   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/resources/webfragments/circus/circusA/webfragmentA.xml   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/resources/webfragments/circus/circusA/webfragmentB.xml   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/resources/webfragments/circus/circusA/webfragmentC.xml   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/resources/webfragments/circus/circusA/webfragmentD.xml   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/resources/webfragments/circus/circusB/
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/resources/webfragments/circus/circusB/web.xml   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/resources/webfragments/circus/circusB/webfragmentA.xml   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/resources/webfragments/circus/circusB/webfragmentB.xml   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/resources/webfragments/circus/circusB/webfragmentC.xml   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/resources/webfragments/circus/circusB/webfragmentD.xml   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/resources/webfragments/circus/circusC/
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/resources/webfragments/circus/circusC/web.xml   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/resources/webfragments/circus/circusC/webfragmentA.xml   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/resources/webfragments/circus/circusC/webfragmentB.xml   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/resources/webfragments/circus/circusC/webfragmentC.xml   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/resources/webfragments/circus/circusC/webfragmentD.xml   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/resources/webfragments/relative/
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/resources/webfragments/relative/web.xml   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/resources/webfragments/relative/webfragmentA.xml   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/resources/webfragments/relative/webfragmentB.xml   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/resources/webfragments/relative/webfragmentC.xml   (with props)
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/test/resources/webfragments/relative/webfragmentD.xml   (with props)
Modified:
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/osgi/BundleAnnotationFinder.java
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/osgi/BundleResourceFinder.java
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/pom.xml
    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/test/java/org/apache/geronimo/web25/deployment/SchemaConversionTest.java
    geronimo/server/trunk/plugins/jetty8/geronimo-jetty8-builder/src/main/java/org/apache/geronimo/jetty8/deployment/JettyModuleBuilder.java
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java

Modified: geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java?rev=931020&r1=931019&r2=931020&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java Tue Apr  6 05:14:09 2010
@@ -26,9 +26,10 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Enumeration;
-import java.util.Hashtable;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
 import java.util.jar.Attributes;
@@ -56,7 +57,6 @@ import org.apache.geronimo.kernel.osgi.B
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.ArtifactResolver;
 import org.apache.geronimo.kernel.util.FileUtils;
-import org.apache.geronimo.kernel.util.IOUtils;
 import org.apache.geronimo.kernel.util.JarUtils;
 import org.apache.geronimo.system.configuration.ExecutableConfigurationUtil;
 import org.apache.geronimo.system.main.CommandLineManifest;
@@ -180,17 +180,17 @@ public class Deployer implements GBeanLi
             return null;
         }
         // Generate the URL based on the remote deployment configuration
-        Hashtable hash = new Hashtable();
+        Map<String, String> hash = new HashMap<String, String>();
         hash.put("J2EEApplication", token.getObjectName().getKeyProperty("J2EEApplication"));
         hash.put("j2eeType", "WebModule");
         try {
             hash.put("name", Configuration.getConfigurationID(config).toString());
-            Set names = kernel.listGBeans(new AbstractNameQuery(null, hash));
+            Set<AbstractName> names = kernel.listGBeans(new AbstractNameQuery(null, hash));
             if (names.size() != 1) {
                 log.error("Unable to look up remote deploy upload URL");
                 return null;
             }
-            AbstractName module = (AbstractName) names.iterator().next();
+            AbstractName module = names.iterator().next();
             String contextPath = (String) kernel.getAttribute(module, "contextPath");
             if (null == contextPath) {
                 throw new IllegalStateException("Cannot find contextPath attribute for [" + module + "]");

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/osgi/BundleAnnotationFinder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/osgi/BundleAnnotationFinder.java?rev=931020&r1=931019&r2=931020&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/osgi/BundleAnnotationFinder.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/osgi/BundleAnnotationFinder.java Tue Apr  6 05:14:09 2010
@@ -38,8 +38,12 @@ public class BundleAnnotationFinder exte
     private final Bundle bundle;
 
     public BundleAnnotationFinder(PackageAdmin packageAdmin, Bundle bundle) throws Exception {
+        this(packageAdmin, bundle, BundleResourceFinder.FULL_DISCOVERY_FILTER);
+    }
+
+    public BundleAnnotationFinder(PackageAdmin packageAdmin, Bundle bundle, DiscoveryFilter discoveryFilter) throws Exception {
         this.bundle = bundle;
-        BundleResourceFinder bundleResourceFinder = new BundleResourceFinder(packageAdmin, bundle, "", ".class");
+        BundleResourceFinder bundleResourceFinder = new BundleResourceFinder(packageAdmin, bundle, "", ".class", discoveryFilter);
         bundleResourceFinder.find(new AnnotationFindingCallback());
     }
 

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/osgi/BundleResourceFinder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/osgi/BundleResourceFinder.java?rev=931020&r1=931019&r2=931020&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/osgi/BundleResourceFinder.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/osgi/BundleResourceFinder.java Tue Apr  6 05:14:09 2010
@@ -35,30 +35,38 @@ import org.osgi.framework.Bundle;
 import org.osgi.service.packageadmin.PackageAdmin;
 
 /**
- * Finds all available resources to a bundle by scanning Bundle-ClassPath header 
+ * Finds all available resources to a bundle by scanning Bundle-ClassPath header
  * of the given bundle and its fragments.
  * DynamicImport-Package header is not considered during scanning.
- * 
+ *
  * @version $Rev$ $Date$
  */
 public class BundleResourceFinder {
-   
+
+    public static final DiscoveryFilter FULL_DISCOVERY_FILTER = new DummyDiscoveryFilter();
     private final Bundle bundle;
     private final PackageAdmin packageAdmin;
     private final String prefix;
     private final String suffix;
-    
+    private DiscoveryFilter discoveryFilter;
+
     public BundleResourceFinder(PackageAdmin packageAdmin, Bundle bundle, String prefix, String suffix) {
+        this(packageAdmin, bundle, prefix, suffix, FULL_DISCOVERY_FILTER);
+    }
+
+    public BundleResourceFinder(PackageAdmin packageAdmin, Bundle bundle, String prefix, String suffix, DiscoveryFilter discoveryFilter) {
         this.packageAdmin = packageAdmin;
         this.bundle = bundle;
         this.prefix = prefix.trim();
         this.suffix = suffix.trim();
+        this.discoveryFilter = discoveryFilter;
     }
-    
-    public void find(ResourceFinderCallback callback) throws Exception {
-        scanBundleClassPath(callback, bundle);
 
-        if (packageAdmin != null) {
+    public void find(ResourceFinderCallback callback) throws Exception {
+        if (discoveryFilter.rangeDiscoveryRequired(DiscoveryRange.BUNDLE_CLASSPATH)) {
+            scanBundleClassPath(callback, bundle);
+        }
+        if (packageAdmin != null && discoveryFilter.rangeDiscoveryRequired(DiscoveryRange.FRAGMENT_BUNDLES)) {
             Bundle[] fragments = packageAdmin.getFragments(bundle);
             if (fragments != null) {
                 for (Bundle fragment : fragments) {
@@ -67,7 +75,7 @@ public class BundleResourceFinder {
             }
         }
     }
-    
+
     public Set<URL> find() {
         Set<URL> resources = new LinkedHashSet<URL>();
         try {
@@ -78,7 +86,7 @@ public class BundleResourceFinder {
         }
         return resources;
     }
-    
+
     private void scanBundleClassPath(ResourceFinderCallback callback, Bundle bundle) throws Exception {
         BundleDescription desc = new BundleDescription(bundle.getHeaders());
         List<HeaderEntry> paths = desc.getBundleClassPath();
@@ -100,8 +108,11 @@ public class BundleResourceFinder {
             }
         }
     }
-    
+
     private void scanDirectory(ResourceFinderCallback callback, Bundle bundle, String basePath) throws Exception {
+        if (!discoveryFilter.directoryDiscoveryRequired(basePath)) {
+            return;
+        }
         Enumeration e = bundle.findEntries(basePath, "*" + suffix, true);
         if (e != null) {
             while (e.hasMoreElements()) {
@@ -109,8 +120,11 @@ public class BundleResourceFinder {
             }
         }
     }
-    
-    private void scanZip(ResourceFinderCallback callback, Bundle bundle, String zipName) throws Exception {   
+
+    private void scanZip(ResourceFinderCallback callback, Bundle bundle, String zipName) throws Exception {
+        if (!discoveryFilter.zipFileDiscoveryRequired(zipName)) {
+            return;
+        }
         URL zipEntry = bundle.getEntry(zipName);
         if (zipEntry == null) {
             return;
@@ -128,7 +142,7 @@ public class BundleResourceFinder {
             e.printStackTrace();
         }
     }
-    
+
     private static class ZipEntryInputStream extends FilterInputStream {
         public ZipEntryInputStream(ZipInputStream in) {
             super(in);
@@ -138,7 +152,7 @@ public class BundleResourceFinder {
             // ((ZipInputStream) in).closeEntry();
         }
     }
-    
+
     private boolean prefixMatches(String name) {
         if (prefix.length() == 0 || prefix.equals(".") || prefix.equals("/")) {
             return true;
@@ -148,40 +162,40 @@ public class BundleResourceFinder {
             return name.startsWith(prefix);
         }
     }
-    
+
     private boolean suffixMatches(String name) {
         return (suffix.length() == 0) ? true : name.endsWith(suffix);
     }
-               
+
     private static String addSlash(String name) {
         if (!name.endsWith("/")) {
             name = name + "/";
         }
         return name;
     }
-    
+
     public interface ResourceFinderCallback {
         void foundInDirectory(Bundle bundle, String baseDir, URL url) throws Exception;
-        
+
         void foundInJar(Bundle bundle, String jarName, ZipEntry entry, InputStream in) throws Exception;
     }
-    
+
     public static class DefaultResourceFinderCallback implements ResourceFinderCallback {
 
         private Set<URL> resources;
-        
+
         public DefaultResourceFinderCallback() {
             this(new LinkedHashSet<URL>());
         }
-        
-        public DefaultResourceFinderCallback(Set<URL> resources) {  
+
+        public DefaultResourceFinderCallback(Set<URL> resources) {
             this.resources = resources;
         }
-        
+
         public Set<URL> getResources() {
             return resources;
         }
-        
+
         public void foundInDirectory(Bundle bundle, String baseDir, URL url) throws Exception {
             resources.add(url);
         }
@@ -191,6 +205,25 @@ public class BundleResourceFinder {
             URL url = new URL("jar:" + jarURL.toString() + "!/" + entry.getName());
             resources.add(url);
         }
-        
+
+    }
+
+    public static class DummyDiscoveryFilter implements DiscoveryFilter {
+
+        @Override
+        public boolean directoryDiscoveryRequired(String url) {
+            return true;
+        }
+
+        @Override
+        public boolean rangeDiscoveryRequired(DiscoveryRange discoveryRange) {
+            return true;
+        }
+
+        @Override
+        public boolean zipFileDiscoveryRequired(String url) {
+            return true;
+        }
+
     }
 }

Added: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/osgi/DiscoveryFilter.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/osgi/DiscoveryFilter.java?rev=931020&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/osgi/DiscoveryFilter.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/osgi/DiscoveryFilter.java Tue Apr  6 05:14:09 2010
@@ -0,0 +1,30 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.kernel.osgi;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface DiscoveryFilter {
+
+    public boolean rangeDiscoveryRequired(DiscoveryRange discoveryRange);
+
+    public boolean zipFileDiscoveryRequired(String url);
+
+    public boolean directoryDiscoveryRequired(String url);
+}

Propchange: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/osgi/DiscoveryFilter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/osgi/DiscoveryFilter.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/osgi/DiscoveryFilter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/osgi/DiscoveryRange.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/osgi/DiscoveryRange.java?rev=931020&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/osgi/DiscoveryRange.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/osgi/DiscoveryRange.java Tue Apr  6 05:14:09 2010
@@ -0,0 +1,25 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.kernel.osgi;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public enum DiscoveryRange {
+    REQUIRED_BUNDLES, IMPORT_PACKAGES, BUNDLE_CLASSPATH, FRAGMENT_BUNDLES
+}

Propchange: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/osgi/DiscoveryRange.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/osgi/DiscoveryRange.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/osgi/DiscoveryRange.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/pom.xml?rev=931020&r1=931019&r2=931020&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/pom.xml (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/pom.xml Tue Apr  6 05:14:09 2010
@@ -84,7 +84,11 @@
                             org.apache.geronimo.web25.deployment,
                             org.apache.geronimo.web25.deployment.security,
                             org.apache.geronimo.xbeans.geronimo.web,
-                            org.apache.geronimo.xbeans.geronimo.web.impl
+                            org.apache.geronimo.xbeans.geronimo.web.impl,
+                            org.apache.geronimo.web25.deployment.merge,
+                            org.apache.geronimo.web25.deployment.merge.annotation,
+                            org.apache.geronimo.web25.deployment.merge.webfragment,
+                            org.apache.geronimo.web25.deployment.utils
                         </Export-Package>
                         <_exportcontents>schemaorg_apache_xmlbeans*</_exportcontents>
                         <DynamicImport-Package>schemaorg_apache_xmlbeans.*</DynamicImport-Package>

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=931020&r1=931019&r2=931020&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 Tue Apr  6 05:14:09 2010
@@ -17,6 +17,33 @@
 
 package org.apache.geronimo.web25.deployment;
 
+import java.io.File;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.zip.ZipEntry;
+
+import javax.security.auth.message.module.ServerAuthModule;
+import javax.xml.bind.JAXBException;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.stream.Location;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.components.jaspi.model.AuthModuleType;
 import org.apache.geronimo.components.jaspi.model.ConfigProviderType;
@@ -63,20 +90,18 @@ import org.apache.geronimo.security.jasp
 import org.apache.geronimo.security.jaspi.ServerAuthConfigGBean;
 import org.apache.geronimo.security.jaspi.ServerAuthContextGBean;
 import org.apache.geronimo.security.jaspi.ServerAuthModuleGBean;
+import org.apache.geronimo.web25.deployment.merge.MergeHelper;
 import org.apache.geronimo.web25.deployment.security.AuthenticationWrapper;
 import org.apache.geronimo.web25.deployment.security.SpecSecurityBuilder;
 import org.apache.geronimo.xbeans.geronimo.j2ee.GerSecurityDocument;
-import org.apache.geronimo.xbeans.javaee6.FilterMappingType;
 import org.apache.geronimo.xbeans.javaee6.FilterType;
 import org.apache.geronimo.xbeans.javaee6.FullyQualifiedClassType;
 import org.apache.geronimo.xbeans.javaee6.ListenerType;
-import org.apache.geronimo.xbeans.javaee6.SecurityConstraintType;
 import org.apache.geronimo.xbeans.javaee6.ServletMappingType;
 import org.apache.geronimo.xbeans.javaee6.ServletType;
 import org.apache.geronimo.xbeans.javaee6.UrlPatternType;
 import org.apache.geronimo.xbeans.javaee6.WebAppDocument;
 import org.apache.geronimo.xbeans.javaee6.WebAppType;
-import org.apache.geronimo.xbeans.javaee6.WebResourceCollectionType;
 import org.apache.xbean.finder.ClassFinder;
 import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlDocumentProperties;
@@ -88,63 +113,54 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.xml.sax.SAXException;
 
-import javax.security.auth.message.module.ServerAuthModule;
-import javax.xml.bind.JAXBException;
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.namespace.QName;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.stream.Location;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.StringWriter;
-import java.net.URI;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.LinkedHashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-import java.util.zip.ZipEntry;
-
 /**
  * @version $Rev$ $Date$
  */
 public abstract class AbstractWebModuleBuilder implements ModuleBuilder {
+
     //are we combining all web apps into one bundle in an ear?
     //TODO eliminate this
     protected static final boolean COMBINED_BUNDLE = true;
 
     public final static NamingBuilder.Key<GBeanData> DEFAULT_JSP_SERVLET_KEY = new NamingBuilder.Key<GBeanData>() {
+
         public GBeanData get(Map context) {
             return (GBeanData) context.get(this);
         }
-
     };
+
     private static final Logger log = LoggerFactory.getLogger(AbstractWebModuleBuilder.class);
 
     private static final QName TAGLIB = new QName(SchemaConversionUtils.JAVAEE_NAMESPACE, "taglib");
 
     private static final String LINE_SEP = System.getProperty("line.separator");
 
+    public static final String WEB_MODULE_HAS_SECURITY_REALM = "WEB_MODULE_HAS_SECURITY_REALM";
+
+    public static final String EXCLUDED_JAR_URLS = "EXCLUDED_JAR_URLS";
+
+    public static final String EXCLUDED_ANNOTATION_SCAN_JAR_URLS = "EXCLUDED_ANNOTATION_SCAN_JAR_URLS";
+
     protected static final AbstractNameQuery MANAGED_CONNECTION_FACTORY_PATTERN;
+
     private static final AbstractNameQuery ADMIN_OBJECT_PATTERN;
+
     protected static final AbstractNameQuery STATELESS_SESSION_BEAN_PATTERN;
+
     protected static final AbstractNameQuery STATEFUL_SESSION_BEAN_PATTERN;
+
     protected static final AbstractNameQuery ENTITY_BEAN_PATTERN;
+
     protected final Kernel kernel;
+
     protected final NamespaceDrivenBuilderCollection serviceBuilders;
+
     protected final ResourceEnvironmentSetter resourceEnvironmentSetter;
+
     protected final Collection<WebServiceBuilder> webServiceBuilder;
 
     protected final NamingBuilder namingBuilders;
+
     protected final Collection<ModuleBuilderExtension> moduleBuilderExtensions;
 
     private static final QName SECURITY_QNAME = GerSecurityDocument.type.getDocumentElementName();
@@ -156,7 +172,8 @@ public abstract class AbstractWebModuleB
      */
     private static final URI RELATIVE_MODULE_BASE_URI = URI.create("../");
 
-    protected AbstractWebModuleBuilder(Kernel kernel, Collection<NamespaceDrivenBuilder> serviceBuilders, NamingBuilder namingBuilders, ResourceEnvironmentSetter resourceEnvironmentSetter, Collection<WebServiceBuilder> webServiceBuilder, Collection<ModuleBuilderExtension> moduleBuilderExtensions) {
+    protected AbstractWebModuleBuilder(Kernel kernel, Collection<NamespaceDrivenBuilder> serviceBuilders, NamingBuilder namingBuilders, ResourceEnvironmentSetter resourceEnvironmentSetter,
+            Collection<WebServiceBuilder> webServiceBuilder, Collection<ModuleBuilderExtension> moduleBuilderExtensions) {
         this.kernel = kernel;
         this.serviceBuilders = new NamespaceDrivenBuilderCollection(serviceBuilders);
         this.namingBuilders = namingBuilders;
@@ -171,7 +188,6 @@ public abstract class AbstractWebModuleB
         STATELESS_SESSION_BEAN_PATTERN = new AbstractNameQuery(null, Collections.singletonMap(NameFactory.J2EE_TYPE, NameFactory.STATELESS_SESSION_BEAN));
         STATEFUL_SESSION_BEAN_PATTERN = new AbstractNameQuery(null, Collections.singletonMap(NameFactory.J2EE_TYPE, NameFactory.STATEFUL_SESSION_BEAN));
         ENTITY_BEAN_PATTERN = new AbstractNameQuery(null, Collections.singletonMap(NameFactory.J2EE_TYPE, NameFactory.ENTITY_BEAN));
-
     }
 
     public NamingBuilder getNamingBuilders() {
@@ -198,11 +214,13 @@ public abstract class AbstractWebModuleB
         return createModule(plan, moduleFile, ".", null, null, null, null, naming, idBuilder);
     }
 
-    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
+    public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming,
+            ModuleIDBuilder idBuilder) throws DeploymentException {
         return createModule(plan, moduleFile, targetPath, specDDUrl, environment, (String) moduleContextInfo, earName, naming, idBuilder);
     }
 
-    protected abstract Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment earEnvironment, String contextRoot, AbstractName earName, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException;
+    protected abstract Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment earEnvironment, String contextRoot, AbstractName earName, Naming naming,
+            ModuleIDBuilder idBuilder) throws DeploymentException;
 
     /**
      * Some servlets will have multiple url patterns.  However, webservice servlets
@@ -223,7 +241,6 @@ public abstract class AbstractWebModuleB
         for (ServletMappingType servletMapping : servletMappings) {
             String servletName = servletMapping.getServletName().getStringValue().trim();
             UrlPatternType[] urlPatterns = servletMapping.getUrlPatternArray();
-
             for (int i = 0; urlPatterns != null && (i < urlPatterns.length); i++) {
                 map.put(servletName, contextRoot + urlPatterns[i].getStringValue().trim());
             }
@@ -232,37 +249,32 @@ public abstract class AbstractWebModuleB
     }
 
     protected String determineDefaultContextRoot(WebAppType webApp, boolean isStandAlone, JarFile moduleFile, String targetPath) {
-
         if (webApp != null && webApp.getId() != null) {
             return webApp.getId();
         }
-
         if (isStandAlone) {
             // default configId is based on the moduleFile name
             return "/" + trimPath(new File(moduleFile.getName()).getName());
         }
-
         // default configId is based on the module uri from the application.xml
         return trimPath(targetPath);
     }
 
     private String trimPath(String path) {
-
         if (path == null) {
             return null;
         }
-
         if (path.endsWith(".war")) {
             path = path.substring(0, path.length() - 4);
         }
         if (path.endsWith("/")) {
             path = path.substring(0, path.length() - 1);
         }
-
         return path;
     }
 
-    public void installModule(JarFile earFile, EARContext earContext, Module module, Collection configurationStores, ConfigurationStore targetConfigurationStore, Collection repositories) throws DeploymentException {
+    public void installModule(JarFile earFile, EARContext earContext, Module module, Collection configurationStores, ConfigurationStore targetConfigurationStore, Collection repositories)
+            throws DeploymentException {
         EARContext moduleContext;
         //TODO GERONIMO-4972 find a way to create working nested bundles.
         if (true || module.isStandAlone()) {
@@ -275,19 +287,13 @@ public abstract class AbstractWebModuleB
             environment.addDependency(earConfigId, ImportType.ALL);
             File configurationDir = new File(earContext.getBaseDir(), module.getTargetPath());
             configurationDir.mkdirs();
-
             // construct the web app deployment context... this is the same class used by the ear context
             try {
                 File inPlaceConfigurationDir = null;
                 if (null != earContext.getInPlaceConfigurationDir()) {
                     inPlaceConfigurationDir = new File(earContext.getInPlaceConfigurationDir(), module.getTargetPath());
                 }
-                moduleContext = new EARContext(configurationDir,
-                        inPlaceConfigurationDir,
-                        environment,
-                        ConfigurationModuleType.WAR,
-                        module.getModuleName(),
-                        earContext);
+                moduleContext = new EARContext(configurationDir, inPlaceConfigurationDir, environment, ConfigurationModuleType.WAR, module.getModuleName(), earContext);
             } catch (DeploymentException e) {
                 cleanupConfigurationDir(configurationDir);
                 throw e;
@@ -295,7 +301,6 @@ public abstract class AbstractWebModuleB
         }
         module.setEarContext(moduleContext);
         module.setRootEarContext(earContext);
-
         try {
             ClassPathList manifestcp = new ClassPathList();
             // add the warfile's content to the configuration
@@ -315,27 +320,23 @@ public abstract class AbstractWebModuleB
                     moduleContext.addFile(targetPath, warFile, entry);
                 }
             }
-
             // always add WEB-INF/classes to the classpath regardless of whether
             // any classes exist.  This must be searched BEFORE the WEB-INF/lib jar files,
             // per the servlet specifications.
             moduleContext.addToClassPath(module.resolve("WEB-INF/classes/").getPath());
             manifestcp.add("WEB-INF/classes/");
-
             // install the libs
             for (ZipEntry entry : libs) {
                 URI targetPath = module.resolve(entry.getName());
                 moduleContext.addInclude(targetPath, warFile, entry);
                 manifestcp.add(entry.getName());
             }
-
             // add the manifest classpath entries declared in the war to the class loader
             // we have to explicitly add these since we are unpacking the web module
             // and the url class loader will not pick up a manifest from an unpacked dir
             //GERONIMO-4972 this can't be correct for one-bundle deployments.
             moduleContext.addManifestClassPath(warFile, RELATIVE_MODULE_BASE_URI);
             moduleContext.getGeneralData().put(ClassPathList.class, manifestcp);
-
         } catch (IOException e) {
             throw new DeploymentException("Problem deploying war", e);
         } finally {
@@ -352,7 +353,18 @@ public abstract class AbstractWebModuleB
         }
     }
 
-    protected void basicInitContext(EARContext earContext, Module module, XmlObject gerWebApp, boolean hasSecurityRealmName) throws DeploymentException {
+    protected abstract void preInitContext(EARContext earContext, Module module, Bundle bundle) throws DeploymentException;
+
+    protected abstract void postInitContext(EARContext earContext, Module module, Bundle bundle) throws DeploymentException;
+
+    @Override
+    public void initContext(EARContext earContext, Module module, Bundle bundle) throws DeploymentException {
+        preInitContext(earContext, module, bundle);
+        basicInitContext(earContext, module, bundle, (XmlObject) module.getVendorDD());
+        postInitContext(earContext, module, bundle);
+    }
+
+    protected void basicInitContext(EARContext earContext, Module module, Bundle bundle, XmlObject gerWebApp) throws DeploymentException {
         WebModule webModule = (WebModule) module;
         //complete manifest classpath
         EARContext moduleContext = webModule.getEarContext();
@@ -361,11 +373,13 @@ public abstract class AbstractWebModuleB
         URI baseUri = URI.create(webModule.getTargetPath());
         URI resolutionUri = invertURI(baseUri);
         earContext.getCompleteManifestClassPath(webModule.getDeployable(), baseUri, resolutionUri, manifestcp, moduleLocations);
-
+        //Security Configuration Validation
         WebAppType webApp = (WebAppType) webModule.getSpecDD();
+        boolean hasSecurityRealmName = (Boolean) module.getEarContext().getGeneralData().get(WEB_MODULE_HAS_SECURITY_REALM);
         if ((webApp.getSecurityConstraintArray().length > 0 || webApp.getSecurityRoleArray().length > 0)) {
             if (!hasSecurityRealmName) {
-                throw new DeploymentException("web.xml for web app " + webModule.getName() + " includes security elements but Geronimo deployment plan is not provided or does not contain <security-realm-name> element necessary to configure security accordingly.");
+                throw new DeploymentException("web.xml for web app " + webModule.getName()
+                        + " includes security elements but Geronimo deployment plan is not provided or does not contain <security-realm-name> element necessary to configure security accordingly.");
             }
         }
         if (hasSecurityRealmName) {
@@ -376,12 +390,18 @@ public abstract class AbstractWebModuleB
         if (securityElements.length > 0 && !hasSecurityRealmName) {
             throw new DeploymentException("You have supplied a security configuration for web app " + webModule.getName() + " but no security-realm-name to allow login");
         }
+
+        //Process Naming
         getNamingBuilders().buildEnvironment(webApp, webModule.getVendorDD(), webModule.getEnvironment());
-        //this is silly
         getNamingBuilders().initContext(webApp, gerWebApp, webModule);
 
-        Map servletNameToPathMap = buildServletNameToPathMap((WebAppType) webModule.getSpecDD(), webModule.getContextRoot());
+      //Process web fragments and annotations
+        if (!webApp.getMetadataComplete()) {
+            MergeHelper.processWebFragmentsAndAnnotations(earContext, webModule, bundle, webApp);
+        }
 
+        //Process Web Service
+        Map servletNameToPathMap = buildServletNameToPathMap((WebAppType) webModule.getSpecDD(), webModule.getContextRoot());
         Map sharedContext = webModule.getSharedContext();
         for (Object aWebServiceBuilder : webServiceBuilder) {
             WebServiceBuilder serviceBuilder = (WebServiceBuilder) aWebServiceBuilder;
@@ -403,6 +423,8 @@ public abstract class AbstractWebModuleB
         XmlOptions options = new XmlOptions();
         QName webQName = new QName("http://java.sun.com/xml/ns/javaee", "web-app");
         options.setSaveSyntheticDocumentElement(webQName);
+        options.setSavePrettyPrint();
+        options.setSavePrettyPrintIndent(4);
         try {
             module.getSpecDD().save(writer, options);
         } catch (IOException e) {
@@ -429,13 +451,11 @@ public abstract class AbstractWebModuleB
             XmlDocumentProperties xmlDocumentProperties = cursor.documentProperties();
             String publicId = xmlDocumentProperties.getDoctypePublicId();
             boolean is22 = "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN".equals(publicId);
-            if ("-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN".equals(publicId) ||
-                    is22) {
+            if ("-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN".equals(publicId) || is22) {
                 XmlCursor moveable = xmlObject.newCursor();
                 try {
                     moveable.toStartDoc();
                     moveable.toFirstChild();
-
                     SchemaConversionUtils.convertToSchema(cursor, SchemaConversionUtils.JAVAEE_NAMESPACE, schemaLocationURL, version);
                     cursor.toStartDoc();
                     cursor.toChild(SchemaConversionUtils.JAVAEE_NAMESPACE, "web-app");
@@ -500,7 +520,8 @@ public abstract class AbstractWebModuleB
         return builder.buildSpecSecurityConfig(webApp);
     }
 
-    protected void configureLocalJaspicProvider(AuthenticationWrapper authType, String contextPath, Module module, GBeanData securityFactoryData) throws DeploymentException, GBeanAlreadyExistsException {
+    protected void configureLocalJaspicProvider(AuthenticationWrapper authType, String contextPath, Module module, GBeanData securityFactoryData) throws DeploymentException,
+            GBeanAlreadyExistsException {
         EARContext moduleContext = module.getEarContext();
         GBeanData authConfigProviderData = null;
         AbstractName providerName = moduleContext.getNaming().createChildName(module.getModuleName(), "authConfigProvider", GBeanInfoBuilder.DEFAULT_J2EE_TYPE);
@@ -575,72 +596,17 @@ public abstract class AbstractWebModuleB
         }
     }
 
-    protected static void check(WebAppType webApp) throws DeploymentException {
-        checkURLPattern(webApp);
-        checkMultiplicities(webApp);
-    }
-
-    private static void checkURLPattern(WebAppType webApp) throws DeploymentException {
-
-        FilterMappingType[] filterMappings = webApp.getFilterMappingArray();
-        for (FilterMappingType filterMapping : filterMappings) {
-            UrlPatternType[] urlPatterns = filterMapping.getUrlPatternArray();
-            for (int j = 0; (urlPatterns != null) && (j < urlPatterns.length); j++) {
-                checkString(urlPatterns[j].getStringValue().trim());
-            }
-        }
-
-        ServletMappingType[] servletMappings = webApp.getServletMappingArray();
-        for (ServletMappingType servletMapping : servletMappings) {
-            UrlPatternType[] urlPatterns = servletMapping.getUrlPatternArray();
-            for (int j = 0; (urlPatterns != null) && (j < urlPatterns.length); j++) {
-                checkString(urlPatterns[j].getStringValue().trim());
-            }
-        }
-
-        SecurityConstraintType[] constraints = webApp.getSecurityConstraintArray();
-        for (SecurityConstraintType constraint : constraints) {
-            WebResourceCollectionType[] collections = constraint.getWebResourceCollectionArray();
-            for (WebResourceCollectionType collection : collections) {
-                UrlPatternType[] patterns = collection.getUrlPatternArray();
-                for (UrlPatternType pattern : patterns) {
-                    checkString(pattern.getStringValue().trim());
-                }
-            }
-        }
-    }
-
-    protected static void checkString(String pattern) throws DeploymentException {
-        //j2ee_1_4.xsd explicitly requires preserving all whitespace. Do not trim.
-        if (pattern.indexOf(0x0D) >= 0) throw new DeploymentException("<url-pattern> must not contain CR(#xD)");
-        if (pattern.indexOf(0x0A) >= 0) throw new DeploymentException("<url-pattern> must not contain LF(#xA)");
-    }
-
-    private static void checkMultiplicities(WebAppType webApp) throws DeploymentException {
-        if (webApp.getSessionConfigArray().length > 1)
-            throw new DeploymentException("Multiple <session-config> elements found");
-        if (webApp.getJspConfigArray().length > 1)
-            throw new DeploymentException("Multiple <jsp-config> elements found");
-        if (webApp.getLoginConfigArray().length > 1)
-            throw new DeploymentException("Multiple <login-config> elements found");
-    }
-
     private boolean cleanupConfigurationDir(File configurationDir) {
         LinkedList<String> cannotBeDeletedList = new LinkedList<String>();
-
         if (!FileUtils.recursiveDelete(configurationDir, cannotBeDeletedList)) {
             // Output a message to help user track down file problem
-            log.warn("Unable to delete " + cannotBeDeletedList.size() +
-                    " files while recursively deleting directory "
-                    + configurationDir.getAbsolutePath() + LINE_SEP +
-                    "The first file that could not be deleted was:" + LINE_SEP + "  " +
-                    (!cannotBeDeletedList.isEmpty() ? cannotBeDeletedList.getFirst() : ""));
+            log.warn("Unable to delete " + cannotBeDeletedList.size() + " files while recursively deleting directory " + configurationDir.getAbsolutePath() + LINE_SEP
+                    + "The first file that could not be deleted was:" + LINE_SEP + "  " + (!cannotBeDeletedList.isEmpty() ? cannotBeDeletedList.getFirst() : ""));
             return false;
         }
         return true;
     }
 
-
     protected ClassFinder createWebAppClassFinder(WebAppType webApp, WebModule webModule) throws DeploymentException {
         // Get the classloader from the module's EARContext
         Bundle bundle = webModule.getEarContext().getDeploymentBundle();
@@ -652,12 +618,11 @@ public abstract class AbstractWebModuleB
         // Find the list of classes from the web.xml we want to search for annotations in
         //------------------------------------------------------------------------------------
         List<Class> classes = new ArrayList<Class>();
-
         // Get all the servlets from the deployment descriptor
         ServletType[] servlets = webApp.getServletArray();
         for (ServletType servlet : servlets) {
             FullyQualifiedClassType cls = servlet.getServletClass();
-            if (cls != null) {                              // Don't try this for JSPs
+            if (cls != null) { // Don't try this for JSPs
                 Class<?> clas;
                 try {
                     clas = bundle.loadClass(cls.getStringValue());
@@ -667,7 +632,6 @@ public abstract class AbstractWebModuleB
                 addClass(classes, clas);
             }
         }
-
         // Get all the listeners from the deployment descriptor
         ListenerType[] listeners = webApp.getListenerArray();
         for (ListenerType listener : listeners) {
@@ -680,7 +644,6 @@ public abstract class AbstractWebModuleB
             }
             addClass(classes, clas);
         }
-
         // Get all the filters from the deployment descriptor
         FilterType[] filters = webApp.getFilterArray();
         for (FilterType filter : filters) {
@@ -693,7 +656,6 @@ public abstract class AbstractWebModuleB
             }
             addClass(classes, clas);
         }
-
         // see https://issues.apache.org/jira/browse/GERONIMO-3421 .
         // if the user has botched her classloader config (perhaps by
         // not including a jar that her app needs) then ClassFinder
@@ -714,14 +676,13 @@ public abstract class AbstractWebModuleB
         }
     }
 
-    protected void configureBasicWebModuleAttributes(WebAppType webApp, XmlObject vendorPlan, EARContext moduleContext, EARContext earContext, WebModule webModule, GBeanData webModuleData) throws DeploymentException {
+    protected void configureBasicWebModuleAttributes(WebAppType webApp, XmlObject vendorPlan, EARContext moduleContext, EARContext earContext, WebModule webModule, GBeanData webModuleData)
+            throws DeploymentException {
         Map<NamingBuilder.Key, Object> buildingContext = new HashMap<NamingBuilder.Key, Object>();
         buildingContext.put(NamingBuilder.GBEAN_NAME_KEY, moduleContext.getModuleName());
-
         //get partial jndi context from earContext.
         Map<JndiKey, Map<String, Object>> jndiContext = new HashMap<JndiKey, Map<String, Object>>(NamingBuilder.JNDI_KEY.get(earContext.getGeneralData()));
         buildingContext.put(NamingBuilder.JNDI_KEY, jndiContext);
-
         if (!webApp.getMetadataComplete()) {
             // Create a classfinder and populate it for the naming builder(s). The absence of a
             // classFinder in the module will convey whether metadata-complete is set (or not)
@@ -732,7 +693,6 @@ public abstract class AbstractWebModuleB
         //nope, persistence units can be in the war.
         //This means that you cannot use the default environment of the web builder to add configs that will be searched.
         getNamingBuilders().buildNaming(webApp, vendorPlan, webModule, buildingContext);
-
         //Combine contexts.  Note this may not work right for jaxws which has a comp/env/WebServiceContext binding
         Map<String, Object> compContext = new HashMap<String, Object>();
         if (jndiContext.get(JndiScope.comp) != null) {
@@ -744,7 +704,7 @@ public abstract class AbstractWebModuleB
         AbstractName contextSourceName = moduleContext.getNaming().createChildName(webModuleData.getAbstractName(), "ContextSource", "ContextSource");
         GBeanData contextSourceData = new GBeanData(contextSourceName, WebContextSource.class);
         contextSourceData.setAttribute("componentContext", compContext);
-        contextSourceData.setReferencePattern("ApplicationJndi", (AbstractName)earContext.getGeneralData().get(EARContext.APPLICATION_JNDI_NAME_KEY));
+        contextSourceData.setReferencePattern("ApplicationJndi", (AbstractName) earContext.getGeneralData().get(EARContext.APPLICATION_JNDI_NAME_KEY));
         contextSourceData.setReferencePattern("TransactionManager", moduleContext.getTransactionManagerName());
         try {
             moduleContext.addGBean(contextSourceData);
@@ -752,9 +712,7 @@ public abstract class AbstractWebModuleB
             throw new DeploymentException("ContextSource for this webapp already present:" + webModuleData.getAbstractName(), e);
         }
         webModuleData.setReferencePattern("ContextSource", contextSourceName);
-
         Holder holder = NamingBuilder.INJECTION_KEY.get(buildingContext);
-
         webModule.getSharedContext().put(WebModule.WEB_APP_DATA, webModuleData);
         webModule.getSharedContext().put(NamingBuilder.JNDI_KEY, jndiContext);
         webModule.getSharedContext().put(NamingBuilder.INJECTION_KEY, holder);
@@ -764,22 +722,20 @@ public abstract class AbstractWebModuleB
         if (!webModule.isStandAlone()) {
             webModuleData.setReferencePattern("J2EEApplication", earContext.getModuleName());
         }
-
         webModuleData.setAttribute("holder", holder);
-
         //Add dependencies on managed connection factories and ejbs in this app
         //This is overkill, but allows for people not using java:comp context (even though we don't support it)
         //and sidesteps the problem of circular references between ejbs.
         if (earContext != moduleContext) {
             addGBeanDependencies(earContext, webModuleData);
         }
-
         webModuleData.setReferencePattern("TransactionManager", moduleContext.getTransactionManagerName());
         webModuleData.setReferencePattern("TrackedConnectionAssociator", moduleContext.getConnectionTrackerName());
-        webModuleData.setAttribute("modulePath", webModule.isStandAlone() || webModule.getEarContext() != webModule.getRootEarContext()? null: webModule.getTargetPath());
+        webModuleData.setAttribute("modulePath", webModule.isStandAlone() || webModule.getEarContext() != webModule.getRootEarContext() ? null : webModule.getTargetPath());
     }
 
     private static class InternWrapper implements XMLStreamReader {
+
         private final XMLStreamReader delegate;
 
         private InternWrapper(XMLStreamReader delegate) {
@@ -966,5 +922,4 @@ public abstract class AbstractWebModuleB
             return delegate.standaloneSet();
         }
     }
-
 }

Added: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/ElementSource.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/ElementSource.java?rev=931020&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/ElementSource.java (added)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/ElementSource.java Tue Apr  6 05:14:09 2010
@@ -0,0 +1,25 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.web25.deployment.merge;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public enum ElementSource {
+    ANNOTATION, WEB_FRAGMENT, WEB_XML
+}

Propchange: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/ElementSource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/ElementSource.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/ElementSource.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeContext.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/MergeContext.java?rev=931020&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeContext.java (added)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeContext.java Tue Apr  6 05:14:09 2010
@@ -0,0 +1,88 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.web25.deployment.merge;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.geronimo.j2ee.deployment.EARContext;
+import org.apache.geronimo.web25.deployment.merge.webfragment.WebFragmentEntry;
+import org.apache.geronimo.xbeans.javaee6.WebFragmentType;
+import org.osgi.framework.Bundle;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MergeContext {
+
+    private Map<String, Object> attributes = new ConcurrentHashMap<String, Object>();
+
+    private Bundle bundle;
+
+    private EARContext earContext;
+
+    private WebFragmentEntry webFragmentEntry;
+
+    public Object getAttribute(String attributeName) {
+        return attributes.get(attributeName);
+    }
+
+    public Bundle getBundle() {
+        return bundle;
+    }
+
+    public WebFragmentType getCurrentWebFragment() {
+        return webFragmentEntry.getWebFragment();
+    }
+
+    public String getCurrentJarUrl() {
+        return webFragmentEntry.getJarURL();
+    }
+
+    public EARContext getEarContext() {
+        return earContext;
+    }
+
+    public void setAttribute(String attributeName, Object value) {
+        attributes.put(attributeName, value);
+    }
+
+    public void setBundle(Bundle bundle) {
+        this.bundle = bundle;
+    }
+
+    public void setEarContext(EARContext earContext) {
+        this.earContext = earContext;
+    }
+
+    public void setWebFragmentEntry(WebFragmentEntry webFragmentEntry) {
+        this.webFragmentEntry = webFragmentEntry;
+    }
+
+    public boolean containsAttribute(String name) {
+        return attributes.containsKey(name);
+    }
+
+    public void removeAttribute(String name) {
+        attributes.remove(name);
+    }
+
+    public void clearup() {
+        attributes.clear();
+    }
+}

Propchange: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeContext.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/MergeContext.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message