1 64 65 package com.jcorporate.expresso.core.misc; 66 67 import com.jcorporate.expresso.core.controller.Controller; 68 69 import java.util.TreeSet ; 70 71 72 83 public class ReservedWords { 84 85 89 protected TreeSet caseInsensitiveWords; 90 91 96 protected TreeSet caseSensitiveWords; 97 98 101 static protected volatile ReservedWords theInstance = null; 102 103 106 public static synchronized ReservedWords getInstance() { 107 if (theInstance == null) { 108 theInstance = new ReservedWords(); 109 } 110 111 return theInstance; 112 } 113 114 122 public boolean isReservedWord(String testWord) { 123 if (caseSensitiveWords.contains(testWord)) { 124 return true; 125 } else if (caseInsensitiveWords.contains(testWord.toLowerCase())) { 126 return true; 127 } else { 128 return false; 129 } 130 } 131 132 136 public boolean isExpressoReservedWord(String testWord) { 137 return caseSensitiveWords.contains(testWord); 138 } 139 140 protected ReservedWords() { 141 caseInsensitiveWords = new TreeSet (); 142 caseSensitiveWords = new TreeSet (); 143 buildCaseInsensitiveList(); 144 buildCaseSensitiveList(); 145 } 146 147 protected void buildCaseSensitiveList() { 148 149 caseSensitiveWords.add(Controller.STATE_PARAM_KEY); 153 caseSensitiveWords.add(Controller.CONTROLLER_PARAM_KEY); 154 caseSensitiveWords.add("page"); 155 caseSensitiveWords.add("style"); 156 caseSensitiveWords.add("xsl"); 157 caseSensitiveWords.add("fields"); 158 caseSensitiveWords.add("search"); 159 caseSensitiveWords.add("db"); 160 } 161 162 protected void buildCaseInsensitiveList() { 163 164 caseInsensitiveWords.add("absolute"); 166 caseInsensitiveWords.add("action"); 167 caseInsensitiveWords.add("add"); 168 caseInsensitiveWords.add("admin"); 169 caseInsensitiveWords.add("after"); 170 caseInsensitiveWords.add("aggregate"); 171 caseInsensitiveWords.add("alias"); 172 caseInsensitiveWords.add("all"); 173 caseInsensitiveWords.add("allocate"); 174 caseInsensitiveWords.add("alter"); 175 caseInsensitiveWords.add("and"); 176 caseInsensitiveWords.add("any"); 177 caseInsensitiveWords.add("are"); 178 caseInsensitiveWords.add("array"); 179 caseInsensitiveWords.add("as"); 180 caseInsensitiveWords.add("asc"); 181 caseInsensitiveWords.add("assertion"); 182 caseInsensitiveWords.add("at"); 183 caseInsensitiveWords.add("authorization"); 184 caseInsensitiveWords.add("before"); 185 caseInsensitiveWords.add("begin"); 186 caseInsensitiveWords.add("binary"); 187 caseInsensitiveWords.add("bit"); 188 caseInsensitiveWords.add("blob"); 189 caseInsensitiveWords.add("boolean"); 190 caseInsensitiveWords.add("both"); 191 caseInsensitiveWords.add("breadth"); 192 caseInsensitiveWords.add("by"); 193 caseInsensitiveWords.add("call"); 194 caseInsensitiveWords.add("cascade"); 195 caseInsensitiveWords.add("cascaded"); 196 caseInsensitiveWords.add("case"); 197 caseInsensitiveWords.add("cast"); 198 caseInsensitiveWords.add("catalog"); 199 caseInsensitiveWords.add("char"); 200 caseInsensitiveWords.add("character"); 201 caseInsensitiveWords.add("check"); 202 caseInsensitiveWords.add("class"); 203 caseInsensitiveWords.add("clob"); 204 caseInsensitiveWords.add("close"); 205 caseInsensitiveWords.add("collate"); 206 caseInsensitiveWords.add("collation"); 207 caseInsensitiveWords.add("column"); 208 caseInsensitiveWords.add("commit"); 209 caseInsensitiveWords.add("completion"); 210 caseInsensitiveWords.add("connect"); 211 caseInsensitiveWords.add("connection"); 212 caseInsensitiveWords.add("constraint"); 213 caseInsensitiveWords.add("constraints"); 214 caseInsensitiveWords.add("constructor"); 215 caseInsensitiveWords.add("continue"); 216 caseInsensitiveWords.add("corresponding"); 217 caseInsensitiveWords.add("create"); 218 caseInsensitiveWords.add("cross"); 219 caseInsensitiveWords.add("cube"); 220 caseInsensitiveWords.add("current"); 221 caseInsensitiveWords.add("current_date"); 222 caseInsensitiveWords.add("current_path"); 223 caseInsensitiveWords.add("current_role"); 224 caseInsensitiveWords.add("current_time"); 225 caseInsensitiveWords.add("current_timestamp"); 226 caseInsensitiveWords.add("current_user"); 227 caseInsensitiveWords.add("cursor"); 228 caseInsensitiveWords.add("cycle"); 229 caseInsensitiveWords.add("data"); 230 caseInsensitiveWords.add("date"); 231 caseInsensitiveWords.add("day"); 232 caseInsensitiveWords.add("deallocate"); 233 caseInsensitiveWords.add("dec"); 234 caseInsensitiveWords.add("decimal"); 235 caseInsensitiveWords.add("declare"); 236 caseInsensitiveWords.add("default"); 237 caseInsensitiveWords.add("deferrable"); 238 caseInsensitiveWords.add("deferred"); 239 caseInsensitiveWords.add("delete"); 240 caseInsensitiveWords.add("depth"); 241 caseInsensitiveWords.add("deref"); 242 caseInsensitiveWords.add("desc"); 243 caseInsensitiveWords.add("describe"); 244 caseInsensitiveWords.add("descriptor"); 245 caseInsensitiveWords.add("destroy"); 246 caseInsensitiveWords.add("destructor"); 247 caseInsensitiveWords.add("deterministic"); 248 caseInsensitiveWords.add("diagnostics"); 249 caseInsensitiveWords.add("dictionary"); 250 caseInsensitiveWords.add("disconnect"); 251 caseInsensitiveWords.add("distinct"); 252 caseInsensitiveWords.add("domain"); 253 caseInsensitiveWords.add("double"); 254 caseInsensitiveWords.add("drop"); 255 caseInsensitiveWords.add("dynamic"); 256 caseInsensitiveWords.add("each"); 257 caseInsensitiveWords.add("else"); 258 caseInsensitiveWords.add("end"); 259 caseInsensitiveWords.add("end-exec"); 260 caseInsensitiveWords.add("equals"); 261 caseInsensitiveWords.add("escape"); 262 caseInsensitiveWords.add("every"); 263 caseInsensitiveWords.add("except"); 264 caseInsensitiveWords.add("exception"); 265 caseInsensitiveWords.add("exec"); 266 caseInsensitiveWords.add("execute"); 267 caseInsensitiveWords.add("external"); 268 caseInsensitiveWords.add("false"); 269 caseInsensitiveWords.add("fetch"); 270 caseInsensitiveWords.add("first"); 271 caseInsensitiveWords.add("float"); 272 caseInsensitiveWords.add("for"); 273 caseInsensitiveWords.add("foreign"); 274 caseInsensitiveWords.add("found"); 275 caseInsensitiveWords.add("free"); 276 caseInsensitiveWords.add("from"); 277 caseInsensitiveWords.add("full"); 278 caseInsensitiveWords.add("function"); 279 caseInsensitiveWords.add("general"); 280 caseInsensitiveWords.add("get"); 281 caseInsensitiveWords.add("global"); 282 caseInsensitiveWords.add("go"); 283 caseInsensitiveWords.add("goto"); 284 caseInsensitiveWords.add("grant"); 285 caseInsensitiveWords.add("group"); 286 caseInsensitiveWords.add("grouping"); 287 caseInsensitiveWords.add("having"); 288 caseInsensitiveWords.add("host"); 289 caseInsensitiveWords.add("hour"); 290 caseInsensitiveWords.add("identity"); 291 caseInsensitiveWords.add("ignore"); 292 caseInsensitiveWords.add("immediate"); 293 caseInsensitiveWords.add("in"); 294 caseInsensitiveWords.add("indicator"); 295 caseInsensitiveWords.add("initialize"); 296 caseInsensitiveWords.add("initially"); 297 caseInsensitiveWords.add("inner"); 298 caseInsensitiveWords.add("inout"); 299 caseInsensitiveWords.add("input"); 300 caseInsensitiveWords.add("insert"); 301 caseInsensitiveWords.add("int"); 302 caseInsensitiveWords.add("integer"); 303 caseInsensitiveWords.add("intersect"); 304 caseInsensitiveWords.add("interval"); 305 caseInsensitiveWords.add("into"); 306 caseInsensitiveWords.add("is"); 307 caseInsensitiveWords.add("isolation"); 308 caseInsensitiveWords.add("iterate"); 309 caseInsensitiveWords.add("join"); 310 caseInsensitiveWords.add("key"); 311 caseInsensitiveWords.add("language"); 312 caseInsensitiveWords.add("large"); 313 caseInsensitiveWords.add("last"); 314 caseInsensitiveWords.add("lateral"); 315 caseInsensitiveWords.add("leading"); 316 caseInsensitiveWords.add("left"); 317 caseInsensitiveWords.add("less"); 318 caseInsensitiveWords.add("level"); 319 caseInsensitiveWords.add("like"); 320 caseInsensitiveWords.add("limit"); 321 caseInsensitiveWords.add("local"); 322 caseInsensitiveWords.add("localtime"); 323 caseInsensitiveWords.add("localtimestamp"); 324 caseInsensitiveWords.add("locator"); 325 caseInsensitiveWords.add("map"); 326 caseInsensitiveWords.add("match"); 327 caseInsensitiveWords.add("minute"); 328 caseInsensitiveWords.add("modifies"); 329 caseInsensitiveWords.add("modify"); 330 caseInsensitiveWords.add("module"); 331 caseInsensitiveWords.add("month"); 332 caseInsensitiveWords.add("names"); 333 caseInsensitiveWords.add("national"); 334 caseInsensitiveWords.add("natural"); 335 caseInsensitiveWords.add("nchar"); 336 caseInsensitiveWords.add("nclob"); 337 caseInsensitiveWords.add("new"); 338 caseInsensitiveWords.add("next"); 339 caseInsensitiveWords.add("no"); 340 caseInsensitiveWords.add("none"); 341 caseInsensitiveWords.add("not"); 342 caseInsensitiveWords.add("null"); 343 caseInsensitiveWords.add("numeric"); 344 caseInsensitiveWords.add("object"); 345 caseInsensitiveWords.add("of"); 346 caseInsensitiveWords.add("off"); 347 caseInsensitiveWords.add("old"); 348 caseInsensitiveWords.add("on"); 349 caseInsensitiveWords.add("only"); 350 caseInsensitiveWords.add("open"); 351 caseInsensitiveWords.add("operation"); 352 caseInsensitiveWords.add("option"); 353 caseInsensitiveWords.add("or"); 354 caseInsensitiveWords.add("order"); 355 caseInsensitiveWords.add("ordinality"); 356 caseInsensitiveWords.add("out"); 357 caseInsensitiveWords.add("outer"); 358 caseInsensitiveWords.add("output"); 359 caseInsensitiveWords.add("pad"); 360 caseInsensitiveWords.add("parameter"); 361 caseInsensitiveWords.add("parameters"); 362 caseInsensitiveWords.add("partial"); 363 caseInsensitiveWords.add("path"); 364 caseInsensitiveWords.add("postfix"); 365 caseInsensitiveWords.add("precision"); 366 caseInsensitiveWords.add("prefix"); 367 caseInsensitiveWords.add("preorder"); 368 caseInsensitiveWords.add("prepare"); 369 caseInsensitiveWords.add("preserve"); 370 caseInsensitiveWords.add("primary"); 371 caseInsensitiveWords.add("prior"); 372 caseInsensitiveWords.add("procedure"); 373 caseInsensitiveWords.add("public"); 374 caseInsensitiveWords.add("read"); 375 caseInsensitiveWords.add("reads"); 376 caseInsensitiveWords.add("real"); 377 caseInsensitiveWords.add("recursive"); 378 caseInsensitiveWords.add("ref"); 379 caseInsensitiveWords.add("references"); 380 caseInsensitiveWords.add("referencing"); 381 caseInsensitiveWords.add("relative"); 382 caseInsensitiveWords.add("restrict"); 383 caseInsensitiveWords.add("result"); 384 caseInsensitiveWords.add("return"); 385 caseInsensitiveWords.add("returns"); 386 caseInsensitiveWords.add("revoke"); 387 caseInsensitiveWords.add("right"); 388 caseInsensitiveWords.add("role"); 389 caseInsensitiveWords.add("rollback"); 390 caseInsensitiveWords.add("rolleup"); 391 caseInsensitiveWords.add("routine"); 392 caseInsensitiveWords.add("row"); 393 caseInsensitiveWords.add("rows"); 394 caseInsensitiveWords.add("savepoint"); 395 caseInsensitiveWords.add("schema"); 396 caseInsensitiveWords.add("scope"); 397 caseInsensitiveWords.add("scroll"); 398 caseInsensitiveWords.add("search"); 399 caseInsensitiveWords.add("second"); 400 caseInsensitiveWords.add("section"); 401 caseInsensitiveWords.add("select"); 402 caseInsensitiveWords.add("sequence"); 403 caseInsensitiveWords.add("session"); 404 caseInsensitiveWords.add("session_user"); 405 caseInsensitiveWords.add("set"); 406 caseInsensitiveWords.add("sets"); 407 caseInsensitiveWords.add("similar"); 408 caseInsensitiveWords.add("simple"); 409 caseInsensitiveWords.add("size"); 410 caseInsensitiveWords.add("smallint"); 411 caseInsensitiveWords.add("some"); 412 caseInsensitiveWords.add("space"); 413 caseInsensitiveWords.add("specific"); 414 caseInsensitiveWords.add("specifictype"); 415 caseInsensitiveWords.add("sql"); 416 caseInsensitiveWords.add("sqlexception"); 417 caseInsensitiveWords.add("sqlstate"); 418 caseInsensitiveWords.add("sqlwarning"); 419 caseInsensitiveWords.add("start"); 420 caseInsensitiveWords.add(Controller.STATE_PARAM_KEY); 421 caseInsensitiveWords.add("statement"); 422 caseInsensitiveWords.add("static"); 423 caseInsensitiveWords.add("structure"); 424 caseInsensitiveWords.add("system_user"); 425 caseInsensitiveWords.add("table"); 426 caseInsensitiveWords.add("temporary"); 427 caseInsensitiveWords.add("terminate"); 428 caseInsensitiveWords.add("than"); 429 caseInsensitiveWords.add("then"); 430 caseInsensitiveWords.add("time"); 431 caseInsensitiveWords.add("timestamp"); 432 caseInsensitiveWords.add("timezone_Hour"); 433 caseInsensitiveWords.add("timezone_Minute"); 434 caseInsensitiveWords.add("to"); 435 caseInsensitiveWords.add("trailing"); 436 caseInsensitiveWords.add("transaction"); 437 caseInsensitiveWords.add("translation"); 438 caseInsensitiveWords.add("treat"); 439 caseInsensitiveWords.add("trigger"); 440 caseInsensitiveWords.add("true"); 441 caseInsensitiveWords.add("under"); 442 caseInsensitiveWords.add("union"); 443 caseInsensitiveWords.add("unique"); 444 caseInsensitiveWords.add("unknown"); 445 caseInsensitiveWords.add("unnest"); 446 caseInsensitiveWords.add("update"); 447 caseInsensitiveWords.add("usage"); 448 caseInsensitiveWords.add("user"); 449 caseInsensitiveWords.add("using"); 450 caseInsensitiveWords.add("value"); 451 caseInsensitiveWords.add("values"); 452 caseInsensitiveWords.add("varchar"); 453 caseInsensitiveWords.add("variable"); 454 caseInsensitiveWords.add("varying"); 455 caseInsensitiveWords.add("view"); 456 caseInsensitiveWords.add("when"); 457 caseInsensitiveWords.add("whenever"); 458 caseInsensitiveWords.add("where"); 459 caseInsensitiveWords.add("with"); 460 caseInsensitiveWords.add("without"); 461 caseInsensitiveWords.add("work"); 462 caseInsensitiveWords.add("write"); 463 caseInsensitiveWords.add("year"); 464 caseInsensitiveWords.add("zone"); 465 466 } 469 } | Popular Tags |