geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r992929 - in /geronimo/server/trunk: framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/xmlbeans/ plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/ plugins/tomcat/geron...
Date Mon, 06 Sep 2010 02:43:30 GMT
Author: xuhaihong
Date: Mon Sep  6 02:43:29 2010
New Revision: 992929

URL: http://svn.apache.org/viewvc?rev=992929&view=rev
Log:
GERONIMO-5511 context-priority-classloader is not allowed in geronimo-web.xml for backwards
compatibility (Based on the patch from viola)

Modified:
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/xmlbeans/XmlBeansUtil.java
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.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/xmlbeans/XmlBeansUtil.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/xmlbeans/XmlBeansUtil.java?rev=992929&r1=992928&r2=992929&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/xmlbeans/XmlBeansUtil.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/xmlbeans/XmlBeansUtil.java
Mon Sep  6 02:43:29 2010
@@ -22,10 +22,12 @@ import java.io.InputStream;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import javax.xml.namespace.QName;
 
@@ -35,12 +37,15 @@ import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlOptions;
 import org.apache.xmlbeans.XmlValidationError;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.w3c.dom.Element;
 
 /**
  * @version $Rev$ $Date$
  */
 public class XmlBeansUtil {
+    private static final Logger logger = LoggerFactory.getLogger(XmlBeansUtil.class);
     private static final Map<String, String> NAMESPACE_UPDATES = new HashMap<String,
String>();
     //TODO thread safe? conncurrentReaderMap?
     private static final Map<QName, QNameSet> substitutionGroups = new HashMap<QName,
QNameSet>();
@@ -153,6 +158,10 @@ public class XmlBeansUtil {
     }
 
     public static void validateDD(XmlObject dd) throws XmlException {
+        validateDD(dd, Collections.<String>emptySet());
+    }
+
+    public static void validateDD(XmlObject dd, Set<String> ignoreElements) throws
XmlException {
         XmlOptions xmlOptions = new XmlOptions();
         xmlOptions.setLoadLineNumbers();
         Collection errors = new ArrayList();
@@ -167,6 +176,10 @@ public class XmlBeansUtil {
                         XmlValidationError validationError = (XmlValidationError) o;
                         List<QName> expected = validationError.getExpectedQNames();
                         QName actual = validationError.getOffendingQName();
+                        if (ignoreElements.contains(actual.getLocalPart())) {
+                            iterator.remove();
+                            logger.warn(actual.getLocalPart() + " is not supported yet.");
+                        }
                         if (expected != null) {
                             for (QName expectedQName : expected) {
                                 QNameSet substitutions = getQNameSetForSubstitutionGroup(expectedQName);
@@ -180,8 +193,8 @@ public class XmlBeansUtil {
                 }
 
                 if (!errors.isEmpty()) {
-                    StringBuffer buf = new StringBuffer("Invalid deployment descriptor: errors:\n\n");
-                    for (Object o: errors) {
+                    StringBuilder buf = new StringBuilder("Invalid deployment descriptor:
errors:\n\n");
+                    for (Object o : errors) {
                         buf.append(o).append("\n\n");
                     }
                     buf.append("Descriptor:\n").append(dd.toString()).append("\n");
@@ -193,6 +206,5 @@ public class XmlBeansUtil {
         } catch (AssertionError e) {
             //ignore.  Would be the NPE above if assertions were turned off
         }
-//        System.out.println("descriptor: " + dd.toString());
     }
 }

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=992929&r1=992928&r2=992929&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
Mon Sep  6 02:43:29 2010
@@ -99,7 +99,6 @@ import org.apache.openejb.jee.Servlet;
 import org.apache.openejb.jee.ServletMapping;
 import org.apache.openejb.jee.WebApp;
 import org.apache.xbean.finder.AbstractFinder;
-import org.apache.xbean.finder.BundleAnnotationFinder;
 import org.apache.xbean.finder.ClassFinder;
 import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlDocumentProperties;

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java?rev=992929&r1=992928&r2=992929&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
(original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
Mon Sep  6 02:43:29 2010
@@ -17,6 +17,8 @@
 
 package org.apache.geronimo.tomcat.deployment;
 
+import static java.lang.Boolean.TRUE;
+
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
@@ -26,8 +28,10 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.jar.JarFile;
 
 import javax.servlet.Servlet;
@@ -100,8 +104,6 @@ import org.osgi.framework.BundleContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import static java.lang.Boolean.TRUE;
-
 /**
  * @version $Rev:385659 $ $Date$
  */
@@ -112,6 +114,7 @@ public class TomcatModuleBuilder extends
 
     private static final String TOMCAT_NAMESPACE = TomcatWebAppDocument.type.getDocumentElementName().getNamespaceURI();
     private static final Map<String, String> NAMESPACE_UPDATES = new HashMap<String,
String>();
+    private static final Set<String> INGORE_ELEMENT_NAMES = new HashSet<String>();
     static {
         NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/web", "http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1");
         NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/j2ee/web-1.1", "http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1");
@@ -122,6 +125,10 @@ public class TomcatModuleBuilder extends
         NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-1.2", "http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1");
         NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0", "http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1");
         NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/web/tomcat/config", "http://geronimo.apache.org/xml/ns/j2ee/web/tomcat/config-1.0");
+
+        INGORE_ELEMENT_NAMES.add("context-priority-classloader");
+        INGORE_ELEMENT_NAMES.add("configId");
+        INGORE_ELEMENT_NAMES.add("parentId");
     }
 
     private final Environment defaultEnvironment;
@@ -372,7 +379,7 @@ public class TomcatModuleBuilder extends
                 XmlObject webPlan = new GenericToSpecificPlanConverter(GerTomcatDocument.type.getDocumentElementName().getNamespaceURI(),
                         TomcatWebAppDocument.type.getDocumentElementName().getNamespaceURI(),
"tomcat").convertToSpecificPlan(rawPlan);
                 tomcatWebApp = (TomcatWebAppType) webPlan.changeType(TomcatWebAppType.type);
-                XmlBeansUtil.validateDD(tomcatWebApp);
+                XmlBeansUtil.validateDD(tomcatWebApp, INGORE_ELEMENT_NAMES);
             } else {
                 tomcatWebApp = createDefaultPlan();
             }
@@ -597,9 +604,6 @@ public class TomcatModuleBuilder extends
                 //Also, currently, it seems that Tomcat could not handle those jndi elements
correctly
                 webApp.setMetadataComplete(true);
 
-                String specDeploymentPlan = getSpecDDAsString(webModule);
-                module.setOriginalSpecDD(specDeploymentPlan);
-                
                 //remove naming stuff from webApp so tomcat doesn't process it uselessly
                 webApp.getEjbLocalRef().clear();
                 webApp.getEjbRef().clear();
@@ -609,8 +613,11 @@ public class TomcatModuleBuilder extends
                 webApp.getResourceEnvRef().clear();
                 webApp.getResourceRef().clear();
                 webApp.getServiceRef().clear();
-                specDeploymentPlan = getSpecDDAsString(webModule);
-                earContext.addFile(new URI("./WEB-INF/web.xml"), specDeploymentPlan);   
            
+
+                String specDeploymentPlan = getSpecDDAsString(webModule);
+                module.setOriginalSpecDD(specDeploymentPlan);
+
+                earContext.addFile(new URI("./WEB-INF/web.xml"), specDeploymentPlan);
             }
             //}
             webModuleData.setAttribute("deploymentDescriptor", module.getOriginalSpecDD());



Mime
View raw message