You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by pa...@apache.org on 2001/12/06 23:55:58 UTC

cvs commit: jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin SetUpServerAction.java LabelValueBean.java ServerAction.java ServerForm.java

patrickl    01/12/06 14:55:58

  Added:       webapps/admin/WEB-INF/classes/org/apache/webapp/admin
                        SetUpServerAction.java LabelValueBean.java
                        ServerAction.java ServerForm.java
  Log:
  Submitted by:	Manveen Kaur
  
  Revision  Changes    Path
  1.1                  jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/SetUpServerAction.java
  
  Index: SetUpServerAction.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/SetUpServerAction.java,v 1.1 2001/12/06 22:55:57 patrickl Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/06 22:55:57 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  
  package org.apache.webapp.admin;
  
  
  import java.io.IOException;
  import java.util.Iterator;
  import java.util.List;
  import java.util.Locale;
  import java.util.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;
  /**
   * Test <code>Action</code> that handles events from the tree control test
   * page.
   *
   * @author Jazmin Jonson
   * @version $Revision: 1.1 $ $Date: 2001/12/06 22:55:57 $
   */
  
  public class SetUpServerAction extends Action {
  
      private static MBeanServer mBServer = null;
  
      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 actionList = 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 {
  
  	  // Do I have to do this part ??
  
  	if (form == null) {
                  getServlet().log(" Creating new ServerForm bean under key "
                              + mapping.getAttribute());
  	    form = new ServerForm();
  	   
              if ("request".equals(mapping.getScope()))
                  request.setAttribute(mapping.getAttribute(), form);
              else
                  request.getSession().setAttribute(mapping.getAttribute(), form);
  	       
  	}
  
  	// Do transaction stuff before this
  
  	ServerForm serverFm = (ServerForm) 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"));
  
          }
  
  	if(actionList == null) {
  
              actionList = new ArrayList();
  	  // You can get this from the Mbean
              actionList.add(new LabelValueBean("Available Actions","Available Actions"));
              actionList.add(new LabelValueBean("Create New Service","Create New Service"));
              actionList.add(new LabelValueBean("Delete Services","Delete Services"));
  	}
  
  	Integer portNumb = null;
  	Integer debug = null;
  	String shutdown = null;
          try{
  	
              if(mBServer == null) {
                  ApplicationServlet servlet = (ApplicationServlet)getServlet();	
                  mBServer = servlet.getServer();
  	    }
  
              Iterator serverItr = 
                  mBServer.queryMBeans(new ObjectName(TomcatTreeBuilder.SERVER_TYPE +
                                                      TomcatTreeBuilder. WILDCARD),
                                       null).iterator();
  
              ObjectName serverObjName =
                  ((ObjectInstance)serverItr.next()).getObjectName();
  
  	    /*
              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);
  
              debug = (Integer)mBServer.getAttribute(serverObjName,
                                                     DEBUG_PROP_NAME);
  
              shutdown = (String)mBServer.getAttribute(serverObjName,
                                                       SHUTDOWN_PROP_NAME);
  
              request.setAttribute("debugLvlVals", debugLvlList);
              request.setAttribute("actionVals", actionList);
  
  
          }catch(Throwable t){
              t.printStackTrace(System.out);
              //forward to error page
          } 
  
  	
          serverFm.setPortNumberText(portNumb.toString());
          // Hardcode debuglvl for now
          serverFm.setDebugLvl(debug.toString());
          serverFm.setShutdownText(shutdown);
  
          // Forward back to the test page
          return (mapping.findForward("Server"));
  
      }
  
  
  }
  
  
  
  1.1                  jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/LabelValueBean.java
  
  Index: LabelValueBean.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/LabelValueBean.java,v 1.1 2001/12/06 22:55:57 patrickl Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/06 22:55:57 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Struts", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  
  package org.apache.webapp.admin;
  
  
  /**
   * Simple JavaBean to represent label-value pairs for use in collections
   * that are utilized by the <code>&lt;form:options&gt;</code> tag.
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2001/12/06 22:55:57 $
   */
  
  public class LabelValueBean {
  
  
      // ----------------------------------------------------------- Constructors
  
  
      /**
       * Construct a new LabelValueBean with the specified values.
       *
       * @param label The label to be displayed to the user
       * @param value The value to be returned to the server
       */
      public LabelValueBean(String label, String value) {
          this.label = label;
          this.value = value;
      }
  
  
      // ------------------------------------------------------------- Properties
  
  
      /**
       * The label to be displayed to the user.
       */
      protected String label = null;
  
      public String getLabel() {
          return (this.label);
      }
  
  
      /**
       * The value to be returned to the server.
       */
      protected String value = null;
  
      public String getValue() {
          return (this.value);
      }
  
  
      // --------------------------------------------------------- Public Methods
  
  
      /**
       * Return a string representation of this object.
       */
      public String toString() {
          StringBuffer sb = new StringBuffer("LabelValueBean[");
          sb.append(this.label);
          sb.append(", ");
          sb.append(this.value);
          sb.append("]");
          return (sb.toString());
      }
  
  
  }
  
  
  
  1.1                  jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ServerAction.java
  
  Index: ServerAction.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ServerAction.java,v 1.1 2001/12/06 22:55:57 patrickl Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/06 22:55:57 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Struts", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  
  package org.apache.webapp.admin;
  
  import java.util.Iterator;
  import java.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;
  /**
   * Implementation of <strong>Action</strong> that validates a user logon.
   *
   * @author Jazmin Jonson
   * @version $Revision: 1.1 $ $Date: 2001/12/06 22:55:57 $
   */
  
  public final class ServerAction 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{
  	
              if(mBServer == null) {
                  ApplicationServlet servlet = (ApplicationServlet)getServlet();	
                  mBServer = servlet.getServer();
  	    }        
              Iterator serverItr = 
                  mBServer.queryMBeans(new ObjectName(TomcatTreeBuilder.SERVER_TYPE +
                                                      TomcatTreeBuilder. WILDCARD),
                                       null).iterator();
  
              ObjectName serverObjName =
                  ((ObjectInstance)serverItr.next()).getObjectName();
  
  	    String shutdownText = request.getParameter("shutdownText");
  	    String portNumberText = request.getParameter("portNumberText");
  	    String debugLvlText = request.getParameter("debugLvl");
  
  	    if(shutdownText != null) {
  
  	        mBServer.setAttribute(serverObjName,
                                        new Attribute(SetUpServerAction.SHUTDOWN_PROP_NAME,
  				                    shutdownText));
  	    }
  
  	    if(portNumberText != null) {
  
                  Integer port = new Integer(portNumberText);
  	        mBServer.setAttribute(serverObjName,
                                        new Attribute(SetUpServerAction.PORT_PROP_NAME,
  				                    port));
  	    }
  
  	    if(debugLvlText != null) {
                  Integer debugLvl = new Integer(debugLvlText);
  	        mBServer.setAttribute(serverObjName,
                                        new Attribute(SetUpServerAction.DEBUG_PROP_NAME,
  				                    debugLvl));
  	    }
  	    
          }catch(Throwable t){
              t.printStackTrace(System.out);
              //forward to error page
          } 
          // Forward back to the test page
          return (mapping.findForward("Save Successful"));
  
      }
  
  }
  
  
  
  1.1                  jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ServerForm.java
  
  Index: ServerForm.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ServerForm.java,v 1.1 2001/12/06 22:55:57 patrickl Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/06 22:55:57 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Struts", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  
  package org.apache.webapp.admin;
  
  
  import javax.servlet.http.HttpServletRequest;
  import org.apache.struts.action.ActionError;
  import org.apache.struts.action.ActionErrors;
  import org.apache.struts.action.ActionForm;
  import org.apache.struts.action.ActionMapping;
  
  
  /**
   * Form bean for the user locale page.  This form has the following fields,
   * with default values in square brackets:
   * <ul>
   * <li><b>someText</b> - Entered text value
   * <li><b>moreText</b> - Entered text value
   * </ul>
   *
   * @author Patrick Luby
   * @version $Revision: 1.1 $ $Date: 2001/12/06 22:55:57 $
   */
  
  public final class ServerForm extends ActionForm {
  
      // ----------------------------------------------------- Instance Variables
  
      /**
       * The text for the port number.
       */
      private String action = null;
  
      private String portNumberText = "8080";
  
      /**
       * The text for the debug level.
       */
      private String debugLvl = "0";
  
      /**
       * The text for the debug level.
       */
  
      private String shutdownText = null;
  
  
      // ------------------------------------------------------------- Properties
  
      /**
       * Return the portNumberText.
       */
      public String getAction() {
  
          return this.action;
  
      }
  
      /**
       * Set the portNumberText.
       */
      public void setAction(String action) {
  
          this.portNumberText = action;
  
      }
  
  
      /**
       * Return the portNumberText.
       */
      public String getPortNumberText() {
  
          return this.portNumberText;
  
      }
  
      /**
       * Set the portNumberText.
       */
      public void setPortNumberText(String portNumberText) {
  
          this.portNumberText = portNumberText;
  
      }
  
      /**
       * 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 Shutdown Text.
       */
      public String getShutdownText() {
  
          return this.shutdownText;
  
      }
  
      /**
       * Set the Shut down  Text.
       */
      public void setShutdownText(String shutdownText) {
  
          this.shutdownText = shutdownText;
  
      }
  
      // --------------------------------------------------------- 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.portNumberText = null;
          this.debugLvl = "0";
  	this.shutdownText = null;
          this.action = null;
  
      }
  
  
      /**
       * 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();
  
  	/* Do nothing for now
          if ((someText == null) || (someText.length() < 1))
              errors.add("someText", new ActionError("sample.someText.required"));
          if ((moreText == null) || (moreText.length() < 1))
              errors.add("moreText", new ActionError("sample.moreText.required"));
  	*/
  
          return errors;
  
      }
  
  }
  
  
  

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