geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r788834 - in /geronimo/server/trunk/plugins/tomcat: geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/ geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/ geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/ tomca...
Date Fri, 26 Jun 2009 19:48:04 GMT
Author: djencks
Date: Fri Jun 26 19:48:04 2009
New Revision: 788834

URL: http://svn.apache.org/viewvc?rev=788834&view=rev
Log:
GERONIMO-4715 Get tomcat to use our thread pools

Added:
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatExecutorWrapper.java
  (with props)
Modified:
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatServerGBean.java
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/ConnectorType.java
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/ExecutorType.java
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/ServerType.java
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/ServiceType.java
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/TomcatServerGBeanTest.java
    geronimo/server/trunk/plugins/tomcat/tomcat6/src/main/resources/tomcat-base/server.xml

Added: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatExecutorWrapper.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatExecutorWrapper.java?rev=788834&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatExecutorWrapper.java
(added)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatExecutorWrapper.java
Fri Jun 26 19:48:04 2009
@@ -0,0 +1,71 @@
+/*
+ * 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.tomcat;
+
+import org.apache.catalina.LifecycleException;
+import org.apache.catalina.LifecycleListener;
+import org.apache.catalina.util.LifecycleSupport;
+import org.apache.geronimo.pool.GeronimoExecutor;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TomcatExecutorWrapper implements org.apache.catalina.Executor{
+    private final GeronimoExecutor executor;
+    private final LifecycleSupport lifecycle = new LifecycleSupport(this);
+
+    public TomcatExecutorWrapper(GeronimoExecutor executor) {
+        this.executor = executor;
+    }
+
+    public String getName() {
+        return executor.getName();
+    }
+
+    public void execute(Runnable runnable) {
+        executor.execute(runnable);
+    }
+
+    public void addLifecycleListener(LifecycleListener listener) {
+        lifecycle.addLifecycleListener(listener);
+    }
+
+    public LifecycleListener[] findLifecycleListeners() {
+        return lifecycle.findLifecycleListeners();
+    }
+
+    public void removeLifecycleListener(LifecycleListener listener) {
+        lifecycle.removeLifecycleListener(listener);
+    }
+
+    public void start() throws LifecycleException {
+        lifecycle.fireLifecycleEvent(BEFORE_START_EVENT, null);
+        lifecycle.fireLifecycleEvent(START_EVENT, null);
+        lifecycle.fireLifecycleEvent(AFTER_START_EVENT, null);
+    }
+
+    public void stop() throws LifecycleException {
+        lifecycle.fireLifecycleEvent(BEFORE_STOP_EVENT, null);
+        lifecycle.fireLifecycleEvent(STOP_EVENT, null);
+        lifecycle.fireLifecycleEvent(AFTER_STOP_EVENT, null);
+    }
+    
+}

Propchange: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatExecutorWrapper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatExecutorWrapper.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatExecutorWrapper.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatServerGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatServerGBean.java?rev=788834&r1=788833&r2=788834&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatServerGBean.java
(original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatServerGBean.java
Fri Jun 26 19:48:04 2009
@@ -49,6 +49,7 @@
 import org.apache.geronimo.system.jmx.MBeanServerReference;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
 import org.apache.geronimo.tomcat.model.ServerType;
+import org.apache.geronimo.kernel.Kernel;
 import org.apache.tomcat.util.modeler.Registry;
 import org.xml.sax.SAXException;
 
@@ -75,13 +76,14 @@
     private final ServerInfo serverInfo;
     private final Server server;
 
-    public TomcatServerGBean(@ParamAttribute(name = "serverConfig")String serverConfig,
-                             @ParamAttribute(name = "serverConfigLocation")String serverConfigLocation,
-                             @ParamAttribute(name= "catalinaHome")String catalinaHome,
+    public TomcatServerGBean(@ParamAttribute(name = "serverConfig") String serverConfig,
+                             @ParamAttribute(name = "serverConfigLocation") String serverConfigLocation,
+                             @ParamAttribute(name = "catalinaHome") String catalinaHome,
                              @ParamReference(name = "ServerInfo") ServerInfo serverInfo,
                              @ParamReference(name = "AttributeManager", namingType = "AttributeStore")
PluginAttributeStore attributeStore,
                              @ParamReference(name = "MBeanServerReference") MBeanServerReference
mbeanServerReference,
-                             @ParamSpecial(type= SpecialAttributeType.classLoader)ClassLoader
classLoader) throws Exception {
+                             @ParamSpecial(type = SpecialAttributeType.classLoader) ClassLoader
classLoader,
+                             @ParamSpecial(type = SpecialAttributeType.kernel) Kernel kernel)
throws Exception {
         this.serverConfig = serverConfig;
         this.serverInfo = serverInfo;
         this.classLoader = classLoader;
@@ -115,7 +117,7 @@
 
         try {
             ServerType serverType = loadServerType(in);            
-            server = serverType.build(classLoader);
+            server = serverType.build(classLoader, kernel);
         } finally {
             in.close();
         }

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/ConnectorType.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/ConnectorType.java?rev=788834&r1=788833&r2=788834&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/ConnectorType.java
(original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/ConnectorType.java
Fri Jun 26 19:48:04 2009
@@ -24,15 +24,18 @@
 
 import org.apache.catalina.connector.Connector;
 import org.apache.catalina.LifecycleListener;
+import org.apache.catalina.Service;
+import org.apache.catalina.Executor;
 import org.apache.xbean.recipe.ObjectRecipe;
 import org.apache.xbean.recipe.Option;
+import org.apache.tomcat.util.IntrospectionUtils;
 
 
 /**
  * <p>Java class for ConnectorType complex type.
- *
+ * <p/>
  * <p>The following schema fragment specifies the expected content contained within
this class.
- *
+ * <p/>
  * <pre>
  * &lt;complexType name="ConnectorType">
  *   &lt;complexContent>
@@ -62,12 +65,10 @@
  *   &lt;/complexContent>
  * &lt;/complexType>
  * </pre>
- *
- *
  */
 @XmlAccessorType(XmlAccessType.FIELD)
 @XmlType(name = "ConnectorType", propOrder = {
-    "listener"
+        "listener"
 })
 public class ConnectorType {
 
@@ -132,25 +133,23 @@
 
     /**
      * Gets the value of the listener property.
-     *
-     * <p>
+     * <p/>
+     * <p/>
      * This accessor method returns a reference to the live list,
      * not a snapshot. Therefore any modification you make to the
      * returned list will be present inside the JAXB object.
      * This is why there is not a <CODE>set</CODE> method for the listener property.
-     *
-     * <p>
+     * <p/>
+     * <p/>
      * For example, to add a new item, do as follows:
      * <pre>
      *    getListener().add(newItem);
      * </pre>
-     *
-     *
-     * <p>
+     * <p/>
+     * <p/>
+     * <p/>
      * Objects of the following type(s) are allowed in the list
      * {@link ListenerType }
-     *
-     *
      */
     public List<ListenerType> getListener() {
         if (listener == null) {
@@ -162,10 +161,8 @@
     /**
      * Gets the value of the className property.
      *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
+     * @return possible object is
+     *         {@link String }              z
      */
     public String getClassName() {
         return className;
@@ -174,10 +171,8 @@
     /**
      * Sets the value of the className property.
      *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
+     * @param value allowed object is
+     *              {@link String }
      */
     public void setClassName(String value) {
         this.className = value;
@@ -186,10 +181,8 @@
     /**
      * Gets the value of the allowTrace property.
      *
-     * @return
-     *     possible object is
-     *     {@link Boolean }
-     *
+     * @return possible object is
+     *         {@link Boolean }
      */
     public Boolean isAllowTrace() {
         return allowTrace;
@@ -198,10 +191,8 @@
     /**
      * Sets the value of the allowTrace property.
      *
-     * @param value
-     *     allowed object is
-     *     {@link Boolean }
-     *
+     * @param value allowed object is
+     *              {@link Boolean }
      */
     public void setAllowTrace(Boolean value) {
         this.allowTrace = value;
@@ -210,10 +201,8 @@
     /**
      * Gets the value of the emptySessionPath property.
      *
-     * @return
-     *     possible object is
-     *     {@link Boolean }
-     *
+     * @return possible object is
+     *         {@link Boolean }
      */
     public Boolean isEmptySessionPath() {
         return emptySessionPath;
@@ -222,10 +211,8 @@
     /**
      * Sets the value of the emptySessionPath property.
      *
-     * @param value
-     *     allowed object is
-     *     {@link Boolean }
-     *
+     * @param value allowed object is
+     *              {@link Boolean }
      */
     public void setEmptySessionPath(Boolean value) {
         this.emptySessionPath = value;
@@ -234,10 +221,8 @@
     /**
      * Gets the value of the enableLookups property.
      *
-     * @return
-     *     possible object is
-     *     {@link Boolean }
-     *
+     * @return possible object is
+     *         {@link Boolean }
      */
     public Boolean isEnableLookups() {
         return enableLookups;
@@ -246,10 +231,8 @@
     /**
      * Sets the value of the enableLookups property.
      *
-     * @param value
-     *     allowed object is
-     *     {@link Boolean }
-     *
+     * @param value allowed object is
+     *              {@link Boolean }
      */
     public void setEnableLookups(Boolean value) {
         this.enableLookups = value;
@@ -258,10 +241,8 @@
     /**
      * Gets the value of the maxPostSize property.
      *
-     * @return
-     *     possible object is
-     *     {@link Integer }
-     *
+     * @return possible object is
+     *         {@link Integer }
      */
     public Integer getMaxPostSize() {
         return maxPostSize;
@@ -270,10 +251,8 @@
     /**
      * Sets the value of the maxPostSize property.
      *
-     * @param value
-     *     allowed object is
-     *     {@link Integer }
-     *
+     * @param value allowed object is
+     *              {@link Integer }
      */
     public void setMaxPostSize(Integer value) {
         this.maxPostSize = value;
@@ -282,10 +261,8 @@
     /**
      * Gets the value of the maxSavePostSize property.
      *
-     * @return
-     *     possible object is
-     *     {@link Integer }
-     *
+     * @return possible object is
+     *         {@link Integer }
      */
     public Integer getMaxSavePostSize() {
         return maxSavePostSize;
@@ -294,10 +271,8 @@
     /**
      * Sets the value of the maxSavePostSize property.
      *
-     * @param value
-     *     allowed object is
-     *     {@link Integer }
-     *
+     * @param value allowed object is
+     *              {@link Integer }
      */
     public void setMaxSavePostSize(Integer value) {
         this.maxSavePostSize = value;
@@ -306,10 +281,8 @@
     /**
      * Gets the value of the port property.
      *
-     * @return
-     *     possible object is
-     *     {@link Integer }
-     *
+     * @return possible object is
+     *         {@link Integer }
      */
     public Integer getPort() {
         return port;
@@ -318,10 +291,8 @@
     /**
      * Sets the value of the port property.
      *
-     * @param value
-     *     allowed object is
-     *     {@link Integer }
-     *
+     * @param value allowed object is
+     *              {@link Integer }
      */
     public void setPort(Integer value) {
         this.port = value;
@@ -330,10 +301,8 @@
     /**
      * Gets the value of the protocol property.
      *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
+     * @return possible object is
+     *         {@link String }
      */
     public String getProtocol() {
         return protocol;
@@ -342,10 +311,8 @@
     /**
      * Sets the value of the protocol property.
      *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
+     * @param value allowed object is
+     *              {@link String }
      */
     public void setProtocol(String value) {
         this.protocol = value;
@@ -354,10 +321,8 @@
     /**
      * Gets the value of the protocolHandlerClassName property.
      *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
+     * @return possible object is
+     *         {@link String }
      */
     public String getProtocolHandlerClassName() {
         return protocolHandlerClassName;
@@ -366,10 +331,8 @@
     /**
      * Sets the value of the protocolHandlerClassName property.
      *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
+     * @param value allowed object is
+     *              {@link String }
      */
     public void setProtocolHandlerClassName(String value) {
         this.protocolHandlerClassName = value;
@@ -378,10 +341,8 @@
     /**
      * Gets the value of the proxyName property.
      *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
+     * @return possible object is
+     *         {@link String }
      */
     public String getProxyName() {
         return proxyName;
@@ -390,10 +351,8 @@
     /**
      * Sets the value of the proxyName property.
      *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
+     * @param value allowed object is
+     *              {@link String }
      */
     public void setProxyName(String value) {
         this.proxyName = value;
@@ -402,10 +361,8 @@
     /**
      * Gets the value of the proxyPort property.
      *
-     * @return
-     *     possible object is
-     *     {@link Integer }
-     *
+     * @return possible object is
+     *         {@link Integer }
      */
     public Integer getProxyPort() {
         return proxyPort;
@@ -414,10 +371,8 @@
     /**
      * Sets the value of the proxyPort property.
      *
-     * @param value
-     *     allowed object is
-     *     {@link Integer }
-     *
+     * @param value allowed object is
+     *              {@link Integer }
      */
     public void setProxyPort(Integer value) {
         this.proxyPort = value;
@@ -426,10 +381,8 @@
     /**
      * Gets the value of the redirectPort property.
      *
-     * @return
-     *     possible object is
-     *     {@link Integer }
-     *
+     * @return possible object is
+     *         {@link Integer }
      */
     public Integer getRedirectPort() {
         return redirectPort;
@@ -438,10 +391,8 @@
     /**
      * Sets the value of the redirectPort property.
      *
-     * @param value
-     *     allowed object is
-     *     {@link Integer }
-     *
+     * @param value allowed object is
+     *              {@link Integer }
      */
     public void setRedirectPort(Integer value) {
         this.redirectPort = value;
@@ -450,10 +401,8 @@
     /**
      * Gets the value of the scheme property.
      *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
+     * @return possible object is
+     *         {@link String }
      */
     public String getScheme() {
         return scheme;
@@ -462,10 +411,8 @@
     /**
      * Sets the value of the scheme property.
      *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
+     * @param value allowed object is
+     *              {@link String }
      */
     public void setScheme(String value) {
         this.scheme = value;
@@ -474,10 +421,8 @@
     /**
      * Gets the value of the secure property.
      *
-     * @return
-     *     possible object is
-     *     {@link Boolean }
-     *
+     * @return possible object is
+     *         {@link Boolean }
      */
     public Boolean isSecure() {
         return secure;
@@ -486,10 +431,8 @@
     /**
      * Sets the value of the secure property.
      *
-     * @param value
-     *     allowed object is
-     *     {@link Boolean }
-     *
+     * @param value allowed object is
+     *              {@link Boolean }
      */
     public void setSecure(Boolean value) {
         this.secure = value;
@@ -498,10 +441,8 @@
     /**
      * Gets the value of the encoding property.
      *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
+     * @return possible object is
+     *         {@link String }
      */
     public String getEncoding() {
         return encoding;
@@ -510,10 +451,8 @@
     /**
      * Sets the value of the encoding property.
      *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
+     * @param value allowed object is
+     *              {@link String }
      */
     public void setEncoding(String value) {
         this.encoding = value;
@@ -522,10 +461,8 @@
     /**
      * Gets the value of the useBodyEncodingForURI property.
      *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
+     * @return possible object is
+     *         {@link String }
      */
     public String getUseBodyEncodingForURI() {
         return useBodyEncodingForURI;
@@ -534,10 +471,8 @@
     /**
      * Sets the value of the useBodyEncodingForURI property.
      *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
+     * @param value allowed object is
+     *              {@link String }
      */
     public void setUseBodyEncodingForURI(String value) {
         this.useBodyEncodingForURI = value;
@@ -546,10 +481,8 @@
     /**
      * Gets the value of the xpoweredBy property.
      *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
+     * @return possible object is
+     *         {@link String }
      */
     public String getXpoweredBy() {
         return xpoweredBy;
@@ -558,10 +491,8 @@
     /**
      * Sets the value of the xpoweredBy property.
      *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
+     * @param value allowed object is
+     *              {@link String }
      */
     public void setXpoweredBy(String value) {
         this.xpoweredBy = value;
@@ -570,10 +501,8 @@
     /**
      * Gets the value of the useIPVHosts property.
      *
-     * @return
-     *     possible object is
-     *     {@link Boolean }
-     *
+     * @return possible object is
+     *         {@link Boolean }
      */
     public Boolean isUseIPVHosts() {
         return useIPVHosts;
@@ -582,10 +511,8 @@
     /**
      * Sets the value of the useIPVHosts property.
      *
-     * @param value
-     *     allowed object is
-     *     {@link Boolean }
-     *
+     * @param value allowed object is
+     *              {@link Boolean }
      */
     public void setUseIPVHosts(Boolean value) {
         this.useIPVHosts = value;
@@ -593,24 +520,22 @@
 
     /**
      * Gets a map that contains attributes that aren't bound to any typed property on this
class.
-     *
-     * <p>
+     * <p/>
+     * <p/>
      * the map is keyed by the name of the attribute and
      * the value is the string value of the attribute.
-     *
+     * <p/>
      * the map returned by this method is live, and you can add new attribute
      * by updating the map directly. Because of this design, there's no setter.
      *
-     *
-     * @return
-     *     always non-null
+     * @return always non-null
      */
     public Map<QName, String> getOtherAttributes() {
         return otherAttributes;
     }
 
 
-    public Connector getConnector(ClassLoader cl) throws Exception {
+    public Connector getConnector(ClassLoader cl, Service service) throws Exception {
         Map<String, Object> properties = new HashMap<String, Object>();
         if (isAllowTrace() != null) {
             properties.put(ALLOW_TRACE, isAllowTrace());
@@ -666,12 +591,25 @@
         ObjectRecipe recipe = new ObjectRecipe(className, properties);
         recipe.allow(Option.IGNORE_MISSING_PROPERTIES);
         Connector connector = (Connector) recipe.create(cl);
-        for (Map.Entry<QName, String> entry: otherAttributes.entrySet()) {
+        for (Map.Entry<QName, String> entry : otherAttributes.entrySet()) {
             String name = entry.getKey().getLocalPart();
-            connector.setProperty(name, entry.getValue());
+            if ("executor".equals(name)) {
+                Executor executor = service.getExecutor(entry.getValue());
+                if (executor == null) {
+                    throw new IllegalArgumentException("No executor found in service with
name: " + entry.getValue());
+                }
+                IntrospectionUtils.callMethod1(connector.getProtocolHandler(),
+                        "setExecutor",
+                        executor,
+                        java.util.concurrent.Executor.class.getName(),
+                        cl);
+
+            } else {
+                connector.setProperty(name, entry.getValue());
+            }
         }
-        
-        for (ListenerType listenerType: getListener()) {
+
+        for (ListenerType listenerType : getListener()) {
             LifecycleListener listener = listenerType.getLifecycleListener(cl);
             connector.addLifecycleListener(listener);
         }

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/ExecutorType.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/ExecutorType.java?rev=788834&r1=788833&r2=788834&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/ExecutorType.java
(original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/ExecutorType.java
Fri Jun 26 19:48:04 2009
@@ -10,6 +10,8 @@
 
 import java.util.Map;
 import java.util.HashMap;
+import java.util.Set;
+import java.net.URI;
 
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
@@ -22,6 +24,9 @@
 import org.apache.catalina.core.StandardThreadExecutor;
 import org.apache.xbean.recipe.ObjectRecipe;
 import org.apache.xbean.recipe.Option;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.gbean.AbstractName;
 
 
 /**
@@ -93,15 +98,25 @@
     }
 
 
-    public Executor getExecutor(ClassLoader cl) throws Exception {
+    public Executor getExecutor(ClassLoader cl, Kernel kernel) throws Exception {
         Map<String, Object> properties = new HashMap<String, Object>();
 
         for (Map.Entry<QName, String> entry: otherAttributes.entrySet()) {
             String name = entry.getKey().getLocalPart();
-            properties.put(name, entry.getValue());
+            if (name.endsWith("-ref")) {
+                AbstractNameQuery query = new AbstractNameQuery(URI.create(entry.getValue()));
+                Set<AbstractName> names = kernel.listGBeans(query);
+                if (names.size() != 1) throw new IllegalStateException("Unsatisfied reference
for name " + name + " and reference to " + entry.getValue());
+                Object ref = kernel.getGBean(names.iterator().next());
+                properties.put(name.substring(0, name.length() - 4), ref);
+
+            } else {
+                properties.put(name, entry.getValue());
+            }
         }
         ObjectRecipe recipe = new ObjectRecipe(className, properties);
         recipe.allow(Option.IGNORE_MISSING_PROPERTIES);
+        recipe.allow(Option.NAMED_PARAMETERS);
         Executor executor = (Executor) recipe.create(cl);
         return executor;
     }

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/ServerType.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/ServerType.java?rev=788834&r1=788833&r2=788834&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/ServerType.java
(original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/ServerType.java
Fri Jun 26 19:48:04 2009
@@ -29,6 +29,7 @@
 import org.apache.catalina.deploy.NamingResources;
 import org.apache.xbean.recipe.ObjectRecipe;
 import org.apache.xbean.recipe.Option;
+import org.apache.geronimo.kernel.Kernel;
 
 
 /**
@@ -255,7 +256,7 @@
         return otherAttributes;
     }
 
-    public Server build(ClassLoader cl) throws Exception {
+    public Server build(ClassLoader cl, Kernel kernel) throws Exception {
         Map<String, Object> properties = new HashMap<String, Object>();
         for (Map.Entry<QName, String> entry: otherAttributes.entrySet()) {
             String name = entry.getKey().getLocalPart();
@@ -281,7 +282,7 @@
         instance.setGlobalNamingResources(globalNamingResources);
 
         for (ServiceType serviceType: getService()) {
-            Service service = serviceType.getService(cl);
+            Service service = serviceType.getService(cl, kernel);
             instance.addService(service);
         }
 

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/ServiceType.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/ServiceType.java?rev=788834&r1=788833&r2=788834&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/ServiceType.java
(original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/ServiceType.java
Fri Jun 26 19:48:04 2009
@@ -30,6 +30,7 @@
 import org.apache.catalina.connector.Connector;
 import org.apache.xbean.recipe.ObjectRecipe;
 import org.apache.xbean.recipe.Option;
+import org.apache.geronimo.kernel.Kernel;
 
 
 /**
@@ -257,7 +258,7 @@
         return otherAttributes;
     }
 
-    public Service getService(ClassLoader cl) throws Exception {
+    public Service getService(ClassLoader cl, Kernel kernel) throws Exception {
         Map<String, Object> properties = new HashMap<String, Object>();
         properties.put("name", getName());
         for (Map.Entry<QName, String> entry: otherAttributes.entrySet()) {
@@ -267,14 +268,14 @@
         ObjectRecipe recipe = new ObjectRecipe(className, properties);
         recipe.allow(Option.IGNORE_MISSING_PROPERTIES);
         Service service = (Service) recipe.create(cl);
-        for (ConnectorType connectorType: getConnector()) {
-            Connector connector = connectorType.getConnector(cl);
-            service.addConnector(connector);
-        }
         for (ExecutorType executorType: getExecutor()) {
-            Executor executor = executorType.getExecutor(cl);
+            Executor executor = executorType.getExecutor(cl, kernel);
             service.addExecutor(executor);
         }
+        for (ConnectorType connectorType: getConnector()) {
+            Connector connector = connectorType.getConnector(cl, service);
+            service.addConnector(connector);
+        }
         if (service instanceof Lifecycle) {
             Lifecycle lifecycle = (Lifecycle) service;
             for (ListenerType listenerType: getListener()) {

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/TomcatServerGBeanTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/TomcatServerGBeanTest.java?rev=788834&r1=788833&r2=788834&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/TomcatServerGBeanTest.java
(original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/TomcatServerGBeanTest.java
Fri Jun 26 19:48:04 2009
@@ -23,7 +23,6 @@
 import java.io.File;
 import java.io.FileReader;
 
-import junit.framework.TestCase;
 import org.apache.geronimo.testsupport.TestSupport;
 import org.apache.geronimo.tomcat.model.ServerType;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
@@ -44,7 +43,7 @@
         try {
             ServerType serverType = TomcatServerGBean.loadServerType(in);
             assertEquals(4, serverType.getListener().size());
-            Server server = serverType.build(getClass().getClassLoader());
+            Server server = serverType.build(getClass().getClassLoader(), null);
             try {
                 ((Lifecycle)server).start();
             } finally {
@@ -56,7 +55,7 @@
     }
     public void testGBeanServer1() throws Exception {
         ServerInfo serverInfo = new BasicServerInfo(BASEDIR.getAbsolutePath());
-        TomcatServerGBean tomcatServerGBean = new TomcatServerGBean(null, SERVER_1, null
,serverInfo, null, null, getClass().getClassLoader());
+        TomcatServerGBean tomcatServerGBean = new TomcatServerGBean(null, SERVER_1, null
,serverInfo, null, null, getClass().getClassLoader(), null);
         try {
             tomcatServerGBean.doStart();
         } finally {

Modified: geronimo/server/trunk/plugins/tomcat/tomcat6/src/main/resources/tomcat-base/server.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/tomcat6/src/main/resources/tomcat-base/server.xml?rev=788834&r1=788833&r2=788834&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/tomcat6/src/main/resources/tomcat-base/server.xml
(original)
+++ geronimo/server/trunk/plugins/tomcat/tomcat6/src/main/resources/tomcat-base/server.xml
Fri Jun 26 19:48:04 2009
@@ -16,147 +16,154 @@
   limitations under the License.
 -->
 
-    <!-- this is the basic tomcat server.xml -->
-    
+<!-- this is the basic tomcat server.xml -->
+
 <!-- Note:  A "Server" is not itself a "Container", so you may not
-     define subcomponents such as "Valves" at this level.
-     Documentation at /docs/config/server.html
- -->
+    define subcomponents such as "Valves" at this level.
+    Documentation at /docs/config/server.html
+-->
 <Server port="8005" shutdown="SHUTDOWN">
 
-  <!--APR library loader. Documentation at /docs/apr.html -->
-  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
-  <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html
-->
-  <Listener className="org.apache.catalina.core.JasperListener" />
-  <!-- JMX Support for the Tomcat server. Documentation at /docs/non-existent.html -->
-  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
-  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
-
-  <!-- Global JNDI resources
-       Documentation at /docs/jndi-resources-howto.html
-  -->
-  <GlobalNamingResources>
-    <!-- Editable user database that can also be used by
-         UserDatabaseRealm to authenticate users
-    -->
-    <Resource name="UserDatabase" auth="Container"
-              type="org.apache.catalina.UserDatabase"
-              description="User database that can be updated and saved"
-              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
-              pathname="conf/tomcat-users.xml" />
-  </GlobalNamingResources>
-
-  <!-- A "Service" is a collection of one or more "Connectors" that share
-       a single "Container" Note:  A "Service" is not itself a "Container",
-       so you may not define subcomponents such as "Valves" at this level.
-       Documentation at /docs/config/service.html
-   -->
-  <Service name="Catalina">
-
-    <!--The connectors can use a shared executor, you can define one or more named thread
pools-->
-    <!--
-    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
-        maxThreads="150" minSpareThreads="4"/>
-    -->
-
+    <!--APR library loader. Documentation at /docs/apr.html -->
+    <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on"/>
+    <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html
-->
+    <Listener className="org.apache.catalina.core.JasperListener"/>
+    <!-- JMX Support for the Tomcat server. Documentation at /docs/non-existent.html -->
+    <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
+    <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
 
-    <!-- A "Connector" represents an endpoint by which requests are received
-         and responses are returned. Documentation at :
-         Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
-         Java AJP  Connector: /docs/config/ajp.html
-         APR (HTTP/AJP) Connector: /docs/apr.html
-         Define a non-SSL HTTP/1.1 Connector on port 8080
+    <!-- Global JNDI resources
+         Documentation at /docs/jndi-resources-howto.html
     -->
-    <Connector port="${HTTPPort + PortOffset}"
-               host="${ServerHostname}"
-               protocol="HTTP/1.1"
-               connectionTimeout="20000"
-               redirectPort="${HTTPSPort + PortOffset}" />
-    <!-- A "Connector" using the shared thread pool-->
-    <!--
-    <Connector executor="tomcatThreadPool"
-               port="8080" protocol="HTTP/1.1"
-               connectionTimeout="20000"
-               redirectPort="8443" />
+    <GlobalNamingResources>
+        <!-- Editable user database that can also be used by
+             UserDatabaseRealm to authenticate users
+        -->
+        <Resource name="UserDatabase" auth="Container"
+                  type="org.apache.catalina.UserDatabase"
+                  description="User database that can be updated and saved"
+                  factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
+                  pathname="conf/tomcat-users.xml"/>
+    </GlobalNamingResources>
+
+    <!-- A "Service" is a collection of one or more "Connectors" that share
+        a single "Container" Note:  A "Service" is not itself a "Container",
+        so you may not define subcomponents such as "Valves" at this level.
+        Documentation at /docs/config/service.html
     -->
-    <!-- Define a SSL HTTP/1.1 Connector on port 8443
-         This connector uses the JSSE configuration, when using APR, the
-         connector should be using the OpenSSL style configuration
-         described in the APR documentation -->
-    <Connector port="${HTTPSPort + PortOffset}"
-               host="${ServerHostname}"
-               protocol="HTTP/1.1"
-               SSLEnabled="true"
-               maxThreads="150"
-               scheme="https"
-               secure="true"
-               clientAuth="false"
-               keystoreFile="../security/keystores/geronimo-default"
-               keystorePass="secret"
-               sslProtocol="TLS" />
-
-    <!-- Define an AJP 1.3 Connector on port 8009 -->
-    <Connector port="${AJPPort + PortOffset}"
-               host="${ServerHostname}"
-               protocol="AJP/1.3"
-               redirectPort="${HTTPSPort + PortOffset}" />
-
-
-    <!-- An Engine represents the entry point (within Catalina) that processes
-         every request.  The Engine implementation for Tomcat stand alone
-         analyzes the HTTP headers included with the request, and passes them
-         on to the appropriate Host (virtual host).
-         Documentation at /docs/config/engine.html -->
+    <Service name="Catalina">
+        <Executor className="org.apache.geronimo.tomcat.TomcatExecutorWrapper"
+                  name="DefaultThreadPool"
+                  executor-ref="?name=DefaultThreadPool#java.util.concurrent.Executor"/>
 
-    <!-- You should set jvmRoute to support load-balancing via AJP ie :
-    <Engine name="Standalone" defaultHost="localhost" jvmRoute="jvm1">
-    -->
-    <Engine name="Catalina" defaultHost="${ServerHostname}">
 
-      <!--For clustering, please take a look at documentation at:
-          /docs/cluster-howto.html  (simple how to)
-          /docs/config/cluster.html (reference documentation) -->
-      <!--
-      <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
-      -->
-
-      <!-- The request dumper valve dumps useful debugging information about
-           the request and response data received and sent by Tomcat.
-           Documentation at: /docs/config/valve.html -->
-      <!--
-      <Valve className="org.apache.catalina.valves.RequestDumperValve"/>
-      -->
-
-      <!-- This Realm uses the UserDatabase configured in the global JNDI
-           resources under the key "UserDatabase".  Any edits
-           that are performed against this UserDatabase are immediately
-           available for use by the Realm.  -->
-      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
-             resourceName="UserDatabase"/>
-
-      <!-- Define the default virtual host
-           Note: XML Schema validation will not work with Xerces 2.2.
-       -->
-      <Host name="${ServerHostname}"  appBase=""
-            unpackWARs="true" autoDeploy="true"
-            xmlValidation="false" xmlNamespaceAware="false">
-
-        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
-               prefix="${ServerHostname}_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>

-        <!-- SingleSignOn valve, share authentication between web applications
-             Documentation at: /docs/config/valve.html -->
+        <!--The connectors can use a shared executor, you can define one or more named
thread pools-->
         <!--
-        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
+        <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
+            maxThreads="150" minSpareThreads="4"/>
         -->
 
-        <!-- Access log processes all example.
-             Documentation at: /docs/config/valve.html -->
+
+        <!-- A "Connector" represents an endpoint by which requests are received
+             and responses are returned. Documentation at :
+             Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
+             Java AJP  Connector: /docs/config/ajp.html
+             APR (HTTP/AJP) Connector: /docs/apr.html
+             Define a non-SSL HTTP/1.1 Connector on port 8080
+        -->
+        <Connector port="${HTTPPort + PortOffset}"
+                   host="${ServerHostname}"
+                   protocol="HTTP/1.1"
+                   connectionTimeout="20000"
+                   redirectPort="${HTTPSPort + PortOffset}"
+                   executor="DefaultThreadPool"/>
+        <!-- A "Connector" using the shared thread pool-->
         <!--
-        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
-               prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
+        <Connector executor="tomcatThreadPool"
+                   port="8080" protocol="HTTP/1.1"
+                   connectionTimeout="20000"
+                   redirectPort="8443" />
+        -->
+        <!-- Define a SSL HTTP/1.1 Connector on port 8443
+   This connector uses the JSSE configuration, when using APR, the
+   connector should be using the OpenSSL style configuration
+   described in the APR documentation -->
+        <Connector port="${HTTPSPort + PortOffset}"
+                   host="${ServerHostname}"
+                   protocol="HTTP/1.1"
+                   SSLEnabled="true"
+                   maxThreads="150"
+                   scheme="https"
+                   secure="true"
+                   clientAuth="false"
+                   keystoreFile="../security/keystores/geronimo-default"
+                   keystorePass="secret"
+                   sslProtocol="TLS"
+                   executor="DefaultThreadPool"/>
+
+        <!-- Define an AJP 1.3 Connector on port 8009 -->
+        <Connector port="${AJPPort + PortOffset}"
+                   host="${ServerHostname}"
+                   protocol="AJP/1.3"
+                   redirectPort="${HTTPSPort + PortOffset}"
+                   executor="DefaultThreadPool"/>
+
+
+        <!-- An Engine represents the entry point (within Catalina) that processes
+     every request.  The Engine implementation for Tomcat stand alone
+     analyzes the HTTP headers included with the request, and passes them
+     on to the appropriate Host (virtual host).
+     Documentation at /docs/config/engine.html -->
+
+        <!-- You should set jvmRoute to support load-balancing via AJP ie :
+        <Engine name="Standalone" defaultHost="localhost" jvmRoute="jvm1">
         -->
+        <Engine name="Catalina" defaultHost="${ServerHostname}">
+
+            <!--For clustering, please take a look at documentation at:
+         /docs/cluster-howto.html  (simple how to)
+         /docs/config/cluster.html (reference documentation) -->
+            <!--
+            <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
+            -->
+
+            <!-- The request dumper valve dumps useful debugging information about
+         the request and response data received and sent by Tomcat.
+         Documentation at: /docs/config/valve.html -->
+            <!--
+            <Valve className="org.apache.catalina.valves.RequestDumperValve"/>
+            -->
+
+            <!-- This Realm uses the UserDatabase configured in the global JNDI
+     resources under the key "UserDatabase".  Any edits
+     that are performed against this UserDatabase are immediately
+     available for use by the Realm.  -->
+            <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
+                   resourceName="UserDatabase"/>
+
+            <!-- Define the default virtual host
+                Note: XML Schema validation will not work with Xerces 2.2.
+            -->
+            <Host name="${ServerHostname}" appBase=""
+                  unpackWARs="true" autoDeploy="true"
+                  xmlValidation="false" xmlNamespaceAware="false">
+
+                <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
+                       prefix="${ServerHostname}_access_log." suffix=".txt" pattern="common"
resolveHosts="false"/>
+                <!-- SingleSignOn valve, share authentication between web applications
+             Documentation at: /docs/config/valve.html -->
+                <!--
+                <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
+                -->
 
-      </Host>
-    </Engine>
-  </Service>
+                <!-- Access log processes all example.
+             Documentation at: /docs/config/valve.html -->
+                <!--
+                <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
+                       prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
+                -->
+
+            </Host>
+        </Engine>
+    </Service>
 </Server>



Mime
View raw message