org.objectweb.medor.optim.jorm
Class JormLeafRewriteRule

java.lang.Object
  extended byorg.objectweb.medor.optim.lib.BasicRule
      extended byorg.objectweb.medor.optim.jorm.JormLeafRewriteRule
All Implemented Interfaces:
LeafRewriteRule, RewriteRule

public class JormLeafRewriteRule
extends BasicRule
implements LeafRewriteRule

This class represents the rule to transform QueryLeaves into the corresponding QueryLeaf on the data store (for example into an RdbQueryLeaf).


Nested Class Summary
 
Nested classes inherited from class org.objectweb.medor.optim.lib.BasicRule
BasicRule.ModifiedExpression
 
Field Summary
 
Fields inherited from class org.objectweb.medor.optim.lib.BasicRule
debug, log
 
Constructor Summary
JormLeafRewriteRule()
           
JormLeafRewriteRule(LeafRewriter lr)
           
 
Method Summary
 void addLeafRewriter(LeafRewriter lr)
           
 LeafRewriter getLeafRewriter(QueryLeaf ql)
           
 java.util.Collection getLeafRewriters()
           
protected  java.util.Map getLeafUsers(QueryTree qt)
           
protected  void getLeafUsers(QueryTree qt, java.util.Map m, java.util.ArrayList al)
          It fetches the QueryTree nodes which are 'parents' of QueryLeaf nodes.
 Logger getLogger()
           
 LoggerFactory getLoggerFactory()
           
 void removeLeafRewriter(LeafRewriter lr)
           
 QueryTree rewrite(QueryTree qt, QueryNode _parent)
          This method applies a single rule.
 void setLogger(Logger logger)
           
 void setLoggerFactory(LoggerFactory loggerFactory)
           
 
Methods inherited from class org.objectweb.medor.optim.lib.BasicRule
replaceUsage, rewrite
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.objectweb.medor.optim.api.RewriteRule
rewrite
 

Constructor Detail

JormLeafRewriteRule

public JormLeafRewriteRule()

JormLeafRewriteRule

public JormLeafRewriteRule(LeafRewriter lr)
Method Detail

addLeafRewriter

public void addLeafRewriter(LeafRewriter lr)
Specified by:
addLeafRewriter in interface LeafRewriteRule

removeLeafRewriter

public void removeLeafRewriter(LeafRewriter lr)
Specified by:
removeLeafRewriter in interface LeafRewriteRule

getLeafRewriters

public java.util.Collection getLeafRewriters()
Specified by:
getLeafRewriters in interface LeafRewriteRule

getLeafRewriter

public LeafRewriter getLeafRewriter(QueryLeaf ql)
Specified by:
getLeafRewriter in interface LeafRewriteRule

setLoggerFactory

public void setLoggerFactory(LoggerFactory loggerFactory)

getLoggerFactory

public LoggerFactory getLoggerFactory()

setLogger

public void setLogger(Logger logger)

getLogger

public Logger getLogger()

rewrite

public QueryTree rewrite(QueryTree qt,
                         QueryNode _parent)
                  throws MedorException
Description copied from interface: RewriteRule
This method applies a single rule.

It is typically called by the QueryRewriter for applying the entire rewriting process.

Specified by:
rewrite in interface RewriteRule
Parameters:
qt - the QueryTree to be rewritten
_parent - the parent QueryNode for which modification of propagated field, if they are replaced in the qt, should be done.
Returns:
the rewritten QueryTree
Throws:
MedorException

getLeafUsers

protected java.util.Map getLeafUsers(QueryTree qt)
                              throws MedorException
Throws:
MedorException

getLeafUsers

protected void getLeafUsers(QueryTree qt,
                            java.util.Map m,
                            java.util.ArrayList al)
                     throws MedorException
It fetches the QueryTree nodes which are 'parents' of QueryLeaf nodes.

Parameters:
qt - is the queryTree to analyze.
m - is the current result of the recusrive evaluation. key = a queryTree Value = the users of the querytree key : ArrayList( FieldOperand | PropagatedField | NestedField )
al - is the list of the visited queryTree. (It does not contain the 'qt' parameter)
Throws:
MedorException