CatalinaAccessLogValveForm.java

00001 /*
00002  * JOnAS: Java(TM) Open Application Server
00003  * Copyright (C) 1999 Bull S.A.
00004  * Contact: jonas-team@objectweb.org
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
00019  * USA
00020  *
00021  * --------------------------------------------------------------------------
00022  * $Id: CatalinaAccessLogValveForm.java,v 1.2 2004/03/19 14:31:48 sauthieg Exp $
00023  * --------------------------------------------------------------------------
00024  */
00025 
00026 package org.objectweb.jonas.webapp.jonasadmin.logging;
00027 
00028 import java.util.List;
00029 
00030 import javax.servlet.http.HttpServletRequest;
00031 
00032 import org.apache.struts.action.ActionError;
00033 import org.apache.struts.action.ActionErrors;
00034 import org.apache.struts.action.ActionMapping;
00035 import org.objectweb.jonas.webapp.jonasadmin.Jlists;
00036 
00041 public final class CatalinaAccessLogValveForm extends CatalinaValveForm {
00042 
00043 // ----------------------------------------------------- Properties Variables
00044 
00045     private String directory = null;
00046     private String pattern = null;
00047     private String prefix = null;
00048     private String suffix = null;
00049     private boolean rotatable = true;
00050     private boolean resolveHosts = false;
00051 
00052     private List booleanValues = Jlists.getBooleanValues();
00053 
00054 // --------------------------------------------------------- Public Methods
00055 
00056     public void reset(ActionMapping mapping, HttpServletRequest request) {
00057 
00058         super.reset(mapping, request);
00059         directory = "logs";
00060         prefix = "access_log.";
00061         suffix = ".txt";
00062         pattern = "%h %l %u %t \"%r\" %s %b";
00063         resolveHosts = false;
00064         rotatable = true;
00065     }
00066 
00067     public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
00068         ActionErrors oErrors = new ActionErrors();
00069         // prefix
00070         if ((prefix == null) || (prefix.length() < 1)) {
00071             oErrors.add("pattern", new ActionError("error.logger.catalina.access.prefix.required"));
00072         }
00073         // default is a 0 length string
00074         if ((suffix == null) || (suffix.length() < 1)) {
00075             suffix = "";
00076         }
00077         // pattern
00078         if ((pattern == null) || (pattern.length() < 1)) {
00079             oErrors.add("pattern", new ActionError("error.logger.catalina.access.pattern.required"));
00080         }
00081         return oErrors;
00082     }
00083 
00084 // ------------------------------------------------------------- Properties Methods
00085 
00086     public List getBooleanValues() {
00087         return booleanValues;
00088     }
00089 
00090     public void setBooleanValues(List booleanValues) {
00091         this.booleanValues = booleanValues;
00092     }
00093 
00094     public String getDirectory() {
00095         return this.directory;
00096     }
00097 
00098     public void setDirectory(String directory) {
00099         this.directory = directory;
00100     }
00101 
00102     public String getPattern() {
00103         return this.pattern;
00104     }
00105 
00106     public void setPattern(String pattern) {
00107         this.pattern = pattern;
00108     }
00109 
00110     public String getPrefix() {
00111         return this.prefix;
00112     }
00113 
00114     public void setPrefix(String prefix) {
00115         this.prefix = prefix;
00116     }
00117 
00118     public String getSuffix() {
00119         return this.suffix;
00120     }
00121 
00122     public void setSuffix(String suffix) {
00123         this.suffix = suffix;
00124     }
00125 
00126     public boolean isResolveHosts() {
00127         return this.resolveHosts;
00128     }
00129 
00130     public void setResolveHosts(boolean resolveHosts) {
00131         this.resolveHosts = resolveHosts;
00132     }
00133 
00134     public boolean isRotatable() {
00135         return this.rotatable;
00136     }
00137 
00138     public void setRotatable(boolean rotatable) {
00139         this.rotatable = rotatable;
00140     }
00141 }

Generated on Tue Feb 15 15:05:28 2005 for JOnAS by  doxygen 1.3.9.1