Author: remy.maucherat(a)jboss.com
Date: 2009-04-23 12:36:32 -0400 (Thu, 23 Apr 2009)
New Revision: 1026
Added:
trunk/java/org/apache/catalina/deploy/WebAbsoluteOrdering.java
trunk/java/org/apache/catalina/deploy/WebOrder.java
trunk/java/org/apache/catalina/deploy/WebOrdering.java
trunk/java/org/apache/catalina/startup/WebAbsoluteOrderingRuleSet.java
trunk/java/org/apache/catalina/startup/WebOrderingRuleSet.java
Modified:
trunk/ROADMAP.txt
trunk/java/org/apache/catalina/startup/ContextConfig.java
trunk/webapps/docs/changelog.xml
Log:
- Add some code which will parse the ordering elements.
Modified: trunk/ROADMAP.txt
===================================================================
--- trunk/ROADMAP.txt 2009-04-22 17:47:49 UTC (rev 1025)
+++ trunk/ROADMAP.txt 2009-04-23 16:36:32 UTC (rev 1026)
@@ -10,6 +10,7 @@
- ServletContainerInitializer support
- JSP 2.2 changes
- EL 1.1 changes
+- Jasper plugin for TLD metadata
- Setup standalone TCK environment for testing compliance with the new features
- Javassist annotation scanning impl for JBoss Web standalone
- Coordinate with AS 6 to implement new web.xml parsing (out of tree)
Added: trunk/java/org/apache/catalina/deploy/WebAbsoluteOrdering.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/WebAbsoluteOrdering.java
(rev 0)
+++ trunk/java/org/apache/catalina/deploy/WebAbsoluteOrdering.java 2009-04-23 16:36:32 UTC
(rev 1026)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.apache.catalina.deploy;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+public class WebAbsoluteOrdering implements Serializable {
+
+ protected String name = null;
+ protected List<String> order = new ArrayList<String>();
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public List<String> getOrder() {
+ return order;
+ }
+
+ public void addName(String name) {
+ order.add(name);
+ }
+}
Added: trunk/java/org/apache/catalina/deploy/WebOrder.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/WebOrder.java (rev 0)
+++ trunk/java/org/apache/catalina/deploy/WebOrder.java 2009-04-23 16:36:32 UTC (rev
1026)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.apache.catalina.deploy;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+public class WebOrder implements Serializable {
+
+ protected WebAbsoluteOrdering web = null;
+ protected Map<String, WebOrdering> fragments = new HashMap<String,
WebOrdering>();
+
+ public Map<String, WebOrdering> getFragments() {
+ return fragments;
+ }
+ public void setFragments(Map<String, WebOrdering> fragments) {
+ this.fragments = fragments;
+ }
+ public WebAbsoluteOrdering getWeb() {
+ return web;
+ }
+ public void addFragment(String name, WebOrdering ordering) {
+ fragments.put(name, ordering);
+ }
+
+}
Added: trunk/java/org/apache/catalina/deploy/WebOrdering.java
===================================================================
--- trunk/java/org/apache/catalina/deploy/WebOrdering.java (rev
0)
+++ trunk/java/org/apache/catalina/deploy/WebOrdering.java 2009-04-23 16:36:32 UTC (rev
1026)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.apache.catalina.deploy;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+public class WebOrdering implements Serializable {
+
+ protected String name = null;
+ protected List<String> after = new ArrayList<String>();
+ protected List<String> before = new ArrayList<String>();
+
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public List<String> getAfter() {
+ return after;
+ }
+
+ public void addAfter(String name) {
+ after.add(name);
+ }
+
+ public List<String> getBefore() {
+ return before;
+ }
+
+ public void addBefore(String name) {
+ before.add(name);
+ }
+
+}
Modified: trunk/java/org/apache/catalina/startup/ContextConfig.java
===================================================================
--- trunk/java/org/apache/catalina/startup/ContextConfig.java 2009-04-22 17:47:49 UTC (rev
1025)
+++ trunk/java/org/apache/catalina/startup/ContextConfig.java 2009-04-23 16:36:32 UTC (rev
1026)
@@ -54,6 +54,7 @@
import java.io.InputStream;
import java.net.URL;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
@@ -194,6 +195,18 @@
/**
+ * The <code>Digester</code> we will use to parse fragment ordering.
+ */
+ protected static Digester fragmentOrderingDigester = null;
+
+
+ /**
+ * The <code>Digester</code> we will use to parse absolute ordering in
web.xml.
+ */
+ protected static Digester orderingDigester = null;
+
+
+ /**
* The <code>Rule</code> used to parse the web.xml
*/
protected static WebRuleSet webRuleSet = new WebRuleSet();
@@ -746,6 +759,25 @@
/**
+ * Create (if necessary) and return a Digester configured to process web fragments
ordering.
+ */
+ protected static Digester createFragmentOrderingDigester() {
+ return DigesterFactory.newDigester(Globals.XML_NAMESPACE_AWARE,
+ Globals.XML_VALIDATION, new WebOrderingRuleSet());
+ }
+
+
+ /**
+ * Create (if necessary) and return a Digester configured to process web.xml
+ * absolute ordering.
+ */
+ protected static Digester createOrderingDigester() {
+ return DigesterFactory.newDigester(Globals.XML_NAMESPACE_AWARE,
+ Globals.XML_VALIDATION, new WebAbsoluteOrderingRuleSet());
+ }
+
+
+ /**
* Create (if necessary) and return a Digester configured to process the
* context configuration descriptor for an application.
*/
@@ -924,11 +956,12 @@
*/
protected void applicationExtraDescriptorsConfig() {
// FIXME: Read order from web.xml and fragments (note: if no fragments, skip)
+ Iterator<String> jarsWithWebFragments = scanner.getWebFragments();
// FIXME: Generate final web descriptor order
// FIXME: Add overlays
-
+ scanner.getOverlays();
}
@@ -1219,6 +1252,16 @@
tldDigester.getParser();
}
+ if (fragmentOrderingDigester == null){
+ fragmentOrderingDigester = createFragmentOrderingDigester();
+ fragmentOrderingDigester.getParser();
+ }
+
+ if (orderingDigester == null){
+ orderingDigester = createOrderingDigester();
+ orderingDigester.getParser();
+ }
+
if (contextDigester == null){
contextDigester = createContextDigester();
contextDigester.getParser();
Added: trunk/java/org/apache/catalina/startup/WebAbsoluteOrderingRuleSet.java
===================================================================
--- trunk/java/org/apache/catalina/startup/WebAbsoluteOrderingRuleSet.java
(rev 0)
+++ trunk/java/org/apache/catalina/startup/WebAbsoluteOrderingRuleSet.java 2009-04-23
16:36:32 UTC (rev 1026)
@@ -0,0 +1,116 @@
+/*
+ * 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.catalina.startup;
+
+
+import org.apache.catalina.deploy.WebAbsoluteOrdering;
+import org.apache.tomcat.util.digester.Digester;
+import org.apache.tomcat.util.digester.Rule;
+import org.apache.tomcat.util.digester.RuleSetBase;
+import org.xml.sax.Attributes;
+
+
+/**
+ * <p><strong>RuleSet</strong> for processing the absolute-ordering
element
+ * of web.xml.</p>
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision: 515 $ $Date: 2008-03-17 22:02:23 +0100 (Mon, 17 Mar 2008) $
+ */
+
+public class WebAbsoluteOrderingRuleSet extends RuleSetBase {
+
+
+ // ----------------------------------------------------- Instance Variables
+
+
+ /**
+ * The matching pattern prefix to use for recognizing our elements.
+ */
+ protected String prefix = null;
+
+
+ // ------------------------------------------------------------ Constructor
+
+
+ /**
+ * Construct an instance of this <code>RuleSet</code> with the default
+ * matching pattern prefix.
+ */
+ public WebAbsoluteOrderingRuleSet() {
+
+ this("");
+
+ }
+
+
+ /**
+ * Construct an instance of this <code>RuleSet</code> with the specified
+ * matching pattern prefix.
+ *
+ * @param prefix Prefix for matching pattern rules (including the
+ * trailing slash character)
+ */
+ public WebAbsoluteOrderingRuleSet(String prefix) {
+
+ super();
+ this.namespaceURI = null;
+ this.prefix = prefix;
+
+ }
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * <p>Add the set of Rule instances defined in this RuleSet to the
+ * specified <code>Digester</code> instance, associating them with
+ * our namespace URI (if any). This method should only be called
+ * by a Digester instance.</p>
+ *
+ * @param digester Digester instance to which the new Rule instances
+ * should be added.
+ */
+ public void addRuleInstances(Digester digester) {
+
+ digester.addObjectCreate(prefix + "web-app",
+
"org.apache.catalina.deploy.WebAbsoluteOrdering");
+ digester.addCallMethod(prefix + "web-app/name",
+ "setName", 0);
+ digester.addCallMethod(prefix + "web-app/absolute-ordering/name",
+ "addName", 0);
+ digester.addRule(prefix + "web-app/absolute-ordering/others",
+ new AddOthersRule());
+
+ }
+
+
+ final class AddOthersRule extends Rule {
+ public AddOthersRule() {
+ }
+
+ public void begin(String namespace, String name, Attributes attributes)
+ throws Exception {
+ WebAbsoluteOrdering ordering = (WebAbsoluteOrdering) digester.peek();
+ ordering.addName("");
+ }
+
+ }
+}
Added: trunk/java/org/apache/catalina/startup/WebOrderingRuleSet.java
===================================================================
--- trunk/java/org/apache/catalina/startup/WebOrderingRuleSet.java
(rev 0)
+++ trunk/java/org/apache/catalina/startup/WebOrderingRuleSet.java 2009-04-23 16:36:32 UTC
(rev 1026)
@@ -0,0 +1,122 @@
+/*
+ * 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.catalina.startup;
+
+
+import org.apache.catalina.deploy.WebOrdering;
+import org.apache.tomcat.util.digester.Digester;
+import org.apache.tomcat.util.digester.Rule;
+import org.apache.tomcat.util.digester.RuleSetBase;
+import org.xml.sax.Attributes;
+
+
+/**
+ * <p><strong>RuleSet</strong> for processing the absolute-ordering
element
+ * of web.xml.</p>
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision: 515 $ $Date: 2008-03-17 22:02:23 +0100 (Mon, 17 Mar 2008) $
+ */
+
+public class WebOrderingRuleSet extends RuleSetBase {
+
+
+ // ----------------------------------------------------- Instance Variables
+
+
+ /**
+ * The matching pattern prefix to use for recognizing our elements.
+ */
+ protected String prefix = null;
+
+
+ // ------------------------------------------------------------ Constructor
+
+
+ /**
+ * Construct an instance of this <code>RuleSet</code> with the default
+ * matching pattern prefix.
+ */
+ public WebOrderingRuleSet() {
+
+ this("");
+
+ }
+
+
+ /**
+ * Construct an instance of this <code>RuleSet</code> with the specified
+ * matching pattern prefix.
+ *
+ * @param prefix Prefix for matching pattern rules (including the
+ * trailing slash character)
+ */
+ public WebOrderingRuleSet(String prefix) {
+
+ super();
+ this.namespaceURI = null;
+ this.prefix = prefix;
+
+ }
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * <p>Add the set of Rule instances defined in this RuleSet to the
+ * specified <code>Digester</code> instance, associating them with
+ * our namespace URI (if any). This method should only be called
+ * by a Digester instance.</p>
+ *
+ * @param digester Digester instance to which the new Rule instances
+ * should be added.
+ */
+ public void addRuleInstances(Digester digester) {
+
+ digester.addObjectCreate(prefix + "web-app",
+ "org.apache.catalina.deploy.WebOrdering");
+ digester.addCallMethod(prefix + "web-app/name",
+ "setName", 0);
+ digester.addCallMethod(prefix + "web-app/ordering/after/name",
+ "addAfter", 0);
+ digester.addCallMethod(prefix + "web-app/ordering/before/name",
+ "addBefore", 0);
+ digester.addRule(prefix + "web-app/ordering/after/others",
+ new AddOthersAfterRule());
+ digester.addRule(prefix + "web-app/ordering/before/name",
+ new AddOthersBeforeRule());
+
+ }
+
+ final class AddOthersAfterRule extends Rule {
+ public void begin(String namespace, String name, Attributes attributes)
+ throws Exception {
+ WebOrdering ordering = (WebOrdering) digester.peek();
+ ordering.addAfter("");
+ }
+ }
+ final class AddOthersBeforeRule extends Rule {
+ public void begin(String namespace, String name, Attributes attributes)
+ throws Exception {
+ WebOrdering ordering = (WebOrdering) digester.peek();
+ ordering.addBefore("");
+ }
+ }
+}
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2009-04-22 17:47:49 UTC (rev 1025)
+++ trunk/webapps/docs/changelog.xml 2009-04-23 16:36:32 UTC (rev 1026)
@@ -108,7 +108,7 @@
</subsection>
</section>
-<section name="JBoss Web 2.1.3.CR1 (remm)">
+<section name="JBoss Web 2.1.3.GA (remm)">
<subsection name="General">
<changelog>
</changelog>