manveen     02/03/14 00:49:41

  Modified:    webapps/admin/WEB-INF controls.tld struts-config.xml
               webapps/admin/WEB-INF/classes/org/apache/webapp/admin
                        ActionTag.java ActionsTag.java
                        ApplicationResources_en.properties
                        ApplicationResources_es.properties Lists.java
                        TomcatTreeBuilder.java
               webapps/admin/WEB-INF/classes/org/apache/webapp/admin/host
                        AddHostAction.java DeleteHostAction.java
                        DeleteHostForm.java HostForm.java
               webapps/admin/host host.jsp
  Added:       webapps/admin/WEB-INF/classes/org/apache/webapp/admin/host
                        EditHostAction.java SaveHostAction.java
               webapps/admin/host hosts.jsp
  Removed:     webapps/admin/WEB-INF/classes/org/apache/webapp/admin/host
                        AddHostForm.java HostAction.java
                        SetUpAddHostAction.java SetUpDeleteHostAction.java
                        SetUpHostAction.java
               webapps/admin/host addHost.jsp deleteHost.jsp
  Log:
  Refactored "host" to match the way "service" is handled.
  
  Revision  Changes    Path
  1.6       +10 -0     jakarta-tomcat-4.0/webapps/admin/WEB-INF/controls.tld
  
  Index: controls.tld
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/controls.tld,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- controls.tld      30 Jan 2002 02:05:44 -0000      1.5
  +++ controls.tld      14 Mar 2002 08:49:40 -0000      1.6
  @@ -205,6 +205,16 @@
       </attribute>
   
       <attribute>
  +      <name>disabled</name>
  +      <required>false</required>
  +      <rtexprvalue>true</rtexprvalue>
  +      <description>
  +        (Boolean) variable set to "true" or "yes" if the selection
  +        for this action should be disabled.        
  +      </description>
  +    </attribute>
  +
  +    <attribute>
         <name>url</name>
         <required>false</required>
         <rtexprvalue>true</rtexprvalue>
  
  
  
  1.35      +48 -58    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.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- struts-config.xml 7 Mar 2002 02:48:54 -0000       1.34
  +++ struts-config.xml 14 Mar 2002 08:49:40 -0000      1.35
  @@ -23,18 +23,6 @@
       <form-bean      name="connectorForm"
                       type="org.apache.webapp.admin.connector.ConnectorForm"/>
   
  -    <!-- Host form bean -->
  -    <form-bean      name="hostForm"
  -                    type="org.apache.webapp.admin.host.HostForm"/>
  -
  -    <!-- Add Host form bean -->
  -    <form-bean      name="addHostForm"
  -                    type="org.apache.webapp.admin.host.AddHostForm"/>
  -
  -    <!-- Delete Host form bean -->
  -    <form-bean      name="deleteHostForm"
  -                    type="org.apache.webapp.admin.host.DeleteHostForm"/>
  -                    
       <!-- Context form bean -->
       <form-bean      name="contextForm"
                       type="org.apache.webapp.admin.context.ContextForm"/>
  @@ -72,6 +60,13 @@
       <form-bean      name="servicesForm"
                       type="org.apache.webapp.admin.service.ServicesForm"/>
   
  +    <!-- ============= Host Module ============= -->
  +
  +    <form-bean      name="hostForm"
  +                    type="org.apache.webapp.admin.host.HostForm"/>
  +                    
  +    <form-bean      name="hostsForm"
  +                    type="org.apache.webapp.admin.host.HostsForm"/>
   
       <!-- ========== User Database Module ========== -->
   
  @@ -189,6 +184,15 @@
                       path="/service/services.jsp"
                   redirect="false"/>
   
  +    <!-- ============ Host Module ============== -->
  +
  +    <forward        name="Host"
  +                    path="/host/host.jsp"
  +                redirect="false"/>
  +
  +    <forward        name="Hosts"
  +                    path="/host/hosts.jsp"
  +                redirect="false"/>
   
       <!-- ========== User Database Module ========== -->
   
  @@ -280,28 +284,7 @@
                  scope="session">
       </action>
   
  -     <!-- Set up Host datastructure -->
  -    <action    path="/setUpHost"
  -               type="org.apache.webapp.admin.host.SetUpHostAction"
  -               name="hostForm"
  -               scope="session">
  -    </action>
  -
  -    <!-- Set up add Host datastructure -->
  -    <action    path="/setUpAddHost"
  -               type="org.apache.webapp.admin.host.SetUpAddHostAction"
  -               name="addHostForm"
  -               scope="session">
  -    </action>
  -    
  -    <!-- Set up delete Host datastructure -->
  -    <action    path="/setUpDeleteHost"
  -               type="org.apache.webapp.admin.host.SetUpDeleteHostAction"
  -               name="deleteHostForm"
  -               scope="session">
  -    </action>
  -    
  -      <!-- Set up Context datastructure -->
  +    <!-- Set up Context datastructure -->
       <action    path="/setUpContext"
                  type="org.apache.webapp.admin.context.SetUpContextAction"
                  name="contextForm"
  @@ -366,30 +349,6 @@
                 scope="session"
                 input="/connector.jsp">
       </action>
  -
  -    <!-- Process a host change -->
  -    <action    path="/host"
  -               type="org.apache.webapp.admin.host.HostAction"
  -               name="hostForm"
  -              scope="session"
  -              input="/host/host.jsp">
  -    </action>
  -
  -    <!-- Process a add host change -->
  -    <action    path="/addHost"
  -               type="org.apache.webapp.admin.host.AddHostAction"
  -               name="addHostForm"
  -              scope="session"
  -              input="/host/addHost.jsp">
  -    </action>
  -
  -    <!-- Process a delete host change -->
  -    <action    path="/deleteHost"
  -               type="org.apache.webapp.admin.host.DeleteHostAction"
  -               name="deleteHostForm"
  -              scope="session"
  -              input="/host/deleteHost.jsp">
  -    </action>
       
        <!-- Process a context change -->
       <action    path="/context"
  @@ -477,6 +436,37 @@
                 input="/service/service.jsp"
                  scope="session"/>
   
  +    <!-- ============= Host Module ============== -->
  +
  +    <!-- Set up Add Host transaction -->
  +    <action    path="/AddHost"
  +               type="org.apache.webapp.admin.host.AddHostAction">
  +    </action>
  +
  +    <!-- Set up Delete Hosts transaction -->
  +    <action    path="/DeleteHost"
  +               type="org.apache.webapp.admin.host.DeleteHostAction"
  +               name="hostsForm"
  +               scope="request"/>
  +
  +    <!-- Perform Delete Hosts transaction -->
  +    <action    path="/DeleteHosts"
  +               type="org.apache.webapp.admin.host.DeleteHostsAction"
  +               name="hostsForm"
  +               scope="request"/>
  +
  +    <!-- Set up Edit Host transaction -->
  +    <action    path="/EditHost"
  +               type="org.apache.webapp.admin.host.EditHostAction">
  +    </action>
  +
  +    <!-- Perform Save Host transaction -->
  +    <action    path="/SaveHost"
  +               type="org.apache.webapp.admin.host.SaveHostAction"
  +               name="hostForm"
  +              input="/host/host.jsp"
  +               scope="session"/>
  +               
       <!-- ========== User Database Module ========== -->
   
       <action    path="/users/deleteGroups"
  
  
  
  1.4       +19 -5     
jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ActionTag.java
  
  Index: ActionTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ActionTag.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ActionTag.java    6 Mar 2002 06:49:11 -0000       1.3
  +++ ActionTag.java    14 Mar 2002 08:49:40 -0000      1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ActionTag.java,v
 1.3 2002/03/06 06:49:11 craigmcc Exp $
  - * $Revision: 1.3 $
  - * $Date: 2002/03/06 06:49:11 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ActionTag.java,v
 1.4 2002/03/14 08:49:40 manveen Exp $
  + * $Revision: 1.4 $
  + * $Date: 2002/03/14 08:49:40 $
    *
    * ====================================================================
    *
  @@ -92,7 +92,7 @@
    * <strong>FIXME</strong> - Internationalize the exception messages!
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.3 $ $Date: 2002/03/06 06:49:11 $
  + * @version $Revision: 1.4 $ $Date: 2002/03/14 08:49:40 $
    */
   
   public class ActionTag extends BodyTagSupport {
  @@ -123,6 +123,19 @@
           this.selected = selected;
       }
   
  +    /**
  +     * Should this action selection be disabled? 
  +     * e.g. Action separators should be disabled.
  +     */
  +    protected boolean disabled = false;
  +
  +    public boolean getDisabled() {
  +        return (this.disabled);
  +    }
  +
  +    public void setDisabled(boolean disabled) {
  +        this.disabled = disabled;
  +    }
   
       /**
        * The URL to which control is transferred if this action is selected.
  @@ -203,7 +216,7 @@
           } else {
               path = url;
           }
  -        actions.addAction(label, selected,
  +        actions.addAction(label, selected, disabled,
                             response.encodeURL(path));
   
           return (EVAL_PAGE);
  @@ -218,6 +231,7 @@
   
           this.label = null;
           this.selected = false;
  +        this.disabled = false;
           this.url = null;
   
       }
  
  
  
  1.2       +18 -5     
jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ActionsTag.java
  
  Index: ActionsTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ActionsTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ActionsTag.java   19 Dec 2001 01:58:10 -0000      1.1
  +++ ActionsTag.java   14 Mar 2002 08:49:40 -0000      1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ActionsTag.java,v
 1.1 2001/12/19 01:58:10 craigmcc Exp $
  - * $Revision: 1.1 $
  - * $Date: 2001/12/19 01:58:10 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ActionsTag.java,v
 1.2 2002/03/14 08:49:40 manveen Exp $
  + * $Revision: 1.2 $
  + * $Date: 2002/03/14 08:49:40 $
    *
    * ====================================================================
    *
  @@ -88,7 +88,7 @@
    * <strong>FIXME</strong> - Internationalize the exception messages!
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2001/12/19 01:58:10 $
  + * @version $Revision: 1.2 $ $Date: 2002/03/14 08:49:40 $
    */
   
   public class ActionsTag extends BodyTagSupport {
  @@ -120,6 +120,10 @@
        */
       protected ArrayList selecteds = new ArrayList();
   
  +    /**
  +     * The set of "disabled" flags for Actions displayed by this control.
  +     */
  +    protected ArrayList disableds = new ArrayList();
   
       /**
        * The set of URLs for the Actions displayed by this control.
  @@ -211,10 +215,16 @@
               for (int i = 0; i < n; i++) {
                   String label = (String) labels.get(i);
                   boolean selected = ((Boolean) selecteds.get(i)).booleanValue();
  +                boolean disabled = ((Boolean) disableds.get(i)).booleanValue();     
        
                   String url = (String) urls.get(i);
  +                if (disabled) {
  +                    out.println("<optgroup disabled> </optgroup>");
  +                } else {    
                   out.print("<option");
                   if (selected)
                       out.print(" selected=\"selected\"");
  +                //if (disabled)
  +                   // out.print(" disabled");                
                   out.print(" value=\"");
                   if (url != null)
                       out.print(url);
  @@ -223,6 +233,7 @@
                   if (label != null)
                       out.print(label);
                   out.println("</option>");
  +                }
               }
   
               // Render the end of this element
  @@ -261,12 +272,14 @@
        *
        * @param label Localized label visible to the user
        * @param selected Initial selected state of this option
  +     * @param disabled Ability to be selected state of this option
        * @param url URL to which control should be transferred if selected
        */
  -    void addAction(String label, boolean selected, String url) {
  +    void addAction(String label, boolean selected, boolean disabled, String url) {
   
           labels.add(label);
           selecteds.add(new Boolean(selected));
  +        disableds.add(new Boolean(disabled));
           urls.add(url);
   
       }
  
  
  
  1.33      +5 -4      
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.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- ApplicationResources_en.properties        8 Mar 2002 00:12:29 -0000       1.32
  +++ ApplicationResources_en.properties        14 Mar 2002 08:49:40 -0000      1.33
  @@ -54,6 +54,7 @@
   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>
  +error.hostName.bad=Invalid host name {0}
   error.hostName.required=<li>Hostname is required</li>
   error.hostName.exists=<li>Hostname already exists</li>
   error.appBase.required=<li>Application Base is required</li>
  @@ -75,8 +76,10 @@
   actions.connector.delete=Delete Connectors
   actions.group.create=Create New Group
   actions.group.delete=Delete Existing Group
  -actions.host.create=Create New Host
  -actions.host.delete=Delete Hosts
  +actions.hosts.create=Create New Host
  +actions.hosts.delete=Delete This Host
  +actions.hosts.deletes=Delete Existing Hosts
  +actions.hosts.edit=Edit Existing Host
   actions.logger.create=Create New Logger
   actions.logger.delete=Delete Loggers
   actions.requestfilter.create=Create New Request Filter
  @@ -87,11 +90,9 @@
   actions.userrealm.delete=Delete User Realms
   actions.valve.create=Create New Valve
   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.thishost.delete=Delete This Host
   actions.thiscontext.delete=Delete This Context
   actions.thislogger.delete=Delete This Logger
   connector.type=Type
  
  
  
  1.28      +8 -4      
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.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- ApplicationResources_es.properties        15 Feb 2002 21:04:37 -0000      1.27
  +++ ApplicationResources_es.properties        14 Mar 2002 08:49:40 -0000      1.28
  @@ -54,6 +54,7 @@
   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>
  +error.hostName.bad=Invalido nombre de host {0}
   error.hostName.required=<li>Se requiere el hostname</li>
   error.hostName.exists=<li>El hostname ya existe</li>
   error.appBase.required=<li>Se requiere la base de la aplicacion</li>
  @@ -66,15 +67,19 @@
   service.create.new=Cree El Nuevo Servicio
   actions.available.actions=Acciones Disponibles
   actions.services.create=Crear Nuevo Servicio
  -actions.services.delete=Eliminar Servicios
  +actions.services.delete=Eliminar este servicio
  +actions.services.deletes=Eliminar Servicios
  +actions.services.edit=Corrija existente el Servicio
   actions.accesslogger.create=Crear Nuevo (Access Logger) Registrador de Acceso
   actions.accesslogger.delete=Eliminar (Access Logger) Registrador de Acceso
   actions.connector.create=Crear Nuevo Conector
   actions.connector.delete=Eliminar Conectores
   actions.group.create=Crear Nuevo Grupo
   actions.group.delete=Grupo Existente De la Cancelacion
  -actions.host.create=Crear Nuevo Host
  -actions.host.delete=Eliminar Hosts
  +actions.hosts.create=Crear Nuevo Host
  +actions.hosts.delete=Eliminar este Host
  +actions.hosts.deletes=Eliminar Hosts
  +actions.hosts.edit=Corrija existente el Host
   actions.logger.create=Crear Nuevo (Logger) Registrador
   actions.logger.delete=Eliminar (Logger) Registradores
   actions.requestfilter.create=Cree El Filtro Nuevo de la Petici\u00f3n
  @@ -89,7 +94,6 @@
   actions.thisconnector.delete=Eliminar este conector
   actions.alias.create=Cree Los Nuevos Pseudonimos
   actions.alias.delete=Pseudonimos De la Cancelacion
  -actions.thishost.delete=Suprima Este Ordenador principal
   actions.thiscontext.delete=Suprima Este Contexto
   actions.thislogger.delete=Suprima Este Logger
   connector.type=Tipo
  
  
  
  1.3       +22 -4     
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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Lists.java        9 Mar 2002 00:10:56 -0000       1.2
  +++ Lists.java        14 Mar 2002 08:49:40 -0000      1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/Lists.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/Lists.java,v
 1.3 2002/03/14 08:49:40 manveen Exp $
  + * $Revision: 1.3 $
  + * $Date: 2002/03/14 08:49:40 $
    *
    * ====================================================================
    *
  @@ -77,7 +77,7 @@
    * is returned.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.2 $ $Date: 2002/03/09 00:10:56 $
  + * @version $Revision: 1.3 $ $Date: 2002/03/14 08:49:40 $
    */
   
   public class Lists {
  @@ -113,6 +113,15 @@
           debugLevels.add(new LabelValueBean("9", "9"));
       }
   
  +    /**
  +     * Precomputed list of (true,false) labels and values.
  +     */
  +    private static List booleanValues = new ArrayList();
  +
  +    static {
  +            booleanValues.add(new LabelValueBean("True", "true"));
  +            booleanValues.add(new LabelValueBean("False", "false"));
  +    }
   
       // --------------------------------------------------------- Public Methods
   
  @@ -127,6 +136,15 @@
   
       }
   
  +    /**
  +     * Return a <code>List</code> of {@link LabelValueBean}s for the legal
  +     * settings for <code>boolean</code> properties.
  +     */
  +    public static List getBooleanValues() {
  +
  +        return (booleanValues);
  +
  +    }
   
       /**
        * Return a list of <code>Connector</code> object name strings
  
  
  
  1.19      +5 -5      
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.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- TomcatTreeBuilder.java    9 Mar 2002 00:10:56 -0000       1.18
  +++ TomcatTreeBuilder.java    14 Mar 2002 08:49:40 -0000      1.19
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/TomcatTreeBuilder.java,v
 1.18 2002/03/09 00:10:56 craigmcc Exp $
  - * $Revision: 1.18 $
  - * $Date: 2002/03/09 00:10:56 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/TomcatTreeBuilder.java,v
 1.19 2002/03/14 08:49:40 manveen Exp $
  + * $Revision: 1.19 $
  + * $Date: 2002/03/14 08:49:40 $
    *
    * ====================================================================
    *
  @@ -96,7 +96,7 @@
    *
    * @author Jazmin Jonson
    * @author Manveen Kaur
  - * @version $Revision: 1.18 $ $Date: 2002/03/09 00:10:56 $
  + * @version $Revision: 1.19 $ $Date: 2002/03/14 08:49:40 $
    */
   
   
  @@ -272,7 +272,7 @@
                   new TreeControlNode(hostName,
                                       "folder_16_pad.gif",
                                       nodeLabel,
  -                                    "setUpHost.do?select=" +
  +                                    "EditHost.do?select=" +
                                       URLEncoder.encode(hostName) +
                                       "&nodeLabel=" +
                                       URLEncoder.encode(nodeLabel),
  
  
  
  1.2       +34 -145   
jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/host/AddHostAction.java
  
  Index: AddHostAction.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/host/AddHostAction.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AddHostAction.java        15 Feb 2002 21:04:37 -0000      1.1
  +++ AddHostAction.java        14 Mar 2002 08:49:41 -0000      1.2
  @@ -1,13 +1,13 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/host/AddHostAction.java,v
 1.1 2002/02/15 21:04:37 manveen Exp $
  - * $Revision: 1.1 $
  - * $Date: 2002/02/15 21:04:37 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/host/AddHostAction.java,v
 1.2 2002/03/14 08:49:41 manveen Exp $
  + * $Revision: 1.2 $
  + * $Date: 2002/03/14 08:49:41 $
    *
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2002 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -29,7 +29,7 @@
    *    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
  + * 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]
  @@ -61,45 +61,38 @@
   
   package org.apache.webapp.admin.host;
   
  -import java.util.Iterator;
   import java.io.IOException;
   import java.util.Locale;
  +import java.util.ArrayList;
   import javax.servlet.ServletException;
  -import javax.servlet.http.HttpSession;
   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.Attribute;
  -import javax.management.MBeanServer;
  -import javax.management.MBeanServerFactory;
  -import javax.management.QueryExp;
  -import javax.management.ObjectInstance;
  -import javax.management.ObjectName;
  -import javax.management.JMException;
   import org.apache.struts.util.MessageResources;
  -
  -import org.apache.webapp.admin.ApplicationServlet;
  -import org.apache.webapp.admin.TomcatTreeBuilder;
  +import org.apache.webapp.admin.LabelValueBean;
  +import org.apache.webapp.admin.Lists;
   
   /**
  - * Implementation of <strong>Action</strong> that validates
  - * add host actions.
  + * The <code>Action</code> that sets up <em>Add Host</em> transactions.
    *
    * @author Manveen Kaur
  - * @version $Revision: 1.1 $ $Date: 2002/02/15 21:04:37 $
  + * @version $Revision: 1.2 $ $Date: 2002/03/14 08:49:41 $
    */
   
  -public final class AddHostAction extends Action {
  +public class AddHostAction extends Action {
       
  -    private static MBeanServer mBServer = null;
  -    private static MessageResources resources = null;
  +    /**
  +     * The MessageResources we will be retrieving messages from.
  +     */
  +    private MessageResources resources = null;
       
  -    // --------------------------------------------------------- Public Methods
       
  +    // --------------------------------------------------------- Public Methods
       
       /**
        * Process the specified HTTP request, and create the corresponding HTTP
  @@ -122,138 +115,34 @@
       HttpServletResponse response)
       throws IOException, ServletException {
           
  -        // Look up the components we will be using as needed
  -        if (mBServer == null) {
  -            mBServer = ((ApplicationServlet) getServlet()).getServer();
  -        }
  -        if (resources == null) {
  -            resources = getServlet().getResources();
  -        }
  +        // Acquire the resources that we need
           HttpSession session = request.getSession();
           Locale locale = (Locale) session.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 (resources == null) {
  +            resources = getServlet().getResources();
           }
           
  +        // the service Name is needed to retrieve the engine mBean to
  +        // which the new host mBean will be added.
           String serviceName = request.getParameter("serviceName");
  -        String hostName = request.getParameter("name");
  -        String unpackWARs = request.getParameter("unpackWARs");
  -        String appBase = request.getParameter("appBase");
  -        String debugLvlText = request.getParameter("debugLvl");
           
  -        ObjectInstance mBeanFactory = null;
  -        
  -        // unique mBean name of the new service that is created.
  -        String newHost = null;
  -        
  -        // Get hold of the parent engine.
  -        ObjectName engine = null;
  -        try {
  -            Iterator engineItr =
  -            mBServer.queryMBeans(new ObjectName(
  -            TomcatTreeBuilder.ENGINE_TYPE + ",service=" + serviceName),
  -            null).iterator();
  -            
  -            ObjectInstance objInstance = (ObjectInstance)engineItr.next();
  -            engine = (objInstance).getObjectName();
  -            
  -        } catch (Exception e) {
  -            throw new ServletException("Error getting engine mBean", e);
  -        }
  +        // Fill in the form values for display and editing
  +        HostForm hostFm = new HostForm();
  +        session.setAttribute("hostForm", hostFm);
  +        hostFm.setAdminAction("Create");
  +        hostFm.setObjectName("");
  +        hostFm.setHostName("");
  +        hostFm.setDebugLvl("0");
  +        hostFm.setServiceName(serviceName);
  +        hostFm.setAppBase("");
  +        hostFm.setUnpackWARs("false");
  +        hostFm.setDebugLvlVals(Lists.getDebugLevels());
  +        hostFm.setBooleanVals(Lists.getBooleanValues());        
           
  -        // invoke createStandardHost operation on the mBean factory.
  -        try {
  -            mBeanFactory = TomcatTreeBuilder.getMBeanFactory();
  -            ObjectName factory = mBeanFactory.getObjectName();
  -            
  -            Object[] params = new Object[2];
  -            // mBean name of the parent engine
  -            params[0] = new String(engine.toString());
  -            // name of the new host to be added
  -            params[1] = new String(hostName);
  -            
  -            String[] types = new String[2];
  -            types[0]= "java.lang.String";
  -            types[1]= "java.lang.String";
  -            
  -            newHost = (String)
  -            mBServer.invoke(factory, "createStandardHost", params, types);
  -            
  -        } catch (Throwable t) {
  -            getServlet().log
  -            (resources.getMessage(locale, "users.error.invoke",
  -            "createStandardHost"), t);
  -            response.sendError
  -            (HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
  -            resources.getMessage(locale, 
"users.error.invoke","createStandardHost"));
  -            return (null);
  -        } 
  +        // Forward to the host display page
  +        return (mapping.findForward("Host"));
           
  -        // add the newly created service to the server mBean.
  -        try {
  -            Object[] params = new Object[1];
  -            params[0] = new String(newHost);
  -            
  -            String[] type = new String[1];
  -            type[0]= "java.lang.String";
  -            
  -            mBServer.invoke(engine, "addHost", params, type);
  -            
  -        } catch (Exception e) {
  -            getServlet().log
  -            (resources.getMessage(locale, "users.error.invoke",
  -            "addHost"), e);
  -            response.sendError
  -            (HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
  -            resources.getMessage(locale, "users.error.invoke",
  -            "addHost"));
  -            return (null);
  -        }
  -        
  -        // set the attributes read from the form to this newly created host.
  -        String attribute = null;
  -        try{
  -            ObjectName hostObjName = new ObjectName(newHost);
  -            
  -            if(debugLvlText != null) {
  -                Integer debugLvl = new Integer(debugLvlText);
  -                mBServer.setAttribute(hostObjName,
  -                new Attribute(attribute=SetUpHostAction.DEBUG_PROP_NAME,
  -                debugLvl));
  -            }
  -            
  -            if (unpackWARs != null) {
  -                mBServer.setAttribute(hostObjName,
  -                new Attribute(attribute=SetUpHostAction.UNPACKWARS_PROP_NAME,
  -                new Boolean(unpackWARs)));
  -            }
  -            
  -            if(appBase != null) {
  -                mBServer.setAttribute(hostObjName,
  -                new Attribute(attribute=SetUpHostAction.APPBASE_PROP_NAME,
  -                appBase));
  -            }
  -            
  -        }catch(Exception e){
  -            getServlet().log
  -            (resources.getMessage(locale, "users.error.set.attribute",
  -            attribute), e);
  -            response.sendError
  -            (HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
  -            resources.getMessage(locale, "users.error.set.attribute",
  -            attribute));
  -            return (null);
  -        }
  -        
  -        if (servlet.getDebug() >= 1)
  -            servlet.log(" Forwarding to success page");
  -        return (mapping.findForward("Save Successful"));
       }
  +    
       
   }
  
  
  
  1.2       +67 -86    
jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/host/DeleteHostAction.java
  
  Index: DeleteHostAction.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/host/DeleteHostAction.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DeleteHostAction.java     14 Feb 2002 20:37:21 -0000      1.1
  +++ DeleteHostAction.java     14 Mar 2002 08:49:41 -0000      1.2
  @@ -1,13 +1,13 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/host/DeleteHostAction.java,v
 1.1 2002/02/14 20:37:21 manveen Exp $
  - * $Revision: 1.1 $
  - * $Date: 2002/02/14 20:37:21 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/host/DeleteHostAction.java,v
 1.2 2002/03/14 08:49:41 manveen Exp $
  + * $Revision: 1.2 $
  + * $Date: 2002/03/14 08:49:41 $
    *
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2002 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2002 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -59,55 +59,63 @@
    *
    */
   
  +
   package org.apache.webapp.admin.host;
   
   import java.io.IOException;
  +import java.util.Collections;
   import java.util.Iterator;
  +import java.util.List;
   import java.util.Locale;
   import java.util.TreeSet;
  -import javax.management.MBeanServer;
  -import javax.management.ObjectName;
  -import javax.management.ObjectInstance;
  +import java.util.Set;
  +import java.util.ArrayList;
   import javax.servlet.ServletException;
  -import javax.servlet.http.HttpSession;
   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 org.apache.struts.util.MessageResources;
   
   import org.apache.webapp.admin.ApplicationServlet;
   import org.apache.webapp.admin.TomcatTreeBuilder;
   
   /**
  - * Delete hosts that are selected to be deleted.
  + * The <code>Action</code> that sets up <em>Delete Hosts</em> transactions.
    *
    * @author Manveen Kaur
  - * @version $Revision: 1.1 $ $Date: 2002/02/14 20:37:21 $
  + * @version $Revision: 1.2 $ $Date: 2002/03/14 08:49:41 $
    */
   
   public class DeleteHostAction 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;
       
  -    /* 
  -     * Remove operation.
  -     */
  -    private String REMOVE_OP = "removeHost";
  -    
  +
       // --------------------------------------------------------- Public Methods
       
  -    
       /**
        * Process the specified HTTP request, and create the corresponding HTTP
        * response (or forward to another web component that will create it).
  @@ -124,21 +132,20 @@
        * @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 {
           
  -        // Look up the components we will be using as needed
  -        if (mBServer == null) {
  -            mBServer = ((ApplicationServlet) getServlet()).getServer();
  -        }
  +
  +        // Acquire the resources that we need
  +        HttpSession session = request.getSession();
  +        Locale locale = (Locale) session.getAttribute(Action.LOCALE_KEY);
           if (resources == null) {
               resources = getServlet().getResources();
           }
  -        HttpSession session = request.getSession();
  -        Locale locale = (Locale) session.getAttribute(Action.LOCALE_KEY);
           
  +        // Acquire a reference to the MBeanServer containing our MBeans
           try {
               mBServer = ((ApplicationServlet) getServlet()).getServer();
           } catch (Throwable t) {
  @@ -146,69 +153,43 @@
               ("Cannot acquire MBeanServer reference", t);
           }
           
  -        // Get the parent engine name
  -        String serviceName = request.getParameter("serviceName");        
  -        
  -        ObjectName engine = null;
  -        // retrieve the parent engine bean
  -        String enginePattern = TomcatTreeBuilder.ENGINE_TYPE +
  -        ",service=" + serviceName;
  -        
  +        // Set up a form bean containing the currently selected
  +        // objects to be deleted
  +        HostsForm hostsForm = new HostsForm();
  +        String select = request.getParameter("select");
  +        if (select != null) {
  +            String hosts[] = new String[1];
  +            hosts[0] = select;
  +            hostsForm.setHosts(hosts);
  +        }
  +        request.setAttribute("hostsForm", hostsForm);
  +
  +        // Accumulate a list of all available hosts
  +        ArrayList list = new ArrayList();
           try {
  -            Iterator engineItr =
  -            mBServer.queryMBeans(new ObjectName(
  -            enginePattern), null).iterator();
  -            
  -            ObjectInstance objInstance = (ObjectInstance)engineItr.next();
  -            engine = (objInstance).getObjectName();
  +            // FIX ME -- do we need serviceName here?
  +            String pattern = TomcatTreeBuilder.HOST_TYPE +
  +                TomcatTreeBuilder.WILDCARD; 
  +                //+ ",service=" + serviceName; 
  +            Iterator items =
  +                mBServer.queryNames(new ObjectName(pattern), null).iterator();
  +            while (items.hasNext()) {
  +                list.add(items.next().toString());
  +            }
           } catch (Exception e) {
  -            throw new ServletException("Error getting parent engine Bean(" +
  -            enginePattern + ")", e);
  +            getServlet().log
  +                (resources.getMessage(locale, "users.error.select"));
  +            response.sendError
  +                (HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
  +                 resources.getMessage(locale, "users.error.select"));
  +            return (null);
           }
  +        Collections.sort(list);
  +        request.setAttribute("hostsList", list);
           
  -        // selected services to be deleted
  -        String[] selected  = request.getParameterValues("checkbox");
  -        
  -        // process delete action
  -        if (selected != null) {
  -            for (int index=0; index <selected.length; index++) {
  -                String pattern = selected[index];
  -                Iterator names = null;
  -                
  -                try {
  -                    names = mBServer.queryNames(new ObjectName(pattern), 
null).iterator();
  -                } catch (Exception e) {
  -                    throw new ServletException("queryNames(" + pattern + ")", e);
  -                }
  -                                
  -                while (names.hasNext()) {
  -                    try {
  -                        ObjectName oName = (ObjectName) names.next();
  -                        
  -                        // remove this host
  -                        Object[] param = new Object[1];
  -                        param[0] = new String(oName.toString());
  -                        
  -                        String[] type = new String[1];
  -                        type[0]= "java.lang.String";
  -                        
  -                        mBServer.invoke(engine, REMOVE_OP , param, type);
  -                        
  -                    } catch (Exception e) {
  -                        getServlet().log
  -                        (resources.getMessage(locale, "users.error.invoke",
  -                        REMOVE_OP), e);
  -                        response.sendError
  -                        (HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
  -                        resources.getMessage(locale, "users.error.invoke",
  -                        REMOVE_OP));
  -                        return (null);
  -                    }
  -                }
  -            }
  -        }
  -        //Fix me -- need to refresh the tree?
  -        return (mapping.findForward("Save Successful"));
  +        // Forward to the list display page
  +        return (mapping.findForward("Hosts"));
  +
       }
  -    
  +
   }
  
  
  
  1.2       +4 -39     
jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/host/DeleteHostForm.java
  
  Index: DeleteHostForm.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/host/DeleteHostForm.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DeleteHostForm.java       14 Feb 2002 20:37:21 -0000      1.1
  +++ DeleteHostForm.java       14 Mar 2002 08:49:41 -0000      1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/host/DeleteHostForm.java,v
 1.1 2002/02/14 20:37:21 manveen Exp $
  - * $Revision: 1.1 $
  - * $Date: 2002/02/14 20:37:21 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/host/DeleteHostForm.java,v
 1.2 2002/03/14 08:49:41 manveen Exp $
  + * $Revision: 1.2 $
  + * $Date: 2002/03/14 08:49:41 $
    *
    * ====================================================================
    *
  @@ -69,46 +69,11 @@
    * Form bean for the "Delete Host" page.
    *
    * @author Manveen Kaur
  - * @version $Revision: 1.1 $ $Date: 2002/02/14 20:37:21 $
  + * @version $Revision: 1.2 $ $Date: 2002/03/14 08:49:41 $
    */
   
   public class DeleteHostForm extends ActionForm {
       
  -    // ----------------------------------------------------- Instance Variables
  -    
  -    /**
  -     * The text for the serviceName.
  -     */
  -    private String serviceName = null;
  -    
  -    /**
  -     * Return the Service Name.
  -     */
  -    public String getServiceName() {
  -        
  -        return this.serviceName;
  -        
  -    }
  -    
  -    /**
  -     * Set the Service Name.
  -     */
  -    public void setServiceName(String serviceName) {
  -        
  -        this.serviceName = serviceName;
  -        
  -    }
  -    
  -    // --------------------------------------------------------- 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.serviceName = null;
  -    }
  +  // No extensions needed
       
   }
  
  
  
  1.3       +119 -43   
jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/host/HostForm.java
  
  Index: HostForm.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/host/HostForm.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HostForm.java     14 Feb 2002 20:37:21 -0000      1.2
  +++ HostForm.java     14 Mar 2002 08:49:41 -0000      1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/host/HostForm.java,v
 1.2 2002/02/14 20:37:21 manveen Exp $
  - * $Revision: 1.2 $
  - * $Date: 2002/02/14 20:37:21 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/host/HostForm.java,v
 1.3 2002/03/14 08:49:41 manveen Exp $
  + * $Revision: 1.3 $
  + * $Date: 2002/03/14 08:49:41 $
    *
    * ====================================================================
    *
  @@ -67,19 +67,29 @@
   import org.apache.struts.action.ActionErrors;
   import org.apache.struts.action.ActionForm;
   import org.apache.struts.action.ActionMapping;
  -import java.util.ArrayList;
  +import java.util.List;
   
   /**
    * Form bean for the host page.
    *
    * @author Manveen Kaur
  - * @version $Revision: 1.2 $ $Date: 2002/02/14 20:37:21 $
  + * @version $Revision: 1.3 $ $Date: 2002/03/14 08:49:41 $
    */
   
   public final class HostForm extends ActionForm {
       
       // ----------------------------------------------------- Instance Variables
  -    
  +        
  +    /**
  +     * The administrative action represented by this form.
  +     */
  +    private String adminAction = "Edit";
  +
  +    /**
  +     * The object name of the Service this bean refers to.
  +     */
  +    private String objectName = null;
  +
       /**
        * The text for the node label. This is of the form 'Host(name)'
        * and is picked up from the node of the tree that is clicked on.
  @@ -89,13 +99,12 @@
       /**
        * The text for the hostName.
        */
  -    private String name = null;
  +    private String hostName = 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.
  +     * The name of the service this host belongs to.
        */
  -    private String hostName = null;
  +    private String serviceName = null;
       
       /**
        * The directory for the appBase.
  @@ -120,70 +129,111 @@
       /**
        * Set of valid values for debug level.
        */
  -    private ArrayList debugLvlVals = null;
  +    private List debugLvlVals = null;
       
       /*
        * Represent boolean (true, false) values for unpackWARs etc.
        */
  -    private ArrayList booleanVals = null;
  +    private List booleanVals = null;
       
       /*
        * Represent aliases as a List.
        */    
  -    private ArrayList aliasVals = null;
  +    private List aliasVals = null;
      
       // ------------------------------------------------------------- Properties
  +
       /**
  -     * Return the label of the node that was clicked.
  +     * Return the administrative action represented by this form.
        */
  -    public String getNodeLabel() {
  -        
  -        return this.nodeLabel;
  -        
  +    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 Host this bean refers to.
  +     */
  +    public String getObjectName() {
  +
  +        return this.objectName;
  +
  +    }
  +
  +
  +    /**
  +     * Set the object name of the Host this bean refers to.
  +     */
  +    public void setObjectName(String objectName) {
  +
  +        this.objectName = objectName;
  +
       }
  +
       
       /**
  -     * Set the node label.
  +     * Return the object name of the service this host belongs to.
        */
  -    public void setNodeLabel(String nodeLabel) {
  -        
  -        this.nodeLabel = nodeLabel;
  -        
  +    public String getServiceName() {
  +
  +        return this.serviceName;
  +
  +    }
  +
  +
  +    /**
  +     * Set the object name of the Service this host belongs to.
  +     */
  +    public void setServiceName(String serviceName) {
  +
  +        this.serviceName = serviceName;
  +
       }
       
       /**
  -     * Return the selected node host name to lookup mBean.
  +     * Return the label of the node that was clicked.
        */
  -    public String getHostName() {
  +    public String getNodeLabel() {
           
  -        return this.hostName;
  +        return this.nodeLabel;
           
       }
       
       /**
  -     * Set the selected node host name to lookup mBean.
  +     * Set the node label.
        */
  -    public void setHostName(String hostName) {
  +    public void setNodeLabel(String nodeLabel) {
           
  -        this.hostName = hostName;
  +        this.nodeLabel = nodeLabel;
           
       }
       
       /**
        * Return the host name.
        */
  -    public String getName() {
  +    public String getHostName() {
           
  -        return this.name;
  +        return this.hostName;
           
       }
       
       /**
        * Set the host name.
        */
  -    public void setName(String name) {
  +    public void setHostName(String hostName) {
           
  -        this.name = name;
  +        this.hostName = hostName;
           
       }
       
  @@ -229,7 +279,7 @@
       /**
        * Return the debugVals.
        */
  -    public ArrayList getDebugLvlVals() {
  +    public List getDebugLvlVals() {
           
           return this.debugLvlVals;
           
  @@ -238,7 +288,7 @@
       /**
        * Set the debugVals.
        */
  -    public void setDebugLvlVals(ArrayList debugLvlVals) {
  +    public void setDebugLvlVals(List debugLvlVals) {
           
           this.debugLvlVals = debugLvlVals;
           
  @@ -267,7 +317,7 @@
       /**
        * Return the booleanVals.
        */
  -    public ArrayList getBooleanVals() {
  +    public List getBooleanVals() {
           
           return this.booleanVals;
           
  @@ -276,7 +326,7 @@
       /**
        * Set the booleanVals.
        */
  -    public void setBooleanVals(ArrayList booleanVals) {
  +    public void setBooleanVals(List booleanVals) {
           
           this.booleanVals = booleanVals;
           
  @@ -285,7 +335,7 @@
       /**
        * Return the List of alias Vals.
        */
  -    public ArrayList getAliasVals() {
  +    public List getAliasVals() {
           
           return this.aliasVals;
           
  @@ -294,7 +344,7 @@
       /**
        * Set the alias Vals.
        */
  -    public void setAliasVals(ArrayList aliasVals) {
  +    public void setAliasVals(List aliasVals) {
           
           this.aliasVals = aliasVals;
           
  @@ -310,13 +360,39 @@
        */
       public void reset(ActionMapping mapping, HttpServletRequest request) {
           
  -        this.name = null;
  +        this.objectName = null;        
  +        this.serviceName = null;
  +        this.hostName = null;
           this.appBase = null;
           this.debugLvl = "0";
           this.unpackWARs = "false";
           
       }
       
  +     /**
  +     * Render this object as a String.
  +     */
  +    public String toString() {
  +
  +        StringBuffer sb = new StringBuffer("HostForm[adminAction=");
  +        sb.append(adminAction);
  +        sb.append(",debugLvl=");
  +        sb.append(debugLvl);
  +        sb.append(",appBase=");
  +        sb.append(appBase);
  +        sb.append(",unpackWARs=");
  +        sb.append(unpackWARs);
  +        sb.append("',objectName='");
  +        sb.append(objectName);
  +        sb.append("',hostName=");
  +        sb.append(hostName);
  +        sb.append("',serviceName=");
  +        sb.append(serviceName);
  +        sb.append("]");
  +        return (sb.toString());
  +
  +    }
  +
       /**
        * Validate the properties that have been set from this HTTP request,
        * and return an <code>ActionErrors</code> object that encapsulates any
  @@ -338,9 +414,9 @@
           // 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"));
  +            // hostName cannot be null
  +            if ((hostName== null) || (hostName.length() < 1)) {
  +                errors.add("hostName", new ActionError("error.hostName.required"));
               }
               
               // appBase cannot be null
  
  
  
  1.1                  
jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/host/EditHostAction.java
  
  Index: EditHostAction.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/host/EditHostAction.java,v
 1.1 2002/03/14 08:49:41 manveen Exp $
   * $Revision: 1.1 $
   * $Date: 2002/03/14 08:49:41 $
   *
   * ====================================================================
   *
   * 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.host;
  
  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 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 Host</em> transactions.
   *
   * @author Manveen Kaur
   * @version $Revision: 1.1 $ $Date: 2002/03/14 08:49:41 $
   */
  
  public class EditHostAction 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 hname = null;
          StringBuffer sb = null;
          try {
              hname = new ObjectName(request.getParameter("select"));
          } catch (Exception e) {
              String message =
                  resources.getMessage("error.hostName.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
          HostForm hostFm = new HostForm();
          session.setAttribute("hostForm", hostFm);
          hostFm.setAdminAction("Edit");
          hostFm.setObjectName(hname.toString());
          sb = new StringBuffer("Host (");
          sb.append(hname.getKeyProperty("name"));
          sb.append(")");
          hostFm.setNodeLabel(sb.toString());
          hostFm.setDebugLvlVals(Lists.getDebugLevels());
          hostFm.setBooleanVals(Lists.getBooleanValues());
          
          String attribute = null;
          try {
  
              // Copy scalar properties
              attribute = "name";
              hostFm.setHostName
                  ((String) mBServer.getAttribute(hname, attribute));
              attribute = "debug";
              hostFm.setDebugLvl
                  (((Integer) mBServer.getAttribute(hname, attribute)).toString());
              attribute = "appBase";
              hostFm.setAppBase
                  ((String) mBServer.getAttribute(hname, attribute));
              attribute = "unpackWARs";
              hostFm.setUnpackWARs
                  (((Boolean) mBServer.getAttribute(hname, 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);
          }
  
          // retrieve all aliases
          String operation = null;
          try {
              operation = "findAliases";
              String aliases[] = 
                  (String[]) mBServer.invoke(hname, operation, null, null);
              
              hostFm.setAliasVals(new ArrayList(Arrays.asList(aliases)));
  
          } catch (Throwable t) {
              getServlet().log
              (resources.getMessage(locale, "users.error.invoke",
                                    operation), t);
              response.sendError
                  (HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
                  resources.getMessage(locale, "users.error.invoke",
                                       operation));
              return (null);            
          }
                  
          // Forward to the host display page
          return (mapping.findForward("Host"));
          
      }
  }
  
  
  
  1.1                  
jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/host/SaveHostAction.java
  
  Index: SaveHostAction.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/host/SaveHostAction.java,v
 1.1 2002/03/14 08:49:41 manveen Exp $
   * $Revision: 1.1 $
   * $Date: 2002/03/14 08:49:41 $
   *
   * ====================================================================
   *
   * 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", "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 [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.host;
  
  
  import java.net.URLEncoder;
  import java.util.Iterator;
  import java.util.Locale;
  import java.io.IOException;
  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.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.ActionError;
  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 org.apache.webapp.admin.ApplicationServlet;
  import org.apache.webapp.admin.TomcatTreeBuilder;
  import org.apache.webapp.admin.TreeControl;
  import org.apache.webapp.admin.TreeControlNode;
  
  
  
  /**
   * The <code>Action</code> that completes <em>Add Host</em> and
   * <em>Edit Host</em> transactions.
   *
   * @author Manveen Kaur
   * @version $Revision: 1.1 $ $Date: 2002/03/14 08:49:41 $
   */
  
  public final class SaveHostAction extends Action {
  
  
      // ----------------------------------------------------- Instance Variables
  
      /**
       * Signature for the <code>createStandardHost</code> operation.
       */
      private String createStandardHostTypes[] =
      { "java.lang.String",     // parent
        "java.lang.String",     // name
        "java.lang.String",     // appBase
        "boolean",              // unpackWARs
      };
  
      /**
       * 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);
          }
          
          // Identify the requested action
          HostForm hform = (HostForm) form;
          String adminAction = hform.getAdminAction();
          String hObjectName = hform.getObjectName();
  
          // Perform a "Create Host" transaction (if requested)
          if ("Create".equals(adminAction)) {
  
              String operation = null;
              Object values[] = null;
              
              try {
                  
                  String serviceName = hform.getServiceName();
  
                  // Ensure that the requested host name is unique
                  ObjectName oname =
                      new ObjectName(TomcatTreeBuilder.HOST_TYPE +
                                     ",name=" + hform.getHostName() +
                                     ",service=" + serviceName);
                  if (mBServer.isRegistered(oname)) {
                      ActionErrors errors = new ActionErrors();
                      errors.add("hostName",
                                 new ActionError("error.hostName.exists"));
                      saveErrors(request, errors);
                      return (new ActionForward(mapping.getInput()));
                  }
                  
                  // Look up our MBeanFactory MBean
                  ObjectName fname =
                      new ObjectName(TomcatTreeBuilder.FACTORY_TYPE);
  
                  // Create a new StandardHost object
                  values = new Object[4];
                  values[0] = 
                      TomcatTreeBuilder.ENGINE_TYPE + ",service=" + serviceName;
                  values[1] = hform.getHostName();
                  values[2] = hform.getAppBase();
                  values[3] = new Boolean(hform.getUnpackWARs());
                  
                  operation = "createStandardHost";
                  hObjectName = (String)
                      mBServer.invoke(fname, operation,
                                      values, createStandardHostTypes);
  
                  // Add the new Host to our tree control node
                  TreeControl control = (TreeControl)
                      session.getAttribute("treeControlTest");
                  if (control != null) {
                      String parentName = 
                            TomcatTreeBuilder.SERVICE_TYPE + ",name=" + serviceName;
                      TreeControlNode parentNode = control.findNode(parentName);
                      if (parentNode != null) {
                          String nodeLabel =
                              "Host (" + hform.getHostName() + ")";
                          String encodedName =
                              URLEncoder.encode(hObjectName);
                          TreeControlNode childNode =
                              new TreeControlNode(hObjectName,
                                                  "folder_16_pad.gif",
                                                  nodeLabel,
                                                  "EditHost.do?select=" +
                                                  encodedName,
                                                  "content",
                                                  true);
                          parentNode.addChild(childNode);
                          // FIXME - force a redisplay
                      } else {
                          getServlet().log
                              ("Cannot find parent node '" + parentName + "'");
                      }
                  } else {
                      getServlet().log
                          ("Cannot find TreeControlNode!");
                  }
  
              } catch (Exception e) {
                  getServlet().log
                      (resources.getMessage(locale, "users.error.invoke",
                                            operation), e);
                  response.sendError
                      (HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
                       resources.getMessage(locale, "users.error.invoke",
                                            operation));
                  return (null);
  
              }
  
          }
  
          // Perform attribute updates as requested
          String attribute = null;
          try {
  
              ObjectName honame = new ObjectName(hObjectName);
  
              attribute = "debug";
              int debug = 0;
              try {
                  debug = Integer.parseInt(hform.getDebugLvl());
              } catch (Throwable t) {
                  debug = 0;
              }
              mBServer.setAttribute(honame,
                                    new Attribute("debug", new Integer(debug)));
  
              attribute = "appBase";
              String appBase = "";
              try {
                  appBase = hform.getAppBase();
              } catch (Throwable t) {
                  appBase = "";
              }
              mBServer.setAttribute(honame,
                                    new Attribute("appBase", appBase));
              
              attribute = "unpackWARs";
              String unpackWARs = "false";
              try {
                  unpackWARs = hform.getUnpackWARs();
              } catch (Throwable t) {
                  unpackWARs = "false";
              }
              mBServer.setAttribute(honame,
                                    new Attribute("unpackWARs", new 
Boolean(unpackWARs)));
  
          } catch (Exception e) {
  
              getServlet().log
                  (resources.getMessage(locale, "users.error.attribute.set",
                                        attribute), e);
              response.sendError
                  (HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
                   resources.getMessage(locale, "users.error.attribute.set",
                                        attribute));
              return (null);
          }
          
          // Forward to the success reporting page
          session.removeAttribute(mapping.getAttribute());
          return (mapping.findForward("Save Successful"));
          
      }
      
  }
  
  
  
  1.4       +55 -36    jakarta-tomcat-4.0/webapps/admin/host/host.jsp
  
  Index: host.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/host/host.jsp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- host.jsp  9 Mar 2002 00:10:57 -0000       1.3
  +++ host.jsp  14 Mar 2002 08:49:41 -0000      1.4
  @@ -1,6 +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" %>
  @@ -17,21 +17,33 @@
   
   <html:errors/>
   
  -<html:form method="POST" action="/host" focus="name">
  +<html:form method="POST" action="/SaveHost">
   
  +  <bean:define id="hostName" name="hostForm" property="hostName"/>
  +  <bean:define id="thisObjectName" type="java.lang.String"
  +               name="hostForm" property="objectName"/>
  +  <html:hidden property="adminAction"/>
  +  <html:hidden property="objectName"/>
  +  <html:hidden property="serviceName"/>
  +  
     <table width="100%" border="0" cellspacing="0" cellpadding="0">
       <tr class="page-title-row">
         <td align="left" nowrap>
  -        <div class="page-title-text">
  -            <bean:write name="hostForm" property="nodeLabel" scope="session"/>
  -            <bean:define id="hostName" name="hostForm" property="hostName"/>
  +        <div class="page-title-text" align="left">
  +          <logic:equal name="hostForm" property="adminAction" value="Create">
  +            <bean:message key="actions.hosts.create"/>
  +          </logic:equal>
  +          <logic:equal name="hostForm" property="adminAction" value="Edit">
  +            <bean:message key="actions.hosts.edit"/>
  +          </logic:equal>
           </div>
         </td>
  -      <td align="right" nowrap> 
  +      <td width="19%"> 
          <div align="right">
           <controls:actions>
               <controls:action selected="true"> -----<bean:message 
key="actions.available.actions"/>----- </controls:action>
               <controls:action> ------------------------------------- 
</controls:action>
  +            <logic:notEqual name="hostForm" property="adminAction" value="Create">  
            
               <%--
               <controls:action url="">  <bean:message 
key="actions.accesslogger.create"/> </controls:action>
               <controls:action url="">  <bean:message 
key="actions.accesslogger.delete"/> </controls:action>
  @@ -52,28 +64,25 @@
               <controls:action url="">  <bean:message key="actions.valve.delete"/> 
</controls:action>
               <controls:action> ------------------------------------- 
</controls:action>
               --%>
  -            <%--
  -            <controls:action url='<%= "/setUpDeleteHost.do?this=" + 
  -                             java.net.URLEncoder.encode(hostName.toString()) %>'>  
  -                <bean:message key="actions.thishost.delete"/> 
  +            <controls:action url='<%= "/DeleteHost.do?select=" + 
  +                                        URLEncoder.encode(thisObjectName) %>'>  
  +                <bean:message key="actions.hosts.delete"/> 
               </controls:action>
  -            --%>
  -        </controls:actions>
  -          </div>
  +           </logic:notEqual>          
  +         </controls:actions>
  +       </div>
         </td>
       </tr>
     </table>
   
     <%@ include file="../buttons.jsp" %>
  -<br>
  +  <br>
   
  + <%-- Host Properties --%>
    <table border="0" cellspacing="0" cellpadding="0" width="100%">
  -    <tr> <td> 
  -        <div class="table-title-text"> 
  -            <bean:message key="host.properties"/>
  -             <html:hidden property="hostName"/>
  -        </div>
  -    </td> </tr>
  +    <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%">
  @@ -82,19 +91,27 @@
           <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: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:label>
  +                <bean:message key="host.name"/>:
  +            </controls:label>
               <controls:data>
  -<%-- FIXME - input only allowed on create transaction --%>
  -<%--
  -              <html:text property="name" size="24" maxlength="24"/>
  ---%>
  -              <bean:write name="hostForm" property="name"/>
  -              <html:hidden property="name"/>
  +            <%-- input only allowed on create transaction --%>
  +             <logic:equal name="hostForm" property="adminAction" value="Create">
  +              <html:text property="hostName" size="24" maxlength="24"/>
  +             </logic:equal>
  +             <logic:equal name="hostForm" property="adminAction" value="Edit">
  +              <bean:write name="hostForm" property="hostName"/>
  +              <html:hidden property="hostName"/>
  +             </logic:equal>
               </controls:data>
           </controls:row>
   
  @@ -102,12 +119,13 @@
           <controls:row labelStyle="table-label-text" dataStyle="table-normal-text">
               <controls:label><bean:message key="host.base"/>:</controls:label>
               <controls:data>
  -<%-- FIXME - input only allowed on create transaction --%>
  -<%--
  +             <logic:equal name="hostForm" property="adminAction" value="Create">
                 <html:text property="appBase" size="24"/>
  ---%>
  +             </logic:equal>
  +             <logic:equal name="hostForm" property="adminAction" value="Edit">
                 <bean:write name="hostForm" property="appBase"/>
                 <html:hidden property="appBase"/>
  +             </logic:equal>
               </controls:data>
           </controls:row>
   
  @@ -141,7 +159,8 @@
   <br>
   <br>
   
  - <!-- Aliases -->
  +<%-- Aliases List --%>
  + <logic:notEqual name="hostForm" property="adminAction" value="Create">             
 
    <table border="0" cellspacing="0" cellpadding="0" width="100%">
       <tr> <td> 
           <div class="table-title-text"> 
  @@ -150,7 +169,7 @@
       </td> </tr>
     </table>
   
  - <table class="back-table" border="0" cellspacing="0" cellpadding="1" width="100%">
  +  <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"> 
  @@ -166,8 +185,8 @@
            </table>
   
       </td> </tr>
  - </table>
  -  <!-- Alias table end -->
  +  </table>
  + </logic:notEqual>
   
     <%@ include file="../buttons.jsp" %>
   
  
  
  
  1.1                  jakarta-tomcat-4.0/webapps/admin/host/hosts.jsp
  
  Index: hosts.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="../users/header.jsp" %>
  
  <!-- Body -->
  <body bgcolor="white">
  
  <!--Form -->
  
  <html:errors/>
  
  <html:form method="POST" action="/DeleteHosts">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr bgcolor="7171A5">
        <td width="81%"> 
          <div class="page-title-text" align="left">
            <bean:message key="actions.hosts.delete"/>
          </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:actions>
          </div>
        </td>
      </tr>
    </table>
  
  <%@ include file="../buttons.jsp" %>    
    <br>
  
    <%-- Hosts List --%>
  
    <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><div align="left" class="table-header-text">
                <bean:message key="actions.delete"/>
              </div></td>
              <td><div align="left" class="table-header-text">
                <bean:message key="host.name"/>
              </div></td>
            </tr>
  
          <logic:iterate name="hostsList" id="host">
            <tr class="line-row">
              <td><div align="left" class="table-normal-text">&nbsp;
                <html:multibox property="hosts"
                                  value="<%= host.toString() %>"/>
              </div></td>
              <td><div align="left" class="table-normal-text">&nbsp;
                <html:link page='<%= "/EditHost.do?select=" + 
                           java.net.URLEncoder.encode(host.toString()) %>'>
                  <controls:attribute name="host" attribute="name"/>
                </html:link>
              </div></td>
            </tr>
          </logic:iterate>
          </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