Hi,

Please commit my patch to the head branch.

thanks,
Manveen

Comments:
-----------
* 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.

New files to be added:
host.jsp -> jakarta-tomcat-4.0/webapps/admin
HostAction, HostForm, SetUpHostAction.java -->
jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin
Index: connector.jsp
===================================================================
RCS file: /home/cvspublic/jakarta-tomcat-4.0/webapps/admin/connector.jsp,v
retrieving revision 1.1
diff -u -r1.1 connector.jsp
--- connector.jsp       5 Jan 2002 20:45:03 -0000       1.1
+++ connector.jsp       10 Jan 2002 02:30:57 -0000
@@ -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">
Index: server.jsp
===================================================================
RCS file: /home/cvspublic/jakarta-tomcat-4.0/webapps/admin/server.jsp,v
retrieving revision 1.5
diff -u -r1.5 server.jsp
--- server.jsp  5 Jan 2002 21:09:15 -0000       1.5
+++ server.jsp  10 Jan 2002 02:30:58 -0000
@@ -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">
Index: service.jsp
===================================================================
RCS file: /home/cvspublic/jakarta-tomcat-4.0/webapps/admin/service.jsp,v
retrieving revision 1.3
diff -u -r1.3 service.jsp
--- service.jsp 3 Jan 2002 23:21:53 -0000       1.3
+++ service.jsp 10 Jan 2002 02:30:59 -0000
@@ -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">
cvs server: Diffing WEB-INF
Index: WEB-INF/struts-config.xml
===================================================================
RCS file: /home/cvspublic/jakarta-tomcat-4.0/webapps/admin/WEB-INF/struts-config.xml,v
retrieving revision 1.13
diff -u -r1.13 struts-config.xml
--- WEB-INF/struts-config.xml   5 Jan 2002 20:45:03 -0000       1.13
+++ WEB-INF/struts-config.xml   10 Jan 2002 02:31:00 -0000
@@ -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>
cvs server: Diffing WEB-INF/classes
cvs server: Diffing WEB-INF/classes/org
cvs server: Diffing WEB-INF/classes/org/apache
cvs server: Diffing WEB-INF/classes/org/apache/webapp
cvs server: Diffing WEB-INF/classes/org/apache/webapp/admin
Index: WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_en.properties
===================================================================
RCS file: 
/home/cvspublic/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_en.properties,v
retrieving revision 1.11
diff -u -r1.11 ApplicationResources_en.properties
--- WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_en.properties  5 Jan 
2002 20:45:03 -0000       1.11
+++ WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_en.properties  10 Jan 
+2002 02:31:01 -0000
@@ -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
Index: WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_es.properties
===================================================================
RCS file: 
/home/cvspublic/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_es.properties,v
retrieving revision 1.14
diff -u -r1.14 ApplicationResources_es.properties
--- WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_es.properties  9 Jan 
2002 20:07:12 -0000       1.14
+++ WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_es.properties  10 Jan 
+2002 02:31:02 -0000
@@ -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
Index: WEB-INF/classes/org/apache/webapp/admin/ConnectorForm.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ConnectorForm.java,v
retrieving revision 1.1
diff -u -r1.1 ConnectorForm.java
--- WEB-INF/classes/org/apache/webapp/admin/ConnectorForm.java  5 Jan 2002 20:45:03 
-0000       1.1
+++ WEB-INF/classes/org/apache/webapp/admin/ConnectorForm.java  10 Jan 2002 02:31:04 
+-0000
@@ -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;
         
     }
     
Index: WEB-INF/classes/org/apache/webapp/admin/LabelValueBean.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/LabelValueBean.java,v
retrieving revision 1.1
diff -u -r1.1 LabelValueBean.java
--- WEB-INF/classes/org/apache/webapp/admin/LabelValueBean.java 6 Dec 2001 22:55:57 
-0000       1.1
+++ WEB-INF/classes/org/apache/webapp/admin/LabelValueBean.java 10 Jan 2002 02:31:05 
+-0000
@@ -62,7 +62,6 @@
 
 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.
Index: WEB-INF/classes/org/apache/webapp/admin/ServerForm.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ServerForm.java,v
retrieving revision 1.5
diff -u -r1.5 ServerForm.java
--- WEB-INF/classes/org/apache/webapp/admin/ServerForm.java     5 Jan 2002 20:45:03 
-0000       1.5
+++ WEB-INF/classes/org/apache/webapp/admin/ServerForm.java     10 Jan 2002 02:31:07 
+-0000
@@ -81,6 +81,14 @@
     
     // ----------------------------------------------------- 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.
Index: WEB-INF/classes/org/apache/webapp/admin/ServiceForm.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ServiceForm.java,v
retrieving revision 1.2
diff -u -r1.2 ServiceForm.java
--- WEB-INF/classes/org/apache/webapp/admin/ServiceForm.java    20 Dec 2001 09:31:52 
-0000      1.2
+++ WEB-INF/classes/org/apache/webapp/admin/ServiceForm.java    10 Jan 2002 02:31:08 
+-0000
@@ -80,12 +80,15 @@
     
     // ----------------------------------------------------- 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.
      */
Index: WEB-INF/classes/org/apache/webapp/admin/SetUpConnectorAction.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/SetUpConnectorAction.java,v
retrieving revision 1.1
diff -u -r1.1 SetUpConnectorAction.java
--- WEB-INF/classes/org/apache/webapp/admin/SetUpConnectorAction.java   5 Jan 2002 
20:45:03 -0000       1.1
+++ WEB-INF/classes/org/apache/webapp/admin/SetUpConnectorAction.java   10 Jan 2002 
+02:31:11 -0000
@@ -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());
         
Index: WEB-INF/classes/org/apache/webapp/admin/SetUpServerAction.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/SetUpServerAction.java,v
retrieving revision 1.6
diff -u -r1.6 SetUpServerAction.java
--- WEB-INF/classes/org/apache/webapp/admin/SetUpServerAction.java      20 Dec 2001 
09:31:52 -0000      1.6
+++ WEB-INF/classes/org/apache/webapp/admin/SetUpServerAction.java      10 Jan 2002 
+02:31:12 -0000
@@ -102,17 +102,17 @@
  */
 
 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"));
-
+        
     }
-
-
+    
+    
 }
Index: WEB-INF/classes/org/apache/webapp/admin/SetUpServiceAction.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/SetUpServiceAction.java,v
retrieving revision 1.4
diff -u -r1.4 SetUpServiceAction.java
--- WEB-INF/classes/org/apache/webapp/admin/SetUpServiceAction.java     20 Dec 2001 
09:31:52 -0000      1.4
+++ WEB-INF/classes/org/apache/webapp/admin/SetUpServiceAction.java     10 Jan 2002 
+02:31:14 -0000
@@ -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());
Index: WEB-INF/classes/org/apache/webapp/admin/TomcatTreeBuilder.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/TomcatTreeBuilder.java,v
retrieving revision 1.4
diff -u -r1.4 TomcatTreeBuilder.java
--- WEB-INF/classes/org/apache/webapp/admin/TomcatTreeBuilder.java      5 Jan 2002 
20:45:03 -0000       1.4
+++ WEB-INF/classes/org/apache/webapp/admin/TomcatTreeBuilder.java      10 Jan 2002 
+02:31:16 -0000
@@ -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);
+        }        
+    }
 }

Attachment: host.jsp
Description: application/unknown-content-type-jspfile

/*
 * $Header: Exp $
 * $Revision: $
 * $Date: $
 *
 * ====================================================================
 *
 * 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 [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;

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:  $ $Date: $
 */

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;
        
    }
    
}
/*
 * $Header: Exp $
 * $Revision: $
 * $Date: $
 *
 * ====================================================================
 *
 * 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 [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;

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:  $Date: $
 */

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"));
        
    }
    
}
/*
 * $Header:  Exp $
 * $Revision:  $
 * $Date: $
 *
 * ====================================================================
 *
 * 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 [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;


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:  $ $Date:  $
 */

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:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to