org.objectweb.speedo.query.lib
Class AbstractCompiledQuery

java.lang.Object
  extended by org.objectweb.speedo.query.lib.AbstractCompiledQuery
All Implemented Interfaces:
CacheEntry, FixableCacheEntry, ReplaceableCacheEntry, StateFilter, CompiledQuery
Direct Known Subclasses:
EJBCompiledQuery, JDOAbstractCompiledQuery

public abstract class AbstractCompiledQuery
extends java.lang.Object
implements CompiledQuery, StateFilter, ReplaceableCacheEntry

Defines a common abstract implement of CompiledQuery interface. This class must be subclassed for each Speedo personality.

Author:
S.Chassande-Barrioz

Field Summary
protected  long age
          Compiled queries are cached by Speedo.
protected  java.lang.ClassLoader classLoader
          the classloader used for the loading of persistent class.
protected  int fixCount
          Compiled queries are cached by Speedo.
protected  JormFactory jf
          Is the JormFactory in charge of the initialization of Naming of persistent class.
protected  org.objectweb.util.monolog.api.Logger logger
          Logger for monolog
protected  DelegatePMapper mapper
          The delegate mapper initializes a required class if it is not already done.
protected  java.util.Collection pncParams
          The PNamingContext to use for the parameters.
protected  PrefetchBufferFactory prefetchBufferFactory
          Is the Factory of PrefetchBuffer
protected  short status
          status of the Compiledquery
protected  UserCache userCache
          A query can correspond to a UserCache.
protected  org.objectweb.medor.expression.api.Operand[] userCacheIndexes
           
 
Fields inherited from interface org.objectweb.speedo.query.api.CompiledQuery
COMPILED, DEFINED, UNDEFINED
 
Constructor Summary
AbstractCompiledQuery()
           
 
Method Summary
 boolean accept(State ce)
           
protected  void assignMapper(QueryTree qt)
          Assign mappers and project and project name on the JormExtent nodes include in a QueryTree.
 void fixCe()
           
 long getCeAge()
           
 int getCeFixCount()
           
 java.lang.Object getCeObject()
           
protected  boolean getFieldComparaison(org.objectweb.medor.expression.api.Expression e, java.util.Map field2value)
           
 org.objectweb.util.monolog.api.Logger getLogger()
           
 org.objectweb.jorm.api.PMapper getMapper()
           
 PrefetchBufferFactory getPrefetchBufferFactory()
           
protected  org.objectweb.jorm.type.api.PType getPType(java.lang.String name)
           
 short getStatus()
           
 void init(org.objectweb.util.monolog.api.Logger l, org.objectweb.jorm.api.PMapper m, PrefetchBufferFactory pbf, JormFactory _jf)
           
 void setCeAge(long _age)
           
 void setJormFactory(JormFactory jf)
           
abstract  void setMapper(org.objectweb.jorm.api.PMapper m)
           
 void unfixCe()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.objectweb.speedo.query.api.CompiledQuery
compile, execute, execute, getDefinition
 
Methods inherited from interface org.objectweb.perseus.cache.api.CacheEntry
getCeIdentifier
 
Methods inherited from interface org.objectweb.perseus.cache.api.CacheEntry
getCeIdentifier
 

Field Detail

status

protected short status
status of the Compiledquery

See Also:
CompiledQuery.COMPILED, CompiledQuery.DEFINED, CompiledQuery.UNDEFINED

classLoader

protected java.lang.ClassLoader classLoader
the classloader used for the loading of persistent class. It is also used to load generated class such as the XXXMapping (the home of the persistent class).


pncParams

protected java.util.Collection pncParams
The PNamingContext to use for the parameters.


logger

protected org.objectweb.util.monolog.api.Logger logger
Logger for monolog


mapper

protected DelegatePMapper mapper
The delegate mapper initializes a required class if it is not already done. Otherwise it only foward calls to the real PMapper.


jf

protected JormFactory jf
Is the JormFactory in charge of the initialization of Naming of persistent class.


prefetchBufferFactory

protected PrefetchBufferFactory prefetchBufferFactory
Is the Factory of PrefetchBuffer


userCache

protected UserCache userCache
A query can correspond to a UserCache.


userCacheIndexes

protected org.objectweb.medor.expression.api.Operand[] userCacheIndexes

age

protected long age
Compiled queries are cached by Speedo. So a compiled query must be a ReplaceableCacheEntry. This field defines the old of the query.


fixCount

protected int fixCount
Compiled queries are cached by Speedo. So a compiled query must be a ReplaceableCacheEntry. This field defines the number of user of the query.

Constructor Detail

AbstractCompiledQuery

public AbstractCompiledQuery()
Method Detail

getMapper

public org.objectweb.jorm.api.PMapper getMapper()

setMapper

public abstract void setMapper(org.objectweb.jorm.api.PMapper m)

setJormFactory

public void setJormFactory(JormFactory jf)

getLogger

public org.objectweb.util.monolog.api.Logger getLogger()

getPrefetchBufferFactory

public PrefetchBufferFactory getPrefetchBufferFactory()

init

public void init(org.objectweb.util.monolog.api.Logger l,
                 org.objectweb.jorm.api.PMapper m,
                 PrefetchBufferFactory pbf,
                 JormFactory _jf)

getPType

protected org.objectweb.jorm.type.api.PType getPType(java.lang.String name)

getStatus

public short getStatus()
Specified by:
getStatus in interface CompiledQuery
Returns:
the query status. The possible values are UNDEFINED, DEFINED or COMPILED.

assignMapper

protected void assignMapper(QueryTree qt)
                     throws SpeedoException
Assign mappers and project and project name on the JormExtent nodes include in a QueryTree.

Throws:
SpeedoException

getFieldComparaison

protected boolean getFieldComparaison(org.objectweb.medor.expression.api.Expression e,
                                      java.util.Map field2value)

accept

public boolean accept(State ce)
Specified by:
accept in interface StateFilter

getCeAge

public long getCeAge()
Specified by:
getCeAge in interface ReplaceableCacheEntry

setCeAge

public void setCeAge(long _age)
Specified by:
setCeAge in interface ReplaceableCacheEntry

fixCe

public void fixCe()
Specified by:
fixCe in interface FixableCacheEntry

unfixCe

public void unfixCe()
             throws UnFixProtocolException
Specified by:
unfixCe in interface FixableCacheEntry
Throws:
UnFixProtocolException

getCeFixCount

public int getCeFixCount()
Specified by:
getCeFixCount in interface FixableCacheEntry

getCeObject

public java.lang.Object getCeObject()
Specified by:
getCeObject in interface CacheEntry