1 23 24 package com.sun.enterprise.deployment.runtime.web; 25 26 import com.sun.enterprise.deployment.runtime.RuntimeDescriptor; 27 28 35 public class CacheMapping extends RuntimeDescriptor 36 { 37 38 static public final String SERVLET_NAME = "ServletName"; static public final String URL_PATTERN = "UrlPattern"; static public final String CACHE_HELPER_REF = "CacheHelperRef"; static public final String TIMEOUT = "Timeout"; static public final String NAME = "Name"; 43 static public final String SCOPE = "Scope"; 44 static public final String REFRESH_FIELD = "RefreshField"; static public final String HTTP_METHOD = "HttpMethod"; static public final String DISPATCHER = "Dispatcher"; static public final String KEY_FIELD = "KeyField"; static public final String CONSTRAINT_FIELD = "ConstraintField"; 50 public CacheMapping(CacheMapping other) { 51 super(other); 52 } 53 54 public CacheMapping() { 55 setAttributeValue(KEY_FIELD, SCOPE, "request.parameter"); 56 setAttributeValue(REFRESH_FIELD, SCOPE, "request.parameter"); 57 } 58 59 public void setServletName(String value) 61 { 62 this.setValue(SERVLET_NAME, value); 63 } 64 65 public String getServletName() 67 { 68 return (String )this.getValue(SERVLET_NAME); 69 } 70 71 public void setUrlPattern(String value) 73 { 74 this.setValue(URL_PATTERN, value); 75 } 76 77 public String getUrlPattern() 79 { 80 return (String )this.getValue(URL_PATTERN); 81 } 82 83 public void setCacheHelperRef(String value) 85 { 86 this.setValue(CACHE_HELPER_REF, value); 87 } 88 89 public String getCacheHelperRef() 91 { 92 return (String )this.getValue(CACHE_HELPER_REF); 93 } 94 95 public void setTimeout(String value) 97 { 98 this.setValue(TIMEOUT, value); 99 } 100 101 public String getTimeout() 103 { 104 return (String )this.getValue(TIMEOUT); 105 } 106 107 public void setRefreshField(boolean value) 109 { 110 this.setValue(REFRESH_FIELD, new Boolean (value)); 111 } 112 113 public boolean isRefreshField() 115 { 116 Boolean ret = (Boolean )this.getValue(REFRESH_FIELD); 117 if (ret == null) 118 return false; 119 return ret.booleanValue(); 120 } 121 122 123 public void setDispatcher(int index, String value) 125 { 126 this.setValue(DISPATCHER, index, value); 127 } 128 129 public String getDispatcher(int index) 131 { 132 return (String )this.getValue(DISPATCHER, index); 133 } 134 135 public void setDispatcher(String [] value) 137 { 138 this.setValue(DISPATCHER, value); 139 } 140 141 public String [] getDispatcher() 143 { 144 return (String [])this.getValues(DISPATCHER); 145 } 146 147 public int sizeDispatcher() 149 { 150 return this.size(DISPATCHER); 151 } 152 153 public int addDispatcher(String value) 155 { 156 return this.addValue(DISPATCHER, value); 157 } 158 159 public void addNewDispatcher(String value) 161 { 162 addValue(DISPATCHER, value); 163 } 164 165 public int removeDispatcher(String value) 170 { 171 return this.removeValue(DISPATCHER, value); 172 } 173 174 175 public void setHttpMethod(int index, String value) 177 { 178 this.setValue(HTTP_METHOD, index, value); 179 } 180 181 public String getHttpMethod(int index) 183 { 184 return (String )this.getValue(HTTP_METHOD, index); 185 } 186 187 public void setHttpMethod(String [] value) 189 { 190 this.setValue(HTTP_METHOD, value); 191 } 192 193 public String [] getHttpMethod() 195 { 196 return (String [])this.getValues(HTTP_METHOD); 197 } 198 199 public int sizeHttpMethod() 201 { 202 return this.size(HTTP_METHOD); 203 } 204 205 public int addHttpMethod(String value) 207 { 208 return this.addValue(HTTP_METHOD, value); 209 } 210 public void addNewHttpMethod(String value) 212 { 213 addValue(HTTP_METHOD, value); 214 } 215 216 public int removeHttpMethod(String value) 221 { 222 return this.removeValue(HTTP_METHOD, value); 223 } 224 225 public void setKeyField(int index, boolean value) 227 { 228 this.setValue(KEY_FIELD, index, new Boolean (value)); 229 } 230 231 public boolean isKeyField(int index) 233 { 234 Boolean ret = (Boolean )this.getValue(KEY_FIELD, index); 235 if (ret == null) 236 return false; 237 return ret.booleanValue(); 238 } 239 240 public void setKeyField(boolean[] value) 242 { 243 Boolean [] values = null; 244 if (value != null) 245 { 246 values = new Boolean [value.length]; 247 for (int i=0; i<value.length; i++) 248 values[i] = new Boolean (value[i]); 249 } 250 this.setValue(KEY_FIELD, values); 251 } 252 253 public boolean[] getKeyField() 255 { 256 boolean[] ret = null; 257 Boolean [] values = (Boolean [])this.getValues(KEY_FIELD); 258 if (values != null) 259 { 260 ret = new boolean[values.length]; 261 for (int i=0; i<values.length; i++) 262 ret[i] = values[i].booleanValue(); 263 } 264 return ret; 265 } 266 267 public int sizeKeyField() 269 { 270 return this.size(KEY_FIELD); 271 } 272 273 public int addKeyField(boolean value) 275 { 276 return this.addValue(KEY_FIELD, new Boolean (value)); 277 } 278 279 public int removeKeyField(boolean value) 284 { 285 return this.removeValue(KEY_FIELD, new Boolean (value)); 286 } 287 288 public void removeKeyField(int index) 292 { 293 this.removeValue(KEY_FIELD, index); 294 } 295 296 public void setConstraintField(int index, ConstraintField value) 298 { 299 this.setValue(CONSTRAINT_FIELD, index, value); 300 } 301 302 public ConstraintField getConstraintField(int index) 304 { 305 return (ConstraintField)this.getValue(CONSTRAINT_FIELD, index); 306 } 307 308 public void setConstraintField(ConstraintField[] value) 310 { 311 this.setValue(CONSTRAINT_FIELD, value); 312 } 313 314 public ConstraintField[] getConstraintField() 316 { 317 return (ConstraintField[])this.getValues(CONSTRAINT_FIELD); 318 } 319 320 public int sizeConstraintField() 322 { 323 return this.size(CONSTRAINT_FIELD); 324 } 325 326 public int addConstraintField(ConstraintField value) 328 { 329 return this.addValue(CONSTRAINT_FIELD, value); 330 } 331 332 public void addNewConstraintField(ConstraintField value) 334 { 335 this.addValue(CONSTRAINT_FIELD, value); 336 } 337 338 public int removeConstraintField(ConstraintField value) 343 { 344 return this.removeValue(CONSTRAINT_FIELD, value); 345 } 346 347 public boolean verify() 349 { 350 return true; 351 } 352 353 } 354 | Popular Tags |