manveen     02/04/02 16:27:31

  Modified:    webapps/admin connector.jsp
               webapps/admin/WEB-INF struts-config.xml
               webapps/admin/WEB-INF/classes/org/apache/webapp/admin
                        ApplicationResources_en.properties
                        ApplicationResources_es.properties Lists.java
                        TomcatTreeBuilder.java
               webapps/admin/WEB-INF/classes/org/apache/webapp/admin/connector
                        ConnectorForm.java
  Added:       webapps/admin/WEB-INF/classes/org/apache/webapp/admin/connector
                        EditConnectorAction.java
               webapps/admin/connector connector.jsp
  Log:
  Refactoring Connectors.
  Added support for Coyote, AJP13 connectors.
  
  Revision  Changes    Path
  1.5       +23 -13    jakarta-tomcat-4.0/webapps/admin/connector.jsp
  
  Index: connector.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/connector.jsp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- connector.jsp     9 Mar 2002 00:10:56 -0000       1.4
  +++ connector.jsp     3 Apr 2002 00:27:30 -0000       1.5
  @@ -1,5 +1,6 @@
   <!-- Standard Struts Entries -->
  -<%@ page language="java" %>
  +
  +<%@ page language="java" import="java.net.URLEncoder" %>
   <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
   <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
   <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
  @@ -7,7 +8,7 @@
   
   <html:html locale="true">
   
  -<%@ include file="header.jsp" %>
  +<%@ include file="../users/header.jsp" %>
   
   <!-- Body -->
   <body bgcolor="white">
  @@ -16,11 +17,18 @@
   
   <html:errors/>
   
  -<html:form method="POST" action="/connector">
  +<html:form method="POST" action="/SaveConnector">
  +
  +  <bean:define id="thisObjectName" type="java.lang.String"
  +               name="connectorForm" property="objectName"/>
  +  <html:hidden property="connectorName"/>
  +  <html:hidden property="adminAction"/>
  +  <html:hidden property="objectName"/>
  +  <html:hidden property="connectorType"/>
  +
     <table width="100%" border="0" cellspacing="0" cellpadding="0">
       <tr bgcolor="7171A5">
         <td width="81%"> 
  -       <html:hidden property="connectorName"/>
          <div class="page-title-text" align="left">
            <bean:write name="connectorForm" property="nodeLabel" scope="session"/>
          </div>
  @@ -38,7 +46,7 @@
         </td>
       </tr>
     </table>
  -    <%@ include file="buttons.jsp" %>
  +    <%@ include file="../buttons.jsp" %>
     <br>
   
     <table class="back-table" border="0" cellspacing="0" cellpadding="1" width="100%">
  @@ -105,13 +113,13 @@
   
           <controls:row labelStyle="table-label-text" dataStyle="table-normal-text">
               <controls:label><bean:message 
key="connector.address.ip"/>:</controls:label>
  -            <controls:data>
  +            <controls:data> 
   <%-- FIXME - input only allowed on create transaction --%>
   <%--
                  <html:text property="address" size="20"/>    
   --%>
  -               <bean:write name="connectorForm" property="address"/>
  -               <html:hidden property="address"/>
  +               &nbsp;<bean:write name="connectorForm" property="address"/>
  +               <html:hidden property="address"/> 
               </controls:data>
           </controls:row>
    
  @@ -158,9 +166,11 @@
               </controls:data>
           </controls:row>
   
  -<%-- FIXME - The proxyName and proxyPort properties not supported   --%>
  -<%--         on all connectors, so comment this section out for now --%>
  -<%--
  +<%-- The following properties are supported only on Coyote Connector --%>
  +     <logic:equal name="connectorForm" property="connectorType" scope="session" 
  +                  value="CoyoteConnector">
  +     <br>
  +
           <controls:row header="true" labelStyle="table-header-text" 
dataStyle="table-header-text">
               <controls:label>Proxy</controls:label>
               <controls:data>&nbsp;</controls:data>
  @@ -179,13 +189,13 @@
                   <html:text property="proxyPortText" size="5"/> 
               </controls:data>
           </controls:row>
  ---%>
  +    </logic:equal>
         </controls:table>
     
         </td>
       </tr>
     </table>
  -    <%@ include file="buttons.jsp" %>
  +    <%@ include file="../buttons.jsp" %>
     <br>
     </html:form>
   <p>&nbsp;</p>
  
  
  
  1.41      +50 -24    jakarta-tomcat-4.0/webapps/admin/WEB-INF/struts-config.xml
  
  Index: struts-config.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/struts-config.xml,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- struts-config.xml 24 Mar 2002 04:13:23 -0000      1.40
  +++ struts-config.xml 3 Apr 2002 00:27:30 -0000       1.41
  @@ -18,10 +18,6 @@
       <!-- Server form bean -->
       <form-bean      name="serverForm"
                       type="org.apache.webapp.admin.ServerForm"/>
  -
  -    <!-- Connector form bean -->
  -    <form-bean      name="connectorForm"
  -                    type="org.apache.webapp.admin.connector.ConnectorForm"/>
                       
       <!-- Set Locale form bean -->
       <form-bean      name="setLocaleForm"
  @@ -76,6 +72,14 @@
       <form-bean      name="contextsForm"
                       type="org.apache.webapp.admin.context.ContextsForm"/>
   
  +    <!-- ============= Connector Module ============= -->
  +
  +    <form-bean      name="connectorForm"
  +                    type="org.apache.webapp.admin.connector.ConnectorForm"/>
  +                    
  +    <form-bean      name="connectorsForm"
  +                    type="org.apache.webapp.admin.host.ConnectorsForm"/>
  +
       <!-- ========== User Database Module ========== -->
   
       <form-bean      name="databaseForm"
  @@ -128,10 +132,6 @@
       <forward        name="Server"
                       path="/server.jsp"
                   redirect="false"/>
  -
  -    <forward        name="Connector"
  -                    path="/connector.jsp"
  -                redirect="false"/>
                      
       <forward        name="Save Successful"
                       path="/saved.jsp"
  @@ -185,6 +185,16 @@
                       path="/context/contexts.jsp"
                   redirect="false"/>
   
  +    <!-- ============ Connector Module ============== -->
  +
  +    <forward        name="Connector"
  +                    path="/connector/connector.jsp"
  +                redirect="false"/>
  +
  +    <forward        name="Connectors"
  +                    path="/connector/connectors.jsp"
  +                redirect="false"/>
  +
       <!-- ============ Realm Module ============== -->
   
       <forward        name="JDBCRealm"
  @@ -300,13 +310,6 @@
                  scope="session">
       </action>
   
  -   <!-- Set up Connector datastructure -->
  -    <action    path="/setUpConnector"
  -               type="org.apache.webapp.admin.connector.SetUpConnectorAction"
  -               name="connectorForm"
  -               scope="session">
  -    </action>
  -    
       <!-- Log out of the application -->
       <action    path="/logOut"
                  type="org.apache.webapp.admin.LogOutAction">
  @@ -322,14 +325,6 @@
                 scope="session"
                 input="/server.jsp">
       </action>
  -
  -    <!-- Process a connector change -->
  -    <action    path="/connector"
  -               type="org.apache.webapp.admin.connector.ConnectorAction"
  -               name="connectorForm"
  -              scope="session"
  -              input="/connector.jsp">
  -    </action>
       
       <!-- Process a set-locale action -->
       <action    path="/setLocale"
  @@ -511,11 +506,42 @@
                  type="org.apache.webapp.admin.context.EditContextAction">
       </action>
   
  -    <!-- Perform Save Host transaction -->
  +    <!-- Perform Save Context transaction -->
       <action    path="/SaveContext"
                  type="org.apache.webapp.admin.context.SaveContextAction"
                  name="contextForm"
                 input="/context/context.jsp"
  +               scope="session"/>
  +
  +   <!-- ============= Connector Module ============== -->
  +
  +    <!-- Set up Add Connector transaction -->
  +    <action    path="/AddConnector"
  +               type="org.apache.webapp.admin.connector.AddConnectorAction">
  +    </action>
  +
  +    <!-- Set up Delete Connectors transaction -->
  +    <action    path="/DeleteConnector"
  +               type="org.apache.webapp.admin.connector.DeleteConnectorAction"
  +               name="connectorsForm"
  +               scope="request"/>
  +
  +    <!-- Perform Delete Connectors transaction -->
  +    <action    path="/DeleteConnectors"
  +               type="org.apache.webapp.admin.connector.DeleteConnectorsAction"
  +               name="connectorsForm"
  +               scope="request"/>
  +
  +    <!-- Set up Edit Connector transaction -->
  +    <action    path="/EditConnector"
  +               type="org.apache.webapp.admin.connector.EditConnectorAction">
  +    </action>
  +
  +    <!-- Perform Save Connector transaction -->
  +    <action    path="/SaveConnector"
  +               type="org.apache.webapp.admin.connector.SaveConnectorAction"
  +               name="connectorForm"
  +              input="/connector/connector.jsp"
                  scope="session"/>
                  
       <!-- ========== User Database Module ========== -->
  
  
  
  1.38      +1 -0      
jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_en.properties
  
  Index: ApplicationResources_en.properties
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_en.properties,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- ApplicationResources_en.properties        23 Mar 2002 22:17:02 -0000      1.37
  +++ ApplicationResources_en.properties        3 Apr 2002 00:27:30 -0000       1.38
  @@ -185,6 +185,7 @@
   error.contextName.bad=Invalid context name {0}
   error.loaderName.bad=Invalid loader name {0}
   error.managerName.bad=Invalid manager name {0}
  +error.connectorName.bad=Invalid connector name {0}
   realm.driver=Database Driver
   realm.passwd=Database Password
   realm.url=Database URL
  
  
  
  1.33      +1 -0      
jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_es.properties
  
  Index: ApplicationResources_es.properties
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_es.properties,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- ApplicationResources_es.properties        23 Mar 2002 22:17:02 -0000      1.32
  +++ ApplicationResources_es.properties        3 Apr 2002 00:27:30 -0000       1.33
  @@ -185,6 +185,7 @@
   error.contextName.bad=Invalido context nombre {0}
   error.loaderName.bad=Invalido loader nombre {0}
   error.managerName.bad=Invalido manager nombre {0}
  +error.connectorName.bad=Invalido connector nombre {0}
   realm.driver=Database Driver
   realm.passwd=Database Password
   realm.url=Database URL
  
  
  
  1.6       +5 -6      
jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/Lists.java
  
  Index: Lists.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/Lists.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Lists.java        22 Mar 2002 21:45:07 -0000      1.5
  +++ Lists.java        3 Apr 2002 00:27:30 -0000       1.6
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/Lists.java,v
 1.5 2002/03/22 21:45:07 manveen Exp $
  - * $Revision: 1.5 $
  - * $Date: 2002/03/22 21:45:07 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/Lists.java,v
 1.6 2002/04/03 00:27:30 manveen Exp $
  + * $Revision: 1.6 $
  + * $Date: 2002/04/03 00:27:30 $
    *
    * ====================================================================
    *
  @@ -77,7 +77,7 @@
    * is returned.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.5 $ $Date: 2002/03/22 21:45:07 $
  + * @version $Revision: 1.6 $ $Date: 2002/04/03 00:27:30 $
    */
   
   public class Lists {
  @@ -438,8 +438,7 @@
           return (getRealms(mbserver, new ObjectName(container)));
   
       }
  -
  -
  +    
       /**
        * Return a list of <code>Server</code> object name strings.
        *
  
  
  
  1.24      +9 -10     
jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/TomcatTreeBuilder.java
  
  Index: TomcatTreeBuilder.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/TomcatTreeBuilder.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- TomcatTreeBuilder.java    23 Mar 2002 22:17:02 -0000      1.23
  +++ TomcatTreeBuilder.java    3 Apr 2002 00:27:30 -0000       1.24
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/TomcatTreeBuilder.java,v
 1.23 2002/03/23 22:17:02 manveen Exp $
  - * $Revision: 1.23 $
  - * $Date: 2002/03/23 22:17:02 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/TomcatTreeBuilder.java,v
 1.24 2002/04/03 00:27:30 manveen Exp $
  + * $Revision: 1.24 $
  + * $Date: 2002/04/03 00:27:30 $
    *
    * ====================================================================
    *
  @@ -93,7 +93,7 @@
    *
    * @author Jazmin Jonson
    * @author Manveen Kaur
  - * @version $Revision: 1.23 $ $Date: 2002/03/23 22:17:02 $
  + * @version $Revision: 1.24 $ $Date: 2002/04/03 00:27:30 $
    */
   
   
  @@ -113,7 +113,8 @@
       public final static String MANAGER_TYPE = "Catalina:type=Manager";
       public final static String LOGGER_TYPE = "Catalina:type=Logger";
       public final static String REALM_TYPE = "Catalina:type=Realm";
  -    
  +    public final static String VALVE_TYPE = "Catalina:type=Valve";
  +
       public final static String WILDCARD = ",*";
       
       private static MBeanServer mBServer = null;
  @@ -236,7 +237,7 @@
                   new TreeControlNode(connectorName,
                                       "folder_16_pad.gif",
                                       nodeLabel,
  -                                    "setUpConnector.do?select=" +
  +                                    "EditConnector.do?select=" +
                                       URLEncoder.encode(connectorName) +
                                       "&nodeLabel=" +
                                       URLEncoder.encode(nodeLabel),
  @@ -281,8 +282,7 @@
               getRealms(hostNode, hostName);
           }
   
  -    }
  -    
  +    }    
   
       /**
        * Append nodes for all defined contexts for the specified host.
  @@ -383,6 +383,5 @@
               containerNode.addChild(realmNode);
           }
   
  -    }
  -    
  +    }    
   }
  
  
  
  1.3       +87 -16    
jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/connector/ConnectorForm.java
  
  Index: ConnectorForm.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/connector/ConnectorForm.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ConnectorForm.java        9 Mar 2002 00:10:56 -0000       1.2
  +++ ConnectorForm.java        3 Apr 2002 00:27:30 -0000       1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/connector/ConnectorForm.java,v
 1.2 2002/03/09 00:10:56 craigmcc Exp $
  - * $Revision: 1.2 $
  - * $Date: 2002/03/09 00:10:56 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/connector/ConnectorForm.java,v
 1.3 2002/04/03 00:27:30 manveen Exp $
  + * $Revision: 1.3 $
  + * $Date: 2002/04/03 00:27:30 $
    *
    * ====================================================================
    *
  @@ -68,23 +68,39 @@
   import org.apache.struts.action.ActionForm;
   import org.apache.struts.action.ActionMapping;
   import java.net.InetAddress;
  -import java.util.ArrayList;
  +import java.util.List;
   
   /**
    * Form bean for the connector page.
    *
    * @author Manveen Kaur
  - * @version $Revision: 1.2 $ $Date: 2002/03/09 00:10:56 $
  + * @version $Revision: 1.3 $ $Date: 2002/04/03 00:27:30 $
    */
   
   public final class ConnectorForm extends ActionForm {
       
       // ----------------------------------------------------- Instance Variables
       
  +     /**
  +     * The administrative action represented by this form.
  +     */
  +    private String adminAction = "Edit";
  +
  +    /**
  +     * The object name of the Connector this bean refers to.
  +     */
  +    private String objectName = null;
  +    
       /**
        * The text for the scheme.
        */
       private String scheme = null;
  +
  +    /**
  +     * The text for the connector type. 
  +     * Specifies if it is a CoyoteConnector or AJP13Connector etc.
  +     */
  +    private String connectorType = null;    
       
        /**
        * The text for the node label.
  @@ -163,16 +179,54 @@
       /**
        * Set of valid values for debug level.
        */
  -    private ArrayList debugLvlVals = null;
  +    private List debugLvlVals = null;
       
       /*
        * Represent boolean (true, false) values for enableLookups etc.
        */
       
  -    private ArrayList booleanVals = null;
  +    private List booleanVals = null;
       
       // ------------------------------------------------------------- Properties
       
  +   /**
  +     * Return the administrative action represented by this form.
  +     */
  +    public String getAdminAction() {
  +
  +        return this.adminAction;
  +
  +    }
  +
  +
  +    /**
  +     * Set the administrative action represented by this form.
  +     */
  +    public void setAdminAction(String adminAction) {
  +
  +        this.adminAction = adminAction;
  +
  +    }
  +
  +    /**
  +     * Return the object name of the Connector this bean refers to.
  +     */
  +    public String getObjectName() {
  +
  +        return this.objectName;
  +
  +    }
  +
  +
  +    /**
  +     * Set the object name of the Connector this bean refers to.
  +     */
  +    public void setObjectName(String objectName) {
  +
  +        this.objectName = objectName;
  +
  +    }
  +    
       /**
        * Return the Scheme.
        */
  @@ -192,6 +246,24 @@
       }
       
       /**
  +     * Return the Connector type.
  +     */
  +    public String getConnectorType() {
  +        
  +        return this.connectorType;
  +        
  +    }
  +    
  +    /**
  +     * Set the Connector type.
  +     */
  +    public void setConnectorType(String connectorType) {
  +        
  +        this.connectorType = connectorType;
  +        
  +    }
  +    
  +    /**
        * Return the label of the node that was clicked.
        */
       public String getNodeLabel() {
  @@ -247,10 +319,7 @@
           this.connTimeOutText = connTimeOutText;
           
       }
  -    
  -    
  -    
  -    
  +       
       /**
        * Return the bufferSizeText.
        */
  @@ -331,7 +400,7 @@
       /**
        * Return the debugVals.
        */
  -    public ArrayList getDebugLvlVals() {
  +    public List getDebugLvlVals() {
           
           return this.debugLvlVals;
           
  @@ -340,7 +409,7 @@
       /**
        * Set the debugVals.
        */
  -    public void setDebugLvlVals(ArrayList debugLvlVals) {
  +    public void setDebugLvlVals(List debugLvlVals) {
           
           this.debugLvlVals = debugLvlVals;
           
  @@ -389,7 +458,7 @@
       /**
        * Return the booleanVals.
        */
  -    public ArrayList getBooleanVals() {
  +    public List getBooleanVals() {
           
           return this.booleanVals;
           
  @@ -398,7 +467,7 @@
       /**
        * Set the debugVals.
        */
  -    public void setBooleanVals(ArrayList booleanVals) {
  +    public void setBooleanVals(List booleanVals) {
           
           this.booleanVals = booleanVals;
           
  @@ -504,7 +573,9 @@
        * @param request The servlet request we are processing
        */
       public void reset(ActionMapping mapping, HttpServletRequest request) {
  -        
  +    
  +        this.objectName = null;
  +        this.connectorType = null;
           this.portText = null;
           this.acceptCountText = null;
           this.connTimeOutText = null;
  
  
  
  1.1                  
jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/connector/EditConnectorAction.java
  
  Index: EditConnectorAction.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/connector/EditConnectorAction.java,v
 1.1 2002/04/03 00:27:30 manveen Exp $
   * $Revision: 1.1 $
   * $Date: 2002/04/03 00:27:30 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001-2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.webapp.admin.connector;
  
  import java.io.IOException;
  import java.util.Iterator;
  import java.util.List;
  import java.util.Locale;
  import java.util.ArrayList;
  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  import javax.servlet.http.HttpSession;
  import org.apache.struts.action.Action;
  import org.apache.struts.action.ActionErrors;
  import org.apache.struts.action.ActionForm;
  import org.apache.struts.action.ActionForward;
  import org.apache.struts.action.ActionMapping;
  import org.apache.struts.util.MessageResources;
  
  import javax.management.MBeanServer;
  import javax.management.ObjectInstance;
  import javax.management.ObjectName;
  import javax.management.JMException;
  
  import org.apache.webapp.admin.ApplicationServlet;
  import org.apache.webapp.admin.LabelValueBean;
  import org.apache.webapp.admin.Lists;
  import org.apache.webapp.admin.TomcatTreeBuilder;
  
  /**
   * The <code>Action</code> that sets up <em>Edit Connector</em> transactions.
   *
   * @author Manveen Kaur
   * @version $Revision: 1.1 $ $Date: 2002/04/03 00:27:30 $
   */
  
  public class EditConnectorAction extends Action {
      
  
      /**
       * The MBeanServer we will be interacting with.
       */
      private MBeanServer mBServer = null;
      
  
      /**
       * The MessageResources we will be retrieving messages from.
       */
      private MessageResources resources = null;
      
  
      // --------------------------------------------------------- Public Methods
      
      /**
       * Process the specified HTTP request, and create the corresponding HTTP
       * response (or forward to another web component that will create it).
       * Return an <code>ActionForward</code> instance describing where and how
       * control should be forwarded, or <code>null</code> if the response has
       * already been completed.
       *
       * @param mapping The ActionMapping used to select this instance
       * @param actionForm The optional ActionForm bean for this request (if any)
       * @param request The HTTP request we are processing
       * @param response The HTTP response we are creating
       *
       * @exception IOException if an input/output error occurs
       * @exception ServletException if a servlet exception occurs
       */
      public ActionForward perform(ActionMapping mapping,
                                   ActionForm form,
                                   HttpServletRequest request,
                                   HttpServletResponse response)
          throws IOException, ServletException {
          
          // Acquire the resources that we need
          HttpSession session = request.getSession();
          Locale locale = (Locale) session.getAttribute(Action.LOCALE_KEY);
          if (resources == null) {
              resources = getServlet().getResources();
          }
          
          // Acquire a reference to the MBeanServer containing our MBeans
          try {
              mBServer = ((ApplicationServlet) getServlet()).getServer();
          } catch (Throwable t) {
              throw new ServletException
              ("Cannot acquire MBeanServer reference", t);
          }
          
          // Set up the object names of the MBeans we are manipulating
          ObjectName cname = null;
          StringBuffer sb = null;
          try {
              cname = new ObjectName(request.getParameter("select"));
          } catch (Exception e) {
              String message =
                  resources.getMessage("error.connectorName.bad",
                                       request.getParameter("select"));
              getServlet().log(message);
              response.sendError(HttpServletResponse.SC_BAD_REQUEST, message);
              return (null);
          }
  
          // Fill in the form values for display and editing
          ConnectorForm connectorFm = new ConnectorForm();
          session.setAttribute("connectorForm", connectorFm);
          connectorFm.setAdminAction("Edit");
          connectorFm.setObjectName(cname.toString());
          sb = new StringBuffer("Connector (");
          sb.append(cname.getKeyProperty("port"));
          sb.append(")");
          connectorFm.setNodeLabel(sb.toString());
          connectorFm.setDebugLvlVals(Lists.getDebugLevels());               
          connectorFm.setBooleanVals(Lists.getBooleanValues());        
  
          
          String attribute = null;
          try {
  
              // Copy scalar properties
              // General properties
              attribute = "className";
              String className = 
                  (String) mBServer.getAttribute(cname, attribute);
              int period = className.lastIndexOf('.');
              String connectorType = className.substring(period + 1);
              connectorFm.setConnectorType(connectorType);            
              
              attribute = "scheme";
              connectorFm.setScheme
                  (connectorType + " (" + 
                  (String) mBServer.getAttribute(cname, attribute) + 
                  ")");
              attribute = "acceptCount";
              connectorFm.setAcceptCountText
                  (((Integer) mBServer.getAttribute(cname, attribute)).toString());    
        
              attribute = "connectionTimeout";
              connectorFm.setConnTimeOutText
                  (((Integer) mBServer.getAttribute(cname, attribute)).toString());    
        
              attribute = "debug";
              connectorFm.setDebugLvl
                  (((Integer) mBServer.getAttribute(cname, attribute)).toString());    
        
              attribute = "bufferSize";
              connectorFm.setBufferSizeText
                  (((Integer) mBServer.getAttribute(cname, attribute)).toString());    
        
              attribute = "enableLookups";
              connectorFm.setEnableLookups
                  (((Boolean) mBServer.getAttribute(cname, attribute)).toString());    
        
              attribute = "address";
              connectorFm.setAddress
                  ((String) mBServer.getAttribute(cname, attribute));
            
              // Ports
              attribute = "port";
              connectorFm.setPortText
                  (((Integer) mBServer.getAttribute(cname, attribute)).toString());    
        
              attribute = "redirectPort";
              connectorFm.setRedirectPortText
                  (((Integer) mBServer.getAttribute(cname, attribute)).toString());    
        
              
              // Processors
              attribute = "minProcessors";
              connectorFm.setMinProcessorsText
                  (((Integer) mBServer.getAttribute(cname, attribute)).toString());    
        
              attribute = "maxProcessors";
              connectorFm.setMaxProcessorsText
                  (((Integer) mBServer.getAttribute(cname, attribute)).toString());    
        
              
              // Supported only by Coyote Connector.            
              if ("CoyoteConnector".equalsIgnoreCase(connectorType)) {
                  // Initialize rest of variables.            
                  attribute = "proxyName";
                  connectorFm.setProxyName
                      ((String) mBServer.getAttribute(cname, attribute));
                  attribute = "proxyPort";
                  connectorFm.setProxyPortText
                      (((Integer) mBServer.getAttribute(cname, 
attribute)).toString());            
              }
                          
          } catch (Throwable t) {
              getServlet().log
                  (resources.getMessage(locale, "users.error.attribute.get",
                                        attribute), t);
              response.sendError
                  (HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
                   resources.getMessage(locale, "users.error.attribute.get",
                                        attribute));
              return (null);
          }
          
          // Forward to the connector display page
          return (mapping.findForward("Connector"));
          
      }
  
  
  }
  
  
  
  1.1                  jakarta-tomcat-4.0/webapps/admin/connector/connector.jsp
  
  Index: connector.jsp
  ===================================================================
  <!-- Standard Struts Entries -->
  
  <%@ page language="java" import="java.net.URLEncoder" %>
  <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
  <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
  <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
  <%@ taglib uri="/WEB-INF/controls.tld" prefix="controls" %>
  
  <html:html locale="true">
  
  <%@ include file="../users/header.jsp" %>
  
  <!-- Body -->
  <body bgcolor="white">
  
  <!--Form -->
  
  <html:errors/>
  
  <html:form method="POST" action="/SaveConnector">
  
    <bean:define id="thisObjectName" type="java.lang.String"
                 name="connectorForm" property="objectName"/>
    <html:hidden property="connectorName"/>
    <html:hidden property="adminAction"/>
    <html:hidden property="objectName"/>
    <html:hidden property="connectorType"/>
  
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr bgcolor="7171A5">
        <td width="81%"> 
         <div class="page-title-text" align="left">
           <bean:write name="connectorForm" property="nodeLabel" scope="session"/>
         </div>
        </td>
        <td width="19%"> 
          <div align="right">
        <controls:actions>
              <controls:action selected="true"> ----<bean:message 
key="actions.available.actions"/>---- </controls:action>
              <controls:action> --------------------------------- </controls:action>
             <%--
              <controls:action url="">  <bean:message 
key="actions.thisconnector.delete"/> </controls:action>
              --%>
         </controls:actions>   
           </div>
        </td>
      </tr>
    </table>
      <%@ include file="../buttons.jsp" %>
    <br>
  
    <table class="back-table" border="0" cellspacing="0" cellpadding="1" width="100%">
      <tr> 
        <td> 
         <controls:table tableStyle="front-table" lineStyle="line-row">
              <controls:row header="true" 
                  labelStyle="table-header-text" dataStyle="table-header-text">
              <controls:label>General</controls:label>
              <controls:data>&nbsp;</controls:data>
          </controls:row>
  
          <controls:row labelStyle="table-label-text" dataStyle="table-normal-text">
              <controls:label><bean:message key="connector.type"/>:</controls:label>
              <controls:data>
                <bean:write name="connectorForm" property="scheme" 
                      scope="session"/>
              </controls:data>
          </controls:row>
  
          <controls:row labelStyle="table-label-text" dataStyle="table-normal-text">
              <controls:label><bean:message 
key="connector.accept.count"/>:</controls:label>
              <controls:data>
                <html:text property="acceptCountText" size="5" maxlength="5"/>
              </controls:data>
          </controls:row>
  
         <controls:row labelStyle="table-label-text" dataStyle="table-normal-text">
              <controls:label><bean:message key="connector.connection.timeout"/><br>
                  (milliseconds) :</controls:label>
              <controls:data>
                 <html:text property="connTimeOutText" size="10"/>
              </controls:data>
          </controls:row>
   
          <controls:row labelStyle="table-label-text" dataStyle="table-normal-text">
              <controls:label><bean:message key="server.debuglevel"/>:</controls:label>
              <controls:data>
                 <html:select property="debugLvl">
                       <bean:define id="debugLvlVals" name="connectorForm" 
property="debugLvlVals"/>
                       <html:options collection="debugLvlVals" property="value"
                          labelProperty="label"/>
                  </html:select>
              </controls:data>
          </controls:row>
   
          <controls:row labelStyle="table-label-text" dataStyle="table-normal-text">
              <controls:label><bean:message 
key="connector.default.buffer"/>:</controls:label>
              <controls:data>
                 <html:text property="bufferSizeText" size="5"/>   
              </controls:data>
          </controls:row>
   
          <controls:row labelStyle="table-label-text" dataStyle="table-normal-text">
              <controls:label><bean:message 
key="connector.enable.dns"/>:</controls:label>
              <controls:data>
                  <html:select property="enableLookups">
                       <bean:define id="booleanVals" name="connectorForm" 
property="booleanVals"/>
                       <html:options collection="booleanVals" property="value"
                     labelProperty="label"/>
                  </html:select>
              </controls:data>
          </controls:row>
  
          <controls:row labelStyle="table-label-text" dataStyle="table-normal-text">
              <controls:label><bean:message 
key="connector.address.ip"/>:</controls:label>
              <controls:data> 
  <%-- FIXME - input only allowed on create transaction --%>
  <%--
                 <html:text property="address" size="20"/>    
  --%>
                 &nbsp;<bean:write name="connectorForm" property="address"/>
                 <html:hidden property="address"/> 
              </controls:data>
          </controls:row>
   
          <controls:row header="true" labelStyle="table-header-text" 
dataStyle="table-header-text">
              <controls:label>Ports</controls:label>
              <controls:data>&nbsp;</controls:data>
          </controls:row>
      
          <controls:row labelStyle="table-label-text" dataStyle="table-normal-text">
              <controls:label><bean:message key="server.portnumber"/>:</controls:label>
              <controls:data>
  <%-- FIXME - input only allowed on create transaction --%>
  <%--
                 <html:text property="portText" size="5"/> 
  --%>
                 <bean:write name="connectorForm" property="portText"/>
                 <html:hidden property="portText"/>
              </controls:data>
          </controls:row>
  
          <controls:row labelStyle="table-label-text" dataStyle="table-normal-text">
              <controls:label><bean:message 
key="connector.redirect.portnumber"/>:</controls:label>
              <controls:data>
                 <html:text property="redirectPortText" size="5"/> 
              </controls:data>
          </controls:row>
  
          <controls:row header="true" labelStyle="table-header-text" 
dataStyle="table-header-text">
              <controls:label>Processors</controls:label>
              <controls:data>&nbsp;</controls:data>
          </controls:row>
      
          <controls:row labelStyle="table-label-text" dataStyle="table-normal-text">
              <controls:label><bean:message key="connector.min"/>:</controls:label>
              <controls:data>
                 <html:text property="minProcessorsText" size="5"/>  
              </controls:data>
          </controls:row>
  
          <controls:row labelStyle="table-label-text" dataStyle="table-normal-text">
              <controls:label><bean:message key="connector.max"/>:</controls:label>
              <controls:data>
                 <html:text property="maxProcessorsText" size="5"/>
              </controls:data>
          </controls:row>
  
  <%-- The following properties are supported only on Coyote Connector --%>
       <logic:equal name="connectorForm" property="connectorType" scope="session" 
                    value="CoyoteConnector">
       <br>
  
          <controls:row header="true" labelStyle="table-header-text" 
dataStyle="table-header-text">
              <controls:label>Proxy</controls:label>
              <controls:data>&nbsp;</controls:data>
          </controls:row>
      
          <controls:row labelStyle="table-label-text" dataStyle="table-normal-text">
              <controls:label><bean:message 
key="connector.proxy.name"/>:</controls:label>
              <controls:data>
                 <html:text property="proxyName" size="30"/> 
              </controls:data>
          </controls:row>
  
          <controls:row labelStyle="table-label-text" dataStyle="table-normal-text">
              <controls:label><bean:message 
key="connector.proxy.portnumber"/>:</controls:label>
              <controls:data>
                  <html:text property="proxyPortText" size="5"/> 
              </controls:data>
          </controls:row>
      </logic:equal>
        </controls:table>
    
        </td>
      </tr>
    </table>
      <%@ include file="../buttons.jsp" %>
    <br>
    </html:form>
  <p>&nbsp;</p>
  </body>
  </html:html>
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to