1 23 24 package com.sun.appserv.web.cache.mapping; 25 26 import com.sun.appserv.web.cache.CacheHelper; 27 28 33 public class CacheMapping { 34 private String helperNameRef; 35 private String servletName; 36 private String urlPattern; 37 38 private int timeout = CacheHelper.TIMEOUT_VALUE_NOT_SET; 40 private Field timeoutField = null; 41 42 private Field refreshField = null; 44 45 private String methods[] = new String [0]; 47 48 private Field keyFields[] = new Field[0]; 50 51 private ConstraintField constraintFields[] = new ConstraintField[0]; 53 54 56 public CacheMapping() { 57 } 58 59 61 65 public void setHelperNameRef(String helperNameRef) { 66 this.helperNameRef = helperNameRef; 67 } 68 69 72 public void setServletName(String servletName) { 73 this.servletName = servletName; 74 } 75 76 79 public void setURLPattern(String urlPattern) { 80 this.urlPattern = urlPattern; 81 } 82 83 86 public void setTimeout(int timeout) { 87 this.timeout = timeout; 88 } 89 90 93 public void setTimeoutField(Field field) { 94 this.timeoutField = field; 95 } 96 97 100 public void setRefreshField(Field field) { 101 this.refreshField = field; 102 } 103 104 107 public Field getRefreshField() { 108 return refreshField; 109 } 110 111 114 public void setMethods(String [] methods) { 115 if (methods == null) 116 return; 117 118 this.methods = methods; 119 } 120 121 124 public void addMethod(String method) { 125 if (method == null) 126 return; 127 128 String results[] = new String [methods.length + 1]; 129 for (int i = 0; i < methods.length; i++) 130 results[i] = methods[i]; 131 results[methods.length] = method; 132 133 methods = results; 134 } 135 136 139 public void addKeyField(Field field) { 140 if (field == null) 141 return; 142 143 Field results[] = new Field[keyFields.length + 1]; 144 for (int i = 0; i < keyFields.length; i++) 145 results[i] = keyFields[i]; 146 results[keyFields.length] = field; 147 148 keyFields = results; 149 } 150 151 154 public void addConstraintField(ConstraintField field) { 155 if (field == null) 156 return; 157 158 ConstraintField results[] = 159 new ConstraintField[constraintFields.length + 1]; 160 161 for (int i = 0; i < constraintFields.length; i++) 162 results[i] = constraintFields[i]; 163 results[constraintFields.length] = field; 164 165 constraintFields = results; 166 } 167 168 169 170 174 public String getHelperNameRef() { 175 return helperNameRef; 176 } 177 178 182 public String getServletName() { 183 return servletName; 184 } 185 186 190 public String getURLPattern() { 191 return urlPattern; 192 } 193 194 200 public boolean findMethod(String method) { 201 if (methods.length == 0) 202 return (true); 203 for (int i = 0; i < methods.length; i++) { 204 if (methods[i].equals(method)) 205 return (true); 206 } 207 return (false); 208 } 209 210 214 public int getTimeout() { 215 return timeout; 216 } 217 218 222 public Field getTimeoutField() { 223 return timeoutField; 224 } 225 226 230 public Field[] getKeyFields() { 231 return keyFields; 232 } 233 234 238 public ConstraintField[] getConstraintFields() { 239 return constraintFields; 240 } 241 } 242 | Popular Tags |