manveen 02/02/04 09:59:19 Modified: webapps/admin server.jsp webapps/admin/WEB-INF struts-config.xml webapps/admin/WEB-INF/classes/org/apache/webapp/admin ApplicationResources_en.properties ApplicationResources_es.properties Added: webapps/admin addService.jsp webapps/admin/WEB-INF/classes/org/apache/webapp/admin/service AddServiceAction.java AddServiceForm.java SetUpAddServiceAction.java Log: Intermin checkin for "add service" operation implementation. Revision Changes Path 1.8 +1 -1 jakarta-tomcat-4.0/webapps/admin/server.jsp Index: server.jsp =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/server.jsp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- server.jsp 31 Jan 2002 05:25:25 -0000 1.7 +++ server.jsp 4 Feb 2002 17:59:19 -0000 1.8 @@ -31,7 +31,7 @@ <controls:action selected="true"> ----<bean:message key="actions.available.actions"/>---- </controls:action> <controls:action> --------------------------------- </controls:action> <!-- will add the urls later once those screens get implemented --> - <controls:action url=""> <bean:message key="actions.services.create"/> </controls:action> + <controls:action url="setUpAddService.do"> <bean:message key="actions.services.create"/> </controls:action> <controls:action url="setUpDeleteService.do"> <bean:message key="actions.services.delete"/> </controls:action> </controls:actions> </div> 1.1 jakarta-tomcat-4.0/webapps/admin/addService.jsp Index: addService.jsp =================================================================== <!-- Standard Struts Entries --> <%@ page language="java" %> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> <%@ taglib uri="/WEB-INF/controls.tld" prefix="controls" %> <html:html locale="true"> <%@ include file="header.jsp" %> <!-- Body --> <body bgcolor="white"> <!--Form --> <html:errors/> <html:form method="POST" action="/addService"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr class="page-title-row"> <td width="81%"> <div class="page-title-text" align="left"> <bean:message key="service.create.new"/> </div> </td> </tr> </table> <%@ include file="buttons.jsp" %> <%-- Heading --%> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr> <td> <div class="table-title-text"> <bean:define name="addServiceForm" id="addServiceForm" scope="session"/> <bean:message key="service.properties"/> </div> </td> </tr> </table> <table class="back-table" border="0" cellspacing="0" cellpadding="1" width="100%"> <tr> <td> <controls:table tableStyle="front-table" lineStyle="line-row"> <controls:row header="true" labelStyle="table-header-text" dataStyle="table-header-text"> <controls:label><bean:message key="service.property"/></controls:label> <controls:data><bean:message key="service.value"/> </controls:data> </controls:row> <controls:row labelStyle="table-label-text" dataStyle="table-normal-text"> <controls:label><bean:message key="service.name"/>:</controls:label> <controls:data> <html:text property="serviceName" size="24" maxlength="24"/> </controls:data> </controls:row> </controls:table> </td> </tr> </table> <br> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr> <td> <div class="table-title-text"> <bean:message key="service.engine.props"/> </div> </td> </tr> </table> <table class="back-table" border="0" cellspacing="0" cellpadding="1" width="100%"> <tr> <td> <controls:table tableStyle="front-table" lineStyle="line-row"> <controls:row header="true" labelStyle="table-header-text" dataStyle="table-header-text"> <controls:label><bean:message key="service.property"/></controls:label> <controls:data><bean:message key="service.value"/> </controls:data> </controls:row> <controls:row labelStyle="table-label-text" dataStyle="table-normal-text"> <controls:label><bean:message key="service.name"/>:</controls:label> <controls:data> <html:text property="engineName" size="24" maxlength="24"/> </controls:data> </controls:row> <controls:row labelStyle="table-label-text" dataStyle="table-normal-text"> <controls:label><bean:message key="server.debuglevel"/>:</controls:label> <controls:data> <html:select property="debugLvl"> <bean:define id="debugLvlVals" name="addServiceForm" property="debugLvlVals"/> <html:options collection="debugLvlVals" property="value" labelProperty="label"/> </html:select> </controls:data> </controls:row> <controls:row labelStyle="table-label-text" dataStyle="table-normal-text"> <controls:label><bean:message key="service.defaulthostname"/>:</controls:label> <controls:data> <html:text property="defaultHost" size="24" maxlength="24"/> </controls:data> </controls:row> </controls:table> </td> </tr> </table> <br> <%@ include file="buttons.jsp" %> </html:form> <!-- Standard Footer --> <%@ include file="footer.jsp" %> </body> </html:html> 1.22 +25 -5 jakarta-tomcat-4.0/webapps/admin/WEB-INF/struts-config.xml Index: struts-config.xml =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/struts-config.xml,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- struts-config.xml 31 Jan 2002 19:35:57 -0000 1.21 +++ struts-config.xml 4 Feb 2002 17:59:19 -0000 1.22 @@ -23,10 +23,14 @@ <form-bean name="serviceForm" type="org.apache.webapp.admin.service.ServiceForm"/> - <!-- Service form bean --> + <!-- Delete Service form bean --> <form-bean name="deleteServiceForm" type="org.apache.webapp.admin.service.DeleteServiceForm"/> + <!-- Add Service form bean --> + <form-bean name="addServiceForm" + type="org.apache.webapp.admin.service.AddServiceForm"/> + <!-- Connector form bean --> <form-bean name="connectorForm" type="org.apache.webapp.admin.ConnectorForm"/> @@ -94,6 +98,10 @@ path="/deleteService.jsp" redirect="false"/> + <forward name="Add Service" + path="/addService.jsp" + redirect="false"/> + <forward name="Connector" path="/connector.jsp" redirect="false"/> @@ -182,9 +190,14 @@ type="org.apache.webapp.admin.service.SetUpDeleteServiceAction" name="deleteServiceForm" scope="session"> - <forward name="SetUpDeleteService" - path="/deleteService.jsp" - redirect="true"/> + </action> + + + <!-- Set up Add Service datastructure --> + <action path="/setUpAddService" + type="org.apache.webapp.admin.service.SetUpAddServiceAction" + name="addServiceForm" + scope="session"> </action> <!-- Set up Connector datastructure --> @@ -315,12 +328,19 @@ scope="request" type="org.apache.webapp.admin.SaveUserAction"/> - <!-- Save user action --> + <!-- Delete service action --> <action path="/deleteService" input="/deleteService.jsp" name="deleteServiceForm" scope="request" type="org.apache.webapp.admin.service.DeleteServiceAction"/> + + <!-- Add service action --> + <action path="/addService" + input="/addService.jsp" + name="addServiceForm" + scope="request" + type="org.apache.webapp.admin.service.AddServiceAction"/> </action-mappings> 1.19 +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.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- ApplicationResources_en.properties 31 Jan 2002 05:25:25 -0000 1.18 +++ ApplicationResources_en.properties 4 Feb 2002 17:59:19 -0000 1.19 @@ -62,6 +62,7 @@ service.properties=Service Properties service.property=Property service.value=Value +service.create.new=Create New Service actions.available.actions=Available Actions actions.services.create=Create New Service actions.services.delete=Delete Services @@ -164,3 +165,5 @@ error.get.attributes=<li>Error retrieving information properties.</li> error.set.attributes=<li>Error setting information properties.<li> actions.delete=Delete +error.defaultHost.required=<li>Default Hostname required</li> +error.serviceName.required=<li>Service el nombre required</li> 1.20 +3 -1 jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_es.properties Index: ApplicationResources_es.properties =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ApplicationResources_es.properties,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- ApplicationResources_es.properties 31 Jan 2002 05:25:25 -0000 1.19 +++ ApplicationResources_es.properties 4 Feb 2002 17:59:19 -0000 1.20 @@ -62,6 +62,7 @@ service.properties=Propiedades del Servicio service.property=Propiedad service.value=Valor +service.create.new=Cree El Nuevo Servicio actions.available.actions=Acciones Disponibles actions.services.create=Crear Nuevo Servicio actions.services.delete=Eliminar Servicios @@ -164,4 +165,5 @@ error.get.attributes=<li>Error que extrae caracteristicas de la informacion.</li> error.set.attributes=<li>Error que fija caracteristicas de la informacion.</li> actions.delete=Delete - +error.defaultHost.required=<li>Default Hostname required</li> +error.serviceName.required=<li>Service name required</li> 1.1 jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/service/AddServiceAction.java Index: AddServiceAction.java =================================================================== /* * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/service/AddServiceAction.java,v 1.1 2002/02/04 17:59:19 manveen Exp $ * $Revision: 1.1 $ * $Date: 2002/02/04 17:59:19 $ * * ==================================================================== * * 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.service; 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 org.apache.struts.util.MessageResources; import org.apache.webapp.admin.ApplicationServlet; import org.apache.webapp.admin.TomcatTreeBuilder; /** * Implementation of <strong>Action</strong> that validates * add service actions. * * @author Manveen Kaur * @version $Revision: 1.1 $ $Date: 2002/02/04 17:59:19 $ */ public final class AddServiceAction 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(); // 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(); } String serviceName = request.getParameter("serviceName"); Iterator serviceItr = mBServer.queryMBeans(new ObjectName( TomcatTreeBuilder.ENGINE_TYPE + ",service=" + serviceName), null).iterator(); ObjectName serviceObjName = ((ObjectInstance)serviceItr.next()).getObjectName(); String engineName = request.getParameter("engineName"); String debugLvlText = request.getParameter("debugLvl"); String defaultHost = request.getParameter("defaultHost"); if (engineName != null) { mBServer.setAttribute(serviceObjName, new Attribute(SetUpServiceAction.NAME_PROP_NAME, engineName)); } if(debugLvlText != null) { Integer debugLvl = new Integer(debugLvlText); mBServer.setAttribute(serviceObjName, new Attribute(SetUpServiceAction.DEBUG_PROP_NAME, debugLvl)); } if(defaultHost != null) { /* if ((" ").equals(defaultHost)) { // no default host value set. // remove this attribute. TBD: FIX ME - if needed. } */ mBServer.setAttribute(serviceObjName, new Attribute(SetUpServiceAction.HOST_PROP_NAME, defaultHost)); } }catch(Throwable t){ t.printStackTrace(System.out); //forward to error page } if (servlet.getDebug() >= 1) servlet.log(" Forwarding to success page"); // Forward back to the test page return (mapping.findForward("Save Successful")); } } 1.1 jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/service/AddServiceForm.java Index: AddServiceForm.java =================================================================== /* * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/service/AddServiceForm.java,v 1.1 2002/02/04 17:59:19 manveen Exp $ * $Revision: 1.1 $ * $Date: 2002/02/04 17:59:19 $ * * ==================================================================== * * 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.service; 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.util.ArrayList; import java.util.Iterator; import javax.management.MBeanServer; import javax.management.ObjectInstance; import javax.management.ObjectName; import javax.management.InstanceAlreadyExistsException; import javax.management.modelmbean.ModelMBean; import org.apache.webapp.admin.ApplicationServlet; import org.apache.webapp.admin.TomcatTreeBuilder; import org.apache.commons.modeler.ManagedBean; import org.apache.commons.modeler.Registry; /** * Form bean for the add service page. * * @author Manveen Kaur * @version $Revision: 1.1 $ $Date: 2002/02/04 17:59:19 $ */ public final class AddServiceForm extends ActionForm { /** * The configuration information registry for our managed beans. */ private static Registry registry = null; /** * The <code>MBeanServer</code> for this application. */ private static MBeanServer mBServer = null; // ----------------------------------------------------- Instance Variables /** * The text for the serviceName. */ private String serviceName = null; /** * The text for the engine Name. */ private String engineName = null; /** * The text for the debug level. */ private String debugLvl = "0"; /** * The text for the defaultHost Name. */ private String defaultHost = null; private ArrayList debugLvlVals = null; // ------------------------------------------------------------- Properties /** * Return the debugVals. */ public ArrayList getDebugLvlVals() { return this.debugLvlVals; } /** * Set the debugVals. */ public void setDebugLvlVals(ArrayList debugLvlVals) { this.debugLvlVals = debugLvlVals; } /** * Return the engineName. */ public String getEngineName() { return this.engineName; } /** * Set the engineName. */ public void setEngineName(String engineName) { this.engineName = engineName; } /** * 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 Service Name. */ public String getServiceName() { return this.serviceName; } /** * Set the Service Name. */ public void setServiceName(String serviceName) { this.serviceName = serviceName; } /** * Return the default Host. */ public String getDefaultHost() { return this.defaultHost; } /** * Set the default Host. */ public void setDefaultHost(String defaultHost) { this.defaultHost = defaultHost; } // --------------------------------------------------------- Public Methods /** * Reset all properties to their default values. * * @param mapping The mapping used to select this instance * @param request The servlet request we are processing */ public void reset(ActionMapping mapping, HttpServletRequest request) { this.serviceName = null; this.engineName = null; this.debugLvl = "0"; this.defaultHost = 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(); String submit = request.getParameter("submit"); if (submit != null) { if ((serviceName == null) || (serviceName.length() < 1)) { errors.add("serviceName", new ActionError("error.serviceName.required")); } else { // just try to register mBean // if exception is bean already registered, then add error message. try { Registry registry = Registry.getRegistry(); String[] all = registry.findManagedBeans(); for (int i=0; i<all.length; i++) { System.out.println(all[i]); } ApplicationServlet servlet = (ApplicationServlet)getServlet(); mBServer = servlet.getServer(); System.out.println("Creating MBeans ..."); ManagedBean managed = registry.findManagedBean("StandardService"); /* String domain = mserver.getDefaultDomain(); mbean.setClassName("org.apache.catalina.mbeans.StandardContextMBean"); mbean.setDomain(mBServer.getDefaultDomain()); ModelMBean mbean = managed.createMBean(userDatabase); ObjectName oname = createObjectName(domain, userDatabase); */ ObjectName oName = new ObjectName( TomcatTreeBuilder.ENGINE_TYPE + ",service=" + serviceName); ObjectInstance oInst = mBServer.createMBean( "org.apache.catalina.mbeans.StandardContextMBean", oName); ModelMBean mbean = managed.createMBean(); mBServer.registerMBean(mbean, oName); // check that this service name does not already exist. //} catch(InstanceAlreadyExistsException iaee) { // a service with this name does not exist before // therefore add it. //System.out.println("created mBean!"); } catch (Throwable t) { t.printStackTrace(); } } if ((engineName == null) || (engineName.length() < 1)) errors.add("engineName", new ActionError("error.engineName.required")); if ((defaultHost == null) || (defaultHost.length() < 1)) errors.add("defaultHost", new ActionError("error.defaultHost.required")); } return errors; } } 1.1 jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/service/SetUpAddServiceAction.java Index: SetUpAddServiceAction.java =================================================================== /* * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/service/SetUpAddServiceAction.java,v 1.1 2002/02/04 17:59:19 manveen Exp $ * $Revision: 1.1 $ * $Date: 2002/02/04 17:59:19 $ * * ==================================================================== * * 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.service; import java.io.IOException; 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 org.apache.webapp.admin.LabelValueBean; /** * Test <code>Action</code> that handles add service events. * * @author Manveen Kaur * @version $Revision: 1.1 $ $Date: 2002/02/04 17:59:19 $ */ public class SetUpAddServiceAction extends Action { public final static String NAME_PROP_NAME = "name"; 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). * 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(); // fill in the form values for display and editing if (form == null) { getServlet().log(" Creating new ServiceForm bean under key " + mapping.getAttribute()); form = new ServiceForm(); if ("request".equals(mapping.getScope())) request.setAttribute(mapping.getAttribute(), form); else session.setAttribute(mapping.getAttribute(), form); } AddServiceForm serviceFm = (AddServiceForm) 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")); } String serviceName = ""; String engineName = ""; String debug = "0"; String defaultHost = "localhost"; serviceFm.setServiceName(serviceName); serviceFm.setDefaultHost(defaultHost); serviceFm.setDebugLvl(debug); serviceFm.setEngineName(engineName); serviceFm.setDebugLvlVals(debugLvlList); return (mapping.findForward("Add Service")); } }
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>