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/04/11 16:47:48 UTC
cvs commit: jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/valve SaveAccessLogValveAction.java SaveRequestDumperValveAction.java AccessLogValveForm.java RequestDumperValveForm.java SaveRemoteAddrValveAction.java SaveRemoteHostValveAction.java SaveSingleSignOnValveAction.java
manveen 02/04/11 07:47:48
Modified: webapps/admin/WEB-INF/classes/org/apache/webapp/admin/valve
AccessLogValveForm.java RequestDumperValveForm.java
SaveRemoteAddrValveAction.java
SaveRemoteHostValveAction.java
SaveSingleSignOnValveAction.java
Added: webapps/admin/WEB-INF/classes/org/apache/webapp/admin/valve
SaveAccessLogValveAction.java
SaveRequestDumperValveAction.java
Log:
* extend AccessLog and RequestDumper valve forms from the base Valve form.
* remove unnecessray imports
* Implemented save operation for saving edited changes on Request Dumper and AccessLog valves.
Revision Changes Path
1.2 +15 -166 jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/valve/AccessLogValveForm.java
Index: AccessLogValveForm.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/valve/AccessLogValveForm.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AccessLogValveForm.java 9 Apr 2002 01:58:42 -0000 1.1
+++ AccessLogValveForm.java 11 Apr 2002 14:47:47 -0000 1.2
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/valve/AccessLogValveForm.java,v 1.1 2002/04/09 01:58:42 manveen Exp $
- * $Revision: 1.1 $
- * $Date: 2002/04/09 01:58:42 $
+ * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/valve/AccessLogValveForm.java,v 1.2 2002/04/11 14:47:47 manveen Exp $
+ * $Revision: 1.2 $
+ * $Date: 2002/04/11 14:47:47 $
*
* ====================================================================
*
@@ -66,49 +66,23 @@
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
-import java.net.InetAddress;
import java.util.List;
-import org.apache.webapp.admin.ApplicationServlet;
-import org.apache.webapp.admin.LabelValueBean;
-
/**
* Form bean for the accesslog valve page.
*
* @author Manveen Kaur
- * @version $Revision: 1.1 $ $Date: 2002/04/09 01:58:42 $
+ * @version $Revision: 1.2 $ $Date: 2002/04/11 14:47:47 $
*/
-public final class AccessLogValveForm extends ActionForm {
+public final class AccessLogValveForm extends ValveForm {
// ----------------------------------------------------- Instance Variables
-
- /**
- * The administrative action represented by this form.
- */
- private String adminAction = "Edit";
-
- /**
- * The object name of the valve this bean refers to.
- */
- private String objectName = null;
-
/**
* The text for the debug level.
*/
private String debugLvl = "0";
-
- /**
- * The text for the valve name, used to retrieve
- * the corresponding valve mBean.
- */
- private String valveName = null;
-
- /**
- * The text for the valve type.
- */
- private String valveType = null;
-
+
/**
* Set of valid values for debug level.
*/
@@ -132,28 +106,13 @@
/**
* The text for the suffix.
*/
- private String suffix = "";
-
- /**
- * The text for the node label.
- */
- private String nodeLabel = null;
-
+ private String suffix = null;
+
/**
* The text for the connection URL.
*/
private String resolveHosts = "false";
-
- /**
- * The object name of the parent of this valve.
- */
- private String parentObjectName = null;
-
- /**
- * Set of valid values for valves.
- */
- private List valveTypeVals = null;
-
+
/**
* Set of boolean values.
*/
@@ -161,60 +120,6 @@
// ------------------------------------------------------------- Properties
- /**
- * Return the administrative action represented by this form.
- */
- public String getAdminAction() {
-
- return this.adminAction;
-
- }
-
- /**
- * Set the administrative action represented by this form.
- */
- public void setAdminAction(String adminAction) {
-
- this.adminAction = adminAction;
-
- }
-
- /**
- * Return the Object Name.
- */
- public String getObjectName() {
-
- return this.objectName;
-
- }
-
- /**
- * Set the Object Name.
- */
- public void setObjectName(String objectName) {
-
- this.objectName = objectName;
-
- }
-
- /**
- * Return the valve type.
- */
- public String getValveType() {
-
- return this.valveType;
-
- }
-
- /**
- * Set the valve type.
- */
- public void setValveType(String valveType) {
-
- this.valveType = valveType;
-
- }
-
/**
* Return the debugVals.
*/
@@ -340,25 +245,7 @@
this.suffix = suffix;
}
-
- /**
- * Return the label of the node that was clicked.
- */
- public String getNodeLabel() {
-
- return this.nodeLabel;
-
- }
-
- /**
- * Set the node label.
- */
- public void setNodeLabel(String nodeLabel) {
-
- this.nodeLabel = nodeLabel;
-
- }
-
+
/**
* Return the resolve hosts.
*/
@@ -377,44 +264,6 @@
}
- /**
- * Return the parent object name of the valve this bean refers to.
- */
- public String getParentObjectName() {
-
- return this.parentObjectName;
-
- }
-
-
- /**
- * Set the parent object name of the valve this bean refers to.
- */
- public void setParentObjectName(String parentObjectName) {
-
- this.parentObjectName = parentObjectName;
-
- }
-
-
- /**
- * Return the valveTypeVals.
- */
- public List getValveTypeVals() {
-
- return this.valveTypeVals;
-
- }
-
- /**
- * Set the valveTypeVals.
- */
- public void setValveTypeVals(List valveTypeVals) {
-
- this.valveTypeVals = valveTypeVals;
-
- }
-
// --------------------------------------------------------- Public Methods
/**
@@ -424,13 +273,13 @@
* @param request The servlet request we are processing
*/
public void reset(ActionMapping mapping, HttpServletRequest request) {
-
- this.objectName = null;
+
+ super.reset(mapping, request);
this.debugLvl = "0";
this.directory = null;
this.prefix = null;
-
+ this.suffix = null;
this.pattern = null;
this.resolveHosts = "false";
@@ -442,9 +291,9 @@
public String toString() {
StringBuffer sb = new StringBuffer("AccessLogValveForm[adminAction=");
- sb.append(adminAction);
+ sb.append(getAdminAction());
sb.append("',valveType=");
- sb.append(valveType);
+ sb.append(getValveType());
sb.append(",debugLvl=");
sb.append(debugLvl);
sb.append(",directory=");
@@ -456,7 +305,7 @@
sb.append(",resolveHosts=");
sb.append(resolveHosts);
sb.append("',objectName='");
- sb.append(objectName);
+ sb.append(getObjectName());
sb.append("]");
return (sb.toString());
1.2 +10 -160 jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/valve/RequestDumperValveForm.java
Index: RequestDumperValveForm.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/valve/RequestDumperValveForm.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- RequestDumperValveForm.java 9 Apr 2002 02:58:46 -0000 1.1
+++ RequestDumperValveForm.java 11 Apr 2002 14:47:47 -0000 1.2
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/valve/RequestDumperValveForm.java,v 1.1 2002/04/09 02:58:46 manveen Exp $
- * $Revision: 1.1 $
- * $Date: 2002/04/09 02:58:46 $
+ * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/valve/RequestDumperValveForm.java,v 1.2 2002/04/11 14:47:47 manveen Exp $
+ * $Revision: 1.2 $
+ * $Date: 2002/04/11 14:47:47 $
*
* ====================================================================
*
@@ -66,171 +66,21 @@
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
-import java.net.InetAddress;
import java.util.List;
-import org.apache.webapp.admin.ApplicationServlet;
-import org.apache.webapp.admin.LabelValueBean;
-
/**
* Form bean for the Request Dumper valve page.
*
* @author Manveen Kaur
- * @version $Revision: 1.1 $ $Date: 2002/04/09 02:58:46 $
+ * @version $Revision: 1.2 $ $Date: 2002/04/11 14:47:47 $
*/
-public final class RequestDumperValveForm extends ActionForm {
+public final class RequestDumperValveForm extends ValveForm {
// ----------------------------------------------------- Instance Variables
-
- /**
- * The administrative action represented by this form.
- */
- private String adminAction = "Edit";
-
- /**
- * The object name of the valve this bean refers to.
- */
- private String objectName = null;
- /**
- * The text for the valve name, used to retrieve
- * the corresponding valve mBean.
- */
- private String valveName = null;
-
- /**
- * The text for the valve type.
- */
- private String valveType = null;
-
- /**
- * The object name of the parent of this valve.
- */
- private String parentObjectName = null;
-
- /**
- * The text for the node label.
- */
- private String nodeLabel = null;
-
- /**
- * Set of valid values for valves.
- */
- private List valveTypeVals = null;
-
// ------------------------------------------------------------- Properties
- /**
- * Return the administrative action represented by this form.
- */
- public String getAdminAction() {
-
- return this.adminAction;
-
- }
-
- /**
- * Set the administrative action represented by this form.
- */
- public void setAdminAction(String adminAction) {
-
- this.adminAction = adminAction;
-
- }
-
- /**
- * Return the Object Name.
- */
- public String getObjectName() {
-
- return this.objectName;
-
- }
-
- /**
- * Set the Object Name.
- */
- public void setObjectName(String objectName) {
-
- this.objectName = objectName;
-
- }
-
- /**
- * Return the valve type.
- */
- public String getValveType() {
-
- return this.valveType;
-
- }
-
- /**
- * Set the valve type.
- */
- public void setValveType(String valveType) {
-
- this.valveType = valveType;
-
- }
-
- /**
- * Return the label of the node that was clicked.
- */
- public String getNodeLabel() {
-
- return this.nodeLabel;
-
- }
-
- /**
- * Set the node label.
- */
- public void setNodeLabel(String nodeLabel) {
-
- this.nodeLabel = nodeLabel;
-
- }
-
- /**
- * Return the parent object name of the valve this bean refers to.
- */
- public String getParentObjectName() {
-
- return this.parentObjectName;
-
- }
-
-
- /**
- * Set the parent object name of the valve this bean refers to.
- */
- public void setParentObjectName(String parentObjectName) {
-
- this.parentObjectName = parentObjectName;
-
- }
-
-
- /**
- * Return the valveTypeVals.
- */
- public List getValveTypeVals() {
-
- return this.valveTypeVals;
-
- }
-
- /**
- * Set the valveTypeVals.
- */
- public void setValveTypeVals(List valveTypeVals) {
-
- this.valveTypeVals = valveTypeVals;
-
- }
-
// --------------------------------------------------------- Public Methods
/**
@@ -241,7 +91,7 @@
*/
public void reset(ActionMapping mapping, HttpServletRequest request) {
- this.objectName = null;
+ super.reset(mapping, request);
}
@@ -250,12 +100,12 @@
*/
public String toString() {
- StringBuffer sb = new StringBuffer("UserDatabasevalveForm[adminAction=");
- sb.append(adminAction);
+ StringBuffer sb = new StringBuffer("RequestDumperValveForm[adminAction=");
+ sb.append(getAdminAction());
sb.append("',valveType=");
- sb.append(valveType);
+ sb.append(getValveType());
sb.append("',objectName='");
- sb.append(objectName);
+ sb.append(getObjectName());
sb.append("]");
return (sb.toString());
1.2 +4 -11 jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/valve/SaveRemoteAddrValveAction.java
Index: SaveRemoteAddrValveAction.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/valve/SaveRemoteAddrValveAction.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SaveRemoteAddrValveAction.java 11 Apr 2002 14:16:16 -0000 1.1
+++ SaveRemoteAddrValveAction.java 11 Apr 2002 14:47:47 -0000 1.2
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/valve/SaveRemoteAddrValveAction.java,v 1.1 2002/04/11 14:16:16 manveen Exp $
- * $Revision: 1.1 $
- * $Date: 2002/04/11 14:16:16 $
+ * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/valve/SaveRemoteAddrValveAction.java,v 1.2 2002/04/11 14:47:47 manveen Exp $
+ * $Revision: 1.2 $
+ * $Date: 2002/04/11 14:47:47 $
*
* ====================================================================
*
@@ -61,8 +61,6 @@
package org.apache.webapp.admin.valve;
-import java.net.URLEncoder;
-import java.util.Iterator;
import java.util.Locale;
import java.io.IOException;
import javax.management.Attribute;
@@ -70,7 +68,6 @@
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.servlet.ServletException;
@@ -85,17 +82,13 @@
import org.apache.struts.action.ActionMapping;
import org.apache.struts.util.MessageResources;
import org.apache.webapp.admin.ApplicationServlet;
-import org.apache.webapp.admin.TomcatTreeBuilder;
-import org.apache.webapp.admin.TreeControl;
-import org.apache.webapp.admin.TreeControlNode;
-import org.apache.webapp.admin.logger.DeleteLoggerAction;
/**
* The <code>Action</code> that completes <em>Add Valve</em> and
* <em>Edit Valve</em> transactions for Remote Addr valve.
*
* @author Manveen Kaur
- * @version $Revision: 1.1 $ $Date: 2002/04/11 14:16:16 $
+ * @version $Revision: 1.2 $ $Date: 2002/04/11 14:47:47 $
*/
public final class SaveRemoteAddrValveAction extends Action {
1.2 +0 -7 jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/valve/SaveRemoteHostValveAction.java
Index: SaveRemoteHostValveAction.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/valve/SaveRemoteHostValveAction.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SaveRemoteHostValveAction.java 11 Apr 2002 14:16:16 -0000 1.1
+++ SaveRemoteHostValveAction.java 11 Apr 2002 14:47:47 -0000 1.2
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/valve/SaveRemoteHostValveAction.java,v 1.1 2002/04/11 14:16:16 manveen Exp $
- * $Revision: 1.1 $
- * $Date: 2002/04/11 14:16:16 $
+ * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/valve/SaveRemoteHostValveAction.java,v 1.2 2002/04/11 14:47:47 manveen Exp $
+ * $Revision: 1.2 $
+ * $Date: 2002/04/11 14:47:47 $
*
* ====================================================================
*
@@ -61,8 +61,6 @@
package org.apache.webapp.admin.valve;
-import java.net.URLEncoder;
-import java.util.Iterator;
import java.util.Locale;
import java.io.IOException;
import javax.management.Attribute;
@@ -72,7 +70,6 @@
import javax.management.Query;
import javax.management.ObjectInstance;
import javax.management.ObjectName;
-import javax.management.JMException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -85,17 +82,13 @@
import org.apache.struts.action.ActionMapping;
import org.apache.struts.util.MessageResources;
import org.apache.webapp.admin.ApplicationServlet;
-import org.apache.webapp.admin.TomcatTreeBuilder;
-import org.apache.webapp.admin.TreeControl;
-import org.apache.webapp.admin.TreeControlNode;
-import org.apache.webapp.admin.logger.DeleteLoggerAction;
/**
* The <code>Action</code> that completes <em>Add Valve</em> and
* <em>Edit Valve</em> transactions for Remote Host valve.
*
* @author Manveen Kaur
- * @version $Revision: 1.1 $ $Date: 2002/04/11 14:16:16 $
+ * @version $Revision: 1.2 $ $Date: 2002/04/11 14:47:47 $
*/
public final class SaveRemoteHostValveAction extends Action {
1.2 +4 -10 jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/valve/SaveSingleSignOnValveAction.java
Index: SaveSingleSignOnValveAction.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/valve/SaveSingleSignOnValveAction.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SaveSingleSignOnValveAction.java 11 Apr 2002 14:16:16 -0000 1.1
+++ SaveSingleSignOnValveAction.java 11 Apr 2002 14:47:47 -0000 1.2
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/valve/SaveSingleSignOnValveAction.java,v 1.1 2002/04/11 14:16:16 manveen Exp $
- * $Revision: 1.1 $
- * $Date: 2002/04/11 14:16:16 $
+ * $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/valve/SaveSingleSignOnValveAction.java,v 1.2 2002/04/11 14:47:47 manveen Exp $
+ * $Revision: 1.2 $
+ * $Date: 2002/04/11 14:47:47 $
*
* ====================================================================
*
@@ -61,8 +61,6 @@
package org.apache.webapp.admin.valve;
-import java.net.URLEncoder;
-import java.util.Iterator;
import java.util.Locale;
import java.io.IOException;
import javax.management.Attribute;
@@ -85,17 +83,13 @@
import org.apache.struts.action.ActionMapping;
import org.apache.struts.util.MessageResources;
import org.apache.webapp.admin.ApplicationServlet;
-import org.apache.webapp.admin.TomcatTreeBuilder;
-import org.apache.webapp.admin.TreeControl;
-import org.apache.webapp.admin.TreeControlNode;
-import org.apache.webapp.admin.logger.DeleteLoggerAction;
/**
* The <code>Action</code> that completes <em>Add Valve</em> and
* <em>Edit Valve</em> transactions for Single Sign On valve.
*
* @author Manveen Kaur
- * @version $Revision: 1.1 $ $Date: 2002/04/11 14:16:16 $
+ * @version $Revision: 1.2 $ $Date: 2002/04/11 14:47:47 $
*/
public final class SaveSingleSignOnValveAction extends Action {
1.1 jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/valve/SaveAccessLogValveAction.java
Index: SaveAccessLogValveAction.java
===================================================================
/*
* $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/valve/SaveAccessLogValveAction.java,v 1.1 2002/04/11 14:47:47 manveen Exp $
* $Revision: 1.1 $
* $Date: 2002/04/11 14:47:47 $
*
* ====================================================================
*
* 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", "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.valve;
import java.util.Locale;
import java.io.IOException;
import javax.management.Attribute;
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
import javax.management.QueryExp;
import javax.management.Query;
import javax.management.ObjectName;
import javax.management.JMException;
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.ActionError;
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.struts.util.MessageResources;
import org.apache.webapp.admin.ApplicationServlet;
/**
* The <code>Action</code> that completes <em>Add Valve</em> and
* <em>Edit Valve</em> transactions for AccessLog valve.
*
* @author Manveen Kaur
* @version $Revision: 1.1 $ $Date: 2002/04/11 14:47:47 $
*/
public final class SaveAccessLogValveAction extends Action {
// ----------------------------------------------------- Instance Variables
/**
* The MBeanServer we will be interacting with.
*/
private MBeanServer mBServer = null;
/**
* The MessageResources we will be retrieving messages from.
*/
private MessageResources resources = 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 {
// Acquire the resources that we need
HttpSession session = request.getSession();
Locale locale = (Locale) session.getAttribute(Action.LOCALE_KEY);
if (resources == null) {
resources = getServlet().getResources();
}
// 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);
}
// Identify the requested action
AccessLogValveForm vform = (AccessLogValveForm) form;
String adminAction = vform.getAdminAction();
String vObjectName = vform.getObjectName();
String parent = vform.getObjectName();
String valveType = vform.getValveType();
// Perform a "Create Valve" transaction (if requested)
if ("Create".equals(adminAction)) {
return ValveUtil.
createValve(parent, valveType, response, request, mapping,
(ApplicationServlet) getServlet());
}
// Perform attribute updates as requested
String attribute = null;
try {
ObjectName voname = new ObjectName(vObjectName);
attribute = "debug";
int debug = 0;
try {
debug = Integer.parseInt(vform.getDebugLvl());
} catch (Throwable t) {
debug = 0;
}
mBServer.setAttribute(voname,
new Attribute("debug", new Integer(debug)));
attribute = "directory";
mBServer.setAttribute(voname,
new Attribute("directory", vform.getDirectory()));
attribute = "pattern";
mBServer.setAttribute(voname,
new Attribute("pattern", vform.getPattern()));
attribute = "prefix";
mBServer.setAttribute(voname,
new Attribute("prefix", vform.getPrefix()));
attribute = "suffix";
mBServer.setAttribute(voname,
new Attribute("suffix", vform.getSuffix()));
attribute = "resolveHosts";
mBServer.setAttribute(voname,
new Attribute("resolveHosts", new Boolean(vform.getResolveHosts())));
} catch (Exception e) {
getServlet().log
(resources.getMessage(locale, "users.error.attribute.set",
attribute), e);
response.sendError
(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
resources.getMessage(locale, "users.error.attribute.set",
attribute));
return (null);
}
// Forward to the success reporting page
session.removeAttribute(mapping.getAttribute());
return (mapping.findForward("Save Successful"));
}
}
1.1 jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/valve/SaveRequestDumperValveAction.java
Index: SaveRequestDumperValveAction.java
===================================================================
/*
* $Header: /home/cvs/jakarta-tomcat-4.0/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/valve/SaveRequestDumperValveAction.java,v 1.1 2002/04/11 14:47:47 manveen Exp $
* $Revision: 1.1 $
* $Date: 2002/04/11 14:47:47 $
*
* ====================================================================
*
* 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", "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.valve;
import java.util.Locale;
import java.io.IOException;
import javax.management.Attribute;
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
import javax.management.QueryExp;
import javax.management.Query;
import javax.management.ObjectName;
import javax.management.JMException;
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.ActionError;
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.struts.util.MessageResources;
import org.apache.webapp.admin.ApplicationServlet;
/**
* The <code>Action</code> that completes <em>Add Valve</em> and
* <em>Edit Valve</em> transactions for Request Dumper valve.
*
* @author Manveen Kaur
* @version $Revision: 1.1 $ $Date: 2002/04/11 14:47:47 $
*/
public final class SaveRequestDumperValveAction extends Action {
// ----------------------------------------------------- Instance Variables
/**
* The MBeanServer we will be interacting with.
*/
private MBeanServer mBServer = null;
/**
* The MessageResources we will be retrieving messages from.
*/
private MessageResources resources = 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 {
// Acquire the resources that we need
HttpSession session = request.getSession();
Locale locale = (Locale) session.getAttribute(Action.LOCALE_KEY);
if (resources == null) {
resources = getServlet().getResources();
}
// 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);
}
// Identify the requested action
RequestDumperValveForm vform = (RequestDumperValveForm) form;
String adminAction = vform.getAdminAction();
String vObjectName = vform.getObjectName();
String parent = vform.getObjectName();
String valveType = vform.getValveType();
// Perform a "Create Valve" transaction (if requested)
if ("Create".equals(adminAction)) {
return ValveUtil.
createValve(parent, valveType, response, request, mapping,
(ApplicationServlet) getServlet());
}
// Perform attribute updates as requested
// No attributes to be updated.
// Forward to the success reporting page
session.removeAttribute(mapping.getAttribute());
return (mapping.findForward("Save Successful"));
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>