geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From genspr...@apache.org
Subject svn commit: r810766 [1/2] - in /geronimo/server/branches/2.2: framework/modules/geronimo-management/src/main/java/org/apache/geronimo/management/geronimo/ plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/webmanager/ plugi...
Date Thu, 03 Sep 2009 03:06:20 GMT
Author: genspring
Date: Thu Sep  3 03:06:18 2009
New Revision: 810766

URL: http://svn.apache.org/viewvc?rev=810766&view=rev
Log:
GERONIMO-4742 Connector portlets for Tomcat does not work

1, Added ConnectorWrapperGBeanStarter.java to start connector GBeans for connectors defined in server.xml.  
2, Added TomcatServerConfigManager.java to use DOM to read/write connectors from server.xml.
3, Modified other classes to make this happen.

Added:
    geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatServerConfigManager.java   (with props)
    geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/ConnectorWrapperGBeanStarter.java   (with props)
Modified:
    geronimo/server/branches/2.2/framework/modules/geronimo-management/src/main/java/org/apache/geronimo/management/geronimo/WebManager.java
    geronimo/server/branches/2.2/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/webmanager/ConnectorPortlet.java
    geronimo/server/branches/2.2/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyManagerImpl.java
    geronimo/server/branches/2.2/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyManagerImpl.java
    geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6-builder/src/test/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java
    geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/BaseGBean.java
    geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatManagerImpl.java
    geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatServerGBean.java
    geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/AJP13ConnectorGBean.java
    geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/AbstractHttp11ConnectorGBean.java
    geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/BaseHttp11ConnectorGBean.java
    geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/ConnectorGBean.java
    geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11APRConnectorGBean.java
    geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11ConnectorGBean.java
    geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11NIOConnectorGBean.java
    geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Https11APRConnectorGBean.java
    geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Https11ConnectorGBean.java
    geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Https11NIOConnectorGBean.java
    geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/ConnectorType.java
    geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/AbstractWebModuleTest.java
    geronimo/server/branches/2.2/plugins/tomcat/tomcat6/src/main/filtered-resources/tomcat-base/server.xml
    geronimo/server/branches/2.2/plugins/tomcat/tomcat6/src/main/plan/plan.xml

Modified: geronimo/server/branches/2.2/framework/modules/geronimo-management/src/main/java/org/apache/geronimo/management/geronimo/WebManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/framework/modules/geronimo-management/src/main/java/org/apache/geronimo/management/geronimo/WebManager.java?rev=810766&r1=810765&r2=810766&view=diff
==============================================================================
--- geronimo/server/branches/2.2/framework/modules/geronimo-management/src/main/java/org/apache/geronimo/management/geronimo/WebManager.java (original)
+++ geronimo/server/branches/2.2/framework/modules/geronimo-management/src/main/java/org/apache/geronimo/management/geronimo/WebManager.java Thu Sep  3 03:06:18 2009
@@ -49,6 +49,8 @@
     AbstractName getConnectorConfiguration(ConnectorType connectorType, List<ConnectorAttribute> connectorAttributes, WebContainer container, String uniqueName);
 
     ConnectorType getConnectorType(AbstractName connectorName);
+    
+    void updateConnectorConfig(AbstractName connectorName) throws Exception;
 
     public class ConnectorType {
         private final String description;

Modified: geronimo/server/branches/2.2/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/webmanager/ConnectorPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/webmanager/ConnectorPortlet.java?rev=810766&r1=810765&r2=810766&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/webmanager/ConnectorPortlet.java (original)
+++ geronimo/server/branches/2.2/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/webmanager/ConnectorPortlet.java Thu Sep  3 03:06:18 2009
@@ -150,6 +150,12 @@
             } catch (Exception e) {
                 log.error("Unable to start connector", e); //TODO: get into rendered page
             }
+            
+            try {
+                manager.updateConnectorConfig(newConnectorName);
+            } catch (Exception e) {
+                log.error("Unable to start connector", e); //TODO: get into rendered page
+            }
             actionResponse.setRenderParameter(PARM_MODE, "list");
         } else if(mode.equals("save")) { // User just submitted the form to update a connector
             // Get submitted values
@@ -196,6 +202,11 @@
                 
                 // set the keystore properties if its a secure connector
                 setKeystoreProperties(actionRequest, connectorName);
+                try {
+                    manager.updateConnectorConfig(connectorName);
+                } catch (Exception e) {
+                    log.error("Unable to start connector", e); //TODO: get into rendered page
+                }
             }
             actionResponse.setRenderParameter(PARM_MODE, "list");
         } else if(mode.equals("start")) {

Modified: geronimo/server/branches/2.2/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyManagerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyManagerImpl.java?rev=810766&r1=810765&r2=810766&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyManagerImpl.java (original)
+++ geronimo/server/branches/2.2/plugins/jetty/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyManagerImpl.java Thu Sep  3 03:06:18 2009
@@ -424,4 +424,8 @@
     public static GBeanInfo getGBeanInfo() {
         return GBEAN_INFO;
     }
+
+    public void updateConnectorConfig(AbstractName connectorName)  throws Exception {
+        // do nothing for Jetty, only tomcat needs this to update server.xml file.       
+    }
 }

Modified: geronimo/server/branches/2.2/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyManagerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyManagerImpl.java?rev=810766&r1=810765&r2=810766&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyManagerImpl.java (original)
+++ geronimo/server/branches/2.2/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyManagerImpl.java Thu Sep  3 03:06:18 2009
@@ -413,4 +413,8 @@
         }
     }
 
+    public void updateConnectorConfig(AbstractName connectorName)  throws Exception {
+        // do nothing for Jetty, only tomcat needs this to update server.xml file.      
+    }
+
 }

Modified: geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6-builder/src/test/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6-builder/src/test/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java?rev=810766&r1=810765&r2=810766&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6-builder/src/test/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java (original)
+++ geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6-builder/src/test/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java Thu Sep  3 03:06:18 2009
@@ -38,6 +38,7 @@
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.annotation.AnnotationGBeanInfoFactory;
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.deployment.NamingBuilderCollection;
@@ -297,7 +298,7 @@
         containerData.setReferencePattern("ServerInfo", serverInfo.getAbstractName());
         AbstractName containerName = containerData.getAbstractName();
 
-        GBeanData connector = bootstrap.addGBean("TomcatConnector", Http11ConnectorGBean.GBEAN_INFO);
+        GBeanData connector = bootstrap.addGBean("TomcatConnector", new AnnotationGBeanInfoFactory().getGBeanInfo(Http11ConnectorGBean.class));
         connector.setAttribute("name", "HTTP");
         connector.setAttribute("port", new Integer(8181));
         connector.setReferencePattern("TomcatContainer", containerName);

Modified: geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/BaseGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/BaseGBean.java?rev=810766&r1=810765&r2=810766&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/BaseGBean.java (original)
+++ geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/BaseGBean.java Thu Sep  3 03:06:18 2009
@@ -24,13 +24,13 @@
 
 public abstract class BaseGBean {
 
-    protected void setParameters(Object object, Map map){
+    protected void setParameters(Object object, Map<String, String> map){
         if (map != null){
-            Set keySet = map.keySet();
-            Iterator iterator = keySet.iterator();
+            Set<String> keySet = map.keySet();
+            Iterator<String> iterator = keySet.iterator();
             while(iterator.hasNext()){
-                String name = (String)iterator.next();
-                String value = (String)map.get(name);
+                String name = iterator.next();
+                String value = map.get(name);
                 
                 IntrospectionUtils.setProperty(object, name, value);                    
             }

Modified: geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatManagerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatManagerImpl.java?rev=810766&r1=810765&r2=810766&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatManagerImpl.java (original)
+++ geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatManagerImpl.java Thu Sep  3 03:06:18 2009
@@ -22,26 +22,26 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Map.Entry;
 import java.util.Set;
+import java.util.Map.Entry;
 
 import javax.net.ssl.KeyManagerFactory;
 
 import org.apache.catalina.connector.Connector;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.geronimo.crypto.KeystoreUtil;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.ReferencePatterns;
-import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.gbean.annotation.AnnotationGBeanInfoFactory;
+import org.apache.geronimo.gbean.annotation.ParamReference;
+import org.apache.geronimo.gbean.annotation.ParamSpecial;
+import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
+import org.apache.geronimo.kernel.InternalKernelException;
 import org.apache.geronimo.kernel.Kernel;
-import org.apache.geronimo.kernel.config.ConfigurationUtil;
-import org.apache.geronimo.kernel.config.EditableConfigurationManager;
-import org.apache.geronimo.kernel.config.InvalidConfigException;
 import org.apache.geronimo.kernel.proxy.ProxyManager;
 import org.apache.geronimo.management.geronimo.NetworkConnector;
 import org.apache.geronimo.management.geronimo.WebAccessLog;
@@ -57,7 +57,8 @@
 import org.apache.geronimo.tomcat.connector.Https11ConnectorGBean;
 import org.apache.geronimo.tomcat.connector.Https11NIOConnectorGBean;
 import org.apache.geronimo.tomcat.connector.TomcatWebConnector;
-import org.apache.geronimo.crypto.KeystoreUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Tomcat implementation of the WebManager management API.  Knows how to
@@ -68,6 +69,7 @@
 public class TomcatManagerImpl implements WebManager {
     private static final Logger log = LoggerFactory.getLogger(TomcatManagerImpl.class);
     private final Kernel kernel;
+    private TomcatServerConfigManager tomcatServerConfigManager;
     
     private static final ConnectorType HTTP_BIO = new ConnectorType(Messages.getString("TomcatManagerImpl.0")); //$NON-NLS-1$
     private static final ConnectorType HTTPS_BIO = new ConnectorType(Messages.getString("TomcatManagerImpl.1")); //$NON-NLS-1$
@@ -164,6 +166,7 @@
         connectorAttributes.add(new ConnectorAttribute<Integer>("backlog", 10, Messages.getString("TomcatManagerImpl.44"), Integer.class)); //$NON-NLS-1$ //$NON-NLS-2$
         connectorAttributes.add(new ConnectorAttribute<Integer>("bufferSize", -1, Messages.getString("TomcatManagerImpl.46"), Integer.class)); //$NON-NLS-1$ //$NON-NLS-2$
         connectorAttributes.add(new ConnectorAttribute<Integer>("connectionTimeout", org.apache.coyote.ajp.Constants.DEFAULT_CONNECTION_TIMEOUT, Messages.getString("TomcatManagerImpl.48"), Integer.class)); //$NON-NLS-1$ //$NON-NLS-2$
+        connectorAttributes.add(new ConnectorAttribute<String>("executor", "DefaultThreadPool", Messages.getString("TomcatManagerImpl.122"), String.class)); //$NON-NLS-1$ //$NON-NLS-2$
         connectorAttributes.add(new ConnectorAttribute<Integer>("keepAliveTimeout", org.apache.coyote.ajp.Constants.DEFAULT_CONNECTION_TIMEOUT, Messages.getString("TomcatManagerImpl.50"), Integer.class)); //$NON-NLS-1$ //$NON-NLS-2$
         connectorAttributes.add(new ConnectorAttribute<Integer>("maxThreads", 40, Messages.getString("TomcatManagerImpl.52"), Integer.class)); //$NON-NLS-1$ //$NON-NLS-2$
         connectorAttributes.add(new ConnectorAttribute<Integer>("minSpareThreads", 10, Messages.getString("TomcatManagerImpl.54"), Integer.class)); //$NON-NLS-1$ //$NON-NLS-2$
@@ -174,19 +177,34 @@
     }
     
     private static Map<ConnectorType, GBeanInfo> CONNECTOR_GBEAN_INFOS = new HashMap<ConnectorType, GBeanInfo>();
+    private static List<String> defaultAttributeNames = new ArrayList<String>();
+    private static AnnotationGBeanInfoFactory annotationGbeanInfoFactory=new AnnotationGBeanInfoFactory();
 
     static {
-        CONNECTOR_GBEAN_INFOS.put(HTTP_BIO, Http11ConnectorGBean.GBEAN_INFO);
-        CONNECTOR_GBEAN_INFOS.put(HTTPS_BIO, Https11ConnectorGBean.GBEAN_INFO);
-        CONNECTOR_GBEAN_INFOS.put(HTTP_NIO, Http11NIOConnectorGBean.GBEAN_INFO);
-        CONNECTOR_GBEAN_INFOS.put(HTTPS_NIO, Https11NIOConnectorGBean.GBEAN_INFO);
-        CONNECTOR_GBEAN_INFOS.put(HTTP_APR, Http11APRConnectorGBean.GBEAN_INFO);
-        CONNECTOR_GBEAN_INFOS.put(HTTPS_APR, Https11APRConnectorGBean.GBEAN_INFO);
-        CONNECTOR_GBEAN_INFOS.put(AJP, AJP13ConnectorGBean.GBEAN_INFO);
+    	
+        CONNECTOR_GBEAN_INFOS.put(HTTP_BIO, annotationGbeanInfoFactory.getGBeanInfo(Http11ConnectorGBean.class));
+        CONNECTOR_GBEAN_INFOS.put(HTTPS_BIO, annotationGbeanInfoFactory.getGBeanInfo(Https11ConnectorGBean.class));
+        CONNECTOR_GBEAN_INFOS.put(HTTP_NIO, annotationGbeanInfoFactory.getGBeanInfo(Http11NIOConnectorGBean.class));
+        CONNECTOR_GBEAN_INFOS.put(HTTPS_NIO, annotationGbeanInfoFactory.getGBeanInfo(Https11NIOConnectorGBean.class));
+        CONNECTOR_GBEAN_INFOS.put(HTTP_APR, annotationGbeanInfoFactory.getGBeanInfo(Http11APRConnectorGBean.class));
+        CONNECTOR_GBEAN_INFOS.put(HTTPS_APR, annotationGbeanInfoFactory.getGBeanInfo(Https11APRConnectorGBean.class));
+        CONNECTOR_GBEAN_INFOS.put(AJP, annotationGbeanInfoFactory.getGBeanInfo(AJP13ConnectorGBean.class));
+        
+        defaultAttributeNames.add("name");
+        defaultAttributeNames.add("protocol");
+        defaultAttributeNames.add("host");
+        defaultAttributeNames.add("port");
+        defaultAttributeNames.add("executor");
+        defaultAttributeNames.add("redirectPort");
+        defaultAttributeNames.add("connectionTimeout");
+        
     }
-    
-    public TomcatManagerImpl(Kernel kernel) {
+
+    public TomcatManagerImpl(
+            @ParamSpecial(type = SpecialAttributeType.kernel) Kernel kernel,
+            @ParamReference(name = "Server") TomcatServerGBean tomcatServerGBean) {
         this.kernel = kernel;
+        this.tomcatServerConfigManager = tomcatServerGBean.getTomcatServerConfigManager();
     }
 
     public String getProductName() {
@@ -221,37 +239,17 @@
      * connector that uses this network technology.
      * @param connectorName
      */
-    public void removeConnector(AbstractName connectorName) {
-        try {
-            GBeanInfo info = kernel.getGBeanInfo(connectorName);
-            boolean found = false;
-            Set intfs = info.getInterfaces();
-            for (Iterator it = intfs.iterator(); it.hasNext();) {
-                String intf = (String) it.next();
-                if (intf.equals(TomcatWebConnector.class.getName())) {
-                    found = true;
-                }
-            }
-            if (!found) {
-                throw new GBeanNotFoundException(connectorName);
-            }
-            EditableConfigurationManager mgr = ConfigurationUtil.getEditableConfigurationManager(kernel);
-            if(mgr != null) {
-                try {
-                    mgr.removeGBeanFromConfiguration(connectorName.getArtifact(), connectorName);
-                } catch (InvalidConfigException e) {
-                    log.error("Unable to add GBean", e);
-                } finally {
-                    ConfigurationUtil.releaseConfigurationManager(kernel, mgr);
-                }
-            } else {
-                log.warn("The ConfigurationManager in the kernel does not allow editing");
+    public void removeConnector(AbstractName connectorAbstractName) {
+      
+            try {
+                kernel.invoke(connectorAbstractName, "doStop");
+                String connectorName=(String)kernel.getGBeanData(connectorAbstractName).getAttribute("name");
+                tomcatServerConfigManager.removeConnector(connectorName);
+                kernel.unloadGBean(connectorAbstractName);
+            } catch (Exception e) {
+                log.error("error when removing connector:"+connectorAbstractName,e);           
             }
-        } catch (GBeanNotFoundException e) {
-            log.warn("No such GBean '" + connectorName + "'"); //todo: what if we want to remove a failed GBean?
-        } catch (Exception e) {
-            log.error("Failed to remove connector", e);
-        }
+
     }
 
     /**
@@ -309,27 +307,25 @@
         GBeanData gbeanData = new GBeanData(name, gbeanInfo);
         gbeanData.setAttribute("name", uniqueName);
         gbeanData.setReferencePattern(ConnectorGBean.CONNECTOR_CONTAINER_REFERENCE, containerName);
+        Map<String, Object> initParams = new HashMap<String, Object>();
         for (ConnectorAttribute connectorAttribute : connectorAttributes) {
             gbeanData.setAttribute(connectorAttribute.getAttributeName(), connectorAttribute.getValue());
+            initParams.put(connectorAttribute.getAttributeName(), connectorAttribute.getStringValue());
         }
+        
+        gbeanData.setAttribute("initParams", initParams);
+
         AbstractNameQuery query = new AbstractNameQuery(ServerInfo.class.getName());
         Set set = kernel.listGBeans(query);
-        AbstractName serverInfo = (AbstractName)set.iterator().next();
+        
+        AbstractName serverInfo = (AbstractName) set.iterator().next();
         gbeanData.setReferencePattern("ServerInfo", serverInfo);
 
-        EditableConfigurationManager mgr = ConfigurationUtil.getEditableConfigurationManager(kernel);
-        if (mgr != null) {
-            try {
-                mgr.addGBeanToConfiguration(containerName.getArtifact(), gbeanData, false);
-            } catch (InvalidConfigException e) {
-                log.error("Unable to add GBean", e);
-                return null;
-            } finally {
-                ConfigurationUtil.releaseConfigurationManager(kernel, mgr);
-            }
-        } else {
-            log.warn("The ConfigurationManager in the kernel does not allow editing");
-            return null;
+        try {
+            kernel.loadGBean(gbeanData, container.getClass().getClassLoader());
+            kernel.startGBean(name);
+        } catch (Exception e) {
+            log.error("Error when adding new tomcat connector" + uniqueName, e);
         }
         return name;
     }
@@ -425,6 +421,7 @@
         connectorAttributes.add(new ConnectorAttribute<Boolean>("useBodyEncodingForURI", false, Messages.getString("TomcatManagerImpl.99"), Boolean.class)); //$NON-NLS-1$ //$NON-NLS-2$
         connectorAttributes.add(new ConnectorAttribute<Boolean>("useIPVHosts", false, Messages.getString("TomcatManagerImpl.101"), Boolean.class)); //$NON-NLS-1$ //$NON-NLS-2$
         connectorAttributes.add(new ConnectorAttribute<Boolean>("xpoweredBy", false, Messages.getString("TomcatManagerImpl.103"), Boolean.class)); //$NON-NLS-1$ //$NON-NLS-2$
+        
     }
     
     // see http://tomcat.apache.org/tomcat-6.0-doc/config/http.html
@@ -436,7 +433,7 @@
         connectorAttributes.add(new ConnectorAttribute<String>("compression", "off", Messages.getString("TomcatManagerImpl.116"), String.class)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
         connectorAttributes.add(new ConnectorAttribute<Integer>("connectionLinger", -1, Messages.getString("TomcatManagerImpl.118"), Integer.class)); //$NON-NLS-1$ //$NON-NLS-2$
         connectorAttributes.add(new ConnectorAttribute<Integer>("connectionTimeout", 60000, Messages.getString("TomcatManagerImpl.120"), Integer.class)); //$NON-NLS-1$ //$NON-NLS-2$
-        connectorAttributes.add(new ConnectorAttribute<String>("executor", null, Messages.getString("TomcatManagerImpl.122"), String.class)); //$NON-NLS-1$ //$NON-NLS-2$
+        connectorAttributes.add(new ConnectorAttribute<String>("executor", "DefaultThreadPool", Messages.getString("TomcatManagerImpl.122"), String.class)); //$NON-NLS-1$ //$NON-NLS-2$
         connectorAttributes.add(new ConnectorAttribute<Integer>("keepAliveTimeout", 60000, Messages.getString("TomcatManagerImpl.124"), Integer.class)); //$NON-NLS-1$ //$NON-NLS-2$
         connectorAttributes.add(new ConnectorAttribute<Boolean>("disableUploadTimeout", true, Messages.getString("TomcatManagerImpl.126"), Boolean.class)); //$NON-NLS-1$ //$NON-NLS-2$
         connectorAttributes.add(new ConnectorAttribute<Integer>("maxHttpHeaderSize", 4096, Messages.getString("TomcatManagerImpl.128"), Integer.class)); //$NON-NLS-1$ //$NON-NLS-2$
@@ -554,11 +551,122 @@
             
         return connectorType;
     }
+    /*
+     * update server.xml based on changes to connectors
+     * 1, if there's existing <Connector> for connectorName, update it.
+     * 2, if there's no existing <Connector> for connectorName, create it.     * 
+     */
+    @SuppressWarnings("unchecked")
+    public void updateConnectorConfig(AbstractName connectorName) throws Exception {
+
+        
+        //1, getting service name
+        
+        String serviceName;
+ 
+        
+        GBeanData containerGBeanData = null;
+
+        try {
+            GBeanData connectorGBeanData = kernel.getGBeanData(connectorName);
+
+            ReferencePatterns rp = connectorGBeanData.getReferencePatterns("TomcatContainer");
+            containerGBeanData = kernel.getGBeanData(rp.getAbstractName());
+            
+            Object object = containerGBeanData.getAttribute("serviceName");       
+
+            serviceName = (object == null) ? null : object.toString();
+
+        } catch (GBeanNotFoundException e) {
+            
+            throw new Exception("Can't find connector GBean when updating connector config",e);
+
+        } catch (InternalKernelException e) {
+            
+            throw new Exception("error to update conector config",e);
+        }
+        
+        
+        
+        //2, getting connector name
+        
+        Map<String,String> attributesToUpdate=new HashMap<String,String>();
+        
+        String connectorUniqueName = (String) kernel.getAttribute(connectorName, "name");    
+        
+        // 3, populate tomcat protocol attribute.
+        String tomcatProtocol=(String) kernel.getAttribute(connectorName, "tomcatProtocol");       
+        
+        attributesToUpdate.put("protocol", tomcatProtocol);
+        
+        
+        // 4, remove the unchanged attributes, we don't need to store them back to server.xml.
+        
+        ConnectorType connectorType = this.getConnectorType(connectorName);
+
+        List<ConnectorAttribute> defaultAttributes = this.getConnectorAttributes(connectorType);
+
+        
+        for (ConnectorAttribute defaultAttribute : defaultAttributes) {
+
+            String attributeName = defaultAttribute.getAttributeName();
+
+            Object latestAttibuteValue=null;
+            
+            try {
+                latestAttibuteValue=kernel.getAttribute(connectorName, attributeName);
+            } catch (Exception e) {
+                
+                continue;
+            }
+            
+
+            
+            if (null == latestAttibuteValue) {
+                
+                if(defaultAttributeNames.contains(attributeName)){
+                   
+                    //put default value to attributes listed in defaultAttributeNames.
+                    attributesToUpdate.put(attributeName, defaultAttribute.getStringValue());
+                   
+                } else {
+                    
+                      continue;
+               }
+
+            } else if(defaultAttribute.getValue().equals(latestAttibuteValue)){
+               
+                if (defaultAttributeNames.contains(attributeName)) {
+
+                    attributesToUpdate.put(attributeName, defaultAttribute.getStringValue());
+
+                } else {
+                     //don't update the unchanged attributes.
+                    continue;
+                }
+               
+            } else {
+                //adding changed attributes to attributesToUpdate map.
+                attributesToUpdate.put(attributeName, defaultAttribute.getStringValue());  
+            }
+        }
+        
+        
     
+        //5, call tomcatServerConfigManager to update connector info in server.xml
+
+        
+        tomcatServerConfigManager.updateConnector(attributesToUpdate, connectorUniqueName, serviceName);
+
+    }
+    
+
+
+
     private boolean isNativeAPRLibInstalled() {
 
         try {
-        	Connector connector = new Connector("HTTP/1.1");
+            Connector connector = new Connector("HTTP/1.1");
             if (!connector.getProtocolHandlerClassName().equalsIgnoreCase("org.apache.coyote.http11.Http11AprProtocol")) {        
                return false;
             } 
@@ -569,18 +677,8 @@
         return true;
     }
     
-    public static final GBeanInfo GBEAN_INFO;
 
-    static {
-        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Tomcat Web Manager", TomcatManagerImpl.class);
-        infoFactory.addAttribute("kernel", Kernel.class, false);
-        infoFactory.addInterface(WebManager.class);
-        infoFactory.setConstructor(new String[] {"kernel"});
-        GBEAN_INFO = infoFactory.getBeanInfo();
-    }
 
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
+
 
 }

Added: geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatServerConfigManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatServerConfigManager.java?rev=810766&view=auto
==============================================================================
--- geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatServerConfigManager.java (added)
+++ geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatServerConfigManager.java Thu Sep  3 03:06:18 2009
@@ -0,0 +1,203 @@
+/*
+ * 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 java.io.File;
+import java.io.FileOutputStream;
+import java.util.Map;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+
+
+/**
+ * This class is used to manipulate connectors in server.xml of tomcat.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TomcatServerConfigManager {
+    
+    private static final Logger log = LoggerFactory.getLogger(TomcatServerConfigManager.class);
+
+    private Document server_xml_dom_doc;
+    private File server_XML_File;
+
+    public TomcatServerConfigManager(File _server_XML_File) {
+
+        this.server_XML_File = _server_XML_File;
+
+        DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
+
+        try {
+            DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
+            server_xml_dom_doc = docBuilder.parse(this.server_XML_File);
+        } catch (Exception e) {
+            log.error("Error when parsing server.xml:"+server_XML_File+" into dom doc",e);
+        }
+
+    }
+
+
+    /**
+     * Remove the connector from server.xml
+     * @param name
+     *          the name of connector to be removed.
+     */
+    public void removeConnector(String name) {
+
+        Element connector = this.findTargetConnector(name);
+        if (null != connector) {
+            connector.getParentNode().removeChild(connector);
+        }
+        persistServerConfig();
+    }
+
+
+    /**
+     * @param attributesToUpdate
+     *                      The connector attributes that need to be updated.
+     * @param uniqueConnectorName
+     *                      the name of connector to be updated. 
+     * @param serviceName
+     *                      the name attribute of <Service> that the connector resides in.
+     */
+    public void updateConnector(Map<String, String> attributesToUpdate, String uniqueConnectorName, String serviceName) {
+
+        Element connector = this.findTargetConnector(uniqueConnectorName);
+
+        if (null == connector) {
+            // if can't find the unique Connector,create a new one.
+            connector = server_xml_dom_doc.createElement("Connector");
+
+            Element service = this.getService(serviceName);
+
+            NodeList ChildNodes = service.getChildNodes();
+
+            Node lastConnectorNode = ChildNodes.item(ChildNodes.getLength() - 1);
+
+            service.insertBefore(connector, lastConnectorNode);
+        }
+        
+
+        // set attributes for the connector
+
+        for (String attributeName : attributesToUpdate.keySet()) {
+            connector.setAttribute(attributeName, attributesToUpdate.get(attributeName));
+        }
+
+        connector.setAttribute("name", uniqueConnectorName);
+        connector.getAttributes();
+
+        persistServerConfig();
+
+    }
+    
+
+
+    private Element findTargetConnector(String name) {
+
+        NodeList connectors = server_xml_dom_doc.getElementsByTagName("Connector");
+
+        for (int i = 0; i < connectors.getLength(); i++) {
+
+            Element connector = (Element) (connectors.item(i));
+            if (name.equals(connector.getAttribute("name"))) {
+                return connector;
+            }
+        }
+
+        return null;
+
+    }
+
+    private Element getService(String serviceName) {
+
+        NodeList services = server_xml_dom_doc.getElementsByTagName("Service");
+
+        Element service = null;
+
+        if (services == null || services.getLength() == 0) {
+
+            throw new IllegalStateException("No services in server");
+        }
+
+        // return the legal <Service> element when there's no serviceName
+        // provided.
+        if (null == serviceName) {
+
+            if (services.getLength() > 1) {
+                throw new IllegalStateException("More than one service in server.  Provide name of desired server");
+            }
+
+            return (Element) services.item(0);
+
+        } else {
+
+            // return the specific <Service> element by serviceName
+            for (int i = 0; i < services.getLength(); i++) {
+
+                service = (Element) services.item(i);
+
+                if (service.getAttribute("name").equals(serviceName)) {
+                    return service;
+                }
+            }
+
+        }
+
+        return service;
+
+    }
+
+    private void persistServerConfig() {
+        
+        TransformerFactory tf = TransformerFactory.newInstance();
+       
+        Transformer transformer;
+        try {
+            transformer = tf.newTransformer();
+
+            transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+            transformer.setOutputProperty(OutputKeys.METHOD, "xml");
+            DOMSource source = new DOMSource(server_xml_dom_doc);
+            FileOutputStream fos=new FileOutputStream(server_XML_File);
+            StreamResult result = new StreamResult(fos);
+            transformer.transform(source, result);
+        } catch (Exception e1) {
+            
+            log.error("Error when persist modified dom back to file:"+server_XML_File,e1);
+        }
+
+    }
+
+}
+

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

Modified: geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatServerGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatServerGBean.java?rev=810766&r1=810765&r2=810766&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatServerGBean.java (original)
+++ geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatServerGBean.java Thu Sep  3 03:06:18 2009
@@ -25,7 +25,11 @@
 import java.io.IOException;
 import java.io.Reader;
 import java.io.StringReader;
+import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBElement;
@@ -37,19 +41,21 @@
 import javax.xml.stream.XMLStreamReader;
 
 import org.apache.catalina.Lifecycle;
+import org.apache.catalina.LifecycleListener;
 import org.apache.catalina.Server;
 import org.apache.catalina.Service;
+import org.apache.catalina.connector.Connector;
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.gbean.annotation.GBean;
 import org.apache.geronimo.gbean.annotation.ParamAttribute;
 import org.apache.geronimo.gbean.annotation.ParamReference;
 import org.apache.geronimo.gbean.annotation.ParamSpecial;
 import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
+import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.system.configuration.PluginAttributeStore;
 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;
 
@@ -62,6 +68,8 @@
     public static final XMLInputFactory XMLINPUT_FACTORY = XMLInputFactory.newInstance();
     public static final JAXBContext SERVER_CONTEXT;
     private static final String DEFAULT_CATALINA_HOME = "var/catalina";
+    public static final Map<Connector,String> ConnectorName=new HashMap<Connector,String>();
+    public static final List<LifecycleListener> LifecycleListeners=new ArrayList<LifecycleListener>();
     static {
         try {
             SERVER_CONTEXT = JAXBContext.newInstance(ServerType.class);
@@ -75,6 +83,7 @@
     private final ClassLoader classLoader;
     private final ServerInfo serverInfo;
     private final Server server;
+    private TomcatServerConfigManager tomcatServerConfigManager;
 
     public TomcatServerGBean(@ParamAttribute(name = "serverConfig") String serverConfig,
                              @ParamAttribute(name = "serverConfigLocation") String serverConfigLocation,
@@ -99,8 +108,9 @@
         System.setProperty("catalina.base", serverInfo.resolveServerPath(catalinaHome));
 
         if (serverConfig == null) {
-            File loc = serverInfo.resolveServer(serverConfigLocation);
-            Reader in = new FileReader(loc);
+            File serverConfigFile = serverInfo.resolveServer(serverConfigLocation);
+            this.tomcatServerConfigManager = new TomcatServerConfigManager(serverConfigFile);
+            Reader in = new FileReader(serverConfigFile);
             StringBuilder b = new StringBuilder();
             char[] buf = new char[1024];
             int i;
@@ -161,6 +171,11 @@
         }
         return service;
     }
+    
+
+    public TomcatServerConfigManager getTomcatServerConfigManager() {
+        return tomcatServerConfigManager;
+    }
 
     public Server getServer() {
         return server;

Modified: geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/AJP13ConnectorGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/AJP13ConnectorGBean.java?rev=810766&r1=810765&r2=810766&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/AJP13ConnectorGBean.java (original)
+++ geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/AJP13ConnectorGBean.java Thu Sep  3 03:06:18 2009
@@ -25,14 +25,18 @@
 
 import javax.management.j2ee.statistics.Stats;
 
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.catalina.Executor;
+import org.apache.catalina.connector.Connector;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.gbean.annotation.ParamReference;
 import org.apache.geronimo.management.StatisticsProvider;
 import org.apache.geronimo.management.geronimo.WebManager;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
 import org.apache.geronimo.tomcat.TomcatContainer;
 import org.apache.geronimo.tomcat.stats.ConnectorStats;
 
+@GBean(name="Tomcat Connector AJP")
 public class AJP13ConnectorGBean extends ConnectorGBean implements Ajp13Protocol, StatisticsProvider {
     
     // JSR77 stats
@@ -42,8 +46,16 @@
 
     protected String connectHost;
     
-    public AJP13ConnectorGBean(String name, Map initParams, String host, int port, TomcatContainer container, ServerInfo serverInfo) throws Exception {
-        super(name, initParams, "AJP/1.3", container, serverInfo);
+    public AJP13ConnectorGBean(@ParamAttribute(name = "name") String name,
+                               @ParamAttribute(name = "initParams") Map<String, String> initParams,
+                               @ParamAttribute(name = "host") String host,
+                               @ParamAttribute(name = "port") int port,
+                               @ParamReference(name = "TomcatContainer") TomcatContainer container,
+                               @ParamReference(name = "ServerInfo") ServerInfo serverInfo,
+                               @ParamAttribute(name = "connector") Connector conn)  throws Exception {
+    
+
+        super(name, initParams, "AJP/1.3", container, serverInfo, conn);
         
         // Default the host to listen on all address is one was not specified
         if (host == null) {
@@ -125,7 +137,18 @@
     }
 
     public String getExecutor() {
-        return (String) connector.getAttribute("Executor");
+    	 Object value = connector.getAttribute("executor");
+         if (value == null)
+             return null;
+         
+         if (value instanceof String)
+             return (String)value;
+         
+         if(value instanceof Executor){
+         	return ((Executor) value).getName();
+         }
+         
+         return (String) value.getClass().getName();
     }
     
     public String getHost() {
@@ -241,50 +264,5 @@
         reset = true;
     }
     
-    public static final GBeanInfo GBEAN_INFO;
-
-    static {
-        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Tomcat Connector AJP", AJP13ConnectorGBean.class, ConnectorGBean.GBEAN_INFO);
-        infoFactory.addInterface(Ajp13Protocol.class, 
-                new String[] {
-                    //AJP Attributes
-                    "address", 
-                    "backlog", 
-                    "bufferSize", 
-                    "connectionTimeout", 
-                    "executor", 
-                    "host",
-                    "keepAliveTimeout", 
-                    "maxThreads",
-                    "maxSpareThreads",
-                    "minSpareThreads",
-                    "port", 
-                    "tcpNoDelay", 
-                    "tomcatAuthentication", 
-                },
-                new String[] {
-                    //AJP Attributes
-                    "address", 
-                    "backlog", 
-                    "bufferSize", 
-                    "connectionTimeout", 
-                    "executor", 
-                    "host",
-                    "keepAliveTimeout", 
-                    "maxThreads",
-                    "maxSpareThreads",
-                    "minSpareThreads",
-                    "port", 
-                    "tcpNoDelay", 
-                    "tomcatAuthentication", 
-                }
-        );
-        infoFactory.setConstructor(new String[] { "name", "initParams", "host", "port", "TomcatContainer", "ServerInfo"});
-        GBEAN_INFO = infoFactory.getBeanInfo();
-    }
-    
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
-
+   
 }

Modified: geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/AbstractHttp11ConnectorGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/AbstractHttp11ConnectorGBean.java?rev=810766&r1=810765&r2=810766&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/AbstractHttp11ConnectorGBean.java (original)
+++ geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/AbstractHttp11ConnectorGBean.java Thu Sep  3 03:06:18 2009
@@ -22,12 +22,15 @@
 
 import javax.net.ssl.KeyManagerFactory;
 
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.catalina.connector.Connector;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.gbean.annotation.ParamReference;
 import org.apache.geronimo.management.geronimo.WebManager;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
 import org.apache.geronimo.tomcat.TomcatContainer;
 
+@GBean(name="Tomcat Connector")
 public abstract class AbstractHttp11ConnectorGBean extends BaseHttp11ConnectorGBean implements Http11Protocol {
     private String keystoreFileName;
 
@@ -35,8 +38,16 @@
 
     private String algorithm;
     
-    public AbstractHttp11ConnectorGBean(String name, Map initParams, String tomcatProtocol, String host, int port, TomcatContainer container, ServerInfo serverInfo) throws Exception {
-        super(name, initParams, tomcatProtocol, host, port, container, serverInfo);
+    public AbstractHttp11ConnectorGBean(@ParamAttribute(name = "name") String name,
+                                        @ParamAttribute(name = "initParams") Map<String, String> initParams,
+                                        @ParamAttribute(name = "protocol") String tomcatProtocol,
+                                        @ParamAttribute(name = "host") String host,
+                                        @ParamAttribute(name = "port") int port,
+                                        @ParamReference(name = "TomcatContainer") TomcatContainer container,
+                                        @ParamReference(name = "ServerInfo") ServerInfo serverInfo,
+                                        @ParamAttribute(name = "connector") Connector conn)  throws Exception {
+                                        
+        super(name, initParams, tomcatProtocol, host, port, container, serverInfo, conn);
     }
 
     @Override
@@ -167,46 +178,5 @@
         connector.setAttribute("truststoreType", truststoreType);
     }
 
-    public static final GBeanInfo GBEAN_INFO;
-
-    static {
-        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Tomcat Connector", AbstractHttp11ConnectorGBean.class, BaseHttp11ConnectorGBean.GBEAN_INFO);
-        infoFactory.addInterface(Http11Protocol.class, 
-                new String[] {
-                    //SSL Attributes
-                    "algorithm",
-                    "clientAuth",
-                    "keystoreFile",
-                    "keystorePass",
-                    "keystoreType",
-                    "sslProtocol",
-                    "ciphers",
-                    "keyAlias",
-                    "truststoreFile",
-                    "truststorePass",
-                    "truststoreType"
-                },
-                new String[] {
-                    //SSL Attributes
-                    "algorithm",
-                    "clientAuth",
-                    "keystoreFile",
-                    "keystorePass",
-                    "keystoreType",
-                    "sslProtocol",
-                    "ciphers",
-                    "keyAlias",
-                    "truststoreFile",
-                    "truststorePass",
-                    "truststoreType"
-                }
-        );
-        infoFactory.setConstructor(new String[] { "name", "initParams", "tomcatProtocol", "host", "port", "TomcatContainer", "ServerInfo"});
-        GBEAN_INFO = infoFactory.getBeanInfo();
-    }
-    
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
     
 }

Modified: geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/BaseHttp11ConnectorGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/BaseHttp11ConnectorGBean.java?rev=810766&r1=810765&r2=810766&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/BaseHttp11ConnectorGBean.java (original)
+++ geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/BaseHttp11ConnectorGBean.java Thu Sep  3 03:06:18 2009
@@ -24,15 +24,18 @@
 import java.util.Map;
 
 import javax.management.j2ee.statistics.Stats;
-import javax.net.ssl.KeyManagerFactory;
 
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.catalina.Executor;
+import org.apache.catalina.connector.Connector;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.gbean.annotation.ParamReference;
 import org.apache.geronimo.management.StatisticsProvider;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
 import org.apache.geronimo.tomcat.TomcatContainer;
 import org.apache.geronimo.tomcat.stats.ConnectorStats;
 
+@GBean(name="Tomcat Connector")
 public abstract class BaseHttp11ConnectorGBean extends ConnectorGBean implements BaseHttp11Protocol, StatisticsProvider {
 
     protected String connectHost;
@@ -42,8 +45,16 @@
 
     private boolean reset = true;
 
-    public BaseHttp11ConnectorGBean(String name, Map initParams, String tomcatProtocol, String host, int port, TomcatContainer container, ServerInfo serverInfo) throws Exception {
-        super(name, initParams, tomcatProtocol, container, serverInfo);
+    public BaseHttp11ConnectorGBean(@ParamAttribute(name = "name") String name,
+                                    @ParamAttribute(name = "initParams") Map<String, String> initParams,
+                                    @ParamAttribute(name = "protocol") String tomcatProtocol,
+                                    @ParamAttribute(name = "host") String host,
+                                    @ParamAttribute(name = "port") int port,
+                                    @ParamReference(name = "TomcatContainer") TomcatContainer container,
+                                    @ParamReference(name = "ServerInfo") ServerInfo serverInfo,
+                                    @ParamAttribute(name = "connector") Connector conn)  throws Exception {
+                                    
+        super(name, initParams, tomcatProtocol, container, serverInfo, conn);
 
         // Default the host to listen on all address is one was not specified
         if (host == null) {
@@ -57,7 +68,7 @@
 
         connector.setAttribute("address", host);
         connector.setPort(port);
-
+        
     }
     
     protected void initProtocol() {}
@@ -144,6 +155,10 @@
         if (value instanceof String)
             return (String)value;
         
+        if(value instanceof Executor){
+            return ((Executor) value).getName();
+        }
+        
         return (String) value.getClass().getName();
     }
     
@@ -329,94 +344,5 @@
         reset = true;
     }
 
-    public static final GBeanInfo GBEAN_INFO;
-
-    static {
-        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Tomcat Connector", BaseHttp11ConnectorGBean.class, ConnectorGBean.GBEAN_INFO);
-        infoFactory.addInterface(BaseHttp11Protocol.class, 
-                new String[] {
-                    //HTTP Attributes
-                    "acceptCount", 
-                    "address", 
-                    "bufferSize", 
-                    "compressableMimeType", 
-                    "compression", 
-                    "connectionLinger", 
-                    "connectionTimeout", 
-                    "executor", 
-                    "host",
-                    "keepAliveTimeout", 
-                    "disableUploadTimeout", 
-                    "maxHttpHeaderSize", 
-                    "maxKeepAliveRequests", 
-                    "maxThreads", 
-                    "maxSpareThreads",
-                    "minSpareThreads",
-                    "noCompressionUserAgents", 
-                    "port", 
-                    "restrictedUserAgents", 
-                    "server", 
-                    "socketBuffer", 
-                    "tcpNoDelay", 
-                    "threadPriority",
-                    //SSL Attributes
-                    "algorithm",
-                    "clientAuth",
-                    "keystoreFile",
-                    "keystorePass",
-                    "keystoreType",
-                    "sslProtocol",
-                    "ciphers",
-                    "keyAlias",
-                    "truststoreFile",
-                    "truststorePass",
-                    "truststoreType"
-                },
-                new String[] {
-                    //HTTP Attributes
-                    "acceptCount", 
-                    "address", 
-                    "bufferSize", 
-                    "compressableMimeType", 
-                    "compression", 
-                    "connectionLinger", 
-                    "connectionTimeout", 
-                    "executor", 
-                    "host",
-                    "keepAliveTimeout", 
-                    "disableUploadTimeout", 
-                    "maxHttpHeaderSize", 
-                    "maxKeepAliveRequests", 
-                    "maxThreads", 
-                    "maxSpareThreads",
-                    "minSpareThreads",
-                    "noCompressionUserAgents", 
-                    "port", 
-                    "restrictedUserAgents", 
-                    "server", 
-                    "socketBuffer", 
-                    "tcpNoDelay", 
-                    "threadPriority",
-                    //SSL Attributes
-                    "algorithm",
-                    "clientAuth",
-                    "keystoreFile",
-                    "keystorePass",
-                    "keystoreType",
-                    "sslProtocol",
-                    "ciphers",
-                    "keyAlias",
-                    "truststoreFile",
-                    "truststorePass",
-                    "truststoreType"
-                }
-        );
-        infoFactory.setConstructor(new String[] { "name", "initParams", "protocol", "host", "port", "TomcatContainer", "ServerInfo"});
-        GBEAN_INFO = infoFactory.getBeanInfo();
-    }
     
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
-
 }

Modified: geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/ConnectorGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/ConnectorGBean.java?rev=810766&r1=810765&r2=810766&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/ConnectorGBean.java (original)
+++ geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/ConnectorGBean.java Thu Sep  3 03:06:18 2009
@@ -24,19 +24,21 @@
 import javax.management.j2ee.statistics.Stats;
 
 import org.apache.catalina.LifecycleException;
+import org.apache.catalina.LifecycleListener;
 import org.apache.catalina.connector.Connector;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
-import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
-import org.apache.geronimo.management.geronimo.NetworkConnector;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.gbean.annotation.ParamReference;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
 import org.apache.geronimo.tomcat.BaseGBean;
 import org.apache.geronimo.tomcat.ObjectRetriever;
 import org.apache.geronimo.tomcat.TomcatContainer;
+import org.apache.geronimo.tomcat.TomcatServerGBean;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
+@GBean(name="Tomcat Connector")
 public abstract class ConnectorGBean extends BaseGBean implements CommonProtocol, GBeanLifecycle, ObjectRetriever, TomcatWebConnector {
 
     private static final Logger log = LoggerFactory.getLogger(ConnectorGBean.class);
@@ -50,12 +52,19 @@
     private final TomcatContainer container;
 
     private String name;
+    
 
-    public ConnectorGBean(String name, Map initParams, String tomcatProtocol, TomcatContainer container, ServerInfo serverInfo) throws Exception {
+	public ConnectorGBean(@ParamAttribute(name = "name") String name,
+						  @ParamAttribute(name = "initParams") Map<String, String> initParams,
+						  @ParamAttribute(name = "protocol") String tomcatProtocol,
+						  @ParamReference(name = "TomcatContainer") TomcatContainer container,
+						  @ParamReference(name = "ServerInfo") ServerInfo serverInfo,
+						  @ParamAttribute(name = "connector") Connector conn)  throws Exception {
         
         //Relief for new Tomcat-only parameters that may come in the future
         if (initParams == null){
-            initParams = new HashMap();
+            initParams = new HashMap<String, String>();
+            
         }
 
         // Do we really need this?? For Tomcat I don't think so...
@@ -80,7 +89,15 @@
         this.serverInfo = serverInfo;
 
         // Create the Connector object
-        connector = new Connector(tomcatProtocol);
+        if (conn == null) {
+            this.connector= new Connector(tomcatProtocol);
+           
+            for(LifecycleListener listener:TomcatServerGBean.LifecycleListeners){
+                this.connector.addLifecycleListener(listener);
+            }
+        }else{
+            connector=conn;
+        }
         
         setParameters(connector, initParams);
 
@@ -92,21 +109,14 @@
     }
 
     public void doStart() throws LifecycleException {
-        container.addConnector(connector);
-        connector.start();
-        
+        container.addConnector(this.connector);
         log.debug("{} connector started", name);
+
     }
 
     public void doStop() {
-        try {
-            connector.stop();
-        } catch (LifecycleException e) {
-            log.error("Failed to stop", e);
-        }
 
         container.removeConnector(connector);
-
         log.debug("{} connector stopped", name);
     }
     
@@ -268,66 +278,5 @@
         return connector.getXpoweredBy();
     }
 
-    public static final GBeanInfo GBEAN_INFO;
-
-    static {
-        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Tomcat Connector", ConnectorGBean.class);
-
-        infoFactory.addAttribute("name", String.class, true);
-        infoFactory.addAttribute("initParams", Map.class, true);
-        infoFactory.addAttribute("protocol", String.class, true);
-        infoFactory.addReference(CONNECTOR_CONTAINER_REFERENCE, TomcatContainer.class, GBeanInfoBuilder.DEFAULT_J2EE_TYPE);
-        infoFactory.addReference("ServerInfo", ServerInfo.class, "GBean");
-        infoFactory.addInterface(ObjectRetriever.class);
-        infoFactory.addInterface(TomcatWebConnector.class);
-        infoFactory.addInterface(CommonProtocol.class,
-                
-                new String[]{
-                        "allowTrace",
-                        "emptySessionPath",
-                        "enableLookups",
-                        "maxPostSize",
-                        "maxSavePostSize",
-                        "protocol",
-                        "tomcatProtocol",
-                        "proxyName",
-                        "proxyPort",
-                        "redirectPort",
-                        "scheme",
-                        "secure",
-                        "sslEnabled",
-                        "uriEncoding",
-                        "useBodyEncodingForURI",
-                        "useIPVHosts",
-                        "xpoweredBy"
-                },
-
-                new String[]{
-                        "allowTrace",
-                        "emptySessionPath",
-                        "enableLookups",
-                        "maxPostSize",
-                        "maxSavePostSize",
-                        "protocol",
-                        "tomcatProtocol",
-                        "proxyName",
-                        "proxyPort",
-                        "redirectPort",
-                        "scheme",
-                        "secure",
-                        "sslEnabled",
-                        "uriEncoding",
-                        "useBodyEncodingForURI",
-                        "useIPVHosts",
-                        "xpoweredBy"
-                }
-        );
-        infoFactory.setConstructor(new String[] { "name", "initParams", "protocol", "TomcatContainer", "ServerInfo" });
-        GBEAN_INFO = infoFactory.getBeanInfo();
-    }
-
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
 
 }

Added: geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/ConnectorWrapperGBeanStarter.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/ConnectorWrapperGBeanStarter.java?rev=810766&view=auto
==============================================================================
--- geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/ConnectorWrapperGBeanStarter.java (added)
+++ geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/ConnectorWrapperGBeanStarter.java Thu Sep  3 03:06:18 2009
@@ -0,0 +1,172 @@
+/*
+ * 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.connector;
+
+import java.util.Set;
+
+import org.apache.catalina.connector.Connector;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.gbean.annotation.AnnotationGBeanInfoFactory;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamReference;
+import org.apache.geronimo.gbean.annotation.ParamSpecial;
+import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.system.serverinfo.ServerInfo;
+import org.apache.geronimo.tomcat.TomcatContainer;
+import org.apache.geronimo.tomcat.TomcatServerGBean;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This class is used to create corresponding connector GBeans based on
+ * connectors defined in server.xml
+ * 
+ * @version $Rev$ $Date$
+ */
+@GBean
+public class ConnectorWrapperGBeanStarter implements GBeanLifecycle {
+
+    private static final Logger log = LoggerFactory.getLogger(ConnectorWrapperGBeanStarter.class);
+    private final TomcatServerGBean server;
+    private final TomcatContainer container;
+    private final ClassLoader classLoader;
+    private final Kernel kernel;
+
+    public ConnectorWrapperGBeanStarter(
+            @ParamReference(name = "Server") TomcatServerGBean server,
+            @ParamReference(name = "TomcatContainer") TomcatContainer container,
+            @ParamSpecial(type = SpecialAttributeType.classLoader) ClassLoader classLoader,
+            @ParamSpecial(type = SpecialAttributeType.kernel) Kernel kernel) throws Exception {
+
+        this.server = server;
+        this.container = container;
+        this.classLoader = classLoader;
+        this.kernel = kernel;
+
+    }
+
+    private void buildConnectorGBean(ClassLoader cl, Kernel kernel, Connector conn, TomcatContainer container) {
+
+        GBeanInfo gbeanInfo = this.getConnectorGBeanInfo(conn);
+
+        String uniqueName = TomcatServerGBean.ConnectorName.get(conn);
+
+        if (uniqueName == null) {
+            uniqueName = conn.getProtocol() + "_" + conn.getAttribute("host") + "_" + conn.getPort();
+        }
+
+        AbstractName containerAbstractName = kernel.getAbstractNameFor(container);
+
+        AbstractName name = kernel.getNaming().createSiblingName(containerAbstractName, uniqueName,
+                GBeanInfoBuilder.DEFAULT_J2EE_TYPE);
+        server.getService(null);
+        GBeanData gbeanData = new GBeanData(name, gbeanInfo);
+        gbeanData.setAttribute("name", uniqueName);
+        gbeanData.setAttribute("connector", conn);
+        gbeanData.setAttribute("host", conn.getAttribute("address"));
+        gbeanData.setAttribute("port", conn.getPort());
+
+        gbeanData.setReferencePattern(ConnectorGBean.CONNECTOR_CONTAINER_REFERENCE, containerAbstractName);
+
+        AbstractNameQuery query = new AbstractNameQuery(ServerInfo.class.getName());
+        Set<AbstractName> set = kernel.listGBeans(query);
+        gbeanData.setReferencePattern("ServerInfo", set.iterator().next());
+
+        try {
+            kernel.loadGBean(gbeanData, cl);
+            kernel.startGBean(name);
+        } catch (Exception e) {
+            log.error("Error when building connectorGbean for connector: " + conn.getAttribute("address") + ":"
+                    + conn.getPort(), e);
+        }
+
+    }
+
+    private GBeanInfo getConnectorGBeanInfo(Connector conn) {
+
+        String className = conn.getProtocolHandlerClassName();
+        AnnotationGBeanInfoFactory annotationGbeanInfoFactory=new AnnotationGBeanInfoFactory();
+        
+        
+            // BIO
+            if (className.equalsIgnoreCase("org.apache.coyote.http11.Http11Protocol")) {
+                if (conn.getScheme().equalsIgnoreCase("https"))
+
+                    return annotationGbeanInfoFactory.getGBeanInfo(Https11ConnectorGBean.class);
+
+                else
+                    return annotationGbeanInfoFactory.getGBeanInfo(Http11ConnectorGBean.class);
+            }
+
+            // NIO
+            if (className.equalsIgnoreCase("org.apache.coyote.http11.Http11NioProtocol")) {
+                if (conn.getScheme().equalsIgnoreCase("https"))
+                    return annotationGbeanInfoFactory.getGBeanInfo(Https11NIOConnectorGBean.class);
+                else
+                    return annotationGbeanInfoFactory.getGBeanInfo(Http11NIOConnectorGBean.class);
+            }
+
+            // AJP
+            if (className.equalsIgnoreCase("org.apache.coyote.ajp.AjpAprProtocol")) {
+
+                return annotationGbeanInfoFactory.getGBeanInfo(AJP13ConnectorGBean.class);
+            }
+
+            if (className.equalsIgnoreCase("org.apache.jk.server.JkCoyoteHandler")) {
+
+                return annotationGbeanInfoFactory.getGBeanInfo(AJP13ConnectorGBean.class);
+            }
+
+            // Apr
+            if (className.equalsIgnoreCase("org.apache.coyote.http11.Http11AprProtocol")) {
+                if (conn.getScheme().equalsIgnoreCase("https"))
+                    return annotationGbeanInfoFactory.getGBeanInfo(Https11APRConnectorGBean.class);
+            else
+                return annotationGbeanInfoFactory.getGBeanInfo(Http11APRConnectorGBean.class);
+            }
+    
+
+        return null;
+    }
+
+    public void doFail() {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void doStart() throws Exception {
+
+        Connector[] connectors = server.getService(null).findConnectors();
+
+        for (Connector conn : connectors) {
+            this.buildConnectorGBean(classLoader, kernel, conn, container);
+        }
+    }
+
+    public void doStop() throws Exception {
+        // TODO Auto-generated method stub
+
+    }
+}
\ No newline at end of file

Propchange: geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/ConnectorWrapperGBeanStarter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11APRConnectorGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11APRConnectorGBean.java?rev=810766&r1=810765&r2=810766&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11APRConnectorGBean.java (original)
+++ geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11APRConnectorGBean.java Thu Sep  3 03:06:18 2009
@@ -20,12 +20,15 @@
 
 import java.util.Map;
 
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.catalina.connector.Connector;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.gbean.annotation.ParamReference;
 import org.apache.geronimo.management.geronimo.WebManager;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
 import org.apache.geronimo.tomcat.TomcatContainer;
 
+@GBean(name="Tomcat Connector HTTP APR")
 public class Http11APRConnectorGBean extends BaseHttp11ConnectorGBean implements Http11APRProtocol {
 
     private String certificateFile;
@@ -36,8 +39,15 @@
     private String revocationPath;
     private String revocationFile;
     
-    public Http11APRConnectorGBean(String name, Map initParams, String host, int port, TomcatContainer container, ServerInfo serverInfo) throws Exception {
-        super(name, initParams, "org.apache.coyote.http11.Http11AprProtocol", host, port, container, serverInfo);
+    public Http11APRConnectorGBean(@ParamAttribute(name = "name") String name,
+                                   @ParamAttribute(name = "initParams") Map<String, String> initParams,
+                                   @ParamAttribute(name = "host") String host,
+                                   @ParamAttribute(name = "port") int port,
+                                   @ParamReference(name = "TomcatContainer") TomcatContainer container,
+                                   @ParamReference(name = "ServerInfo") ServerInfo serverInfo,
+                                   @ParamAttribute(name = "connector") Connector conn)  throws Exception {
+                                   
+        super(name, initParams, "org.apache.coyote.http11.Http11AprProtocol", host, port, container, serverInfo, conn);
     }
 
     @Override
@@ -228,58 +238,4 @@
         connector.setAttribute("useSendfile", useSendfile);
     }
     
-    public static final GBeanInfo GBEAN_INFO;
-
-    static {
-        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Tomcat Connector HTTP APR", Http11APRConnectorGBean.class, BaseHttp11ConnectorGBean.GBEAN_INFO);
-        infoFactory.addInterface(Http11APRProtocol.class, 
-                new String[] {
-                    //APR Attributes
-                    "pollTime",
-                    "pollerSize",
-                    "useSendfile",
-                    "sendfileSize",
-                    //SSL Attributes
-                    "sslProtocol",
-                    "sslCipherSuite",
-                    "sslCertificateFile",
-                    "sslCertificateKeyFile",
-                    "sslPassword",
-                    "sslVerifyClient",
-                    "sslVerifyDepth",
-                    "sslCACertificateFile",
-                    "sslCACertificatePath",
-                    "sslCertificateChainFile",
-                    "sslCARevocationFile",
-                    "sslCARevocationPath"
-                },
-                new String[] {
-                    //APR Attributes
-                    "pollTime",
-                    "pollerSize",
-                    "useSendfile",
-                    "sendfileSize",
-                    //SSL Attributes
-                    "sslProtocol",
-                    "sslCipherSuite",
-                    "sslCertificateFile",
-                    "sslCertificateKeyFile",
-                    "sslPassword",
-                    "sslVerifyClient",
-                    "sslVerifyDepth",
-                    "sslCACertificateFile",
-                    "sslCACertificatePath",
-                    "sslCertificateChainFile",
-                    "sslCARevocationFile",
-                    "sslCARevocationPath"
-                }
-        );
-        infoFactory.setConstructor(new String[] { "name", "initParams", "host", "port", "TomcatContainer", "ServerInfo"});
-        GBEAN_INFO = infoFactory.getBeanInfo();
-    }
-    
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
-
 }

Modified: geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11ConnectorGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11ConnectorGBean.java?rev=810766&r1=810765&r2=810766&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11ConnectorGBean.java (original)
+++ geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11ConnectorGBean.java Thu Sep  3 03:06:18 2009
@@ -20,32 +20,30 @@
 
 import java.util.Map;
 
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.catalina.connector.Connector;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.gbean.annotation.ParamReference;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
 import org.apache.geronimo.tomcat.TomcatContainer;
 
+@GBean(name="Tomcat Connector HTTP BIO")
 public class Http11ConnectorGBean extends AbstractHttp11ConnectorGBean {
     
-    public Http11ConnectorGBean(String name, Map initParams,  String host, int port, TomcatContainer container, ServerInfo serverInfo) throws Exception {
-        super(name, initParams, "org.apache.coyote.http11.Http11Protocol", host, port, container, serverInfo);
+    public Http11ConnectorGBean(@ParamAttribute(name = "name") String name,
+                                @ParamAttribute(name = "initParams") Map<String, String> initParams,
+                                @ParamAttribute(name = "host") String host,
+                                @ParamAttribute(name = "port") int port,
+                                @ParamReference(name = "TomcatContainer") TomcatContainer container,
+                                @ParamReference(name = "ServerInfo") ServerInfo serverInfo,
+                                @ParamAttribute(name = "connector") Connector conn)  throws Exception {
+                                
+        super(name, initParams, "org.apache.coyote.http11.Http11Protocol", host, port, container, serverInfo, conn);
     }
     
     public int getDefaultPort() {
         return 80; 
     }  
     
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
-    
-    public static final GBeanInfo GBEAN_INFO;
-
-    static {
-        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Tomcat Connector HTTP BIO", Http11ConnectorGBean.class, AbstractHttp11ConnectorGBean.GBEAN_INFO);
-        infoFactory.setConstructor(new String[] { "name", "initParams", "host", "port", "TomcatContainer", "ServerInfo"});
-        GBEAN_INFO = infoFactory.getBeanInfo();
-    }
-    
     
 }

Modified: geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11NIOConnectorGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11NIOConnectorGBean.java?rev=810766&r1=810765&r2=810766&view=diff
==============================================================================
--- geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11NIOConnectorGBean.java (original)
+++ geronimo/server/branches/2.2/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/connector/Http11NIOConnectorGBean.java Thu Sep  3 03:06:18 2009
@@ -20,16 +20,26 @@
 
 import java.util.Map;
 
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.catalina.connector.Connector;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.gbean.annotation.ParamReference;
 import org.apache.geronimo.management.geronimo.WebManager;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
 import org.apache.geronimo.tomcat.TomcatContainer;
 
+@GBean(name="Tomcat Connector HTTP NIO")
 public class Http11NIOConnectorGBean extends AbstractHttp11ConnectorGBean implements Http11NIOProtocol{
 
-    public Http11NIOConnectorGBean(String name,  Map initParams, String host, int port, TomcatContainer container, ServerInfo serverInfo) throws Exception {
-        super(name, initParams, "org.apache.coyote.http11.Http11NioProtocol", host, port, container, serverInfo);
+    public Http11NIOConnectorGBean(@ParamAttribute(name = "name") String name,
+                                   @ParamAttribute(name = "initParams") Map<String, String> initParams,
+                                   @ParamAttribute(name = "host") String host,
+                                   @ParamAttribute(name = "port") int port,
+                                   @ParamReference(name = "TomcatContainer") TomcatContainer container,
+                                   @ParamReference(name = "ServerInfo") ServerInfo serverInfo,
+                                   @ParamAttribute(name = "connector") Connector conn)  throws Exception {
+                                   
+        super(name, initParams, "org.apache.coyote.http11.Http11NioProtocol", host, port, container, serverInfo, conn);
     }
     
     public int getDefaultPort() {
@@ -345,91 +355,6 @@
     public void setUseSendfile(boolean useSendfile) {
         connector.setAttribute("useSendfile", new Boolean(useSendfile));
     }
-    public static final GBeanInfo GBEAN_INFO;
-
-    static {
-        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Tomcat Connector HTTP NIO", Http11NIOConnectorGBean.class, AbstractHttp11ConnectorGBean.GBEAN_INFO);
-        infoFactory.addInterface(Http11NIOProtocol.class, 
-                new String[] {
-                    "useSendfile", 
-                    "useExecutor", 
-                    "acceptorThreadCount", 
-                    "pollerThreadCount", 
-                    "pollerThreadPriority", 
-                    "acceptorThreadPriority", 
-                    "selectorTimeout", 
-                    "useComet", 
-                    "processCache", 
-                    "socket_directBuffer", 
-                    "socket_rxBufSize", 
-                    "socket_txBufSize", 
-                    "socket_appReadBufSize", 
-                    "socket_appWriteBufSize", 
-                    "socket_processorCache", 
-                    "socket_bufferPool", 
-                    "socket_bufferPoolSize", 
-                    "socket_keyCache", 
-                    "socket_eventCache", 
-                    "socket_tcpNoDelay", 
-                    "socket_soKeepAlive", 
-                    "socket_ooBInline", 
-                    "socket_soReuseAddress", 
-                    "socket_soLingerOn", 
-                    "socket_soLingerTime", 
-                    "socket_soTimeout", 
-                    "socket_soTrafficClass", 
-                    "socket_performanceConnectionTime", 
-                    "socket_performanceLatency", 
-                    "socket_performanceBandwidth", 
-                    "selectorPool_maxSelectors", 
-                    "selectorPool_maxSpareSelectors", 
-                    "command_line_options", 
-                    "oomParachute"
-                },
-                new String[] {
-                    "useSendfile", 
-                    "useExecutor", 
-                    "acceptorThreadCount", 
-                    "pollerThreadCount", 
-                    "pollerThreadPriority", 
-                    "acceptorThreadPriority", 
-                    "selectorTimeout", 
-                    "useComet", 
-                    "processCache", 
-                    "socket_directBuffer", 
-                    "socket_rxBufSize", 
-                    "socket_txBufSize", 
-                    "socket_appReadBufSize", 
-                    "socket_appWriteBufSize", 
-                    "socket_processorCache", 
-                    "socket_bufferPool", 
-                    "socket_bufferPoolSize", 
-                    "socket_keyCache", 
-                    "socket_eventCache", 
-                    "socket_tcpNoDelay", 
-                    "socket_soKeepAlive", 
-                    "socket_ooBInline", 
-                    "socket_soReuseAddress", 
-                    "socket_soLingerOn", 
-                    "socket_soLingerTime", 
-                    "socket_soTimeout", 
-                    "socket_soTrafficClass", 
-                    "socket_performanceConnectionTime", 
-                    "socket_performanceLatency", 
-                    "socket_performanceBandwidth", 
-                    "selectorPool_maxSelectors", 
-                    "selectorPool_maxSpareSelectors", 
-                    "command_line_options", 
-                    "oomParachute",
-
-                }
-        );
-        infoFactory.setConstructor(new String[] { "name", "initParams", "host", "port", "TomcatContainer", "ServerInfo"});
-        GBEAN_INFO = infoFactory.getBeanInfo();
-    }
     
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
 
 }



Mime
View raw message