You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2002/01/31 06:25:25 UTC
cvs commit: jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/service DeleteServiceAction.java DeleteServiceForm.java SetUpDeleteServiceAction.java
manveen 02/01/30 21:25:25
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
ServiceAction.java SetUpServiceAction.java
Added: webapps/admin deleteService.jsp
webapps/admin/WEB-INF/classes/org/apache/webapp/admin/service
DeleteServiceAction.java DeleteServiceForm.java
SetUpDeleteServiceAction.java
Log:
* Implemented "delete service" opertion. This lists the set of services under a server and allows deletons of services.
* created a "service" package under admin to organize the admin files.
Revision Changes Path
1.7 +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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- server.jsp 10 Jan 2002 03:41:13 -0000 1.6
+++ server.jsp 31 Jan 2002 05:25:25 -0000 1.7
@@ -32,7 +32,7 @@
<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=""> <bean:message key="actions.services.delete"/> </controls:action>
+ <controls:action url="setUpDeleteService.do"> <bean:message key="actions.services.delete"/> </controls:action>
</controls:actions>
</div>
</td>
1.1 jakarta-tomcat-4.0/webapps/admin/deleteService.jsp
Index: deleteService.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="/deleteService">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="7171A5">
<td width="81%">
<div class="page-title-text" align="left">
<bean:message key="actions.services.delete"/>
</div>
</td>
<td width="19%">
<div align="right">
<controls:actions>
<controls:action selected="true">
----<bean:message key="actions.available.actions"/>----
</controls:action>
<controls:action>
---------------------------------
</controls:action>
</controls:actions>
</div>
</td>
</tr>
</table>
<%@ include file="buttons.jsp" %>
<br>
<%-- Services List --%>
<table class="back-table" border="0" cellspacing="0" cellpadding="1" width="100%">
<tr>
<td>
<table class="front-table" border="1"
cellspacing="0" cellpadding="0" width="100%">
<tr class="header-row">
<td><div align="left" class="table-header-text">
<bean:message key="actions.delete"/>
</div></td>
<td><div align="left" class="table-header-text">
<bean:message key="host.name"/>
</div></td>
</tr>
<logic:iterate name="services" id="service">
<tr class="line-row">
<td><div align="left" class="table-normal-text">
<input type="checkbox" name="checkbox"
value='<%= service.toString() %>' >
</div></td>
<td><div align="left" class="table-normal-text">
<html:link page='<%= "/setUpService.do?select=" +
java.net.URLEncoder.encode(service.toString()) %>'>
<controls:attribute name="service" attribute="name"/>
</html:link>
</div></td>
</tr>
</logic:iterate>
</table>
</td>
</tr>
</table>
<%@ include file="buttons.jsp" %>
<br>
</html:form>
<p> </p>
</body>
</html:html>
1.20 +25 -2 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.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- struts-config.xml 30 Jan 2002 02:05:44 -0000 1.19
+++ struts-config.xml 31 Jan 2002 05:25:25 -0000 1.20
@@ -22,6 +22,10 @@
<!-- Service form bean -->
<form-bean name="serviceForm"
type="org.apache.webapp.admin.ServiceForm"/>
+
+ <!-- Service form bean -->
+ <form-bean name="deleteServiceForm"
+ type="org.apache.webapp.admin.service.DeleteServiceForm"/>
<!-- Connector form bean -->
<form-bean name="connectorForm"
@@ -86,6 +90,10 @@
path="/service.jsp"
redirect="false"/>
+ <forward name="Delete Service"
+ path="/deleteService.jsp"
+ redirect="false"/>
+
<forward name="Connector"
path="/connector.jsp"
redirect="false"/>
@@ -169,6 +177,15 @@
redirect="true"/>
</action>
+ <!-- Set up Delete Service datastructure -->
+ <action path="/setUpDeleteService"
+ type="org.apache.webapp.admin.service.SetUpDeleteServiceAction"
+ name="deleteServiceForm"
+ scope="session">
+ <forward name="SetUpDeleteService"
+ path="/deleteService.jsp"
+ redirect="true"/>
+ </action>
<!-- Set up Connector datastructure -->
<action path="/setUpConnector"
@@ -298,7 +315,13 @@
scope="request"
type="org.apache.webapp.admin.SaveUserAction"/>
- </action-mappings>
-
+ <!-- Save user action -->
+ <action path="/deleteService"
+ input="/deleteService.jsp"
+ name="deleteServiceForm"
+ scope="request"
+ type="org.apache.webapp.admin.service.DeleteServiceAction"/>
+
+ </action-mappings>
</struts-config>
1.18 +3 -2 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.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- ApplicationResources_en.properties 30 Jan 2002 02:05:44 -0000 1.17
+++ ApplicationResources_en.properties 31 Jan 2002 05:25:25 -0000 1.18
@@ -161,5 +161,6 @@
user.username=Username
error.password.required=<li>Password is required</li>
error.username.required=<li>Username is required</li>
-error.get.attributes=Error retrieving information properties
-error.set.attributes=Error setting information properties
+error.get.attributes=<li>Error retrieving information properties.</li>
+error.set.attributes=<li>Error setting information properties.<li>
+actions.delete=Delete
1.19 +14 -0 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.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- ApplicationResources_es.properties 29 Jan 2002 01:15:55 -0000 1.18
+++ ApplicationResources_es.properties 31 Jan 2002 05:25:25 -0000 1.19
@@ -151,3 +151,17 @@
error.directory.required=<li>El directorio no puede ser vacio.</li>
error.prefix.required=<li>El prefijo no puede ser vacio.</li>
error.suffix.required=<li>El sufijo no puede ser vacio.</li>
+user.fullName=Full Name
+user.groups=Member in Groups
+user.newUser=Cree Las Nuevas Caracteristicas Del Utilizador
+user.oldUser=Corrija Las Caracteristicas Existentes Del Utilizador
+user.password=Password
+user.properties=User Properties
+user.roles=Papeles De la Seguridad
+user.username=Username
+error.password.required=<li>Se requiere la palabra de paso</li>
+error.username.required=<li>Se requiere el username</li>
+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
+
1.2 +6 -5 jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ServiceAction.java
Index: ServiceAction.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ServiceAction.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ServiceAction.java 14 Dec 2001 23:22:33 -0000 1.1
+++ ServiceAction.java 31 Jan 2002 05:25:25 -0000 1.2
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ServiceAction.java,v 1.1 2001/12/14 23:22:33 patrickl Exp $
- * $Revision: 1.1 $
- * $Date: 2001/12/14 23:22:33 $
+ * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/ServiceAction.java,v 1.2 2002/01/31 05:25:25 manveen Exp $
+ * $Revision: 1.2 $
+ * $Date: 2002/01/31 05:25:25 $
*
* ====================================================================
*
@@ -90,7 +90,7 @@
* actions on a Service.
*
* @author Manveen Kaur
- * @version $Revision: 1.1 $ $Date: 2001/12/14 23:22:33 $
+ * @version $Revision: 1.2 $ $Date: 2002/01/31 05:25:25 $
*/
public final class ServiceAction extends Action {
@@ -178,7 +178,7 @@
// remove this attribute.
TBD: FIX ME - if needed.
}
- */
+ */
mBServer.setAttribute(serviceObjName,
new Attribute(SetUpServiceAction.HOST_PROP_NAME,
defaultHost));
@@ -189,6 +189,7 @@
t.printStackTrace(System.out);
//forward to error page
}
+
if (servlet.getDebug() >= 1)
servlet.log(" Forwarding to success page");
// Forward back to the test page
1.6 +19 -36 jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/SetUpServiceAction.java
Index: SetUpServiceAction.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/SetUpServiceAction.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- SetUpServiceAction.java 10 Jan 2002 03:41:13 -0000 1.5
+++ SetUpServiceAction.java 31 Jan 2002 05:25:25 -0000 1.6
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/SetUpServiceAction.java,v 1.5 2002/01/10 03:41:13 patrickl Exp $
- * $Revision: 1.5 $
- * $Date: 2002/01/10 03:41:13 $
+ * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/SetUpServiceAction.java,v 1.6 2002/01/31 05:25:25 manveen Exp $
+ * $Revision: 1.6 $
+ * $Date: 2002/01/31 05:25:25 $
*
* ====================================================================
*
@@ -79,18 +79,9 @@
import org.apache.struts.action.ActionMapping;
import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
-import javax.management.QueryExp;
-import javax.management.Query;
import javax.management.ObjectInstance;
import javax.management.ObjectName;
import javax.management.JMException;
-import javax.management.MBeanAttributeInfo;
-import javax.management.MBeanOperationInfo;
-import javax.management.MBeanInfo;
-
-import javax.management.modelmbean.ModelMBean;
-import javax.management.modelmbean.ModelMBeanInfo;
import org.apache.struts.util.MessageResources;
@@ -99,7 +90,7 @@
* page.
*
* @author Manveen Kaur
- * @version $Revision: 1.5 $ $Date: 2002/01/10 03:41:13 $
+ * @version $Revision: 1.6 $ $Date: 2002/01/31 05:25:25 $
*/
public class SetUpServiceAction extends Action {
@@ -139,6 +130,15 @@
HttpSession session = request.getSession();
+ // Acquire a reference to the MBeanServer containing our MBeans
+ try {
+ mBServer = ((ApplicationServlet) getServlet()).getServer();
+ } catch (Throwable t) {
+ throw new ServletException
+ ("Cannot acquire MBeanServer reference", t);
+ }
+
+ // fill in the form values for display and editing
if (form == null) {
getServlet().log(" Creating new ServiceForm bean under key "
+ mapping.getAttribute());
@@ -148,17 +148,12 @@
request.setAttribute(mapping.getAttribute(), form);
else
session.setAttribute(mapping.getAttribute(), form);
-
}
- // The message resources for this package.
- // MessageResources messages = getResources();
- // Locale locale = (Locale)session.getAttribute(Action.LOCALE_KEY);
-
String selectedName = request.getParameter("select");
// label of the node that was clicked on.
String nodeLabel = request.getParameter("nodeLabel");
-
+
ServiceForm serviceFm = (ServiceForm) form;
if(debugLvlList == null) {
@@ -183,11 +178,6 @@
try{
- if(mBServer == null) {
- ApplicationServlet servlet = (ApplicationServlet)getServlet();
- mBServer = servlet.getServer();
- }
-
Iterator serviceItr =
mBServer.queryMBeans(new
ObjectName(selectedName), null).iterator();
@@ -195,20 +185,14 @@
ObjectInstance objInstance = (ObjectInstance)serviceItr.next();
ObjectName serviceObjName = (objInstance).getObjectName();
- /*
- System.out.println("There are " + mBServer.getMBeanCount().intValue() +
- " registered MBeans");
- Iterator instances = mBServer.queryMBeans(null, null).iterator();
- while (instances.hasNext()) {
- ObjectInstance instance = (ObjectInstance) instances.next();
- System.out.println(" objectName=" + instance.getObjectName() +
- ", className=" + instance.getClassName());
- }
- */
-
serviceName = (String) mBServer.getAttribute(serviceObjName,
NAME_PROP_NAME);
+ // FIX-ME
+ // nodelabel might be null in case of returning from delete screen
+ if (nodeLabel == null)
+ nodeLabel = "Service (" + serviceName + ")";
+
String search = TomcatTreeBuilder.ENGINE_TYPE +
",service=" + serviceName;
@@ -252,7 +236,6 @@
// the pulldown menu..
hostNameList.add(new LabelValueBean(hostName, hostName));
}
-
}catch(Throwable t){
t.printStackTrace(System.out);
1.1 jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/service/DeleteServiceAction.java
Index: DeleteServiceAction.java
===================================================================
/*
* $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/service/DeleteServiceAction.java,v 1.1 2002/01/31 05:25:25 manveen Exp $
* $Revision: 1.1 $
* $Date: 2002/01/31 05:25:25 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 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.service;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;
import javax.management.MBeanServer;
import javax.management.ObjectName;
import javax.management.ObjectInstance;
import javax.management.modelmbean.ModelMBean;
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.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import javax.management.QueryExp;
import org.apache.webapp.admin.ApplicationServlet;
/**
* Delete services that are selected to be deleted.
* Also, deregister their mBeans from the mBeanServer.
*
* @author Manveen Kaur
* @version $Revision: 1.1 $ $Date: 2002/01/31 05:25:25 $
*/
public class DeleteServiceAction extends Action {
// --------------------------------------------------------- Public Methods
/**
* Process the specified HTTP request, and create the corresponding HTTP
* response (or forward to another web component that will create it).
* Return an <code>ActionForward</code> instance describing where and how
* control should be forwarded, or <code>null</code> if the response has
* already been completed.
*
* @param mapping The ActionMapping used to select this instance
* @param actionForm The optional ActionForm bean for this request (if any)
* @param request The HTTP request we are processing
* @param response The HTTP response we are creating
*
* @exception IOException if an input/output error occurs
* @exception ServletException if a servlet exception occurs
*/
public ActionForward perform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
// Acquire a reference to the MBeanServer containing our MBeans
MBeanServer mBServer = null;
try {
mBServer = ((ApplicationServlet) getServlet()).getServer();
} catch (Throwable t) {
throw new ServletException
("Cannot acquire MBeanServer reference", t);
}
// selected services to be deleted
String[] selected = request.getParameterValues("checkbox");
// process delete action
for (int index=0; index <selected.length; index++) {
String pattern = selected[index];
Iterator names = null;
try {
names = mBServer.queryNames(new ObjectName(pattern), null).iterator();
} catch (Throwable t) {
throw new ServletException("queryNames(" + pattern + ")", t);
}
while (names.hasNext()) {
try {
ObjectName oName = (ObjectName) names.next();
// delete this mBean
mBServer.unregisterMBean(oName);
} catch (Throwable t) {
throw new ServletException("Exception while deleting", t);
}
}
}
//Fix me -- need to refresh the tree?
return (mapping.findForward("Save Successful"));
}
}
1.1 jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/service/DeleteServiceForm.java
Index: DeleteServiceForm.java
===================================================================
/*
* $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/service/DeleteServiceForm.java,v 1.1 2002/01/31 05:25:25 manveen Exp $
* $Revision: 1.1 $
* $Date: 2002/01/31 05:25:25 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 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.service;
import org.apache.struts.action.ActionForm;
/**
* Dummy form bean for the "Delete Service" page.
*
* @author Manveen Kaur
* @version $Revision: 1.1 $ $Date: 2002/01/31 05:25:25 $
*/
public class DeleteServiceForm extends ActionForm {
// No extensions needed
}
1.1 jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/service/SetUpDeleteServiceAction.java
Index: SetUpDeleteServiceAction.java
===================================================================
/*
* $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/service/SetUpDeleteServiceAction.java,v 1.1 2002/01/31 05:25:25 manveen Exp $
* $Revision: 1.1 $
* $Date: 2002/01/31 05:25:25 $
*
* ====================================================================
*
* 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.service;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.TreeSet;
import java.util.Set;
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 org.apache.struts.util.MessageResources;
import org.apache.webapp.admin.ApplicationServlet;
import org.apache.webapp.admin.TomcatTreeBuilder;
/**
* Test <code>Action</code> that handles events to delete services.
*
* @author Manveen Kaur
* @version $Revision: 1.1 $ $Date: 2002/01/31 05:25:25 $
*/
public class SetUpDeleteServiceAction 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 {
HttpSession session = request.getSession();
// Acquire a reference to the MBeanServer containing our MBeans
try {
mBServer = ((ApplicationServlet) getServlet()).getServer();
} catch (Throwable t) {
throw new ServletException
("Cannot acquire MBeanServer reference", t);
}
// Acquire the set of service MBean names to be listed
String pattern = TomcatTreeBuilder.SERVICE_TYPE +
TomcatTreeBuilder.WILDCARD;
Set results = null;
try {
results = mBServer.queryNames(new ObjectName(pattern), null);
} catch (Throwable t) {
throw new ServletException("queryNames(" + pattern + ")", t);
}
TreeSet services = new TreeSet();
Iterator names = results.iterator();
while (names.hasNext()) {
ObjectName name = (ObjectName) names.next();
services.add(name);
}
// Forward the Set as a request attribute
request.setAttribute("services", services);
return (mapping.findForward("Delete Service"));
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>