You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by cr...@apache.org on 2002/03/08 01:12:30 UTC

cvs commit: jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/service AddServiceAction.java EditServiceAction.java SaveServiceAction.java ServiceForm.java

craigmcc    02/03/07 16:12:30

  Modified:    catalina/src/share/org/apache/catalina/mbeans
                        MBeanUtils.java
               webapps/admin/WEB-INF/classes/org/apache/webapp/admin
                        ApplicationResources_en.properties
               webapps/admin/WEB-INF/classes/org/apache/webapp/admin/service
                        AddServiceAction.java EditServiceAction.java
                        SaveServiceAction.java ServiceForm.java
  Added:       webapps/admin/WEB-INF/classes/org/apache/webapp/admin
                        Lists.java
  Log:
  Minor cleanups and fixes:
  - When generating MBean Names for Valves, put the sequence property on
    the end, so that sorting the bean names alphabetically is useful.
  - Refactor common list creation activities into a new utility class.
  - Respect changes to the default host property on the Services screen.
  - Change back to "(None)" no the default host select box to indicate
    that no default host is desired.
  
  Revision  Changes    Path
  1.28      +13 -13    jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanUtils.java
  
  Index: MBeanUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanUtils.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- MBeanUtils.java	19 Feb 2002 22:16:00 -0000	1.27
  +++ MBeanUtils.java	8 Mar 2002 00:12:29 -0000	1.28
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanUtils.java,v 1.27 2002/02/19 22:16:00 craigmcc Exp $
  - * $Revision: 1.27 $
  - * $Date: 2002/02/19 22:16:00 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanUtils.java,v 1.28 2002/03/08 00:12:29 craigmcc Exp $
  + * $Revision: 1.28 $
  + * $Date: 2002/03/08 00:12:29 $
    *
    * ====================================================================
    *
  @@ -109,7 +109,7 @@
    *
    * @author Craig R. McClanahan
    * @author Amy Roh
  - * @version $Revision: 1.27 $ $Date: 2002/02/19 22:16:00 $
  + * @version $Revision: 1.28 $ $Date: 2002/03/08 00:12:29 $
    */
   
   public class MBeanUtils {
  @@ -1164,15 +1164,15 @@
   
           if (container instanceof Engine) {
               Service service = ((Engine)container).getService();
  -            name = new ObjectName(domain + ":type=Valve,sequence=" +
  -                                  valve.hashCode() + ",service=" +
  -                                  service.getName());
  +            name = new ObjectName(domain + ":type=Valve,service=" +
  +                                  service.getName() + ",sequence=" +
  +                                  valve.hashCode());
           } else if (container instanceof Host) {
               Service service = ((Engine)container.getParent()).getService();
  -            name = new ObjectName(domain + ":type=Valve,sequence=" +
  -                                  valve.hashCode() + ",host=" +
  +            name = new ObjectName(domain + ":type=Valve,host=" +
                                     container.getName() + ",service=" +
  -                                  service.getName());
  +                                  service.getName() + ",sequence=" +
  +                                  valve.hashCode());
           } else if (container instanceof Context) {
               String path = ((Context)container).getPath();
               if (path.length() < 1) {
  @@ -1180,11 +1180,11 @@
               }
               Host host = (Host) container.getParent();
               Service service = ((Engine) host.getParent()).getService();
  -            name = new ObjectName(domain + ":type=Valve,sequence=" +
  -                                  valve.hashCode() + ",path=" +
  +            name = new ObjectName(domain + ":type=Valve,path=" +
                                     path + ",host=" +
                                     host.getName() + ",service=" +
  -                                  service.getName());
  +                                  service.getName() + ",sequence=" +
  +                                  valve.hashCode());
           }
   
           return (name);
  
  
  
  1.32      +3 -0      jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_en.properties
  
  Index: ApplicationResources_en.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_en.properties,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- ApplicationResources_en.properties	7 Mar 2002 02:48:54 -0000	1.31
  +++ ApplicationResources_en.properties	8 Mar 2002 00:12:29 -0000	1.32
  @@ -138,6 +138,7 @@
   error.mgrMaxSessions.required=<li>Maximum sessions cannot be empty</li>
   error.mgrMaxSessions.format=<li>Maximum sessions not a valid integer!</li>
   error.mgrMaxSessions.range=<li>Maximum sessions seems out of range. Valid range is -1 to 100. </li>
  +list.none=(None)
   logger.directory=Directory
   logger.prefix=Prefix
   logger.suffix=Suffix
  @@ -160,6 +161,8 @@
   error.set.attributes=Error setting information properties.
   actions.delete=Delete
   error.defaultHost.required=<li>Default Hostname required</li>
  +error.engineName.bad=Invalid engine name {0}
  +error.serviceName.bad=Invalid service name {0}
   error.serviceName.required=<li>Service Name required</li>
   error.serviceName.exists=<li>Service Name already exists</li>
   actions.thisrealm.delete=Delete this User Realm
  
  
  
  1.1                  jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/Lists.java
  
  Index: Lists.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/Lists.java,v 1.1 2002/03/08 00:12:29 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2002/03/08 00:12:29 $
   *
   * ====================================================================
   *
   * 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 apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.webapp.admin;
  
  
  import java.util.ArrayList;
  import java.util.Collections;
  import java.util.Iterator;
  import java.util.List;
  import javax.management.MBeanServer;
  import javax.management.ObjectName;
  
  
  /**
   * General purpose utility methods to create lists of objects that are
   * commonly required in building the user interface.  In all cases, if there
   * are no matching elements, a zero-length list (rather than <code>null</code>)
   * is returned.
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2002/03/08 00:12:29 $
   */
  
  public class Lists {
  
  
      // ----------------------------------------------------------- Constructors
  
  
      /**
       * Protected constructor to prevent instantiation.
       */
      protected Lists() { }
  
  
      // ------------------------------------------------------- Static Variables
  
  
      /**
       * Precomputed list of debug level labels and values.
       */
      private static List debugLevels = new ArrayList();
  
      static {
          debugLevels.add(new LabelValueBean("0", "0"));
          debugLevels.add(new LabelValueBean("1", "1"));
          debugLevels.add(new LabelValueBean("2", "2"));
          debugLevels.add(new LabelValueBean("3", "3"));
          debugLevels.add(new LabelValueBean("4", "4"));
          debugLevels.add(new LabelValueBean("5", "5"));
          debugLevels.add(new LabelValueBean("6", "6"));
          debugLevels.add(new LabelValueBean("7", "7"));
          debugLevels.add(new LabelValueBean("8", "8"));
          debugLevels.add(new LabelValueBean("9", "9"));
      }
  
  
      // --------------------------------------------------------- Public Methods
  
  
      /**
       * Return a <code>List</code> of {@link LabelValueBean}s for the legal
       * settings for <code>debug</code> properties.
       */
      public static List getDebugLevels() {
  
          return (debugLevels);
  
      }
  
  
      /**
       * Return a list of <code>Connector</code> object name strings
       * for the specified <code>Service</code> object name.
       *
       * @param mbserver MBeanServer from which to retrieve the list
       * @param service Object name of the service for which to select connectors
       *
       * @exception Exception if thrown while retrieving the list
       */
      public static List getConnectors(MBeanServer mbserver, ObjectName service)
          throws Exception {
  
          StringBuffer sb = new StringBuffer(service.getDomain());
          sb.append(":type=Connector,service=");
          sb.append(service.getKeyProperty("name"));
          sb.append(",*");
          ObjectName search = new ObjectName(sb.toString());
          ArrayList connectors = new ArrayList();
          Iterator names = mbserver.queryNames(search, null).iterator();
          while (names.hasNext()) {
              connectors.add(names.next().toString());
          }
          Collections.sort(connectors);
          return (connectors);
  
      }
  
  
      /**
       * Return a list of <code>Connector</code> object name strings
       * for the specified <code>Service</code> object name.
       *
       * @param mbserver MBeanServer from which to retrieve the list
       * @param service Object name of the service for which to select connectors
       *
       * @exception Exception if thrown while retrieving the list
       */
      public static List getConnectors(MBeanServer mbserver, String service)
          throws Exception {
  
          return (getConnectors(mbserver, new ObjectName(service)));
  
      }
  
  
      /**
       * Return a list of <code>Context</code> object name strings
       * for the specified <code>Host</code> object name.
       *
       * @param mbserver MBeanServer from which to retrieve the list
       * @param host Object name of the host for which to select contexts
       *
       * @exception Exception if thrown while retrieving the list
       */
      public static List getContexts(MBeanServer mbserver, ObjectName host)
          throws Exception {
  
          StringBuffer sb = new StringBuffer(host.getDomain());
          sb.append(":type=Context,host=");
          sb.append(host.getKeyProperty("name"));
          sb.append(",service=");
          sb.append(host.getKeyProperty("service"));
          sb.append(",*");
          ObjectName search = new ObjectName(sb.toString());
          ArrayList contexts = new ArrayList();
          Iterator names = mbserver.queryNames(search, null).iterator();
          while (names.hasNext()) {
              contexts.add(names.next().toString());
          }
          Collections.sort(contexts);
          return (contexts);
  
      }
  
  
      /**
       * Return a list of <code>Context</code> object name strings
       * for the specified <code>Host</code> object name.
       *
       * @param mbserver MBeanServer from which to retrieve the list
       * @param host Object name of the host for which to select contexts
       *
       * @exception Exception if thrown while retrieving the list
       */
      public static List getContexts(MBeanServer mbserver, String host)
          throws Exception {
  
          return (getContexts(mbserver, new ObjectName(host)));
  
      }
  
  
      /**
       * Return a list of <code>Host</code> object name strings
       * for the specified <code>Service</code> object name.
       *
       * @param mbserver MBeanServer from which to retrieve the list
       * @param service Object name of the service for which to select hosts
       *
       * @exception Exception if thrown while retrieving the list
       */
      public static List getHosts(MBeanServer mbserver, ObjectName service)
          throws Exception {
  
          StringBuffer sb = new StringBuffer(service.getDomain());
          sb.append(":type=Host,service=");
          sb.append(service.getKeyProperty("name"));
          sb.append(",*");
          ObjectName search = new ObjectName(sb.toString());
          ArrayList hosts = new ArrayList();
          Iterator names = mbserver.queryNames(search, null).iterator();
          while (names.hasNext()) {
              hosts.add(names.next().toString());
          }
          Collections.sort(hosts);
          return (hosts);
  
      }
  
  
      /**
       * Return a list of <code>Host</code> object name strings
       * for the specified <code>Service</code> object name.
       *
       * @param mbserver MBeanServer from which to retrieve the list
       * @param service Object name of the service for which to select hosts
       *
       * @exception Exception if thrown while retrieving the list
       */
      public static List getHosts(MBeanServer mbserver, String service)
          throws Exception {
  
          return (getHosts(mbserver, new ObjectName(service)));
  
      }
  
  
  }
  
  
  
  1.7       +20 -22    jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/service/AddServiceAction.java
  
  Index: AddServiceAction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/service/AddServiceAction.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- AddServiceAction.java	7 Mar 2002 02:48:54 -0000	1.6
  +++ AddServiceAction.java	8 Mar 2002 00:12:30 -0000	1.7
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/service/AddServiceAction.java,v 1.6 2002/03/07 02:48:54 craigmcc Exp $
  - * $Revision: 1.6 $
  - * $Date: 2002/03/07 02:48:54 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/service/AddServiceAction.java,v 1.7 2002/03/08 00:12:30 craigmcc Exp $
  + * $Revision: 1.7 $
  + * $Date: 2002/03/08 00:12:30 $
    *
    * ====================================================================
    *
  @@ -73,19 +73,25 @@
   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.LabelValueBean;
  +import org.apache.webapp.admin.Lists;
   
   /**
    * The <code>Action</code> that sets up <em>Add Service</em> transactions.
    *
    * @author Manveen Kaur
  - * @version $Revision: 1.6 $ $Date: 2002/03/07 02:48:54 $
  + * @version $Revision: 1.7 $ $Date: 2002/03/08 00:12:30 $
    */
   
   public class AddServiceAction extends Action {
           
  -    private ArrayList debugLvlList = null;
  -        
  +    /**
  +     * The MessageResources we will be retrieving messages from.
  +     */
  +    private MessageResources resources = null;
  +    
  +
       // --------------------------------------------------------- Public Methods
       
       /**
  @@ -109,24 +115,15 @@
                                    HttpServletResponse response)
           throws IOException, ServletException {
   
  -        // Initialize our debug levels list
  -        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"));
  +        // Acquire the resources that we need
  +        HttpSession session = request.getSession();
  +        Locale locale = (Locale) session.getAttribute(Action.LOCALE_KEY);
  +        if (resources == null) {
  +            resources = getServlet().getResources();
           }
           
           // Fill in the form values for display and editing
           ServiceForm serviceFm = new ServiceForm();
  -        HttpSession session = request.getSession();
           session.setAttribute("serviceForm", serviceFm);
           serviceFm.setAdminAction("Create");
           serviceFm.setObjectName("");
  @@ -135,9 +132,10 @@
           serviceFm.setEngineName("");
           serviceFm.setDebugLvl("0");
           serviceFm.setDefaultHost("localhost");
  -        serviceFm.setDebugLvlVals(debugLvlList);
  +        serviceFm.setDebugLvlVals(Lists.getDebugLevels());
           ArrayList hosts = new ArrayList();
  -        hosts.add(new LabelValueBean("----------", ""));
  +        hosts.add(new LabelValueBean
  +                  (resources.getMessage("list.none"), ""));
           serviceFm.setHostNameVals(hosts);
           
           // Forward to the service display page
  
  
  
  1.3       +23 -45    jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/service/EditServiceAction.java
  
  Index: EditServiceAction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/service/EditServiceAction.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- EditServiceAction.java	7 Mar 2002 02:48:54 -0000	1.2
  +++ EditServiceAction.java	8 Mar 2002 00:12:30 -0000	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/service/EditServiceAction.java,v 1.2 2002/03/07 02:48:54 craigmcc Exp $
  - * $Revision: 1.2 $
  - * $Date: 2002/03/07 02:48:54 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/service/EditServiceAction.java,v 1.3 2002/03/08 00:12:30 craigmcc Exp $
  + * $Revision: 1.3 $
  + * $Date: 2002/03/08 00:12:30 $
    *
    * ====================================================================
    *
  @@ -75,23 +75,23 @@
   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.struts.util.MessageResources;
  -
  -import org.apache.webapp.admin.LabelValueBean;
   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 Service</em> transactions.
    *
    * @author Manveen Kaur
  - * @version $Revision: 1.2 $ $Date: 2002/03/07 02:48:54 $
  + * @version $Revision: 1.3 $ $Date: 2002/03/08 00:12:30 $
    */
   
   public class EditServiceAction extends Action {
  @@ -109,10 +109,6 @@
       private MessageResources resources = null;
       
   
  -    private ArrayList debugLvlList = null;
  -    private ArrayList hostNameList = null;
  -    
  -    
       // --------------------------------------------------------- Public Methods
       
       /**
  @@ -136,21 +132,6 @@
                                    HttpServletResponse response)
           throws IOException, ServletException {
           
  -        // Initialize our debug levels list
  -        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"));
  -        }
  -        
           // Acquire the resources that we need
           HttpSession session = request.getSession();
           Locale locale = (Locale) session.getAttribute(Action.LOCALE_KEY);
  @@ -173,8 +154,9 @@
           try {
               sname = new ObjectName(request.getParameter("select"));
           } catch (Exception e) {
  -            String message = "Invalid service name '" +
  -                request.getParameter("select") + "'";
  +            String message =
  +                resources.getMessage("error.serviceName.bad",
  +                                     request.getParameter("select"));
               getServlet().log(message);
               response.sendError(HttpServletResponse.SC_BAD_REQUEST, message);
               return (null);
  @@ -185,10 +167,12 @@
               sb.append(sname.getKeyProperty("name"));
               ename = new ObjectName(sb.toString());
           } catch (Exception e) {
  -            String message = "Invalid engine name '" +
  -                sb.toString() + "'";
  +            String message =
  +                resources.getMessage("error.engineName.bad",
  +                                     sb.toString());
               getServlet().log(message);
               response.sendError(HttpServletResponse.SC_BAD_REQUEST, message);
  +            return (null);
           }
   
           // Fill in the form values for display and editing
  @@ -201,7 +185,7 @@
           sb.append(sname.getKeyProperty("name"));
           sb.append(")");
           serviceFm.setNodeLabel(sb.toString());
  -        serviceFm.setDebugLvlVals(debugLvlList);
  +        serviceFm.setDebugLvlVals(Lists.getDebugLevels());
           String attribute = null;
           try {
   
  @@ -220,21 +204,15 @@
                   ((String) mBServer.getAttribute(ename, attribute));
   
               // Build the list of available hosts
  -            ArrayList hosts = new ArrayList();
  -            hosts.add(new LabelValueBean("---------",""));
               attribute = "hosts";
  -            sb = new StringBuffer(TomcatTreeBuilder.HOST_TYPE);
  -            sb.append(TomcatTreeBuilder.WILDCARD);
  -            sb.append(",service=");
  -            sb.append(sname.getKeyProperty("name"));
  -            String search = sb.toString();
  -            Iterator hnames =
  -                mBServer.queryNames(new ObjectName(search), null).iterator();
  -            while (hnames.hasNext()) {
  -                ObjectName hname = (ObjectName) hnames.next();
  -                String hostName =
  -                    (String) mBServer.getAttribute(hname, "name");
  -                hosts.add(new LabelValueBean(hostName, hostName));
  +            ArrayList hosts = new ArrayList();
  +            hosts.add(new LabelValueBean
  +                      (resources.getMessage("list.none"), ""));
  +            Iterator items = Lists.getHosts(mBServer, sname).iterator();
  +            while (items.hasNext()) {
  +                ObjectName hname = new ObjectName((String) items.next());
  +                String name = hname.getKeyProperty("name");
  +                hosts.add(new LabelValueBean(name, name));
               }
               serviceFm.setHostNameVals(hosts);
   
  
  
  
  1.3       +17 -6     jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/service/SaveServiceAction.java
  
  Index: SaveServiceAction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/service/SaveServiceAction.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SaveServiceAction.java	7 Mar 2002 02:48:54 -0000	1.2
  +++ SaveServiceAction.java	8 Mar 2002 00:12:30 -0000	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/service/SaveServiceAction.java,v 1.2 2002/03/07 02:48:54 craigmcc Exp $
  - * $Revision: 1.2 $
  - * $Date: 2002/03/07 02:48:54 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/service/SaveServiceAction.java,v 1.3 2002/03/08 00:12:30 craigmcc Exp $
  + * $Revision: 1.3 $
  + * $Date: 2002/03/08 00:12:30 $
    *
    * ====================================================================
    *
  @@ -97,7 +97,7 @@
    * <em>Edit Service</em> transactions.
    *
    * @author Manveen Kaur
  - * @version $Revision: 1.2 $ $Date: 2002/03/07 02:48:54 $
  + * @version $Revision: 1.3 $ $Date: 2002/03/08 00:12:30 $
    */
   
   public final class SaveServiceAction extends Action {
  @@ -277,6 +277,9 @@
           String attribute = null;
           try {
   
  +            ObjectName soname = new ObjectName(sObjectName);
  +            ObjectName eoname = new ObjectName(eObjectName);
  +
               attribute = "debug";
               int debug = 0;
               try {
  @@ -284,10 +287,18 @@
               } catch (Throwable t) {
                   debug = 0;
               }
  -            mBServer.setAttribute(new ObjectName(sObjectName),
  +            mBServer.setAttribute(soname,
                                     new Attribute("debug", new Integer(debug)));
  -            mBServer.setAttribute(new ObjectName(eObjectName),
  +            mBServer.setAttribute(eoname,
                                     new Attribute("debug", new Integer(debug)));
  +
  +            attribute = "defaultHost";
  +            String defaultHost = sform.getDefaultHost();
  +            if ("".equals(defaultHost)) {
  +                defaultHost = null;
  +            }
  +            mBServer.setAttribute(eoname,
  +                                  new Attribute("defaultHost", defaultHost));
   
           } catch (Exception e) {
   
  
  
  
  1.5       +16 -18    jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/service/ServiceForm.java
  
  Index: ServiceForm.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/service/ServiceForm.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ServiceForm.java	7 Mar 2002 02:48:54 -0000	1.4
  +++ ServiceForm.java	8 Mar 2002 00:12:30 -0000	1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/service/ServiceForm.java,v 1.4 2002/03/07 02:48:54 craigmcc Exp $
  - * $Revision: 1.4 $
  - * $Date: 2002/03/07 02:48:54 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/service/ServiceForm.java,v 1.5 2002/03/08 00:12:30 craigmcc Exp $
  + * $Revision: 1.5 $
  + * $Date: 2002/03/08 00:12:30 $
    *
    * ====================================================================
    *
  @@ -67,13 +67,13 @@
   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 service page.
    *
    * @author Manveen Kaur
  - * @version $Revision: 1.4 $ $Date: 2002/03/07 02:48:54 $
  + * @version $Revision: 1.5 $ $Date: 2002/03/08 00:12:30 $
    */
   
   public final class ServiceForm extends ActionForm {
  @@ -120,13 +120,14 @@
        */
       private String debugLvl = "0";
           
  +
       /**
        * The text for the defaultHost Name.
        */
  -    private String defaultHost = "";
  +    private String defaultHost = null;
       
  -    private ArrayList debugLvlVals = null;
  -    private ArrayList hostNameVals = null;
  +    private List debugLvlVals = null;
  +    private List hostNameVals = null;
   
   
       // ------------------------------------------------------------- Properties
  @@ -213,7 +214,7 @@
       /**
        * Return the debugVals.
        */
  -    public ArrayList getDebugLvlVals() {
  +    public List getDebugLvlVals() {
           
           return this.debugLvlVals;
           
  @@ -222,7 +223,7 @@
       /**
        * Set the debugVals.
        */
  -    public void setDebugLvlVals(ArrayList debugLvlVals) {
  +    public void setDebugLvlVals(List debugLvlVals) {
           
           this.debugLvlVals = debugLvlVals;
           
  @@ -232,7 +233,7 @@
       /**
        * Return the host name values.
        */
  -    public ArrayList getHostNameVals() {
  +    public List getHostNameVals() {
           
           return this.hostNameVals;
           
  @@ -241,7 +242,7 @@
       /**
        * Set the hostName values.
        */
  -    public void setHostNameVals(ArrayList hostNameVals) {
  +    public void setHostNameVals(List hostNameVals) {
           
           this.hostNameVals = hostNameVals;
           
  @@ -319,11 +320,7 @@
        */
       public void setDefaultHost(String defaultHost) {
   
  -        if (defaultHost == null) {
  -            this.defaultHost = "";
  -        } else {
  -            this.defaultHost = defaultHost;
  -        }
  +        this.defaultHost = defaultHost;
   
       }
   
  @@ -343,9 +340,10 @@
           this.serviceName = null;
           this.engineName = null;
           this.debugLvl = "0";
  -        this.defaultHost = "";
  +        this.defaultHost = null;
       }
       
  +
       /**
        * Render this object as a String.
        */
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>