tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From patri...@apache.org
Subject cvs commit: jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin HostAction.java HostForm.java SetUpHostAction.java ApplicationResources_en.properties ApplicationResources_es.properties ConnectorForm.java LabelValueBean.java ServerForm.java ServiceForm.java SetUpConnectorAction.java SetUpServerAction.java SetUpServiceAction.java TomcatTreeBuilder.java
Date Thu, 10 Jan 2002 03:41:14 GMT
patrickl    02/01/09 19:41:14

  Modified:    webapps/admin connector.jsp server.jsp service.jsp
               webapps/admin/WEB-INF struts-config.xml
               webapps/admin/WEB-INF/classes/org/apache/webapp/admin
                        ApplicationResources_en.properties
                        ApplicationResources_es.properties
                        ConnectorForm.java LabelValueBean.java
                        ServerForm.java ServiceForm.java
                        SetUpConnectorAction.java SetUpServerAction.java
                        SetUpServiceAction.java TomcatTreeBuilder.java
  Added:       webapps/admin host.jsp
               webapps/admin/WEB-INF/classes/org/apache/webapp/admin
                        HostAction.java HostForm.java SetUpHostAction.java
  Log:
  * Made the main page title for each screen  the same as (i.e. in sync with) the label of the node that is selected.
  * Added Host editing and viewing functionality. The values are read/written to the corresponding mBean.
  Submitted by:	Manveen Kaur
  
  Revision  Changes    Path
  1.2       +3 -3      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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- connector.jsp	5 Jan 2002 20:45:03 -0000	1.1
  +++ connector.jsp	10 Jan 2002 03:41:13 -0000	1.2
  @@ -21,9 +21,9 @@
       <tr bgcolor="7171A5">
         <td width="81%"> 
          <html:hidden property="connectorName"/>
  -       <div class="page-title-text" align="left">Connector ( 
  -         <bean:write name="connectorForm" property="scheme" scope="session"/>
  -        ) </div>
  +       <div class="page-title-text" align="left">
  +         <bean:write name="connectorForm" property="nodeLabel" scope="session"/>
  +       </div>
         </td>
         <td width="19%"> 
           <div align="right">
  
  
  
  1.6       +3 -1      jakarta-tomcat-4.0/webapps/admin/server.jsp
  
  Index: server.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/server.jsp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- server.jsp	5 Jan 2002 21:09:15 -0000	1.5
  +++ server.jsp	10 Jan 2002 03:41:13 -0000	1.6
  @@ -21,7 +21,9 @@
     <table width="100%" border="0" cellspacing="0" cellpadding="0">
       <tr class="page-title-row">
         <td align="left" nowrap>
  -        <div class="page-title-text"><bean:message key="server.heading"/></div>
  +        <div class="page-title-text">
  +             <bean:write name="serverForm" property="nodeLabel" scope="session"/>
  +        </div>
         </td>
         <td align="right" nowrap> 
           <div class="page-title-text">
  
  
  
  1.4       +2 -4      jakarta-tomcat-4.0/webapps/admin/service.jsp
  
  Index: service.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/service.jsp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- service.jsp	3 Jan 2002 23:21:53 -0000	1.3
  +++ service.jsp	10 Jan 2002 03:41:13 -0000	1.4
  @@ -22,10 +22,8 @@
       <tr class="page-title-row">
         <td width="81%"> 
           <div class="page-title-text" align="left">
  -        <bean:message key="service.service"/> (
  -        <bean:write name="serviceForm" property="serviceName" 
  -                          scope="session"/>
  -         ) </div>
  +        <bean:write name="serviceForm" property="nodeLabel" scope="session"/>
  +        </div>
         </td>
         <td width="19%"> 
           <div align="right">
  
  
  
  1.1                  jakarta-tomcat-4.0/webapps/admin/host.jsp
  
  Index: host.jsp
  ===================================================================
  <!-- Standard Struts Entries -->
  
  <%@ page language="java" %>
  <%@ 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="header.jsp" %>
  
  <!-- Body -->
  <body bgcolor="white">
  
  <!--Form -->
  
  <html:errors/>
  
  <html:form method="POST" action="/host" focus="name">
  
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr class="page-title-row">
        <td align="left" nowrap>
          <div class="page-title-text">
              <html:hidden property="hostName"/>
              <bean:write name="hostForm" property="nodeLabel" scope="session"/>
          </div>
        </td>
        <td align="right" nowrap> 
         <div align="right">
          <controls:actions>
              <controls:action selected="true"> -----<bean:message key="actions.available.actions"/>----- </controls:action>
              <controls:action> ------------------------------------- </controls:action>
              <!-- will add the urls later once those screens get implemented -->
              <controls:action url="">  <bean:message key="actions.accesslogger.create"/> </controls:action>
              <controls:action url="">  <bean:message key="actions.accesslogger.delete"/> </controls:action>
              <controls:action> ------------------------------------- </controls:action>
              <controls:action url="">  <bean:message key="actions.alias.create"/> </controls:action>
              <controls:action url="">  <bean:message key="actions.alias.delete"/> </controls:action>
             <controls:action> ------------------------------------- </controls:action>
              <controls:action url="">  <bean:message key="actions.logger.create"/> </controls:action>
              <controls:action url="">  <bean:message key="actions.logger.delete"/> </controls:action>
              <controls:action> ------------------------------------- </controls:action>
              <controls:action url="">  <bean:message key="actions.requestfilter.create"/> </controls:action>
              <controls:action url="">  <bean:message key="actions.requestfilter.delete"/> </controls:action>
              <controls:action> ------------------------------------- </controls:action>
              <controls:action url="">  <bean:message key="actions.userrealm.create"/> </controls:action>
              <controls:action url="">  <bean:message key="actions.userrealm.delete"/> </controls:action>
              <controls:action> ------------------------------------- </controls:action>
              <controls:action url="">  <bean:message key="actions.valve.create"/> </controls:action>
              <controls:action url="">  <bean:message key="actions.valve.delete"/> </controls:action>
              <controls:action> ------------------------------------- </controls:action>
              <controls:action url="">  <bean:message key="actions.host.delete"/> </controls:action>
          </controls:actions>
            </div>
        </td>
      </tr>
    </table>
  
    <%@ include file="buttons.jsp" %>
  <br>
  
   <table border="0" cellspacing="0" cellpadding="0" width="100%">
      <tr> <td> 
          <div class="table-title-text"> 
              <bean:message key="host.properties"/> 
          </div>
      </td> </tr>
    </table>
  
    <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><bean:message key="service.property"/></controls:label>
              <controls:data><bean:message key="service.value"/></controls:data>
          </controls:row>
  
          <controls:row labelStyle="table-label-text" dataStyle="table-normal-text">
              <controls:label><bean:message key="host.name"/>:</controls:label>
              <controls:data>
                <html:text property="name" size="24" maxlength="24"/>
              </controls:data>
          </controls:row>
  
  
          <controls:row labelStyle="table-label-text" dataStyle="table-normal-text">
              <controls:label><bean:message key="host.base"/>:</controls:label>
              <controls:data>
                <html:text property="appBase" size="24" maxlength="24"/>
              </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="hostForm" 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="host.wars"/>:</controls:label>
              <controls:data>
                 <html:select property="unpackWARs">
                       <bean:define id="booleanVals" name="hostForm" property="booleanVals"/>
                       <html:options collection="booleanVals" property="value"
                     labelProperty="label"/>
                  </html:select>
              </controls:data>
          </controls:row>
        </controls:table>
  
        </td>
      </tr>
    </table>
  
  <br>
  <br>
  
   <!-- Aliases -->
   <table border="0" cellspacing="0" cellpadding="0" width="100%">
      <tr> <td> 
          <div class="table-title-text"> 
              <bean:message key="host.aliases"/> 
          </div>
      </td> </tr>
    </table>
  
   <table class="back-table" border="0" cellspacing="0" cellpadding="1" width="100%">
      <tr> <td>
          <table class="front-table" border="1" cellspacing="0" cellpadding="0" width="100%">
            <tr class="header-row"> 
              <td width="27%"> 
                <div class="table-header-text" align="left"><bean:message key="host.alias.name"/> </div>
              </td> </tr>
  
              <logic:iterate id="aliasVal" name="hostForm" property="aliasVals">
              <tr> <td width="27%" valign="top" colspan=2> 
                  <div class="table-normal-text"> <%= aliasVal %> </div>
              </td> </tr>
              </logic:iterate>
           </table>
  
      </td> </tr>
   </table>
    <!-- Alias table end -->
  
    <%@ include file="buttons.jsp" %>
  
  </html:form>
  
  <!-- Standard Footer -->
  
  <%@ include file="footer.jsp" %>
  
  </body>
  
  </html:html>
  
  
  
  1.14      +29 -3     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.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- struts-config.xml	5 Jan 2002 20:45:03 -0000	1.13
  +++ struts-config.xml	10 Jan 2002 03:41:13 -0000	1.14
  @@ -27,6 +27,10 @@
       <form-bean      name="connectorForm"
                       type="org.apache.webapp.admin.ConnectorForm"/>
   
  +    <!-- Host form bean -->
  +    <form-bean      name="hostForm"
  +                    type="org.apache.webapp.admin.HostForm"/>
  +
       <!-- Set Locale form bean -->
       <form-bean      name="setLocaleForm"
                       type="org.apache.webapp.admin.SetLocaleForm"/>
  @@ -65,7 +69,11 @@
       <forward        name="Connector"
                       path="/connector.jsp"
                   redirect="false"/>
  -                
  +        
  +    <forward        name="Host"
  +                    path="/host.jsp"
  +                redirect="false"/>
  +                        
       <forward        name="Save Successful"
                       path="/saved.jsp"
                   redirect="false"/>
  @@ -124,6 +132,16 @@
                     redirect="true"/>
       </action>
   
  +     <!-- Set up Host datastructure -->
  +    <action    path="/setUpHost"
  +               type="org.apache.webapp.admin.SetUpHostAction"
  +               name="hostForm"
  +               scope="session">
  +      <forward        name="SetUpHost"
  +                      path="/host.jsp"
  +                  redirect="true"/>
  +    </action>
  +    
       <!-- Log out of the application -->
       <action    path="/logOut"
                  type="org.apache.webapp.admin.LogOutAction">
  @@ -156,6 +174,14 @@
                 input="/connector.jsp">
       </action>
   
  +    <!-- Process a host change -->
  +    <action    path="/host"
  +               type="org.apache.webapp.admin.HostAction"
  +               name="hostForm"
  +              scope="session"
  +              input="/host.jsp">
  +    </action>
  +    
       <!-- Process a set-locale action -->
       <action    path="/setLocale"
                  type="org.apache.webapp.admin.SetLocaleAction"
  @@ -168,6 +194,6 @@
                  type="org.apache.webapp.admin.TreeControlTestAction"/>
   
     </action-mappings>
  -
  -
  +  
  +    
   </struts-config>
  
  
  
  1.12      +11 -2     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.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ApplicationResources_en.properties	5 Jan 2002 20:45:03 -0000	1.11
  +++ ApplicationResources_en.properties	10 Jan 2002 03:41:13 -0000	1.12
  @@ -22,7 +22,6 @@
   sample.someText.required=<li>"Some Text" cannot be empty</li>
   sample.moreText.required=<li>"More Text" cannot be empty</li>
   save.success=Save sucessful!
  -server.heading=Tomcat Server
   server.portnumber=Port Number
   server.debuglevel=Debug Level
   server.shutdown=Shutdown
  @@ -55,7 +54,8 @@
   error.proxyPortText.required=<li>Proxy Port Number cannot be empty</li>
   error.proxyPortText.format=<li>Proxy Port Number not a valid integer!</li>
   error.proxyPortText.range=<li>Proxy Port Number seems out of range. Valid range is 1-65535. </li>
  -service.service=Service
  +error.hostName.required=<li>Hostname is required</li>
  +error.appBase.required=<li>Application Base is required</li>
   service.name=Name
   service.engine.props=Engine properties
   service.defaulthostname=Default Hostname
  @@ -81,6 +81,9 @@
   actions.valve.delete=Delete Valves
   actions.service.delete=Delete This Service
   actions.thisconnector.delete=Delete This connector
  +actions.alias.create=Create New Aliases
  +actions.alias.delete=Delete Aliases
  +actions.host.delete=Delete This Host
   connector.type=Type
   connector.accept.count=Accept Count
   connector.connection.timeout=Connection Timeout
  @@ -92,3 +95,9 @@
   connector.max=Maximum
   connector.proxy.name=Proxy Name
   connector.proxy.portnumber=Proxy Port Number
  +host.properties=Host Properties
  +host.name=Name
  +host.base=Application Base
  +host.wars=Unpack WARs
  +host.aliases=Aliases
  +host.alias.name=Alias Name
  
  
  
  1.15      +11 -2     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.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- ApplicationResources_es.properties	9 Jan 2002 20:07:12 -0000	1.14
  +++ ApplicationResources_es.properties	10 Jan 2002 03:41:13 -0000	1.15
  @@ -22,7 +22,6 @@
   sample.someText.required=<li>\u00abAlg\u00fan Texto\u00bb no puede ser vac\u00edo</li>
   sample.moreText.required=<li>\u00abM\u00e1s Texto\u00bb no puede ser vac\u00edo</li>
   save.success=\u00a1Guardar fue \u00e9xitoso!
  -server.heading=Servidor de Tomcat
   server.portnumber=Numero de Puerto
   server.debuglevel=Nivel de Depuracion
   server.shutdown=Detener
  @@ -55,7 +54,8 @@
   error.proxyName.invalid=<li>El nombre del proxy es invalido</li>
   error.proxyPortText.format=<li>Numero del puerto del proxy es un numero entero no valido!</li>
   error.proxyPortText.range=<li>El numero del puerto del proxy esta fuera de rango. El rango valido es 1-65535.</li>
  -service.service=Servicio
  +error.hostName.required=<li>Se requiere el hostname</li>
  +error.appBase.required=<li>Se requiere la base de la aplicacion</li>
   service.name=Nombre
   service.engine.props=Propiedades del motor
   service.defaulthostname=Hostname por defecto
  @@ -81,6 +81,9 @@
   actions.valve.delete=Eliminar Valvulas
   actions.service.delete=Eliminar este servicio
   actions.thisconnector.delete=Eliminar este conector
  +actions.alias.create=Cree Los Nuevos Pseudonimos
  +actions.alias.delete=Pseudonimos De la Cancelacion
  +actions.host.delete=Suprima Este Ordenador principal
   connector.type=Tipo
   connector.accept.count=Valide La Cuenta
   connector.connection.timeout=Descanso De la Conexi\u00f3n
  @@ -92,3 +95,9 @@
   connector.max=Maximo
   connector.proxy.name=Nombre del Proxy
   connector.proxy.portnumber=Numero de Puerto del Proxy
  +host.properties=Caracteristicas Del Ordenador principal
  +host.name=Nombre
  +host.base=Base De la Aplicacion
  +host.wars=Desempaquete WARs
  +host.aliases=Pseudonimos
  +host.alias.name=Alias Nombre
  
  
  
  1.2       +28 -4     jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ConnectorForm.java
  
  Index: ConnectorForm.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ConnectorForm.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ConnectorForm.java	5 Jan 2002 20:45:03 -0000	1.1
  +++ ConnectorForm.java	10 Jan 2002 03:41:13 -0000	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ConnectorForm.java,v 1.1 2002/01/05 20:45:03 remm Exp $
  - * $Revision: 1.1 $
  - * $Date: 2002/01/05 20:45:03 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ConnectorForm.java,v 1.2 2002/01/10 03:41:13 patrickl Exp $
  + * $Revision: 1.2 $
  + * $Date: 2002/01/10 03:41:13 $
    *
    * ====================================================================
    *
  @@ -74,7 +74,7 @@
    * Form bean for the connector page.
    *
    * @author Manveen Kaur
  - * @version $Revision: 1.1 $ $Date: 2002/01/05 20:45:03 $
  + * @version $Revision: 1.2 $ $Date: 2002/01/10 03:41:13 $
    */
   
   public final class ConnectorForm extends ActionForm {
  @@ -86,6 +86,12 @@
        */
       private String scheme = null;
       
  +     /**
  +     * The text for the node label.
  +     */
  +    private String nodeLabel = null;
  +    
  +    
       /**
        * The text for the accept Count.
        */
  @@ -168,7 +174,7 @@
       // ------------------------------------------------------------- Properties
       
       /**
  -     * Return the Class Name.
  +     * Return the Scheme.
        */
       public String getScheme() {
           
  @@ -182,6 +188,24 @@
       public void setScheme(String scheme) {
           
           this.scheme = scheme;
  +        
  +    }
  +    
  +    /**
  +     * Return the label of the node that was clicked.
  +     */
  +    public String getNodeLabel() {
  +        
  +        return this.nodeLabel;
  +        
  +    }
  +    
  +    /**
  +     * Set the node label.
  +     */
  +    public void setNodeLabel(String nodeLabel) {
  +        
  +        this.nodeLabel = nodeLabel;
           
       }
       
  
  
  
  1.2       +4 -5      jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/LabelValueBean.java
  
  Index: LabelValueBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/LabelValueBean.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- LabelValueBean.java	6 Dec 2001 22:55:57 -0000	1.1
  +++ LabelValueBean.java	10 Jan 2002 03:41:13 -0000	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/LabelValueBean.java,v 1.1 2001/12/06 22:55:57 patrickl Exp $
  - * $Revision: 1.1 $
  - * $Date: 2001/12/06 22:55:57 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/LabelValueBean.java,v 1.2 2002/01/10 03:41:13 patrickl Exp $
  + * $Revision: 1.2 $
  + * $Date: 2002/01/10 03:41:13 $
    *
    * ====================================================================
    *
  @@ -62,13 +62,12 @@
   
   package org.apache.webapp.admin;
   
  -
   /**
    * Simple JavaBean to represent label-value pairs for use in collections
    * that are utilized by the <code>&lt;form:options&gt;</code> tag.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2001/12/06 22:55:57 $
  + * @version $Revision: 1.2 $ $Date: 2002/01/10 03:41:13 $
    */
   
   public class LabelValueBean {
  
  
  
  1.6       +28 -4     jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ServerForm.java
  
  Index: ServerForm.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ServerForm.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ServerForm.java	5 Jan 2002 20:45:03 -0000	1.5
  +++ ServerForm.java	10 Jan 2002 03:41:13 -0000	1.6
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ServerForm.java,v 1.5 2002/01/05 20:45:03 remm Exp $
  - * $Revision: 1.5 $
  - * $Date: 2002/01/05 20:45:03 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ServerForm.java,v 1.6 2002/01/10 03:41:13 patrickl Exp $
  + * $Revision: 1.6 $
  + * $Date: 2002/01/10 03:41:13 $
    *
    * ====================================================================
    *
  @@ -74,13 +74,21 @@
    * Form bean for the server form page.  
    * @author Patrick Luby
    * @author Manveen Kaur
  - * @version $Revision: 1.5 $ $Date: 2002/01/05 20:45:03 $
  + * @version $Revision: 1.6 $ $Date: 2002/01/10 03:41:13 $
    */
   
   public final class ServerForm extends ActionForm {
       
       // ----------------------------------------------------- Instance Variables
       
  +    /**
  +     * The text for the node label.
  +     */
  +    private String nodeLabel = null;
  +    
  +    /**
  +     * The text for the port number.
  +     */    
       private String portNumberText = "8080";
       
       /**
  @@ -97,7 +105,23 @@
       private ArrayList debugLvlVals = null;
       
       // ------------------------------------------------------------- Properties
  +    /**
  +     * Return the label of the node that was clicked.
  +     */
  +    public String getNodeLabel() {
  +        
  +        return this.nodeLabel;
  +        
  +    }
       
  +    /**
  +     * Set the node label.
  +     */
  +    public void setNodeLabel(String nodeLabel) {
  +        
  +        this.nodeLabel = nodeLabel;
  +        
  +    }    
       
       /**
        * Return the debugVals.
  
  
  
  1.3       +26 -6     jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ServiceForm.java
  
  Index: ServiceForm.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ServiceForm.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ServiceForm.java	20 Dec 2001 09:31:52 -0000	1.2
  +++ ServiceForm.java	10 Jan 2002 03:41:13 -0000	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ServiceForm.java,v 1.2 2001/12/20 09:31:52 remm Exp $
  - * $Revision: 1.2 $
  - * $Date: 2001/12/20 09:31:52 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ServiceForm.java,v 1.3 2002/01/10 03:41:13 patrickl Exp $
  + * $Revision: 1.3 $
  + * $Date: 2002/01/10 03:41:13 $
    *
    * ====================================================================
    *
  @@ -73,19 +73,22 @@
    * Form bean for the service page.
    *
    * @author Manveen Kaur
  - * @version $Revision: 1.2 $ $Date: 2001/12/20 09:31:52 $
  + * @version $Revision: 1.3 $ $Date: 2002/01/10 03:41:13 $
    */
   
   public final class ServiceForm extends ActionForm {
       
       // ----------------------------------------------------- Instance Variables
       
  -    
       /**
        * The text for the serviceName.
        */
  -    private String serviceName = null;
  +    private String serviceName = null;    
       
  +   /**
  +     * The text for the node label.
  +    */
  +    private String nodeLabel = null; 
       
       /**
        * The text for the engine Name.
  @@ -107,7 +110,24 @@
       private ArrayList hostNameVals = null;
       // ------------------------------------------------------------- Properties
       
  +       /**
  +     * Return the label of the node that was clicked.
  +     */
  +    public String getNodeLabel() {
  +        
  +        return this.nodeLabel;
  +        
  +    }
       
  +    /**
  +     * Set the node label.
  +     */
  +    public void setNodeLabel(String nodeLabel) {
  +        
  +        this.nodeLabel = nodeLabel;
  +        
  +    }
  +        
       /**
        * Return the debugVals.
        */
  
  
  
  1.2       +8 -5      jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/SetUpConnectorAction.java
  
  Index: SetUpConnectorAction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/SetUpConnectorAction.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SetUpConnectorAction.java	5 Jan 2002 20:45:03 -0000	1.1
  +++ SetUpConnectorAction.java	10 Jan 2002 03:41:13 -0000	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/SetUpConnectorAction.java,v 1.1 2002/01/05 20:45:03 remm Exp $
  - * $Revision: 1.1 $
  - * $Date: 2002/01/05 20:45:03 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/SetUpConnectorAction.java,v 1.2 2002/01/10 03:41:13 patrickl Exp $
  + * $Revision: 1.2 $
  + * $Date: 2002/01/10 03:41:13 $
    *
    * ====================================================================
    *
  @@ -99,7 +99,7 @@
    * a connector is chosen.
    *
    * @author Manveen Kaur
  - * @version $Revision: 1.1 $ $Date: 2002/01/05 20:45:03 $
  + * @version $Revision: 1.2 $ $Date: 2002/01/10 03:41:13 $
    */
   
   public class SetUpConnectorAction extends Action {
  @@ -165,6 +165,8 @@
           }
           
           String selectedName = request.getParameter("select");
  +        // label of the node that was clicked on.
  +        String nodeLabel = request.getParameter("nodeLabel");
           
           ConnectorForm connectorFm = (ConnectorForm) form;
           
  @@ -190,7 +192,7 @@
               booleanList.add(new LabelValueBean("False", "false"));
           }
           
  -        String connectorName = null;
  +        String connectorName = null;        
           String scheme = null;
           Integer debug = null;
           String acceptCountText = null;
  @@ -284,6 +286,7 @@
           
           //setting values obtained from the mBean to be displayed in the form.
           connectorFm.setScheme(scheme);
  +        connectorFm.setNodeLabel(nodeLabel);
           connectorFm.setAcceptCountText(acceptCountText);
           connectorFm.setConnTimeOutText(connTimeOut.toString());
           
  
  
  
  1.7       +54 -51    jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/SetUpServerAction.java
  
  Index: SetUpServerAction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/SetUpServerAction.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SetUpServerAction.java	20 Dec 2001 09:31:52 -0000	1.6
  +++ SetUpServerAction.java	10 Jan 2002 03:41:13 -0000	1.7
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/SetUpServerAction.java,v 1.6 2001/12/20 09:31:52 remm Exp $
  - * $Revision: 1.6 $
  - * $Date: 2001/12/20 09:31:52 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/SetUpServerAction.java,v 1.7 2002/01/10 03:41:13 patrickl Exp $
  + * $Revision: 1.7 $
  + * $Date: 2002/01/10 03:41:13 $
    *
    * ====================================================================
    *
  @@ -98,21 +98,21 @@
    *
    * @author Jazmin Jonson
    * @author Manveen Kaur
  - * @version $Revision: 1.6 $ $Date: 2001/12/20 09:31:52 $
  + * @version $Revision: 1.7 $ $Date: 2002/01/10 03:41:13 $
    */
   
   public class SetUpServerAction extends Action {
  -
  +    
       private static MBeanServer mBServer = null;
  -
  -    public final static String PORT_PROP_NAME = "port"; 
  +    
  +    public final static String PORT_PROP_NAME = "port";
       public final static String SHUTDOWN_PROP_NAME = "shutdown";
       public final static String DEBUG_PROP_NAME = "debug";
  -
  -    private ArrayList debugLvlList = null; 
  - 
  +    
  +    private ArrayList debugLvlList = null;
  +    
       // --------------------------------------------------------- Public Methods
  -
  +    
       /**
        * Process the specified HTTP request, and create the corresponding HTTP
        * response (or forward to another web component that will create it).
  @@ -129,30 +129,33 @@
        * @exception ServletException if a servlet exception occurs
        */
       public ActionForward perform(ActionMapping mapping,
  -                                 ActionForm form,
  -                                 HttpServletRequest request,
  -                                 HttpServletResponse response)
  -        throws IOException, ServletException {
  -
  +    ActionForm form,
  +    HttpServletRequest request,
  +    HttpServletResponse response)
  +    throws IOException, ServletException {
  +        
           HttpSession session = request.getSession();
  -
  +        
           // Do I have to do this part ??
           if (form == null) {
               getServlet().log(" Creating new ServerForm bean under key "
  -                + mapping.getAttribute());
  +            + mapping.getAttribute());
               form = new ServerForm();
  -           
  +            
               if ("request".equals(mapping.getScope()))
                   request.setAttribute(mapping.getAttribute(), form);
               else
                   request.getSession().setAttribute(mapping.getAttribute(), form);
  -               
  +            
           }
  -
  +        
  +        // label of the node that was clicked on.
  +        String nodeLabel = request.getParameter("nodeLabel");
  +        
           // Do transaction stuff before this
  -
  +        
           ServerForm serverFm = (ServerForm) form;
  -
  +        
           if(debugLvlList == null) {
               debugLvlList = new ArrayList();
               debugLvlList.add(new LabelValueBean("0", "0"));
  @@ -165,55 +168,55 @@
               debugLvlList.add(new LabelValueBean("7", "7"));
               debugLvlList.add(new LabelValueBean("8", "8"));
               debugLvlList.add(new LabelValueBean("9", "9"));
  -
  +            
           }
  -
  +        
           Integer portNumb = null;
           Integer debug = null;
           String shutdown = null;
           try{
  -        
  +            
               if(mBServer == null) {
  -                ApplicationServlet servlet = (ApplicationServlet)getServlet();        
  +                ApplicationServlet servlet = (ApplicationServlet)getServlet();
                   mBServer = servlet.getServer();
               }
  -
  -            Iterator serverItr = 
  -                mBServer.queryMBeans(new ObjectName(TomcatTreeBuilder.SERVER_TYPE +
  -                                                    TomcatTreeBuilder. WILDCARD),
  -                                     null).iterator();
  -
  +            
  +            Iterator serverItr =
  +            mBServer.queryMBeans(new ObjectName(TomcatTreeBuilder.SERVER_TYPE +
  +            TomcatTreeBuilder. WILDCARD),
  +            null).iterator();
  +            
               ObjectName serverObjName =
  -                ((ObjectInstance)serverItr.next()).getObjectName();
  -
  +            ((ObjectInstance)serverItr.next()).getObjectName();
  +            
               /*
  -            ModelMBeanInfo info = (ModelMBeanInfo) mBServer.getMBeanInfo(serverObjName);  
  +            ModelMBeanInfo info = (ModelMBeanInfo) mBServer.getMBeanInfo(serverObjName);
               MBeanAttributeInfo attrs[] = info.getAttributes();
               for (int i = 0; i < attrs.length; i++)
                   System.out.println("  AttributeInfo=" + attrs[i]);
  -            
  +             
               MBeanOperationInfo opers[] = info.getOperations();
               for (int i = 0; i < opers.length; i++)
                   System.out.println("  Operation=" + opers[i]);
  -               */
  -
  +             */
  +            
               portNumb = (Integer)mBServer.getAttribute(serverObjName,
  -                                                  PORT_PROP_NAME);
  -
  +            PORT_PROP_NAME);
  +            
               debug = (Integer)mBServer.getAttribute(serverObjName,
  -                                                   DEBUG_PROP_NAME);
  -
  +            DEBUG_PROP_NAME);
  +            
               shutdown = (String)mBServer.getAttribute(serverObjName,
  -                                                     SHUTDOWN_PROP_NAME);
  -
  +            SHUTDOWN_PROP_NAME);
  +            
               request.setAttribute("debugLvlVals", debugLvlList);
  -
  +            
           }catch(Throwable t){
               t.printStackTrace(System.out);
               //forward to error page
  -        } 
  -
  +        }
           
  +        serverFm.setNodeLabel(nodeLabel);        
           serverFm.setPortNumberText(portNumb.toString());
           // Hardcode debuglvl for now
           serverFm.setDebugLvl(debug.toString());
  @@ -222,8 +225,8 @@
           
           // Forward back to the test page
           return (mapping.findForward("Server"));
  -
  +        
       }
  -
  -
  +    
  +    
   }
  
  
  
  1.5       +10 -7     jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/SetUpServiceAction.java
  
  Index: SetUpServiceAction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/SetUpServiceAction.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SetUpServiceAction.java	20 Dec 2001 09:31:52 -0000	1.4
  +++ SetUpServiceAction.java	10 Jan 2002 03:41:13 -0000	1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/SetUpServiceAction.java,v 1.4 2001/12/20 09:31:52 remm Exp $
  - * $Revision: 1.4 $
  - * $Date: 2001/12/20 09:31:52 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/SetUpServiceAction.java,v 1.5 2002/01/10 03:41:13 patrickl Exp $
  + * $Revision: 1.5 $
  + * $Date: 2002/01/10 03:41:13 $
    *
    * ====================================================================
    *
  @@ -99,7 +99,7 @@
    * page.
    *
    * @author Manveen Kaur
  - * @version $Revision: 1.4 $ $Date: 2001/12/20 09:31:52 $
  + * @version $Revision: 1.5 $ $Date: 2002/01/10 03:41:13 $
    */
   
   public class SetUpServiceAction extends Action {
  @@ -136,7 +136,7 @@
       HttpServletRequest request,
       HttpServletResponse response)
       throws IOException, ServletException {
  -
  +        
           HttpSession session = request.getSession();
           
           if (form == null) {
  @@ -152,10 +152,12 @@
           }
           
           // The message resources for this package.
  -    //    MessageResources messages = getResources();
  -    //    Locale locale = (Locale)session.getAttribute(Action.LOCALE_KEY);
  +        //    MessageResources messages = getResources();
  +        //    Locale locale = (Locale)session.getAttribute(Action.LOCALE_KEY);
           
           String selectedName = request.getParameter("select");
  +        // label of the node that was clicked on.
  +        String nodeLabel = request.getParameter("nodeLabel");
           
           ServiceForm serviceFm = (ServiceForm) form;
           
  @@ -257,6 +259,7 @@
               //forward to error page
           }
           
  +        serviceFm.setNodeLabel(nodeLabel);
           serviceFm.setServiceName(serviceName);
           serviceFm.setDefaultHost(defaultHost);
           serviceFm.setDebugLvl(debug.toString());
  
  
  
  1.5       +64 -15    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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TomcatTreeBuilder.java	5 Jan 2002 20:45:03 -0000	1.4
  +++ TomcatTreeBuilder.java	10 Jan 2002 03:41:13 -0000	1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/TomcatTreeBuilder.java,v 1.4 2002/01/05 20:45:03 remm Exp $
  - * $Revision: 1.4 $
  - * $Date: 2002/01/05 20:45:03 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/TomcatTreeBuilder.java,v 1.5 2002/01/10 03:41:13 patrickl Exp $
  + * $Revision: 1.5 $
  + * $Date: 2002/01/10 03:41:13 $
    *
    * ====================================================================
    *
  @@ -91,7 +91,7 @@
    *
    * @author Jazmin Jonson
    * @author Manveen Kaur
  - * @version $Revision: 1.4 $ $Date: 2002/01/05 20:45:03 $
  + * @version $Revision: 1.5 $ $Date: 2002/01/10 03:41:13 $
    */
   
   
  @@ -143,7 +143,8 @@
           TreeControlNode serverNode =
           new TreeControlNode(serverObjName,
           "folder_16_pad.gif", SERVER_LABEL,
  -        "setUpServer.do?select=" + encodedServerName,
  +        "setUpServer.do?select=" + encodedServerName
  +        +"&nodeLabel=" + SERVER_LABEL,
           "content", true);
           
           return serverNode;
  @@ -173,23 +174,26 @@
               
               encodedServiceName =  URLEncoder.encode(service.getObjectName().toString());
               
  +            String nodeLabel = "Service (" + serviceName + ")";
  +            
               TreeControlNode serviceNode =
               new TreeControlNode(service.getObjectName().toString(),
               "folder_16_pad.gif",
  -            "Service(" + serviceName + ")",
  -            "setUpService.do?select=" + encodedServiceName,
  +            nodeLabel,
  +            "setUpService.do?select=" + encodedServiceName
  +            +"&nodeLabel=" + nodeLabel,
               "content", true);
               
               serverNode.addChild(serviceNode);
               
               getConnectors(serviceNode, serviceName);
  -
  +            getHosts(serviceNode, serviceName);
  +            
           }
       }
       
  -    public void getConnectors(TreeControlNode serviceNode,
  -                              String serviceName)
  -        throws JMException{
  +    public void getConnectors(TreeControlNode serviceNode, String serviceName)
  +    throws JMException{
           
           Iterator ConnectorItr =
           (mBServer.queryMBeans(new ObjectName(CONNECTOR_TYPE + WILDCARD +
  @@ -213,12 +217,13 @@
               // This is because warp connector doesn't conform to the
               // standard Engine/Host/Context hierarchy and we don't support it.
               if (!"warp".equalsIgnoreCase(connectorName)) {
  +                String nodeLabel = "Connector (" + connectorName + ")";
                   connectorNode =
                   new TreeControlNode(connectorObj.getObjectName().toString(),
  -                "folder_16_pad.gif",
  -                "Connector(" + connectorName + ")",
  -                "setUpConnector.do?select=" +
  -                encodedConnectorName,
  +                "folder_16_pad.gif", 
  +                nodeLabel,
  +                "setUpConnector.do?select=" + encodedConnectorName
  +                + "&nodeLabel="+nodeLabel,
                   "content", true);
                   
                   serviceNode.addChild(connectorNode);
  @@ -227,4 +232,48 @@
           
       }
       
  +    public void getHosts(TreeControlNode serviceNode, String serviceName)
  +    throws JMException{
  +        
  +        /*
  +        System.out.println("** There are " + mBServer.getMBeanCount().intValue() +
  +        " registered MBeans **");
  +        Iterator instances = mBServer.queryMBeans(null, null).iterator();
  +        while (instances.hasNext()) {
  +            ObjectInstance instance = (ObjectInstance) instances.next();
  +            System.out.println("  objectName=" + instance.getObjectName() +
  +            ", className=" + instance.getClassName());
  +        }
  +        */
  +        
  +        Iterator HostItr =
  +        (mBServer.queryMBeans(new ObjectName(HOST_TYPE + WILDCARD +
  +        ",service=" + serviceName), null)).iterator();
  +        
  +        TreeControlNode hostNode = null;
  +        String encodedHostName;
  +        
  +        while(HostItr.hasNext()){
  +            
  +            ObjectInstance hostObj = (ObjectInstance)HostItr.next();
  +            
  +            String hostName =
  +            (String)mBServer.getAttribute(hostObj.getObjectName(),
  +            "name");
  +            
  +            encodedHostName =  URLEncoder.encode(hostObj.getObjectName().toString());
  +            
  +            String nodeLabel="Host (" + hostName + ")";
  +            
  +            hostNode =
  +            new TreeControlNode(hostObj.getObjectName().toString(),
  +            "folder_16_pad.gif",
  +            nodeLabel,
  +            "setUpHost.do?select=" + encodedHostName
  +            +"&nodeLabel="+nodeLabel,
  +            "content", true);
  +            
  +            serviceNode.addChild(hostNode);
  +        }        
  +    }
   }
  
  
  
  1.1                  jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/HostAction.java
  
  Index: HostAction.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/HostAction.java,v 1.1 2002/01/10 03:41:13 patrickl Exp $
   * $Revision: 1.1 $
   * $Date: 2002/01/10 03:41:13 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001 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", "Struts", 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 apache@apache.org.
   *
   * 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;
  
  import java.util.Iterator;
  import java.util.Locale;
  import java.io.IOException;
  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  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 javax.management.Attribute;
  import javax.management.MBeanServer;
  import javax.management.MBeanServerFactory;
  import javax.management.QueryExp;
  import javax.management.Query;
  import javax.management.ObjectInstance;
  import javax.management.ObjectName;
  import javax.management.JMException;
  import javax.management.MBeanAttributeInfo;
  import javax.management.MBeanOperationInfo;
  import javax.management.MBeanInfo;
  import org.apache.struts.util.MessageResources;
  
  /**
   * Implementation of <strong>Action</strong> that validates
   * actions on a Host.
   *
   * @author Manveen Kaur
   * @version $Revision: 1.1 $Date: 2002/01/10 03:41:13 $
   */
  
  public final class HostAction extends Action {
      
      private static MBeanServer mBServer = 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 {
          
          try{
              
              // front end validation and checking.
              // ===================================================
              MessageResources messages = getResources();
              Locale locale = (Locale)request.getSession().getAttribute(Action.LOCALE_KEY);
              
              // Validate the request parameters specified by the user
              ActionErrors errors = new ActionErrors();
              
              // Report any errors we have discovered back to the original form
              if (!errors.empty()) {
                  saveErrors(request, errors);
                  return (new ActionForward(mapping.getInput()));
              }
              
              if(mBServer == null) {
                  ApplicationServlet servlet = (ApplicationServlet)getServlet();
                  mBServer = servlet.getServer();
              }
              
              /**
               * Get the host Name from the form.
               * This is used to lookup the MBeanServer and
               * retrieve this connector's MBean.
               */
              String hostName = request.getParameter("hostName");
              
              Iterator hostItr =
              mBServer.queryMBeans(new
              ObjectName(hostName), null).iterator();
              
              ObjectInstance objInstance = (ObjectInstance)hostItr.next();
              ObjectName hostObjName = (objInstance).getObjectName();
              
              /**
               * Extracting the values from the form and
               * updating the MBean with the new values.
               */
              
              String nameText = request.getParameter("name");
              if(nameText != null) {
                  mBServer.setAttribute(hostObjName,
                  new Attribute(SetUpHostAction.NAME_PROP_NAME,
                  nameText));
              }
              
              String appBaseText = request.getParameter("appBase");
              if(appBaseText != null) {
                  mBServer.setAttribute(hostObjName,
                  new Attribute(SetUpHostAction.APPBASE_PROP_NAME,
                  appBaseText));
              }
                          
              String debugLvlText = request.getParameter("debugLvl");
              if(debugLvlText != null) {
                  Integer debugLvl = new Integer(debugLvlText);
                  mBServer.setAttribute(hostObjName,
                  new Attribute(SetUpHostAction.DEBUG_PROP_NAME,
                  debugLvl));
              }
              
              
              String unpackWARsText = request.getParameter("unpackWARs");
              if(unpackWARsText != null) {
                  Boolean unpackWARs = Boolean.valueOf(unpackWARsText);
                  mBServer.setAttribute(hostObjName,
                  new Attribute(SetUpHostAction.UNPACKWARS_PROP_NAME,
                  unpackWARs));
                  
              }
           
          }catch(Throwable t){
              t.printStackTrace(System.out);
              //forward to error page
          }
          if (servlet.getDebug() >= 1)
              servlet.log(" Forwarding to success page");
          // Forward back to the test page
          return (mapping.findForward("Save Successful"));
          
      }
      
  }
  
  
  
  1.1                  jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/HostForm.java
  
  Index: HostForm.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/HostForm.java,v 1.1 2002/01/10 03:41:13 patrickl Exp $
   * $Revision: 1.1 $
   * $Date: 2002/01/10 03:41:13 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001 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", "Struts", 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 apache@apache.org.
   *
   * 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;
  
  import javax.servlet.http.HttpServletRequest;
  import org.apache.struts.action.ActionError;
  import org.apache.struts.action.ActionErrors;
  import org.apache.struts.action.ActionForm;
  import org.apache.struts.action.ActionMapping;
  import java.net.InetAddress;
  import java.util.ArrayList;
  
  /**
   * Form bean for the host page.
   *
   * @author Manveen Kaur
   * @version $Revision: 1.1 $ $Date: 2002/01/10 03:41:13 $
   */
  
  public final class HostForm extends ActionForm {
      
      // ----------------------------------------------------- Instance Variables
      
      /**
       * The text for the node label.
       */
      private String nodeLabel = null;
      
      /**
       * The text for the hostName.
       */
      private String name = null;
      
      /**
       * The text for the selected host name that is used to lookup the MBean info.
       * This contains all information including the service name to which this host belongs etc.
       */
      private String hostName = null;
      
      /**
       * The directory for the appBase.
       */
      private String appBase = null;
      
      /**
       * The text for the debug level.
       */
      private String debugLvl = "0";
      
      /**
       * Boolean for unpack WARs.
       */
      private String unpackWARs = "false";
      
      /**
       * The text for the port. -- TBD
       */
      private String findAliases = null;
      
      /**
       * Set of valid values for debug level.
       */
      private ArrayList debugLvlVals = null;
      
      /*
       * Represent boolean (true, false) values for unpackWARs etc.
       */
      private ArrayList booleanVals = null;
      
      /*
       * Represent aliases as a List.
       */    
      private ArrayList aliasVals = null;
     
      // ------------------------------------------------------------- Properties
      /**
       * Return the label of the node that was clicked.
       */
      public String getNodeLabel() {
          
          return this.nodeLabel;
          
      }
      
      /**
       * Set the node label.
       */
      public void setNodeLabel(String nodeLabel) {
          
          this.nodeLabel = nodeLabel;
          
      }
      
      /**
       * Return the selected node host name to lookup mBean.
       */
      public String getHostName() {
          
          return this.hostName;
          
      }
      
      /**
       * Set the selected node host name to lookup mBean.
       */
      public void setHostName(String hostName) {
          
          this.hostName = hostName;
          
      }
      
      /**
       * Return the host name.
       */
      public String getName() {
          
          return this.name;
          
      }
      
      /**
       * Set the host name.
       */
      public void setName(String name) {
          
          this.name = name;
          
      }
      
      /**
       * Return the appBase.
       */
      public String getAppBase() {
          
          return this.appBase;
          
      }
      
      
      /**
       * Set the appBase.
       */
      
      public void setAppBase(String appBase) {
          
          this.appBase = appBase;
          
      }
      
      /**
       * Return the unpackWARs.
       */
      public String getUnpackWARs() {
          
          return this.unpackWARs;
          
      }
      
      /**
       * Set the unpackWARs.
       */
      
      public void setUnpackWARs(String unpackWARs) {
          
          this.unpackWARs = unpackWARs;
          
      }
      
      /**
       * Return the debugVals.
       */
      public ArrayList getDebugLvlVals() {
          
          return this.debugLvlVals;
          
      }
      
      /**
       * Set the debugVals.
       */
      public void setDebugLvlVals(ArrayList debugLvlVals) {
          
          this.debugLvlVals = debugLvlVals;
          
      }
      
      
      /**
       * Return the Debug Level Text.
       */
      
      public String getDebugLvl() {
          
          return this.debugLvl;
          
      }
      
      /**
       * Set the Debug Level Text.
       */
      public void setDebugLvl(String debugLvl) {
          
          this.debugLvl = debugLvl;
          
      }
      
      /**
       * Return the booleanVals.
       */
      public ArrayList getBooleanVals() {
          
          return this.booleanVals;
          
      }
      
      /**
       * Set the booleanVals.
       */
      public void setBooleanVals(ArrayList booleanVals) {
          
          this.booleanVals = booleanVals;
          
      }
      
      /**
       * Return the List of alias Vals.
       */
      public ArrayList getAliasVals() {
          
          return this.aliasVals;
          
      }
      
      /**
       * Set the alias Vals.
       */
      public void setAliasVals(ArrayList aliasVals) {
          
          this.aliasVals = aliasVals;
          
      }
      
      // --------------------------------------------------------- Public Methods
      
      /**
       * Reset all properties to their default values.
       *
       * @param mapping The mapping used to select this instance
       * @param request The servlet request we are processing
       */
      public void reset(ActionMapping mapping, HttpServletRequest request) {
          
          this.name = null;
          this.appBase = null;
          this.debugLvl = "0";
          this.unpackWARs = "false";
          
      }
      
      /**
       * Validate the properties that have been set from this HTTP request,
       * and return an <code>ActionErrors</code> object that encapsulates any
       * validation errors that have been found.  If no errors are found, return
       * <code>null</code> or an <code>ActionErrors</code> object with no
       * recorded error messages.
       *
       * @param mapping The mapping used to select this instance
       * @param request The servlet request we are processing
       */
      
      public ActionErrors validate(ActionMapping mapping,
      HttpServletRequest request) {
          
          ActionErrors errors = new ActionErrors();
          
          String submit = request.getParameter("submit");
          
          // front end validation when save is clicked.
          if (submit != null) {
              
              // name cannot be null
              if ((name== null) || (name.length() < 1)) {
                  errors.add("name", new ActionError("error.hostName.required"));
              }
              
              // appBase cannot be null
              if ((appBase == null) || (appBase.length() < 1)) {
                  errors.add("appBase", new ActionError("error.appBase.required"));
              }
              
          }        
          return errors;
          
      }
      
  }
  
  
  
  1.1                  jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/SetUpHostAction.java
  
  Index: SetUpHostAction.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/SetUpHostAction.java,v 1.1 2002/01/10 03:41:13 patrickl Exp $
   * $Revision: 1.1 $
   * $Date: 2002/01/10 03:41:13 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001 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 apache@apache.org.
   *
   * 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;
  
  
  import java.io.IOException;
  import java.util.Iterator;
  import java.util.List;
  import java.util.Locale;
  import java.util.Arrays;
  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 javax.management.MBeanServer;
  import javax.management.MBeanServerFactory;
  import javax.management.QueryExp;
  import javax.management.Query;
  import javax.management.ObjectInstance;
  import javax.management.ObjectName;
  import javax.management.JMException;
  import javax.management.MBeanAttributeInfo;
  import javax.management.MBeanOperationInfo;
  import javax.management.MBeanInfo;
  
  import javax.management.modelmbean.ModelMBean;
  import javax.management.modelmbean.ModelMBeanInfo;
  
  import org.apache.struts.util.MessageResources;
  /**
   * Test <code>Action</code> that handles events from the tree control test
   * page when a node linking to a host is selected.
   * @author Manveen Kaur
   * @version $Revision: 1.1 $ $Date: 2002/01/10 03:41:13 $
   */
  
  public class SetUpHostAction extends Action {
      
      private static MBeanServer mBServer = null;
      
      public final static String NAME_PROP_NAME = "name";
      public final static String APPBASE_PROP_NAME = "appBase";
      public final static String DEBUG_PROP_NAME = "debug";
      public final static String UNPACKWARS_PROP_NAME = "unpackWARs";
      
      public final static String FINDALIASES_OPERATION_NAME = "findAliases";
      
      private ArrayList debugLvlList = null;
      private ArrayList booleanList = null;
      private ArrayList aliasList = 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 {
          
          HttpSession session = request.getSession();
          
          // Do I have to do this part ??
          if (form == null) {
              getServlet().log(" Creating new hostForm bean under key "
              + mapping.getAttribute());
              form = new HostForm();
              
              if ("request".equals(mapping.getScope()))
                  request.setAttribute(mapping.getAttribute(), form);
              else
                  request.getSession().setAttribute(mapping.getAttribute(), form);
              
          }
          
          String selectedName = request.getParameter("select");
          // label of the node that was clicked on.
          String nodeLabel = request.getParameter("nodeLabel");
          
          // Do transaction stuff before this
          
          HostForm hostFm = (HostForm) form;
          
          if(debugLvlList == null) {
              debugLvlList = new ArrayList();
              debugLvlList.add(new LabelValueBean("0", "0"));
              debugLvlList.add(new LabelValueBean("1", "1"));
              debugLvlList.add(new LabelValueBean("2", "2"));
              debugLvlList.add(new LabelValueBean("3", "3"));
              debugLvlList.add(new LabelValueBean("4", "4"));
              debugLvlList.add(new LabelValueBean("5", "5"));
              debugLvlList.add(new LabelValueBean("6", "6"));
              debugLvlList.add(new LabelValueBean("7", "7"));
              debugLvlList.add(new LabelValueBean("8", "8"));
              debugLvlList.add(new LabelValueBean("9", "9"));
              
          }
          
          /* Boolean (true.false) list for unpackWARs */
          if(booleanList == null) {
              booleanList = new ArrayList();
              booleanList.add(new LabelValueBean("True", "true"));
              booleanList.add(new LabelValueBean("False", "false"));
          }
          
          String name= null;
          String appBase = null;
          Integer debug = null;
          Boolean unpackWARs = null;
          
          try{
              
              if(mBServer == null) {
                  ApplicationServlet servlet = (ApplicationServlet)getServlet();
                  mBServer = servlet.getServer();
              }
              
              Iterator hostItr =
              mBServer.queryMBeans(new ObjectName(TomcatTreeBuilder.HOST_TYPE +
              TomcatTreeBuilder. WILDCARD),
              null).iterator();
              
              ObjectName hostObjName =
              ((ObjectInstance)hostItr.next()).getObjectName();
              
              name = (String)mBServer.getAttribute(hostObjName,
              NAME_PROP_NAME);
              
              appBase = (String)mBServer.getAttribute(hostObjName,
              APPBASE_PROP_NAME);
              
              debug = (Integer)mBServer.getAttribute(hostObjName,
              DEBUG_PROP_NAME);
              
              unpackWARs = (Boolean) mBServer.getAttribute(hostObjName,
              UNPACKWARS_PROP_NAME);
              
              // retrieve all aliases
              String aliases[] = (String[]) mBServer.invoke(hostObjName,
              FINDALIASES_OPERATION_NAME, null, null);
              
              // convert the alias string array into an alias ArrayList
              if (aliasList == null)
                  aliasList = new ArrayList(Arrays.asList(aliases));
              
              request.setAttribute("debugLvlVals", debugLvlList);
              request.setAttribute("booleanVals", booleanList);
              request.setAttribute("aliasVals", aliasList);
              
          }catch(Throwable t){
              t.printStackTrace(System.out);
              //forward to error page -- TBD
              // return (mapping.findForward("error"));
          }
          
          hostFm.setNodeLabel(nodeLabel);
          hostFm.setHostName(selectedName);
          
          hostFm.setName(name);
          hostFm.setAppBase(appBase);
          hostFm.setDebugLvl(debug.toString());
          hostFm.setUnpackWARs(unpackWARs.toString());
          
          hostFm.setDebugLvlVals(debugLvlList);
          hostFm.setBooleanVals(booleanList);
          hostFm.setAliasVals(aliasList);
          
          // Forward back to the test page
          return (mapping.findForward("Host"));
          
      }
      
      
  }
  
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message