org.objectweb.cjdbc.controller.backend.rewriting
Class AbstractRewritingRule

java.lang.Object
  extended byorg.objectweb.cjdbc.controller.backend.rewriting.AbstractRewritingRule
Direct Known Subclasses:
PatternRewritingRule, ReplaceAllRewritingRule, SimpleRewritingRule

public abstract class AbstractRewritingRule
extends java.lang.Object

This class defines a AbstractRewritingRule to rewrite SQL requests for a specific backend.

Version:
1.0
Author:
Emmanuel Cecchet

Field Summary
protected  boolean hasMatched
           
protected  boolean isCaseSensitive
           
protected  java.lang.String queryPattern
           
protected  java.lang.String rewrite
           
protected  boolean stopOnMatch
           
 
Constructor Summary
AbstractRewritingRule(java.lang.String queryPattern, java.lang.String rewrite, boolean caseSensitive, boolean stopOnMatch)
          Creates a new AbstractRewritingRule object
 
Method Summary
 java.lang.String getQueryPattern()
          Returns the queryPattern value.
 java.lang.String getRewrite()
          Returns the rewrite value.
 java.lang.String getXml()
          Get xml information about this AbstractRewritingRule.
 boolean hasMatched()
          Returns true if the query given in the last call to rewrite has matched this rule.
 boolean isCaseSensitive()
          Returns the isCaseSensitive value.
 boolean isStopOnMatch()
          Returns the stopOnMatch value.
abstract  java.lang.String rewrite(java.lang.String sqlQuery)
          Rewrite the given query according to the rule.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

queryPattern

protected java.lang.String queryPattern

rewrite

protected java.lang.String rewrite

isCaseSensitive

protected boolean isCaseSensitive

stopOnMatch

protected boolean stopOnMatch

hasMatched

protected boolean hasMatched
Constructor Detail

AbstractRewritingRule

public AbstractRewritingRule(java.lang.String queryPattern,
                             java.lang.String rewrite,
                             boolean caseSensitive,
                             boolean stopOnMatch)
Creates a new AbstractRewritingRule object

Parameters:
queryPattern - SQL pattern to match
rewrite - rewritten SQL query
caseSensitive - true if matching is case sensitive
stopOnMatch - true if rewriting must stop after this rule if it matches.
Method Detail

hasMatched

public boolean hasMatched()
Returns true if the query given in the last call to rewrite has matched this rule.

1. call rewrite(query)

2. call hasMatched() to know if query matched this rule.

Returns:
true if the query matched this rule.
See Also:
rewrite(String)

rewrite

public abstract java.lang.String rewrite(java.lang.String sqlQuery)
Rewrite the given query according to the rule. Note that this method does not check if the given query matches the rule or not. You must call matches(String) before calling this method.

Parameters:
sqlQuery - request to rewrite
Returns:
the rewritten SQL query according to the rule.
See Also:
hasMatched

isCaseSensitive

public boolean isCaseSensitive()
Returns the isCaseSensitive value.

Returns:
Returns the isCaseSensitive.

getQueryPattern

public java.lang.String getQueryPattern()
Returns the queryPattern value.

Returns:
Returns the queryPattern.

getRewrite

public java.lang.String getRewrite()
Returns the rewrite value.

Returns:
Returns the rewrite.

isStopOnMatch

public boolean isStopOnMatch()
Returns the stopOnMatch value.

Returns:
Returns the stopOnMatch.

getXml

public java.lang.String getXml()
Get xml information about this AbstractRewritingRule.

Returns:
xml formatted information on this AbstractRewritingRule.


Copyright © 2002, 2005 - ObjectWeb Consortium - All Rights Reserved.