1 23 24 28 29 package com.sun.enterprise.config.serverbeans; 30 31 import org.w3c.dom.*; 32 import org.netbeans.modules.schema2beans.*; 33 import java.beans.*; 34 import java.util.*; 35 import java.io.Serializable ; 36 import com.sun.enterprise.config.ConfigBean; 37 import com.sun.enterprise.config.ConfigException; 38 import com.sun.enterprise.config.StaleWriteConfigException; 39 import com.sun.enterprise.util.i18n.StringManager; 40 41 43 public class AccessLog extends ConfigBean implements Serializable 44 { 45 46 static Vector comparators = new Vector(); 47 private static final org.netbeans.modules.schema2beans.Version runtimeVersion = new org.netbeans.modules.schema2beans.Version(4, 2, 0); 48 49 50 public AccessLog() { 51 this(Common.USE_DEFAULT_VALUES); 52 } 53 54 public AccessLog(int options) 55 { 56 super(comparators, runtimeVersion); 57 initPropertyTables(0); 59 this.initialize(options); 60 } 61 62 void initialize(int options) { 64 65 } 66 67 71 public String getFormat() { 72 return getAttributeValue(ServerTags.FORMAT); 73 } 74 79 public void setFormat(String v, boolean overwrite) throws StaleWriteConfigException { 80 setAttributeValue(ServerTags.FORMAT, v, overwrite); 81 } 82 86 public void setFormat(String v) { 87 setAttributeValue(ServerTags.FORMAT, v); 88 } 89 92 public static String getDefaultFormat() { 93 return "%client.name% %auth-user-name% %datetime% %request% %status% %response.length%".trim(); 94 } 95 99 public String getRotationPolicy() { 100 return getAttributeValue(ServerTags.ROTATION_POLICY); 101 } 102 107 public void setRotationPolicy(String v, boolean overwrite) throws StaleWriteConfigException { 108 setAttributeValue(ServerTags.ROTATION_POLICY, v, overwrite); 109 } 110 114 public void setRotationPolicy(String v) { 115 setAttributeValue(ServerTags.ROTATION_POLICY, v); 116 } 117 120 public static String getDefaultRotationPolicy() { 121 return "time".trim(); 122 } 123 127 public String getRotationIntervalInMinutes() { 128 return getAttributeValue(ServerTags.ROTATION_INTERVAL_IN_MINUTES); 129 } 130 135 public void setRotationIntervalInMinutes(String v, boolean overwrite) throws StaleWriteConfigException { 136 setAttributeValue(ServerTags.ROTATION_INTERVAL_IN_MINUTES, v, overwrite); 137 } 138 142 public void setRotationIntervalInMinutes(String v) { 143 setAttributeValue(ServerTags.ROTATION_INTERVAL_IN_MINUTES, v); 144 } 145 148 public static String getDefaultRotationIntervalInMinutes() { 149 return "1440".trim(); 150 } 151 155 public String getRotationSuffix() { 156 return getAttributeValue(ServerTags.ROTATION_SUFFIX); 157 } 158 163 public void setRotationSuffix(String v, boolean overwrite) throws StaleWriteConfigException { 164 setAttributeValue(ServerTags.ROTATION_SUFFIX, v, overwrite); 165 } 166 170 public void setRotationSuffix(String v) { 171 setAttributeValue(ServerTags.ROTATION_SUFFIX, v); 172 } 173 176 public static String getDefaultRotationSuffix() { 177 return "yyyyMMdd-HH'h'mm'm'ss's'".trim(); 178 } 179 183 public boolean isRotationEnabled() { 184 return toBoolean(getAttributeValue(ServerTags.ROTATION_ENABLED)); 185 } 186 191 public void setRotationEnabled(boolean v, boolean overwrite) throws StaleWriteConfigException { 192 setAttributeValue(ServerTags.ROTATION_ENABLED, ""+(v==true), overwrite); 193 } 194 198 public void setRotationEnabled(boolean v) { 199 setAttributeValue(ServerTags.ROTATION_ENABLED, ""+(v==true)); 200 } 201 204 public static String getDefaultRotationEnabled() { 205 return "true".trim(); 206 } 207 212 protected String getRelativeXPath() { 213 String ret = null; 214 ret = "access-log"; 215 return (null != ret ? ret.trim() : null); 216 } 217 218 221 public static String getDefaultAttributeValue(String attr) { 222 if(attr == null) return null; 223 attr = attr.trim(); 224 if(attr.equals(ServerTags.FORMAT)) return "%client.name% %auth-user-name% %datetime% %request% %status% %response.length%".trim(); 225 if(attr.equals(ServerTags.ROTATION_POLICY)) return "time".trim(); 226 if(attr.equals(ServerTags.ROTATION_INTERVAL_IN_MINUTES)) return "1440".trim(); 227 if(attr.equals(ServerTags.ROTATION_SUFFIX)) return "yyyyMMdd-HH'h'mm'm'ss's'".trim(); 228 if(attr.equals(ServerTags.ROTATION_ENABLED)) return "true".trim(); 229 return null; 230 } 231 public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 233 comparators.add(c); 234 } 235 236 public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 238 comparators.remove(c); 239 } 240 public void validate() throws org.netbeans.modules.schema2beans.ValidateException { 241 } 242 243 public void dump(StringBuffer str, String indent){ 245 String s; 246 Object o; 247 org.netbeans.modules.schema2beans.BaseBean n; 248 } 249 public String dumpBeanNode(){ 250 StringBuffer str = new StringBuffer (); 251 str.append("AccessLog\n"); this.dump(str, "\n "); return str.toString(); 254 }} 255 256 258 | Popular Tags |