geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmcma...@apache.org
Subject svn commit: r562021 [2/4] - in /geronimo/server/branches/2.0: applications/console/geronimo-console-framework/src/main/webapp/js/ applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ applications/console/geronimo-co...
Date Thu, 02 Aug 2007 05:51:21 GMT
Copied: geronimo/server/branches/2.0/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/webmanager/connector/editConnector.jsp (from r561149, geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/webmanager/connector/editConnector.jsp)
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/webmanager/connector/editConnector.jsp?view=diff&rev=562021&p1=geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/webmanager/connector/editConnector.jsp&r1=561149&p2=geronimo/server/branches/2.0/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/webmanager/connector/editConnector.jsp&r2=562021
==============================================================================
--- geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/webmanager/connector/editConnector.jsp (original)
+++ geronimo/server/branches/2.0/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/webmanager/connector/editConnector.jsp Wed Aug  1 22:51:18 2007
@@ -26,16 +26,16 @@
     var attributeName;
     var element;
 
-    element = document.forms['<portlet:namespace/>Form'].elements['displayName'];
+    element = document.forms['<portlet:namespace/>Form'].elements['uniqueName'];
     if(element.value.length < 1){
-        alert("displayName must not be empty.");
+        alert("uniqueName must not be empty.");
         return false;
     }
     
 <c:forEach var="connectorAttribute" items="${connectorAttributes}">
     attributeName = '${connectorAttribute.attributeName}';
     element = document.forms['<portlet:namespace/>Form'].elements[attributeName];
-    <c:if test="${connectorAttribute.required}">
+    <c:if test="${connectorAttribute.required && connectorAttribute.attributeClass.simpleName ne 'Boolean'}">
     //validate the required attribute has a value
     if(element.value.length < 1){
         alert(attributeName + " must not be empty.");
@@ -69,7 +69,7 @@
     Add a new ${connectorType}
   </c:when>
   <c:otherwise>
-    Edit connector ${displayName}
+    Edit connector ${uniqueName}
   </c:otherwise>
 </c:choose>
 <p>
@@ -82,21 +82,23 @@
   <th class="DarkBackground">Description</th>
 </tr>
 <tr>
-  <td class="LightBackground"><strong>*displayName</strong></td>
+  <td class="LightBackground"><strong>*uniqueName</strong></td>
   <td>String</td>
   <td><c:choose>
         <c:when test="${empty connectorURI}">
-            <input name="displayName" type="text" size="30">
+            <input name="uniqueName" type="text" size="30">
         </c:when>
         <c:otherwise>
-            <c:out escapeXml="true" value="${displayName}"/>
+            <input name="uniqueName" type="hidden" value='<c:out escapeXml="true" value="${uniqueName}"/>'>
+            <c:out escapeXml="true" value="${uniqueName}"/>
         </c:otherwise>
       </c:choose>
   </td>
-  <td>A unique name for this connector</td>
+  <td>A name that is different than the name for any other web connectors in the server (no spaces in the name please)</td>
 </tr>
 <c:forEach var="connectorAttribute" items="${connectorAttributes}" varStatus="status">
   <c:set var="style" value="${status.index % 2 == 0 ? 'MediumBackground' : 'LightBackground'}"/>
+  <c:set var="enumValues" value="${geronimoConsoleEnumValues[connectorAttribute.attributeName]}"/>
   <tr>
     <td class="${style}">
     <c:if test="${connectorAttribute.required}"><strong>*</c:if>
@@ -105,14 +107,33 @@
     </td>
     <td class="${style}">${connectorAttribute.attributeClass.simpleName}</td>
     <c:choose>
+        <c:when test="${enumValues != null}">
+    	    <td class="${style}">
+    	    <select name="${connectorAttribute.attributeName}">
+                <c:if test="${fn:length(connectorAttribute.value) > 0}">
+                    <option selected>
+                      <c:out escapeXml="true" value="${connectorAttribute.value}"/>
+                    </option>
+                </c:if>
+                <c:forEach var="enumValue" items="${enumValues}">
+                    <c:if test="${connectorAttribute.value ne enumValue}">
+                        <option>
+                          <c:out escapeXml="true" value="${enumValue}"/>
+                        </option>
+                    </c:if>
+                </c:forEach>
+    	    </select>
+    	     </td>
+        </c:when>
         <c:when test="${connectorAttribute.attributeClass.simpleName eq 'Integer'}">
     	    <td class="${style}"><input name="${connectorAttribute.attributeName}" type="text" size="5" 
     	     value="<c:out escapeXml="true" value="${connectorAttribute.stringValue}"/>"></td>
         </c:when>
         <c:when test="${connectorAttribute.attributeClass.simpleName eq 'Boolean'}">
-		    <td class="${style}"><input name="${connectorAttribute.attributeName}" type="checkbox" ${connectorAttribute.value ? 'checked' : ''}></td>
+		    <td class="${style}"><input name="${connectorAttribute.attributeName}" type="checkbox" 
+		    <c:if test="${connectorAttribute.value}">checked</c:if>></td>
         </c:when>
-        <c:when test="${fn:containsIgnoreCase(connectorAttribute.attributeName, 'password')}">
+        <c:when test="${fn:containsIgnoreCase(connectorAttribute.attributeName, 'pass')}">
 		    <td class="${style}"><input name="${connectorAttribute.attributeName}" type="password" size="30"
     	     value="<c:out escapeXml="true" value="${connectorAttribute.stringValue}"/>"></td>
         </c:when>

Propchange: geronimo/server/branches/2.0/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/webmanager/connector/editConnector.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/branches/2.0/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/webmanager/connector/editConnector.jsp
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/server/branches/2.0/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/webmanager/connector/editConnector.jsp
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/branches/2.0/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/webmanager/connector/normal.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/webmanager/connector/normal.jsp?view=diff&rev=562021&r1=562020&r2=562021
==============================================================================
--- geronimo/server/branches/2.0/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/webmanager/connector/normal.jsp (original)
+++ geronimo/server/branches/2.0/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/webmanager/connector/normal.jsp Wed Aug  1 22:51:18 2007
@@ -48,7 +48,7 @@
           </c:otherwise>
       </c:choose>
           <tr>
-            <td class="${backgroundClass}">${info.displayName}</td>
+            <td class="${backgroundClass}">${info.uniqueName}</td>
             <td class="${backgroundClass}">${info.protocol}</td>
             <td class="${backgroundClass}">${info.port}</td>
             <td class="${backgroundClass}">${info.stateName}</td>
@@ -61,7 +61,7 @@
                  <portlet:param name="managerURI" value="${container.managerURI}" />
                  <portlet:param name="containerURI" value="${container.containerURI}" />
                </portlet:actionURL>"
-                 <c:if test="${info.port eq serverPort}"> onClick="return confirm('Console application will not be available if ${info.displayName} is stopped.  Stop ${info.displayName}?');"</c:if>>
+                 <c:if test="${info.port eq serverPort}"> onClick="return confirm('Console application will not be available if ${info.uniqueName} is stopped.  Stop ${info.uniqueName}?');"</c:if>>
                  stop</a>
                </c:when>
                <c:otherwise>
@@ -84,7 +84,7 @@
                  <portlet:param name="connectorURI" value="${info.connectorURI}" />
                  <portlet:param name="managerURI" value="${container.managerURI}" />
                  <portlet:param name="containerURI" value="${container.containerURI}" />
-               </portlet:actionURL>" onClick="return confirm('Are you sure you want to delete ${info.displayName}?');">delete</a>
+               </portlet:actionURL>" onClick="return confirm('Are you sure you want to delete ${info.uniqueName}?');">delete</a>
             </td>
             <td class="${backgroundClass}">${info.description}</td>
           </tr>
@@ -93,18 +93,19 @@
           </c:otherwise>
         </c:choose>
 
-
+<P><HR><P>
 <!-- Links to add new connectors -->
-<c:forEach var="protocol" items="${container.protocols}">
-<br />
-<a href="<portlet:actionURL portletMode="view">
+Add new:
+<ul>
+<c:forEach var="connectorType" items="${container.connectorTypes}">
+<li><a href="<portlet:actionURL portletMode="view">
            <portlet:param name="mode" value="new" />
-           <portlet:param name="protocol" value="${protocol}" />
+           <portlet:param name="connectorType" value="${connectorType.description}" />
            <portlet:param name="managerURI" value="${container.managerURI}" />
            <portlet:param name="containerURI" value="${container.containerURI}" />
-           <portlet:param name="containerDisplayName" value="${container.name}" />
-         </portlet:actionURL>">Add new ${protocol} listener for ${container.name}</a>
+         </portlet:actionURL>">${connectorType.description}</a>
 </c:forEach>
+</ul>
 
     </c:forEach>
   </c:otherwise>

Modified: geronimo/server/branches/2.0/configs/geronimo-gbean-deployer/src/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/configs/geronimo-gbean-deployer/src/plan/plan.xml?view=diff&rev=562021&r1=562020&r2=562021
==============================================================================
--- geronimo/server/branches/2.0/configs/geronimo-gbean-deployer/src/plan/plan.xml (original)
+++ geronimo/server/branches/2.0/configs/geronimo-gbean-deployer/src/plan/plan.xml Wed Aug  1 22:51:18 2007
@@ -20,6 +20,7 @@
     
     <!-- Deployer used to process modules and plans -->
     <gbean name="Deployer" class="org.apache.geronimo.deployment.Deployer">
+        <attribute name="remoteDeployAddress">localhost:8080</attribute>
         <reference name="Store">
             <!--<pattern><gbean-name>*:j2eeType=ConfigurationStore,*</gbean-name></pattern>-->
          </reference>

Modified: geronimo/server/branches/2.0/configs/j2ee-server/src/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/configs/j2ee-server/src/plan/plan.xml?view=diff&rev=562021&r1=562020&r2=562021
==============================================================================
--- geronimo/server/branches/2.0/configs/j2ee-server/src/plan/plan.xml (original)
+++ geronimo/server/branches/2.0/configs/j2ee-server/src/plan/plan.xml Wed Aug  1 22:51:18 2007
@@ -91,10 +91,8 @@
            javax.xml.soap.SOAPFactory=org.apache.geronimo.webservices.saaj.GeronimoSOAPFactory
            javax.xml.soap.SOAPConnectionFactory=org.apache.geronimo.webservices.saaj.GeronimoSOAPConnectionFactory
            javax.xml.soap.MetaFactory=org.apache.geronimo.webservices.saaj.GeronimoMetaFactory
-
            org.apache.cxf.jaxws.checkPublishEndpointPermission=true
-
-             
+           java.net.preferIPv4Stack=true
          </attribute>
     </gbean>
 

Modified: geronimo/server/branches/2.0/configs/tomcat6/src/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/configs/tomcat6/src/plan/plan.xml?view=diff&rev=562021&r1=562020&r2=562021
==============================================================================
--- geronimo/server/branches/2.0/configs/tomcat6/src/plan/plan.xml (original)
+++ geronimo/server/branches/2.0/configs/tomcat6/src/plan/plan.xml Wed Aug  1 22:51:18 2007
@@ -57,55 +57,62 @@
         </reference>
     </gbean>
 
-    <gbean name="TomcatWebConnector" class="org.apache.geronimo.tomcat.ConnectorGBean">
+    <gbean name="TomcatWebConnector" class="org.apache.geronimo.tomcat.connector.Http11ConnectorGBean">
         <attribute name="name">HTTP</attribute>
         <attribute name="host">${PlanServerHostname}</attribute>
         <attribute name="port">${PlanHTTPPort}</attribute>
-        <attribute name="maxHttpHeaderSizeBytes">8192</attribute>
+        <attribute name="maxHttpHeaderSize">8192</attribute>
         <attribute name="maxThreads">150</attribute>
         <attribute name="minSpareThreads">25</attribute>
         <attribute name="maxSpareThreads">75</attribute>
-        <attribute name="hostLookupEnabled">false</attribute>
+        <attribute name="enableLookups">false</attribute>
         <attribute name="redirectPort">${PlanHTTPSPort}</attribute>
-        <attribute name="acceptQueueSize">100</attribute>
-        <attribute name="connectionTimeoutMillis">20000</attribute>
-        <attribute name="uploadTimeoutEnabled">false</attribute>
+        <attribute name="acceptCount">100</attribute>
+        <attribute name="connectionTimeout">20000</attribute>
+        <attribute name="disableUploadTimeout">true</attribute>
         <reference name="TomcatContainer">
             <name>TomcatWebContainer</name>
         </reference>
+        <reference name="ServerInfo">
+            <name>ServerInfo</name>
+        </reference>
     </gbean>
 
-    <gbean name="TomcatAJPConnector" class="org.apache.geronimo.tomcat.ConnectorGBean">
-        <attribute name="protocol">AJP</attribute>
+    <gbean name="TomcatAJPConnector" class="org.apache.geronimo.tomcat.connector.AJP13ConnectorGBean">
         <attribute name="name">AJP</attribute>
         <attribute name="host">${PlanServerHostname}</attribute>
         <attribute name="port">${PlanAJPPort}</attribute>
-        <attribute name="hostLookupEnabled">false</attribute>
+        <attribute name="minSpareThreads">25</attribute>
+        <attribute name="maxSpareThreads">75</attribute>
+        <attribute name="enableLookups">false</attribute>
         <attribute name="redirectPort">${PlanHTTPSPort}</attribute>
         <reference name="TomcatContainer">
             <name>TomcatWebContainer</name>
         </reference>
+        <reference name="ServerInfo">
+            <name>ServerInfo</name>
+        </reference>
     </gbean>
 
     <!-- SSL support
     NOTE: If keystoreFile is a relative path, it is relative to GERONIMO_HOME
     -->
-    <gbean name="TomcatWebSSLConnector" class="org.apache.geronimo.tomcat.HttpsConnectorGBean">
+    <gbean name="TomcatWebSSLConnector" class="org.apache.geronimo.tomcat.connector.Https11ConnectorGBean">
         <attribute name="name">HTTPS</attribute>
         <attribute name="host">${PlanServerHostname}</attribute>
         <attribute name="port">${PlanHTTPSPort}</attribute>
-        <attribute name="maxHttpHeaderSizeBytes">8192</attribute>
+        <attribute name="maxHttpHeaderSize">8192</attribute>
         <attribute name="maxThreads">150</attribute>
         <attribute name="minSpareThreads">25</attribute>
         <attribute name="maxSpareThreads">75</attribute>
-        <attribute name="hostLookupEnabled">false</attribute>
-        <attribute name="acceptQueueSize">100</attribute>
-        <attribute name="uploadTimeoutEnabled">false</attribute>
-        <attribute name="clientAuthRequired">false</attribute>
+        <attribute name="enableLookups">false</attribute>
+        <attribute name="acceptCount">100</attribute>
+        <attribute name="disableUploadTimeout">false</attribute>
+        <attribute name="clientAuth">false</attribute>
         <attribute name="algorithm">Default</attribute>
-        <attribute name="secureProtocol">TLS</attribute>
-        <attribute name="keystoreFileName">var/security/keystores/geronimo-default</attribute>
-        <attribute name="keystorePassword">secret</attribute>
+        <attribute name="sslProtocol">TLS</attribute>
+        <attribute name="keystoreFile">var/security/keystores/geronimo-default</attribute>
+        <attribute name="keystorePass">secret</attribute>
         <reference name="TomcatContainer">
             <name>TomcatWebContainer</name>
         </reference>

Modified: geronimo/server/branches/2.0/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/JMXDeploymentManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/JMXDeploymentManager.java?view=diff&rev=562021&r1=562020&r2=562021
==============================================================================
--- geronimo/server/branches/2.0/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/JMXDeploymentManager.java (original)
+++ geronimo/server/branches/2.0/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/JMXDeploymentManager.java Wed Aug  1 22:51:18 2007
@@ -174,7 +174,7 @@
                     }
                 }
             }
-            CommandSupport.addWebURLs(kernel, result);
+            CommandSupport.addWebContextPaths(kernel, result);
             return result.size() == 0 ? null : result.toArray(new TargetModuleID[result.size()]);
         } catch (Exception e) {
             throw (TargetException) new TargetException(e.getMessage()).initCause(e);

Modified: geronimo/server/branches/2.0/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/local/CommandSupport.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/local/CommandSupport.java?view=diff&rev=562021&r1=562020&r2=562021
==============================================================================
--- geronimo/server/branches/2.0/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/local/CommandSupport.java (original)
+++ geronimo/server/branches/2.0/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/local/CommandSupport.java Wed Aug  1 22:51:18 2007
@@ -274,14 +274,14 @@
     }
 
     protected void addWebURLs(Kernel kernel) throws Exception{
-        addWebURLs(kernel, moduleIDs);
+        addWebContextPaths(kernel, moduleIDs);
     }
 
     /**
      * Given a list of TargetModuleIDs, figure out which ones represent web
      * modules and add a WebURL to each if possible.
      */
-    public static void addWebURLs(Kernel kernel, List moduleIDs) throws Exception{
+    public static void addWebContextPaths(Kernel kernel, List moduleIDs) throws Exception{
         Set webApps = null;
         for (int i = 0; i < moduleIDs.size(); i++) {
             TargetModuleIDImpl id = (TargetModuleIDImpl) moduleIDs.get(i);
@@ -292,12 +292,12 @@
                 for (Iterator it = webApps.iterator(); it.hasNext();) {
                     AbstractName name = (AbstractName) it.next();
                     if(name.getName().get("name").equals(id.getModuleID())) {
-                        id.setWebURL(kernel.getAttribute(name, "URLFor").toString());
+                        id.setWebURL(kernel.getAttribute(name, "contextPath").toString());
                     }
                 }
             }
             if(id.getChildTargetModuleID() != null) {
-                addWebURLs(kernel, Arrays.asList(id.getChildTargetModuleID()));
+                addWebContextPaths(kernel, Arrays.asList(id.getChildTargetModuleID()));
             }
         }
     }

Modified: geronimo/server/branches/2.0/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java?view=diff&rev=562021&r1=562020&r2=562021
==============================================================================
--- geronimo/server/branches/2.0/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java (original)
+++ geronimo/server/branches/2.0/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java Wed Aug  1 22:51:18 2007
@@ -67,14 +67,15 @@
     private final int REAPER_INTERVAL = 60 * 1000;
     private final Properties pendingDeletionIndex = new Properties();
     private DeployerReaper reaper;
+    private final String remoteDeployAddress;
     private final Collection builders;
     private final Collection stores;
     private final Collection watchers;
     private final ArtifactResolver artifactResolver;
     private final Kernel kernel;
 
-    public Deployer(Collection builders, Collection stores, Collection watchers, Kernel kernel) {
-        this(builders, stores, watchers, getArtifactResolver(kernel), kernel);
+    public Deployer(String remoteDeployAddress, Collection builders, Collection stores, Collection watchers, Kernel kernel) {
+        this(remoteDeployAddress, builders, stores, watchers, getArtifactResolver(kernel), kernel);
     }
 
     private static ArtifactResolver getArtifactResolver(Kernel kernel) {
@@ -82,7 +83,8 @@
         return configurationManager.getArtifactResolver();
     }
 
-    public Deployer(Collection builders, Collection stores, Collection watchers, ArtifactResolver artifactResolver, Kernel kernel) {
+    public Deployer(String remoteDeployAddress, Collection builders, Collection stores, Collection watchers, ArtifactResolver artifactResolver, Kernel kernel) {
+        this.remoteDeployAddress = remoteDeployAddress;
         this.builders = builders;
         this.stores = stores;
         this.watchers = watchers;
@@ -177,7 +179,7 @@
                 return null;
             }
             AbstractName module = (AbstractName) names.iterator().next();
-            return kernel.getAttribute(module, "URLFor") + "/upload";
+            return remoteDeployAddress + "/" + kernel.getAttribute(module, "contextPath") + "/upload";
         } catch (Exception e) {
             log.error("Unable to look up remote deploy upload URL", e);
             return null;
@@ -473,6 +475,7 @@
         GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(Deployer.class, DEPLOYER);
 
         infoFactory.addAttribute("kernel", Kernel.class, false);
+        infoFactory.addAttribute("remoteDeployAddress", String.class, true, true);
         infoFactory.addAttribute("remoteDeployUploadURL", String.class, false);
         infoFactory.addOperation("deploy", new Class[]{boolean.class, File.class, File.class});
         infoFactory.addOperation("deploy", new Class[]{boolean.class, File.class, File.class, String.class});
@@ -482,7 +485,7 @@
         infoFactory.addReference("Store", ConfigurationStore.class, "ConfigurationStore");
         infoFactory.addReference("Watchers", DeploymentWatcher.class);
 
-        infoFactory.setConstructor(new String[]{"Builders", "Store", "Watchers", "kernel"});
+        infoFactory.setConstructor(new String[]{"remoteDeployAddress", "Builders", "Store", "Watchers", "kernel"});
 
         GBEAN_INFO = infoFactory.getBeanInfo();
     }

Modified: geronimo/server/branches/2.0/modules/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyManagerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyManagerImpl.java?view=diff&rev=562021&r1=562020&r2=562021
==============================================================================
--- geronimo/server/branches/2.0/modules/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyManagerImpl.java (original)
+++ geronimo/server/branches/2.0/modules/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyManagerImpl.java Wed Aug  1 22:51:18 2007
@@ -17,9 +17,13 @@
 package org.apache.geronimo.jetty6;
 
 import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
+import java.util.Map.Entry;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -31,8 +35,11 @@
 import org.apache.geronimo.gbean.ReferencePatterns;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.jetty6.connector.AJP13Connector;
-import org.apache.geronimo.jetty6.connector.HTTPSocketConnector;
+import org.apache.geronimo.jetty6.connector.HTTPBlockingConnector;
+import org.apache.geronimo.jetty6.connector.HTTPSSelectChannelConnector;
 import org.apache.geronimo.jetty6.connector.HTTPSSocketConnector;
+import org.apache.geronimo.jetty6.connector.HTTPSelectChannelConnector;
+import org.apache.geronimo.jetty6.connector.HTTPSocketConnector;
 import org.apache.geronimo.jetty6.connector.JettyConnector;
 import org.apache.geronimo.jetty6.requestlog.JettyLogManager;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
@@ -56,6 +63,125 @@
  */
 public class JettyManagerImpl implements WebManager {
     private final static Log log = LogFactory.getLog(JettyManagerImpl.class);
+
+    private static final ConnectorType HTTP_NIO = new ConnectorType("Jetty NIO HTTP Connector");
+    private static final ConnectorType HTTPS_NIO = new ConnectorType("Jetty NIO HTTPS Connector");
+    private static final ConnectorType HTTP_BLOCKING_NIO = new ConnectorType("Jetty Blocking HTTP Connector using NIO");
+    private static final ConnectorType HTTP_BIO = new ConnectorType("Jetty BIO HTTP Connector");
+    private static final ConnectorType HTTPS_BIO = new ConnectorType("Jetty BIO HTTPS Connector");
+    private static final ConnectorType AJP_NIO = new ConnectorType("Jetty NIO AJP Connector");
+    private static List<ConnectorType> CONNECTOR_TYPES = Arrays.asList(
+            HTTP_NIO,
+            HTTPS_NIO,
+            HTTP_BLOCKING_NIO,
+            HTTP_BIO,
+            HTTPS_BIO,
+            AJP_NIO
+    );
+
+    private static Map<ConnectorType, List<ConnectorAttribute>> CONNECTOR_ATTRIBUTES = new HashMap<ConnectorType, List<ConnectorAttribute>>();
+
+    //"host", "port", "minThreads", "maxThreads", "bufferSizeBytes", "acceptQueueSize", "lingerMillis", "protocol", "redirectPort", "connectUrl", "maxIdleTimeMs"
+    static {
+        List<ConnectorAttribute> connectorAttributes = new ArrayList<ConnectorAttribute>();
+        connectorAttributes.add(new ConnectorAttribute<String>("host", "0.0.0.0", "The host name or IP to bind to. The normal values are 0.0.0.0 (all interfaces) or localhost (local connections only)", String.class, true));
+        connectorAttributes.add(new ConnectorAttribute<Integer>("port", 8080, "The network port to bind to.", Integer.class, true));
+        connectorAttributes.add(new ConnectorAttribute<Integer>("maxThreads", 10, "The maximum number of threads this connector should use to handle incoming requests", Integer.class));
+        connectorAttributes.add(new ConnectorAttribute<Integer>("bufferSizeBytes", 8096, "Buffer size", Integer.class));
+        connectorAttributes.add(new ConnectorAttribute<Integer>("acceptQueueSize", 10, "acceptQueueSize", Integer.class));
+        connectorAttributes.add(new ConnectorAttribute<Integer>("lingerMillis", 30000, "lingerMillis", Integer.class));
+        //connectorAttributes.add(new ConnectorAttribute<Boolean>("tcpNoDelay", false, "tcpNoDelay", Boolean.class));
+        connectorAttributes.add(new ConnectorAttribute<Integer>("redirectPort", 8443, "redirectPort", Integer.class));
+        //connectorAttributes.add(new ConnectorAttribute<Integer>("maxIdleTimeMs", 30000, "maxIdleTimeMs", Integer.class));
+        CONNECTOR_ATTRIBUTES.put(HTTP_NIO, connectorAttributes);
+
+        connectorAttributes = new ArrayList<ConnectorAttribute>();
+        connectorAttributes.add(new ConnectorAttribute<String>("host", "0.0.0.0", "The host name or IP to bind to. The normal values are 0.0.0.0 (all interfaces) or localhost (local connections only)", String.class, true));
+        connectorAttributes.add(new ConnectorAttribute<Integer>("port", 8443, "The network port to bind to.", Integer.class, true));
+        connectorAttributes.add(new ConnectorAttribute<Integer>("maxThreads", 10, "The maximum number of threads this connector should use to handle incoming requests", Integer.class));
+        connectorAttributes.add(new ConnectorAttribute<Integer>("bufferSizeBytes", 8096, "Buffer size", Integer.class));
+        connectorAttributes.add(new ConnectorAttribute<Integer>("acceptQueueSize", 10, "acceptQueueSize", Integer.class));
+        connectorAttributes.add(new ConnectorAttribute<Integer>("lingerMillis", 30000, "lingerMillis", Integer.class));
+        //connectorAttributes.add(new ConnectorAttribute<Boolean>("tcpNoDelay", false, "tcpNoDelay", Boolean.class));
+        connectorAttributes.add(new ConnectorAttribute<Integer>("redirectPort", 8443, "redirectPort", Integer.class));
+        //connectorAttributes.add(new ConnectorAttribute<Integer>("maxIdleTimeMs", 30000, "maxIdleTimeMs", Integer.class));
+        //connectorAttributes.add(new ConnectorAttribute<Boolean>("clientAuthRequested", false, "clientAuthRequested", Boolean.class));
+        connectorAttributes.add(new ConnectorAttribute<Boolean>("clientAuthRequired", false, "If set, then clients connecting through this connector must supply a valid client certificate.", Boolean.class));
+        connectorAttributes.add(new ConnectorAttribute<String>("keyStore", "", "The keystore to use for accessing the server's private key", String.class, true));
+        connectorAttributes.add(new ConnectorAttribute<String>("trustStore", "", "The keystore containing the trusted certificate entries, including Certification Authority (CA) certificates", String.class));
+        //connectorAttributes.add(new ConnectorAttribute<String>("keyAlias", "", "keyAlias", String.class, true));
+        connectorAttributes.add(new ConnectorAttribute<String>("secureProtocol", "", "This should normally be set to TLS, though some (IBM) JVMs don't work properly with popular browsers unless it is changed to SSL.", String.class));
+        connectorAttributes.add(new ConnectorAttribute<String>("algorithm", "Default", "This should normally be set to match the JVM vendor.", String.class));
+        CONNECTOR_ATTRIBUTES.put(HTTPS_NIO, connectorAttributes);
+
+        connectorAttributes = new ArrayList<ConnectorAttribute>();
+        connectorAttributes.add(new ConnectorAttribute<String>("host", "0.0.0.0", "The host name or IP to bind to. The normal values are 0.0.0.0 (all interfaces) or localhost (local connections only)", String.class, true));
+        connectorAttributes.add(new ConnectorAttribute<Integer>("port", 8080, "The network port to bind to.", Integer.class, true));
+        connectorAttributes.add(new ConnectorAttribute<Integer>("maxThreads", 10, "The maximum number of threads this connector should use to handle incoming requests", Integer.class));
+        connectorAttributes.add(new ConnectorAttribute<Integer>("bufferSizeBytes", 8096, "Buffer size", Integer.class));
+        connectorAttributes.add(new ConnectorAttribute<Integer>("acceptQueueSize", 10, "acceptQueueSize", Integer.class));
+        connectorAttributes.add(new ConnectorAttribute<Integer>("lingerMillis", 30000, "lingerMillis", Integer.class));
+        //connectorAttributes.add(new ConnectorAttribute<Boolean>("tcpNoDelay", false, "tcpNoDelay", Boolean.class));
+        connectorAttributes.add(new ConnectorAttribute<Integer>("redirectPort", 8443, "redirectPort", Integer.class));
+        //connectorAttributes.add(new ConnectorAttribute<Integer>("maxIdleTimeMs", 30000, "maxIdleTimeMs", Integer.class));
+        CONNECTOR_ATTRIBUTES.put(HTTP_BIO, connectorAttributes);
+
+        connectorAttributes = new ArrayList<ConnectorAttribute>();
+        connectorAttributes.add(new ConnectorAttribute<String>("host", "0.0.0.0", "The host name or IP to bind to. The normal values are 0.0.0.0 (all interfaces) or localhost (local connections only)", String.class, true));
+        connectorAttributes.add(new ConnectorAttribute<Integer>("port", 8443, "The network port to bind to.", Integer.class, true));
+        connectorAttributes.add(new ConnectorAttribute<Integer>("maxThreads", 10, "The maximum number of threads this connector should use to handle incoming requests", Integer.class));
+        connectorAttributes.add(new ConnectorAttribute<Integer>("bufferSizeBytes", 8096, "Buffer size", Integer.class));
+        connectorAttributes.add(new ConnectorAttribute<Integer>("acceptQueueSize", 10, "acceptQueueSize", Integer.class));
+        connectorAttributes.add(new ConnectorAttribute<Integer>("lingerMillis", 30000, "lingerMillis", Integer.class));
+        //connectorAttributes.add(new ConnectorAttribute<Boolean>("tcpNoDelay", false, "tcpNoDelay", Boolean.class));
+        connectorAttributes.add(new ConnectorAttribute<Integer>("redirectPort", 8443, "redirectPort", Integer.class));
+        //connectorAttributes.add(new ConnectorAttribute<Integer>("maxIdleTimeMs", 30000, "maxIdleTimeMs", Integer.class));
+        //connectorAttributes.add(new ConnectorAttribute<Boolean>("clientAuthRequested", false, "clientAuthRequested", Boolean.class));
+        connectorAttributes.add(new ConnectorAttribute<Boolean>("clientAuthRequired", false, "If set, then clients connecting through this connector must supply a valid client certificate.", Boolean.class));
+        connectorAttributes.add(new ConnectorAttribute<String>("keyStore", "", "The keystore to use for accessing the server's private key", String.class, true));
+        connectorAttributes.add(new ConnectorAttribute<String>("trustStore", "", "The keystore containing the trusted certificate entries, including Certification Authority (CA) certificates", String.class));
+        //connectorAttributes.add(new ConnectorAttribute<String>("keyAlias", "", "keyAlias", String.class, true));
+        connectorAttributes.add(new ConnectorAttribute<String>("secureProtocol", "", "This should normally be set to TLS, though some (IBM) JVMs don't work properly with popular browsers unless it is changed to SSL.", String.class));
+        connectorAttributes.add(new ConnectorAttribute<String>("algorithm", "Default", "This should normally be set to match the JVM vendor.", String.class));
+        CONNECTOR_ATTRIBUTES.put(HTTPS_BIO, connectorAttributes);
+
+        connectorAttributes = new ArrayList<ConnectorAttribute>();
+        connectorAttributes.add(new ConnectorAttribute<String>("host", "0.0.0.0", "The host name or IP to bind to. The normal values are 0.0.0.0 (all interfaces) or localhost (local connections only)", String.class, true));
+        connectorAttributes.add(new ConnectorAttribute<Integer>("port", 8080, "The network port to bind to.", Integer.class, true));
+        connectorAttributes.add(new ConnectorAttribute<Integer>("maxThreads", 10, "The maximum number of threads this connector should use to handle incoming requests", Integer.class));
+        connectorAttributes.add(new ConnectorAttribute<Integer>("bufferSizeBytes", 8096, "Buffer size", Integer.class));
+        connectorAttributes.add(new ConnectorAttribute<Integer>("acceptQueueSize", 10, "acceptQueueSize", Integer.class));
+        connectorAttributes.add(new ConnectorAttribute<Integer>("lingerMillis", 30000, "lingerMillis", Integer.class));
+        //connectorAttributes.add(new ConnectorAttribute<Boolean>("tcpNoDelay", false, "tcpNoDelay", Boolean.class));
+        connectorAttributes.add(new ConnectorAttribute<Integer>("redirectPort", 8443, "redirectPort", Integer.class));
+        //connectorAttributes.add(new ConnectorAttribute<Integer>("maxIdleTimeMs", 30000, "maxIdleTimeMs", Integer.class));
+        CONNECTOR_ATTRIBUTES.put(HTTP_BLOCKING_NIO, connectorAttributes);
+
+        connectorAttributes = new ArrayList<ConnectorAttribute>();
+        connectorAttributes.add(new ConnectorAttribute<String>("host", "0.0.0.0", "The host name or IP to bind to. The normal values are 0.0.0.0 (all interfaces) or localhost (local connections only)", String.class, true));
+        connectorAttributes.add(new ConnectorAttribute<Integer>("port", 8009, "The network port to bind to.", Integer.class, true));
+        connectorAttributes.add(new ConnectorAttribute<Integer>("maxThreads", 10, "The maximum number of threads this connector should use to handle incoming requests", Integer.class));
+        connectorAttributes.add(new ConnectorAttribute<Integer>("bufferSizeBytes", 8096, "Buffer size", Integer.class));
+        connectorAttributes.add(new ConnectorAttribute<Integer>("acceptQueueSize", 10, "acceptQueueSize", Integer.class));
+        connectorAttributes.add(new ConnectorAttribute<Integer>("lingerMillis", 30000, "lingerMillis", Integer.class));
+        //connectorAttributes.add(new ConnectorAttribute<Boolean>("tcpNoDelay", false, "tcpNoDelay", Boolean.class));
+        connectorAttributes.add(new ConnectorAttribute<Integer>("redirectPort", 8443, "redirectPort", Integer.class));
+        //connectorAttributes.add(new ConnectorAttribute<Integer>("maxIdleTimeMs", 30000, "maxIdleTimeMs", Integer.class));
+        CONNECTOR_ATTRIBUTES.put(AJP_NIO, connectorAttributes);
+
+    }
+
+    private static Map<ConnectorType, GBeanInfo> CONNECTOR_GBEAN_INFOS = new HashMap<ConnectorType, GBeanInfo>();
+
+    static {
+        CONNECTOR_GBEAN_INFOS.put(HTTP_NIO, HTTPSelectChannelConnector.GBEAN_INFO);
+        CONNECTOR_GBEAN_INFOS.put(HTTPS_NIO, HTTPSSelectChannelConnector.GBEAN_INFO);
+        CONNECTOR_GBEAN_INFOS.put(HTTP_BLOCKING_NIO, HTTPBlockingConnector.GBEAN_INFO);
+        CONNECTOR_GBEAN_INFOS.put(HTTP_BIO, HTTPSocketConnector.GBEAN_INFO);
+        CONNECTOR_GBEAN_INFOS.put(HTTPS_BIO, HTTPSSocketConnector.GBEAN_INFO);
+        CONNECTOR_GBEAN_INFOS.put(AJP_NIO, AJP13Connector.GBEAN_INFO);
+    }
+
     private final Kernel kernel;
 
     public JettyManagerImpl(Kernel kernel) {
@@ -84,8 +210,7 @@
             //todo: default HTTPS settings
         } else if (protocol.equals(PROTOCOL_AJP)) {
             connector = new GBeanData(name, AJP13Connector.GBEAN_INFO);
-        }
-    	else {
+        } else {
             throw new IllegalArgumentException("Invalid protocol '" + protocol + "'");
         }
         connector.setAttribute("host", host);
@@ -95,7 +220,7 @@
         connector.setAttribute("maxThreads", new Integer(50));
         connector.setReferencePattern(JettyConnector.CONNECTOR_CONTAINER_REFERENCE, containerName);
         EditableConfigurationManager mgr = ConfigurationUtil.getEditableConfigurationManager(kernel);
-        if(mgr != null) {
+        if (mgr != null) {
             try {
                 mgr.addGBeanToConfiguration(containerName.getArtifact(), connector, false);
                 return (WebConnector) kernel.getProxyManager().createProxy(name, JettyWebConnector.class.getClassLoader());
@@ -119,7 +244,7 @@
         AbstractNameQuery query = new AbstractNameQuery(JettyContainer.class.getName());
         Set names = kernel.listGBeans(query);
         JettyContainer[] results = new JettyContainer[names.size()];
-        int i=0;
+        int i = 0;
         for (Iterator it = names.iterator(); it.hasNext(); i++) {
             AbstractName name = (AbstractName) it.next();
             results[i] = (JettyContainer) proxyManager.createProxy(name, JettyContainer.class.getClassLoader());
@@ -139,6 +264,7 @@
      * Removes a connector.  This shuts it down if necessary, and removes it
      * from the server environment.  It must be a connector that this container
      * is responsible for.
+     *
      * @param connectorName
      */
     public void removeConnector(AbstractName connectorName) {
@@ -156,7 +282,7 @@
                 throw new GBeanNotFoundException(connectorName);
             }
             EditableConfigurationManager mgr = ConfigurationUtil.getEditableConfigurationManager(kernel);
-            if(mgr != null) {
+            if (mgr != null) {
                 try {
                     mgr.removeGBeanFromConfiguration(connectorName.getArtifact(), connectorName);
                 } catch (InvalidConfigException e) {
@@ -181,7 +307,7 @@
      * @param protocol A protocol as returned by getSupportedProtocols
      */
     public NetworkConnector[] getConnectors(String protocol) {
-        if(protocol == null) {
+        if (protocol == null) {
             return getConnectors();
         }
         List result = new ArrayList();
@@ -204,12 +330,87 @@
     public WebAccessLog getAccessLog(WebContainer container) {
         AbstractNameQuery query = new AbstractNameQuery(JettyLogManager.class.getName());
         Set names = kernel.listGBeans(query);
-        if(names.size() == 0) {
+        if (names.size() == 0) {
             return null;
-        } else if(names.size() > 1) {
+        } else if (names.size() > 1) {
             throw new IllegalStateException("Should not be more than one Jetty access log manager");
         }
-        return (WebAccessLog) kernel.getProxyManager().createProxy((AbstractName)names.iterator().next(), JettyLogManager.class.getClassLoader());
+        return (WebAccessLog) kernel.getProxyManager().createProxy((AbstractName) names.iterator().next(), JettyLogManager.class.getClassLoader());
+    }
+
+    public List<ConnectorType> getConnectorTypes() {
+        return CONNECTOR_TYPES;
+    }
+
+    public List<ConnectorAttribute> getConnectorAttributes(ConnectorType connectorType) {
+        return ConnectorAttribute.copy(CONNECTOR_ATTRIBUTES.get(connectorType));
+    }
+
+    public AbstractName getConnectorConfiguration(ConnectorType connectorType, List<ConnectorAttribute> connectorAttributes, WebContainer container, String uniqueName) {
+        GBeanInfo gbeanInfo = CONNECTOR_GBEAN_INFOS.get(connectorType);
+        AbstractName containerName = kernel.getAbstractNameFor(container);
+        AbstractName name = kernel.getNaming().createSiblingName(containerName, uniqueName, NameFactory.GERONIMO_SERVICE);
+        GBeanData gbeanData = new GBeanData(name, gbeanInfo);
+        gbeanData.setReferencePattern(JettyConnector.CONNECTOR_CONTAINER_REFERENCE, containerName);
+        for (ConnectorAttribute connectorAttribute : connectorAttributes) {
+            Object value = connectorAttribute.getValue();
+            if (value != null) {
+                gbeanData.setAttribute(connectorAttribute.getAttributeName(), connectorAttribute.getValue());
+            }
+        }
+        
+        // provide a reference to KeystoreManager gbean for HTTPS connectors
+        if (connectorType.equals(HTTPS_NIO) || connectorType.equals(HTTPS_BIO)) {
+            AbstractNameQuery query = new AbstractNameQuery(KeystoreManager.class.getName());
+            gbeanData.setReferencePattern("KeystoreManager", query);
+        }
+        
+        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;
+        }
+        return name;
+    }
+    
+    public ConnectorType getConnectorType(AbstractName connectorName) {
+        ConnectorType connectorType = null; 
+        try {
+            GBeanInfo info = kernel.getGBeanInfo(connectorName);
+            boolean found = false;
+            Set intfs = info.getInterfaces();
+            for (Iterator it = intfs.iterator(); it.hasNext() && !found;) {
+                String intf = (String) it.next();
+                if (intf.equals(JettyWebConnector.class.getName())) {
+                    found = true;
+                }
+            }
+            if (!found) {
+                throw new GBeanNotFoundException(connectorName);
+            }
+            String searchingFor = info.getName();
+            for (Entry<ConnectorType, GBeanInfo> entry : CONNECTOR_GBEAN_INFOS.entrySet() ) {
+                String candidate = entry.getValue().getName();
+                if (candidate.equals(searchingFor)) {
+                    return entry.getKey();
+                }
+            }
+        } catch (GBeanNotFoundException e) {
+            log.warn("No such GBean '" + connectorName + "'");
+        } catch (Exception e) {
+            log.error(e);
+        }
+            
+        return connectorType;
     }
 
     /**
@@ -220,7 +421,7 @@
         AbstractNameQuery query = new AbstractNameQuery(JettyWebConnector.class.getName());
         Set names = kernel.listGBeans(query);
         JettyWebConnector[] results = new JettyWebConnector[names.size()];
-        int i=0;
+        int i = 0;
         for (Iterator it = names.iterator(); it.hasNext(); i++) {
             AbstractName name = (AbstractName) it.next();
             results[i] = (JettyWebConnector) proxyManager.createProxy(name, JettyWebConnector.class.getClassLoader());
@@ -229,7 +430,7 @@
     }
 
     public NetworkConnector[] getConnectorsForContainer(Object container, String protocol) {
-        if(protocol == null) {
+        if (protocol == null) {
             return getConnectorsForContainer(container);
         }
         AbstractName containerName = kernel.getAbstractNameFor(container);
@@ -242,21 +443,21 @@
                 AbstractName name = (AbstractName) it.next(); // a single Jetty connector
                 GBeanData data = kernel.getGBeanData(name);
                 ReferencePatterns refs = data.getReferencePatterns(JettyConnector.CONNECTOR_CONTAINER_REFERENCE);
-                if(containerName.equals(refs.getAbstractName())) {
+                if (containerName.equals(refs.getAbstractName())) {
                     try {
                         String testProtocol = (String) kernel.getAttribute(name, "protocol");
-                        if(testProtocol != null && testProtocol.equals(protocol)) {
+                        if (testProtocol != null && testProtocol.equals(protocol)) {
                             results.add(mgr.createProxy(name, JettyWebConnector.class.getClassLoader()));
                         }
                     } catch (Exception e) {
-                        log.error("Unable to look up protocol for connector '"+name+"'",e);
+                        log.error("Unable to look up protocol for connector '" + name + "'", e);
                     }
                     break;
                 }
             }
             return (JettyWebConnector[]) results.toArray(new JettyWebConnector[results.size()]);
         } catch (Exception e) {
-            throw (IllegalArgumentException)new IllegalArgumentException("Unable to look up connectors for Jetty container '"+containerName +"': ").initCause(e);
+            throw (IllegalArgumentException) new IllegalArgumentException("Unable to look up connectors for Jetty container '" + containerName + "': ").initCause(e);
         }
     }
 
@@ -277,7 +478,7 @@
             }
             return (JettyWebConnector[]) results.toArray(new JettyWebConnector[results.size()]);
         } catch (Exception e) {
-            throw (IllegalArgumentException) new IllegalArgumentException("Unable to look up connectors for Jetty container '"+containerName+"'").initCause(e);
+            throw (IllegalArgumentException) new IllegalArgumentException("Unable to look up connectors for Jetty container '" + containerName + "'").initCause(e);
         }
     }
 
@@ -287,7 +488,7 @@
         GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Jetty Web Manager", JettyManagerImpl.class);
         infoFactory.addAttribute("kernel", Kernel.class, false);
         infoFactory.addInterface(WebManager.class);
-        infoFactory.setConstructor(new String[] {"kernel"});
+        infoFactory.setConstructor(new String[]{"kernel"});
         GBEAN_INFO = infoFactory.getBeanInfo();
     }
 

Modified: geronimo/server/branches/2.0/modules/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyWebAppContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyWebAppContext.java?view=diff&rev=562021&r1=562020&r2=562021
==============================================================================
--- geronimo/server/branches/2.0/modules/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyWebAppContext.java (original)
+++ geronimo/server/branches/2.0/modules/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyWebAppContext.java Wed Aug  1 22:51:18 2007
@@ -282,35 +282,6 @@
         return jettyContainer;
     }
 
-    public URL getURLFor() {
-        WebConnector[] connectors = (WebConnector[]) jettyContainer.getConnectors();
-        Map<String, String> map = new HashMap<String, String>();
-        for (WebConnector connector : connectors) {
-            map.put(connector.getProtocol(), connector.getConnectUrl());
-        }
-        String urlPrefix;
-        if ((urlPrefix = map.get("HTTP")) == null) {
-            if ((urlPrefix = map.get("HTTPS")) == null) {
-                urlPrefix = map.get("AJP");
-            }
-        }
-        if (urlPrefix == null) {
-            return null;
-        }
-        StringBuffer buf = new StringBuffer(urlPrefix);
-        String contextPath = getContextPath();
-        if (!contextPath.startsWith("/")) {
-            buf.append("/");
-        }
-        buf.append(contextPath);
-        try {
-            return new URL(buf.toString());
-        } catch (MalformedURLException e) {
-            log.error("Bad URL to connect to web app", e);
-            return null;
-        }
-    }
-
     public void setContextPath(String path) {
         if (path == null || !path.startsWith("/")) {
             throw new IllegalArgumentException("context path must be non-null and start with '/', not " + path);

Modified: geronimo/server/branches/2.0/modules/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/connector/HTTPSSelectChannelConnector.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/connector/HTTPSSelectChannelConnector.java?view=diff&rev=562021&r1=562020&r2=562021
==============================================================================
--- geronimo/server/branches/2.0/modules/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/connector/HTTPSSelectChannelConnector.java (original)
+++ geronimo/server/branches/2.0/modules/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/connector/HTTPSSelectChannelConnector.java Wed Aug  1 22:51:18 2007
@@ -30,7 +30,7 @@
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.system.threads.ThreadPool;
-import org.mortbay.jetty.bio.SocketConnector;
+import org.mortbay.jetty.nio.SelectChannelConnector;
 
 /**
  * Implementation of a HTTPS connector based on Jetty's SslConnector (which uses pure JSSE).
@@ -123,7 +123,7 @@
 
     //TODO does this make sense???
     public void setRedirectPort(int port) {
-        SocketConnector socketListener = (SocketConnector) listener;
+        SelectChannelConnector socketListener = (SelectChannelConnector) listener;
         socketListener.setConfidentialPort(port);
         socketListener.setIntegralPort(port);
         socketListener.setIntegralScheme("https");

Modified: geronimo/server/branches/2.0/modules/geronimo-management/src/main/java/org/apache/geronimo/management/geronimo/WebManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-management/src/main/java/org/apache/geronimo/management/geronimo/WebManager.java?view=diff&rev=562021&r1=562020&r2=562021
==============================================================================
--- geronimo/server/branches/2.0/modules/geronimo-management/src/main/java/org/apache/geronimo/management/geronimo/WebManager.java (original)
+++ geronimo/server/branches/2.0/modules/geronimo-management/src/main/java/org/apache/geronimo/management/geronimo/WebManager.java Wed Aug  1 22:51:18 2007
@@ -16,7 +16,12 @@
  */
 package org.apache.geronimo.management.geronimo;
 
-import java.util.Map;
+import java.util.List;
+import java.util.ArrayList;
+import java.beans.PropertyEditor;
+
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.common.propertyeditor.PropertyEditors;
 
 /**
  * Specialization of NetworkManager for web containers.
@@ -41,6 +46,7 @@
      * @param port         The port that the connector should listen on
      *
      * @return The ObjectName of the new connector.
+     * @deprecated
      */
     public WebConnector addConnector(WebContainer container, String uniqueName, String protocol, String host, int port);
 
@@ -52,4 +58,133 @@
      *
      */
     public WebAccessLog getAccessLog(WebContainer container);
+
+    List<ConnectorType> getConnectorTypes();
+
+    List<ConnectorAttribute> getConnectorAttributes(ConnectorType connectorType);
+
+    AbstractName getConnectorConfiguration(ConnectorType connectorType, List<ConnectorAttribute> connectorAttributes, WebContainer container, String uniqueName);
+
+    ConnectorType getConnectorType(AbstractName connectorName);
+
+    public class ConnectorType {
+        private final String description;
+
+
+        public ConnectorType(String description) {
+            this.description = description;
+        }
+
+
+        public String getDescription() {
+            return description;
+        }
+
+
+        @Override
+        public int hashCode() {
+            final int PRIME = 31;
+            int result = 1;
+            result = PRIME * result + ((description == null) ? 0 : description.hashCode());
+            return result;
+        }
+
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj)
+                return true;
+            if (obj == null)
+                return false;
+            if (getClass() != obj.getClass())
+                return false;
+            final ConnectorType other = (ConnectorType) obj;
+            if (description == null) {
+                if (other.description != null)
+                    return false;
+            } else if (!description.equals(other.description))
+                return false;
+            return true;
+        }
+    }
+
+    public class ConnectorAttribute<T> {
+        private final String attributeName;
+        private String stringValue;
+        private final Class<T> clazz;
+        private T value;
+        private final String description;
+        private boolean required;
+
+        public ConnectorAttribute(String attributeName, T value, String description, Class<T> clazz, boolean required) {
+            this.attributeName = attributeName;
+            this.value = value;
+            this.description = description;
+            this.clazz = clazz;
+            this.required = required;
+        }
+        
+        public ConnectorAttribute(String attributeName, T value, String description, Class<T> clazz) {
+            this(attributeName, value, description, clazz, false);
+        }
+
+        public ConnectorAttribute(ConnectorAttribute<T> connectorAttribute) {
+            this.attributeName = connectorAttribute.attributeName;
+            this.value = connectorAttribute.value;
+            this.description = connectorAttribute.description;
+            this.clazz = connectorAttribute.clazz;
+            this.required = connectorAttribute.required;
+        }
+
+        public String getAttributeName() {
+            return attributeName;
+        }
+
+        public String getStringValue() {
+//            Class<T> clazz = getClass().getTypeParameters();
+            if (value == null) return null;
+            PropertyEditor propertyEditor = PropertyEditors.getEditor(clazz);
+            propertyEditor.setValue(value);
+            return propertyEditor.getAsText();
+        }
+
+        public void setStringValue(String stringValue) {
+            PropertyEditor propertyEditor = PropertyEditors.getEditor(clazz);
+            propertyEditor.setAsText(stringValue);
+            this.value = (T) propertyEditor.getValue();
+        }
+
+        public T getValue() {
+            return value;
+        }
+
+        public void setValue(T value) {
+            this.value = value;
+        }
+
+        public String getDescription() {
+            return description;
+        }
+
+        public static List<ConnectorAttribute> copy(List<ConnectorAttribute> source) {
+            List<ConnectorAttribute> copy = new ArrayList<ConnectorAttribute>(source.size());
+            for (ConnectorAttribute connectorAttribute: source) {
+                copy.add(new ConnectorAttribute(connectorAttribute));
+            }
+            return copy;
+        }
+
+        public Class<T> getAttributeClass() {
+            return clazz;
+        }
+        
+        public boolean isRequired() {
+            return required;
+        }
+
+        public void setRequired(boolean required) {
+            this.required = required;
+        }
+
+    }
 }

Modified: geronimo/server/branches/2.0/modules/geronimo-management/src/main/java/org/apache/geronimo/management/geronimo/WebModule.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-management/src/main/java/org/apache/geronimo/management/geronimo/WebModule.java?view=diff&rev=562021&r1=562020&r2=562021
==============================================================================
--- geronimo/server/branches/2.0/modules/geronimo-management/src/main/java/org/apache/geronimo/management/geronimo/WebModule.java (original)
+++ geronimo/server/branches/2.0/modules/geronimo-management/src/main/java/org/apache/geronimo/management/geronimo/WebModule.java Wed Aug  1 22:51:18 2007
@@ -36,13 +36,6 @@
     public WebContainer getContainer();
 
     /**
-     * Gets a URL that can be used to access this web application.  Prefers
-     * HTTP if available, then HTTPS, then AJP, depending on what the hosting
-     * web container makes available.
-     */
-    public URL getURLFor();
-
-    /**
      * Gets a name for this WAR file that can be used to identify the WAR to a
      * user.  This is not guaranteed to be anything in particular.
      */

Modified: geronimo/server/branches/2.0/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/StartupMonitorUtil.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/StartupMonitorUtil.java?view=diff&rev=562021&r1=562020&r2=562021
==============================================================================
--- geronimo/server/branches/2.0/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/StartupMonitorUtil.java (original)
+++ geronimo/server/branches/2.0/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/StartupMonitorUtil.java Wed Aug  1 22:51:18 2007
@@ -57,7 +57,7 @@
                     apps.add("    " + decodeModule(name.getNameProperty("j2eeType")) + ": " + name.getNameProperty("name"));
                 }
                 if (isWebModule(name)) {
-                    webs.add(kernel.getAttribute(name, "URLFor").toString());
+                    webs.add(kernel.getAttribute(name, "contextPath").toString());
                 }
 
                 int stateValue = kernel.getGBeanState(name);

Modified: geronimo/server/branches/2.0/modules/geronimo-tomcat6-builder/src/test/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-tomcat6-builder/src/test/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java?view=diff&rev=562021&r1=562020&r2=562021
==============================================================================
--- geronimo/server/branches/2.0/modules/geronimo-tomcat6-builder/src/test/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java (original)
+++ geronimo/server/branches/2.0/modules/geronimo-tomcat6-builder/src/test/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java Wed Aug  1 22:51:18 2007
@@ -71,18 +71,18 @@
 import org.apache.geronimo.kernel.repository.ImportType;
 import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.security.SecurityServiceImpl;
-import org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal;
 import org.apache.geronimo.security.credentialstore.DirectConfigurationCredentialStoreImpl;
 import org.apache.geronimo.security.deployment.GeronimoSecurityBuilderImpl;
 import org.apache.geronimo.security.jacc.ApplicationPolicyConfigurationManager;
 import org.apache.geronimo.security.jacc.ComponentPermissions;
+import org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal;
 import org.apache.geronimo.system.serverinfo.BasicServerInfo;
 import org.apache.geronimo.testsupport.TestSupport;
-import org.apache.geronimo.tomcat.ConnectorGBean;
 import org.apache.geronimo.tomcat.EngineGBean;
 import org.apache.geronimo.tomcat.HostGBean;
 import org.apache.geronimo.tomcat.RealmGBean;
 import org.apache.geronimo.tomcat.TomcatContainer;
+import org.apache.geronimo.tomcat.connector.Http11ConnectorGBean;
 import org.apache.geronimo.transaction.manager.GeronimoTransactionManagerGBean;
 
 /**
@@ -301,10 +301,11 @@
         containerData.setReferencePattern("ServerInfo", serverInfo.getAbstractName());
         AbstractName containerName = containerData.getAbstractName();
 
-        GBeanData connector = bootstrap.addGBean("TomcatConnector", ConnectorGBean.GBEAN_INFO);
+        GBeanData connector = bootstrap.addGBean("TomcatConnector", Http11ConnectorGBean.GBEAN_INFO);
         connector.setAttribute("name", "HTTP");
         connector.setAttribute("port", new Integer(8181));
         connector.setReferencePattern("TomcatContainer", containerName);
+        connector.setReferencePattern("ServerInfo", serverInfo.getAbstractName());
 
         GBeanData tm = bootstrap.addGBean("TransactionManager", GeronimoTransactionManagerGBean.GBEAN_INFO);
         tmName = tm.getAbstractName();



Mime
View raw message