org.objectweb.jonas_ejb.lib
Class EjbqlQueryTreeHolder

java.lang.Object
  extended by org.objectweb.jonas_ejb.lib.EjbqlQueryTreeHolder

public class EjbqlQueryTreeHolder
extends java.lang.Object

Class to hold the query tree of a given EJBQL request. This allows walking the JormExtents of the tree to set the mappers.

Author:
Christophe Ney - cney@batisseurs.com : Initial developer, Helene Joanin: Take into account the ORDER BY clause., Sebastien Chassande-Barrioz & Helene Joanin: prefetch code, Helene Joanin: Take into account the aggregate select expression., Cyrille Blot: Take into account the LIMIT clause

Constructor Summary
EjbqlQueryTreeHolder(MethodCmp2Desc mDesc, ASTEJBQL ejbql, org.objectweb.jorm.api.PMapper mapper)
          constructor of a holder for a specific query.
 
Method Summary
 EjbqlLimiterRange[] getLimiterRanges()
           
 org.objectweb.medor.eval.api.QueryEvaluator getOptimizedQueryTree()
          Get the query evaluator of the optimized query.
 int getPrefetchIndex()
           
 org.objectweb.medor.optim.api.QueryTransformer getQueryOptimizer()
          get the current query tree optimizer
 org.objectweb.medor.query.api.QueryTree getQueryTree()
          get the query tree that was built from visiting the lexical tree
 org.objectweb.medor.api.Field getResField()
          get the Medor result Field of the query (useful for the ejbSelect method)
 void setQueryOptimizer(org.objectweb.medor.optim.api.QueryTransformer qtf)
          Set the optimizer to be used when optimizing the query tree
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EjbqlQueryTreeHolder

public EjbqlQueryTreeHolder(MethodCmp2Desc mDesc,
                            ASTEJBQL ejbql,
                            org.objectweb.jorm.api.PMapper mapper)
                     throws java.lang.Exception
constructor of a holder for a specific query.

Parameters:
mDesc - JOnAS meta-information for the corresponding finder/select method
ejbql - root of the lexical tree of the query
mapper - mapper to associate at each leaves of the QueryTree. The mapper may be null in case of the QueryTree is build in the GenIC phase.
Throws:
java.lang.Exception
Method Detail

getPrefetchIndex

public int getPrefetchIndex()

getQueryTree

public org.objectweb.medor.query.api.QueryTree getQueryTree()
get the query tree that was built from visiting the lexical tree


setQueryOptimizer

public void setQueryOptimizer(org.objectweb.medor.optim.api.QueryTransformer qtf)
Set the optimizer to be used when optimizing the query tree


getQueryOptimizer

public org.objectweb.medor.optim.api.QueryTransformer getQueryOptimizer()
get the current query tree optimizer


getResField

public org.objectweb.medor.api.Field getResField()
get the Medor result Field of the query (useful for the ejbSelect method)


getLimiterRanges

public EjbqlLimiterRange[] getLimiterRanges()
Returns:
returns the limiter ranges of the LIMIT clause. May be 0 element if no LIMIT clause, 1 or 2 elements otherwise.

getOptimizedQueryTree

public org.objectweb.medor.eval.api.QueryEvaluator getOptimizedQueryTree()
                                                                  throws java.lang.Exception
Get the query evaluator of the optimized query. The query is optimized on first call. All mappers of the query should have been already set with the help of the iterator returned by the getJormExtentIterator method.

Throws:
java.lang.Exception