1 24 25 package org.objectweb.cjdbc.controller.backend.rewriting; 26 27 import org.objectweb.cjdbc.common.xml.DatabasesXmlTags; 28 29 36 public abstract class AbstractRewritingRule 37 { 38 protected String queryPattern; 39 protected String rewrite; 40 protected boolean isCaseSensitive; 41 protected boolean stopOnMatch; 42 protected boolean hasMatched; 43 44 53 public AbstractRewritingRule(String queryPattern, String rewrite, 54 boolean caseSensitive, boolean stopOnMatch) 55 { 56 this.queryPattern = queryPattern; 57 this.rewrite = rewrite; 58 this.isCaseSensitive = caseSensitive; 59 this.stopOnMatch = stopOnMatch; 60 this.hasMatched = false; 61 } 62 63 72 public boolean hasMatched() 73 { 74 return hasMatched; 75 } 76 77 86 public abstract String rewrite(String sqlQuery); 87 88 93 public boolean isCaseSensitive() 94 { 95 return isCaseSensitive; 96 } 97 98 103 public String getQueryPattern() 104 { 105 return queryPattern; 106 } 107 108 113 public String getRewrite() 114 { 115 return rewrite; 116 } 117 118 123 public boolean isStopOnMatch() 124 { 125 return stopOnMatch; 126 } 127 128 133 public String getXml() 134 { 135 return "<" + DatabasesXmlTags.ELT_RewritingRule + " " 136 + DatabasesXmlTags.ATT_queryPattern + "=\"" + queryPattern + "\" " 137 + DatabasesXmlTags.ATT_rewrite + "=\"" + rewrite + "\" " 138 + DatabasesXmlTags.ATT_caseSensitive + "=\"" + isCaseSensitive + "\" " 139 + DatabasesXmlTags.ATT_stopOnMatch + "=\"" + stopOnMatch + "\"/>"; 140 } 141 142 } 143 | Popular Tags |